SDL_rwops.c: simplify `foo <= 0` checks to `!foo` with unsigned types.
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
diff --git a/Makefile.os2 b/Makefile.os2
index ae3ba6f..fb6289e 100644
--- a/Makefile.os2
+++ b/Makefile.os2
@@ -122,9 +122,6 @@ SDL_syscond.obj: "src/thread/generic/SDL_syscond.c"
SDL_cpuinfo.obj: SDL_cpuinfo.c
wcc386 $(CFLAGS) -wcd=200 -fo=$^@ $<
-SDL_rwops.obj: SDL_rwops.c
- wcc386 $(CFLAGS) -wcd=136 -fo=$^@ $<
-
SDL_wave.obj: SDL_wave.c
wcc386 $(CFLAGS) -wcd=124 -fo=$^@ $<
diff --git a/src/file/SDL_rwops.c b/src/file/SDL_rwops.c
index 8c92018..5187fae 100644
--- a/src/file/SDL_rwops.c
+++ b/src/file/SDL_rwops.c
@@ -166,8 +166,7 @@ vita_file_size(SDL_RWops * context)
return SDL_SetError("vita_file_size: invalid context/file not opened");
}
- if (sceIoGetstatByFd(context->hidden.vitaio.h, &st) < 0)
- {
+ if (sceIoGetstatByFd(context->hidden.vitaio.h, &st) < 0) {
return SDL_SetError("vita_file_size: could not get file size");
}
return st.st_size;
@@ -215,9 +214,9 @@ vita_file_read(SDL_RWops * context, void *ptr, size_t size, size_t maxnum)
total_need = size * maxnum;
- if (!context || context->hidden.vitaio.h < 0
- || !total_need)
+ if (!context || context->hidden.vitaio.h < 0 || !total_need) {
return 0;
+ }
if (context->hidden.vitaio.buffer.left > 0) {
void *data = (char *) context->hidden.vitaio.buffer.data +
@@ -261,9 +260,9 @@ vita_file_write(SDL_RWops * context, const void *ptr, size_t size,
total_bytes = size * num;
- if (!context || context->hidden.vitaio.h < 0
- || total_bytes <= 0 || !size)
+ if (!context || context->hidden.vitaio.h < 0 || !size || !total_bytes) {
return 0;
+ }
if (context->hidden.vitaio.buffer.left) {
sceIoLseek(context->hidden.vitaio.h, -(SceOff)context->hidden.vitaio.buffer.left, SCE_SEEK_CUR);
@@ -433,9 +432,9 @@ windows_file_read(SDL_RWops * context, void *ptr, size_t size, size_t maxnum)
total_need = size * maxnum;
- if (!context || context->hidden.windowsio.h == INVALID_HANDLE_VALUE
- || !total_need)
+ if (!context || context->hidden.windowsio.h == INVALID_HANDLE_VALUE || !total_need) {
return 0;
+ }
if (context->hidden.windowsio.buffer.left > 0) {
void *data = (char *) context->hidden.windowsio.buffer.data +
@@ -488,9 +487,9 @@ windows_file_write(SDL_RWops * context, const void *ptr, size_t size,
total_bytes = size * num;
- if (!context || context->hidden.windowsio.h == INVALID_HANDLE_VALUE
- || total_bytes <= 0 || !size)
+ if (!context || context->hidden.windowsio.h == INVALID_HANDLE_VALUE || !size || !total_bytes) {
return 0;
+ }
if (context->hidden.windowsio.buffer.left) {
SetFilePointer(context->hidden.windowsio.h,
@@ -709,8 +708,7 @@ mem_read(SDL_RWops * context, void *ptr, size_t size, size_t maxnum)
size_t mem_available;
total_bytes = (maxnum * size);
- if ((maxnum <= 0) || (size <= 0)
- || ((total_bytes / maxnum) != size)) {
+ if (!maxnum || !size || ((total_bytes / maxnum) != size)) {
return 0;
}