Readability: remove redundant cast to the same type
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256
diff --git a/src/audio/SDL_audiotypecvt.c b/src/audio/SDL_audiotypecvt.c
index 740c8e2..f8a55e9 100644
--- a/src/audio/SDL_audiotypecvt.c
+++ b/src/audio/SDL_audiotypecvt.c
@@ -614,7 +614,7 @@ static void SDLCALL
SDL_Convert_F32_to_U8_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format)
{
const float *src = (const float *) cvt->buf;
- Uint8 *dst = (Uint8 *) cvt->buf;
+ Uint8 *dst = cvt->buf;
int i;
LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U8 (using SSE2)");
diff --git a/src/audio/alsa/SDL_alsa_audio.c b/src/audio/alsa/SDL_alsa_audio.c
index b65de78..fba8d00 100644
--- a/src/audio/alsa/SDL_alsa_audio.c
+++ b/src/audio/alsa/SDL_alsa_audio.c
@@ -349,7 +349,7 @@ static void
ALSA_PlayDevice(_THIS)
{
const Uint8 *sample_buf = (const Uint8 *) this->hidden->mixbuf;
- const int frame_size = (((int) SDL_AUDIO_BITSIZE(this->spec.format)) / 8) *
+ const int frame_size = ((SDL_AUDIO_BITSIZE(this->spec.format)) / 8) *
this->spec.channels;
snd_pcm_uframes_t frames_left = ((snd_pcm_uframes_t) this->spec.samples);
@@ -398,7 +398,7 @@ static int
ALSA_CaptureFromDevice(_THIS, void *buffer, int buflen)
{
Uint8 *sample_buf = (Uint8 *) buffer;
- const int frame_size = (((int) SDL_AUDIO_BITSIZE(this->spec.format)) / 8) *
+ const int frame_size = ((SDL_AUDIO_BITSIZE(this->spec.format)) / 8) *
this->spec.channels;
const int total_frames = buflen / frame_size;
snd_pcm_uframes_t frames_left = total_frames;
diff --git a/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c
index 8d9fb50..fcfb018 100644
--- a/src/events/SDL_keyboard.c
+++ b/src/events/SDL_keyboard.c
@@ -878,7 +878,7 @@ SDL_GetKeyFromScancode(SDL_Scancode scancode)
{
SDL_Keyboard *keyboard = &SDL_keyboard;
- if (((int)scancode) < ((int)SDL_SCANCODE_UNKNOWN) || scancode >= SDL_NUM_SCANCODES) {
+ if (((int)scancode) < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) {
SDL_InvalidParamError("scancode");
return 0;
}
@@ -905,7 +905,7 @@ const char *
SDL_GetScancodeName(SDL_Scancode scancode)
{
const char *name;
- if (((int)scancode) < ((int)SDL_SCANCODE_UNKNOWN) || scancode >= SDL_NUM_SCANCODES) {
+ if (((int)scancode) < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) {
SDL_InvalidParamError("scancode");
return "";
}
diff --git a/src/file/SDL_rwops.c b/src/file/SDL_rwops.c
index 8e515b5..2aa222e 100644
--- a/src/file/SDL_rwops.c
+++ b/src/file/SDL_rwops.c
@@ -478,7 +478,7 @@ mem_read(SDL_RWops * context, void *ptr, size_t size, size_t maxnum)
total_bytes = (maxnum * size);
if ((maxnum <= 0) || (size <= 0)
- || ((total_bytes / maxnum) != (size_t) size)) {
+ || ((total_bytes / maxnum) != size)) {
return 0;
}
diff --git a/src/filesystem/unix/SDL_sysfilesystem.c b/src/filesystem/unix/SDL_sysfilesystem.c
index dd710a1..b829bba 100644
--- a/src/filesystem/unix/SDL_sysfilesystem.c
+++ b/src/filesystem/unix/SDL_sysfilesystem.c
@@ -140,7 +140,7 @@ SDL_GetBasePath(void)
if (retval == NULL) {
/* older kernels don't have /proc/self ... try PID version... */
char path[64];
- const int rc = (int) SDL_snprintf(path, sizeof(path),
+ const int rc = SDL_snprintf(path, sizeof(path),
"/proc/%llu/exe",
(unsigned long long) getpid());
if ( (rc > 0) && (rc < sizeof(path)) ) {
diff --git a/src/stdlib/SDL_string.c b/src/stdlib/SDL_string.c
index 35eb327..e360ac6 100644
--- a/src/stdlib/SDL_string.c
+++ b/src/stdlib/SDL_string.c
@@ -818,7 +818,7 @@ int SDL_atoi(const char *string)
double SDL_atof(const char *string)
{
#ifdef HAVE_ATOF
- return (double) atof(string);
+ return atof(string);
#else
return SDL_strtod(string, NULL);
#endif /* HAVE_ATOF */
diff --git a/src/test/SDL_test_fuzzer.c b/src/test/SDL_test_fuzzer.c
index 8cab1c8..d110427 100644
--- a/src/test/SDL_test_fuzzer.c
+++ b/src/test/SDL_test_fuzzer.c
@@ -307,7 +307,7 @@ SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool v
/* max value for Uint64 */
const Uint64 maxValue = UINT64_MAX;
return SDLTest_GenerateUnsignedBoundaryValues(maxValue,
- (Uint64) boundary1, (Uint64) boundary2,
+ boundary1, boundary2,
validDomain);
}
@@ -457,7 +457,7 @@ SDLTest_RandomUnitFloat()
float
SDLTest_RandomFloat()
{
- return (float) (SDLTest_RandomUnitDouble() * (double)2.0 * (double)FLT_MAX - (double)(FLT_MAX));
+ return (float) (SDLTest_RandomUnitDouble() * 2.0 * (double)FLT_MAX - (double)(FLT_MAX));
}
double
diff --git a/src/test/SDL_test_harness.c b/src/test/SDL_test_harness.c
index 75ff58d..b6992b5 100644
--- a/src/test/SDL_test_harness.c
+++ b/src/test/SDL_test_harness.c
@@ -434,7 +434,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
/* Count the total number of tests */
suiteCounter = 0;
while (testSuites[suiteCounter]) {
- testSuite=(SDLTest_TestSuiteReference *)testSuites[suiteCounter];
+ testSuite = testSuites[suiteCounter];
suiteCounter++;
testCounter = 0;
while (testSuite->testCases[testCounter])
@@ -457,7 +457,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
/* Loop over all suites to check if we have a filter match */
suiteCounter = 0;
while (testSuites[suiteCounter] && suiteFilter == 0) {
- testSuite=(SDLTest_TestSuiteReference *)testSuites[suiteCounter];
+ testSuite = testSuites[suiteCounter];
suiteCounter++;
if (testSuite->name != NULL && SDL_strcmp(filter, testSuite->name) == 0) {
/* Matched a suite name */
@@ -496,8 +496,8 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
/* Loop over all suites */
suiteCounter = 0;
while(testSuites[suiteCounter]) {
- testSuite=(SDLTest_TestSuiteReference *)testSuites[suiteCounter];
- currentSuiteName = (char *)((testSuite->name) ? testSuite->name : SDLTEST_INVALID_NAME_FORMAT);
+ testSuite = testSuites[suiteCounter];
+ currentSuiteName = (testSuite->name ? testSuite->name : SDLTEST_INVALID_NAME_FORMAT);
suiteCounter++;
/* Filter suite if flag set and we have a name */
@@ -527,7 +527,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
while(testSuite->testCases[testCounter])
{
testCase = testSuite->testCases[testCounter];
- currentTestName = (char *)((testCase->name) ? testCase->name : SDLTEST_INVALID_NAME_FORMAT);
+ currentTestName = (testCase->name ? testCase->name : SDLTEST_INVALID_NAME_FORMAT);
testCounter++;
/* Filter tests if flag set and we have a name */
diff --git a/src/thread/pthread/SDL_systhread.c b/src/thread/pthread/SDL_systhread.c
index 96477d6..5c3f30f 100644
--- a/src/thread/pthread/SDL_systhread.c
+++ b/src/thread/pthread/SDL_systhread.c
@@ -113,7 +113,7 @@ SDL_SYS_CreateThread(SDL_Thread * thread, void *args)
/* Set caller-requested stack size. Otherwise: use the system default. */
if (thread->stacksize) {
- pthread_attr_setstacksize(&type, (size_t) thread->stacksize);
+ pthread_attr_setstacksize(&type, thread->stacksize);
}
/* Create the thread and go! */
diff --git a/src/video/SDL_blit_N.c b/src/video/SDL_blit_N.c
index b4a8e5e..9313ee6 100644
--- a/src/video/SDL_blit_N.c
+++ b/src/video/SDL_blit_N.c
@@ -1466,7 +1466,7 @@ Blit_RGB565_32(SDL_BlitInfo * info, const Uint32 * map)
/* Set up some basic variables */
width = info->dst_w;
height = info->dst_h;
- src = (Uint8 *) info->src;
+ src = info->src;
srcskip = info->src_skip;
dst = (Uint32 *) info->dst;
dstskip = info->dst_skip / 4;
diff --git a/src/video/SDL_blit_slow.c b/src/video/SDL_blit_slow.c
index e8f7d40..2a000eb 100644
--- a/src/video/SDL_blit_slow.c
+++ b/src/video/SDL_blit_slow.c
@@ -56,7 +56,7 @@ SDL_Blit_Slow(SDL_BlitInfo * info)
while (info->dst_h--) {
Uint8 *src = 0;
- Uint8 *dst = (Uint8 *) info->dst;
+ Uint8 *dst = info->dst;
int n = info->dst_w;
srcx = -1;
posx = 0x10000L;
diff --git a/src/video/SDL_shape.c b/src/video/SDL_shape.c
index fffed56..5242090 100644
--- a/src/video/SDL_shape.c
+++ b/src/video/SDL_shape.c
@@ -88,7 +88,7 @@ SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitm
pixel = (Uint8 *)(shape->pixels) + (y*shape->pitch) + (x*shape->format->BytesPerPixel);
switch(shape->format->BytesPerPixel) {
case(1):
- pixel_value = *(Uint8*)pixel;
+ pixel_value = *pixel;
break;
case(2):
pixel_value = *(Uint16*)pixel;
@@ -141,7 +141,7 @@ RecursivelyCalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* mask,SDL_Rec
pixel = (Uint8 *)(mask->pixels) + (y*mask->pitch) + (x*mask->format->BytesPerPixel);
switch(mask->format->BytesPerPixel) {
case(1):
- pixel_value = *(Uint8*)pixel;
+ pixel_value = *pixel;
break;
case(2):
pixel_value = *(Uint16*)pixel;
diff --git a/src/video/wayland/SDL_waylandvulkan.c b/src/video/wayland/SDL_waylandvulkan.c
index 93a5772..b143ac1 100644
--- a/src/video/wayland/SDL_waylandvulkan.c
+++ b/src/video/wayland/SDL_waylandvulkan.c
@@ -153,7 +153,7 @@ SDL_bool Wayland_Vulkan_CreateSurface(_THIS,
(PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr;
PFN_vkCreateWaylandSurfaceKHR vkCreateWaylandSurfaceKHR =
(PFN_vkCreateWaylandSurfaceKHR)vkGetInstanceProcAddr(
- (VkInstance)instance,
+ instance,
"vkCreateWaylandSurfaceKHR");
VkWaylandSurfaceCreateInfoKHR createInfo;
VkResult result;
diff --git a/src/video/x11/SDL_x11vulkan.c b/src/video/x11/SDL_x11vulkan.c
index 1aa90df..604e115 100644
--- a/src/video/x11/SDL_x11vulkan.c
+++ b/src/video/x11/SDL_x11vulkan.c
@@ -182,7 +182,7 @@ SDL_bool X11_Vulkan_CreateSurface(_THIS,
if(videoData->vulkan_xlib_xcb_library)
{
PFN_vkCreateXcbSurfaceKHR vkCreateXcbSurfaceKHR =
- (PFN_vkCreateXcbSurfaceKHR)vkGetInstanceProcAddr((VkInstance)instance,
+ (PFN_vkCreateXcbSurfaceKHR)vkGetInstanceProcAddr(instance,
"vkCreateXcbSurfaceKHR");
VkXcbSurfaceCreateInfoKHR createInfo;
VkResult result;
@@ -213,7 +213,7 @@ SDL_bool X11_Vulkan_CreateSurface(_THIS,
else
{
PFN_vkCreateXlibSurfaceKHR vkCreateXlibSurfaceKHR =
- (PFN_vkCreateXlibSurfaceKHR)vkGetInstanceProcAddr((VkInstance)instance,
+ (PFN_vkCreateXlibSurfaceKHR)vkGetInstanceProcAddr(instance,
"vkCreateXlibSurfaceKHR");
VkXlibSurfaceCreateInfoKHR createInfo;
VkResult result;