Readability: remove redundant cast to the same type
authorSylvain Becker <sylvain.becker@gmail.com>
Wed, 30 Oct 2019 15:13:55 +0100
changeset 13200057a3fe53d5a
parent 13199 6340e9291e64
child 13201 c88f111dc41f
Readability: remove redundant cast to the same type
src/audio/SDL_audiotypecvt.c
src/audio/alsa/SDL_alsa_audio.c
src/events/SDL_keyboard.c
src/file/SDL_rwops.c
src/filesystem/unix/SDL_sysfilesystem.c
src/stdlib/SDL_string.c
src/test/SDL_test_fuzzer.c
src/test/SDL_test_harness.c
src/thread/pthread/SDL_systhread.c
src/video/SDL_blit_N.c
src/video/SDL_blit_slow.c
src/video/SDL_shape.c
src/video/wayland/SDL_waylandvulkan.c
src/video/x11/SDL_x11vulkan.c
     1.1 --- a/src/audio/SDL_audiotypecvt.c	Wed Oct 30 14:37:06 2019 +0100
     1.2 +++ b/src/audio/SDL_audiotypecvt.c	Wed Oct 30 15:13:55 2019 +0100
     1.3 @@ -614,7 +614,7 @@
     1.4  SDL_Convert_F32_to_U8_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
     1.5  {
     1.6      const float *src = (const float *) cvt->buf;
     1.7 -    Uint8 *dst = (Uint8 *) cvt->buf;
     1.8 +    Uint8 *dst = cvt->buf;
     1.9      int i;
    1.10  
    1.11      LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U8 (using SSE2)");
     2.1 --- a/src/audio/alsa/SDL_alsa_audio.c	Wed Oct 30 14:37:06 2019 +0100
     2.2 +++ b/src/audio/alsa/SDL_alsa_audio.c	Wed Oct 30 15:13:55 2019 +0100
     2.3 @@ -349,7 +349,7 @@
     2.4  ALSA_PlayDevice(_THIS)
     2.5  {
     2.6      const Uint8 *sample_buf = (const Uint8 *) this->hidden->mixbuf;
     2.7 -    const int frame_size = (((int) SDL_AUDIO_BITSIZE(this->spec.format)) / 8) *
     2.8 +    const int frame_size = ((SDL_AUDIO_BITSIZE(this->spec.format)) / 8) *
     2.9                                  this->spec.channels;
    2.10      snd_pcm_uframes_t frames_left = ((snd_pcm_uframes_t) this->spec.samples);
    2.11  
    2.12 @@ -398,7 +398,7 @@
    2.13  ALSA_CaptureFromDevice(_THIS, void *buffer, int buflen)
    2.14  {
    2.15      Uint8 *sample_buf = (Uint8 *) buffer;
    2.16 -    const int frame_size = (((int) SDL_AUDIO_BITSIZE(this->spec.format)) / 8) *
    2.17 +    const int frame_size = ((SDL_AUDIO_BITSIZE(this->spec.format)) / 8) *
    2.18                                  this->spec.channels;
    2.19      const int total_frames = buflen / frame_size;
    2.20      snd_pcm_uframes_t frames_left = total_frames;
     3.1 --- a/src/events/SDL_keyboard.c	Wed Oct 30 14:37:06 2019 +0100
     3.2 +++ b/src/events/SDL_keyboard.c	Wed Oct 30 15:13:55 2019 +0100
     3.3 @@ -878,7 +878,7 @@
     3.4  {
     3.5      SDL_Keyboard *keyboard = &SDL_keyboard;
     3.6  
     3.7 -    if (((int)scancode) < ((int)SDL_SCANCODE_UNKNOWN) || scancode >= SDL_NUM_SCANCODES) {
     3.8 +    if (((int)scancode) < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) {
     3.9            SDL_InvalidParamError("scancode");
    3.10            return 0;
    3.11      }
    3.12 @@ -905,7 +905,7 @@
    3.13  SDL_GetScancodeName(SDL_Scancode scancode)
    3.14  {
    3.15      const char *name;
    3.16 -    if (((int)scancode) < ((int)SDL_SCANCODE_UNKNOWN) || scancode >= SDL_NUM_SCANCODES) {
    3.17 +    if (((int)scancode) < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) {
    3.18            SDL_InvalidParamError("scancode");
    3.19            return "";
    3.20      }
     4.1 --- a/src/file/SDL_rwops.c	Wed Oct 30 14:37:06 2019 +0100
     4.2 +++ b/src/file/SDL_rwops.c	Wed Oct 30 15:13:55 2019 +0100
     4.3 @@ -478,7 +478,7 @@
     4.4  
     4.5      total_bytes = (maxnum * size);
     4.6      if ((maxnum <= 0) || (size <= 0)
     4.7 -        || ((total_bytes / maxnum) != (size_t) size)) {
     4.8 +        || ((total_bytes / maxnum) != size)) {
     4.9          return 0;
    4.10      }
    4.11  
     5.1 --- a/src/filesystem/unix/SDL_sysfilesystem.c	Wed Oct 30 14:37:06 2019 +0100
     5.2 +++ b/src/filesystem/unix/SDL_sysfilesystem.c	Wed Oct 30 15:13:55 2019 +0100
     5.3 @@ -140,7 +140,7 @@
     5.4          if (retval == NULL) {
     5.5              /* older kernels don't have /proc/self ... try PID version... */
     5.6              char path[64];
     5.7 -            const int rc = (int) SDL_snprintf(path, sizeof(path),
     5.8 +            const int rc = SDL_snprintf(path, sizeof(path),
     5.9                                                "/proc/%llu/exe",
    5.10                                                (unsigned long long) getpid());
    5.11              if ( (rc > 0) && (rc < sizeof(path)) ) {
     6.1 --- a/src/stdlib/SDL_string.c	Wed Oct 30 14:37:06 2019 +0100
     6.2 +++ b/src/stdlib/SDL_string.c	Wed Oct 30 15:13:55 2019 +0100
     6.3 @@ -818,7 +818,7 @@
     6.4  double SDL_atof(const char *string)
     6.5  {
     6.6  #ifdef HAVE_ATOF
     6.7 -    return (double) atof(string);
     6.8 +    return atof(string);
     6.9  #else
    6.10      return SDL_strtod(string, NULL);
    6.11  #endif /* HAVE_ATOF */
     7.1 --- a/src/test/SDL_test_fuzzer.c	Wed Oct 30 14:37:06 2019 +0100
     7.2 +++ b/src/test/SDL_test_fuzzer.c	Wed Oct 30 15:13:55 2019 +0100
     7.3 @@ -307,7 +307,7 @@
     7.4      /* max value for Uint64 */
     7.5      const Uint64 maxValue = UINT64_MAX;
     7.6      return SDLTest_GenerateUnsignedBoundaryValues(maxValue,
     7.7 -                (Uint64) boundary1, (Uint64) boundary2,
     7.8 +                boundary1, boundary2,
     7.9                  validDomain);
    7.10  }
    7.11  
    7.12 @@ -457,7 +457,7 @@
    7.13  float
    7.14  SDLTest_RandomFloat()
    7.15  {
    7.16 -        return (float) (SDLTest_RandomUnitDouble() * (double)2.0 * (double)FLT_MAX - (double)(FLT_MAX));
    7.17 +        return (float) (SDLTest_RandomUnitDouble() * 2.0 * (double)FLT_MAX - (double)(FLT_MAX));
    7.18  }
    7.19  
    7.20  double
     8.1 --- a/src/test/SDL_test_harness.c	Wed Oct 30 14:37:06 2019 +0100
     8.2 +++ b/src/test/SDL_test_harness.c	Wed Oct 30 15:13:55 2019 +0100
     8.3 @@ -434,7 +434,7 @@
     8.4  	/* Count the total number of tests */
     8.5      suiteCounter = 0;
     8.6      while (testSuites[suiteCounter]) {
     8.7 -        testSuite=(SDLTest_TestSuiteReference *)testSuites[suiteCounter];
     8.8 +        testSuite = testSuites[suiteCounter];
     8.9          suiteCounter++;
    8.10          testCounter = 0;
    8.11          while (testSuite->testCases[testCounter])
    8.12 @@ -457,7 +457,7 @@
    8.13          /* Loop over all suites to check if we have a filter match */
    8.14          suiteCounter = 0;
    8.15          while (testSuites[suiteCounter] && suiteFilter == 0) {
    8.16 -            testSuite=(SDLTest_TestSuiteReference *)testSuites[suiteCounter];
    8.17 +            testSuite = testSuites[suiteCounter];
    8.18              suiteCounter++;
    8.19              if (testSuite->name != NULL && SDL_strcmp(filter, testSuite->name) == 0) {
    8.20                  /* Matched a suite name */
    8.21 @@ -496,8 +496,8 @@
    8.22      /* Loop over all suites */
    8.23      suiteCounter = 0;
    8.24      while(testSuites[suiteCounter]) {
    8.25 -        testSuite=(SDLTest_TestSuiteReference *)testSuites[suiteCounter];
    8.26 -        currentSuiteName = (char *)((testSuite->name) ? testSuite->name : SDLTEST_INVALID_NAME_FORMAT);
    8.27 +        testSuite = testSuites[suiteCounter];
    8.28 +        currentSuiteName = (testSuite->name ? testSuite->name : SDLTEST_INVALID_NAME_FORMAT);
    8.29          suiteCounter++;
    8.30  
    8.31          /* Filter suite if flag set and we have a name */
    8.32 @@ -527,7 +527,7 @@
    8.33              while(testSuite->testCases[testCounter])
    8.34              {
    8.35                  testCase = testSuite->testCases[testCounter];
    8.36 -                currentTestName = (char *)((testCase->name) ? testCase->name : SDLTEST_INVALID_NAME_FORMAT);
    8.37 +                currentTestName = (testCase->name ? testCase->name : SDLTEST_INVALID_NAME_FORMAT);
    8.38                  testCounter++;
    8.39  
    8.40                  /* Filter tests if flag set and we have a name */
     9.1 --- a/src/thread/pthread/SDL_systhread.c	Wed Oct 30 14:37:06 2019 +0100
     9.2 +++ b/src/thread/pthread/SDL_systhread.c	Wed Oct 30 15:13:55 2019 +0100
     9.3 @@ -113,7 +113,7 @@
     9.4      
     9.5      /* Set caller-requested stack size. Otherwise: use the system default. */
     9.6      if (thread->stacksize) {
     9.7 -        pthread_attr_setstacksize(&type, (size_t) thread->stacksize);
     9.8 +        pthread_attr_setstacksize(&type, thread->stacksize);
     9.9      }
    9.10  
    9.11      /* Create the thread and go! */
    10.1 --- a/src/video/SDL_blit_N.c	Wed Oct 30 14:37:06 2019 +0100
    10.2 +++ b/src/video/SDL_blit_N.c	Wed Oct 30 15:13:55 2019 +0100
    10.3 @@ -1466,7 +1466,7 @@
    10.4      /* Set up some basic variables */
    10.5      width = info->dst_w;
    10.6      height = info->dst_h;
    10.7 -    src = (Uint8 *) info->src;
    10.8 +    src = info->src;
    10.9      srcskip = info->src_skip;
   10.10      dst = (Uint32 *) info->dst;
   10.11      dstskip = info->dst_skip / 4;
    11.1 --- a/src/video/SDL_blit_slow.c	Wed Oct 30 14:37:06 2019 +0100
    11.2 +++ b/src/video/SDL_blit_slow.c	Wed Oct 30 15:13:55 2019 +0100
    11.3 @@ -56,7 +56,7 @@
    11.4  
    11.5      while (info->dst_h--) {
    11.6          Uint8 *src = 0;
    11.7 -        Uint8 *dst = (Uint8 *) info->dst;
    11.8 +        Uint8 *dst = info->dst;
    11.9          int n = info->dst_w;
   11.10          srcx = -1;
   11.11          posx = 0x10000L;
    12.1 --- a/src/video/SDL_shape.c	Wed Oct 30 14:37:06 2019 +0100
    12.2 +++ b/src/video/SDL_shape.c	Wed Oct 30 15:13:55 2019 +0100
    12.3 @@ -88,7 +88,7 @@
    12.4              pixel = (Uint8 *)(shape->pixels) + (y*shape->pitch) + (x*shape->format->BytesPerPixel);
    12.5              switch(shape->format->BytesPerPixel) {
    12.6                  case(1):
    12.7 -                    pixel_value = *(Uint8*)pixel;
    12.8 +                    pixel_value = *pixel;
    12.9                      break;
   12.10                  case(2):
   12.11                      pixel_value = *(Uint16*)pixel;
   12.12 @@ -141,7 +141,7 @@
   12.13              pixel = (Uint8 *)(mask->pixels) + (y*mask->pitch) + (x*mask->format->BytesPerPixel);
   12.14              switch(mask->format->BytesPerPixel) {
   12.15                  case(1):
   12.16 -                    pixel_value = *(Uint8*)pixel;
   12.17 +                    pixel_value = *pixel;
   12.18                      break;
   12.19                  case(2):
   12.20                      pixel_value = *(Uint16*)pixel;
    13.1 --- a/src/video/wayland/SDL_waylandvulkan.c	Wed Oct 30 14:37:06 2019 +0100
    13.2 +++ b/src/video/wayland/SDL_waylandvulkan.c	Wed Oct 30 15:13:55 2019 +0100
    13.3 @@ -153,7 +153,7 @@
    13.4          (PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr;
    13.5      PFN_vkCreateWaylandSurfaceKHR vkCreateWaylandSurfaceKHR =
    13.6          (PFN_vkCreateWaylandSurfaceKHR)vkGetInstanceProcAddr(
    13.7 -                                            (VkInstance)instance,
    13.8 +                                            instance,
    13.9                                              "vkCreateWaylandSurfaceKHR");
   13.10      VkWaylandSurfaceCreateInfoKHR createInfo;
   13.11      VkResult result;
    14.1 --- a/src/video/x11/SDL_x11vulkan.c	Wed Oct 30 14:37:06 2019 +0100
    14.2 +++ b/src/video/x11/SDL_x11vulkan.c	Wed Oct 30 15:13:55 2019 +0100
    14.3 @@ -182,7 +182,7 @@
    14.4      if(videoData->vulkan_xlib_xcb_library)
    14.5      {
    14.6          PFN_vkCreateXcbSurfaceKHR vkCreateXcbSurfaceKHR =
    14.7 -            (PFN_vkCreateXcbSurfaceKHR)vkGetInstanceProcAddr((VkInstance)instance,
    14.8 +            (PFN_vkCreateXcbSurfaceKHR)vkGetInstanceProcAddr(instance,
    14.9                                                               "vkCreateXcbSurfaceKHR");
   14.10          VkXcbSurfaceCreateInfoKHR createInfo;
   14.11          VkResult result;
   14.12 @@ -213,7 +213,7 @@
   14.13      else
   14.14      {
   14.15          PFN_vkCreateXlibSurfaceKHR vkCreateXlibSurfaceKHR =
   14.16 -            (PFN_vkCreateXlibSurfaceKHR)vkGetInstanceProcAddr((VkInstance)instance,
   14.17 +            (PFN_vkCreateXlibSurfaceKHR)vkGetInstanceProcAddr(instance,
   14.18                                                                "vkCreateXlibSurfaceKHR");
   14.19          VkXlibSurfaceCreateInfoKHR createInfo;
   14.20          VkResult result;