Fixed more compiler warnings.
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
diff --git a/src/SDL_error.c b/src/SDL_error.c
index 804a1eb..3fccf6a 100644
--- a/src/SDL_error.c
+++ b/src/SDL_error.c
@@ -116,8 +116,68 @@ SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
return -1;
}
+static char *SDL_GetErrorMsg(char *errstr, int maxlen);
+
+/* Available for backwards compatibility */
+const char *
+SDL_GetError(void)
+{
+ static char errmsg[SDL_ERRBUFIZE];
+
+ return SDL_GetErrorMsg(errmsg, SDL_ERRBUFIZE);
+}
+
+void
+SDL_ClearError(void)
+{
+ SDL_error *error;
+
+ error = SDL_GetErrBuf();
+ error->error = 0;
+}
+
+/* Very common errors go here */
+int
+SDL_Error(SDL_errorcode code)
+{
+ switch (code) {
+ case SDL_ENOMEM:
+ return SDL_SetError("Out of memory");
+ case SDL_EFREAD:
+ return SDL_SetError("Error reading from datastream");
+ case SDL_EFWRITE:
+ return SDL_SetError("Error writing to datastream");
+ case SDL_EFSEEK:
+ return SDL_SetError("Error seeking in datastream");
+ case SDL_UNSUPPORTED:
+ return SDL_SetError("That operation is not supported");
+ default:
+ return SDL_SetError("Unknown SDL error");
+ }
+}
+
+#ifdef TEST_ERROR
+int
+main(int argc, char *argv[])
+{
+ char buffer[BUFSIZ + 1];
+
+ SDL_SetError("Hi there!");
+ printf("Error 1: %s\n", SDL_GetError());
+ SDL_ClearError();
+ SDL_memset(buffer, '1', BUFSIZ);
+ buffer[BUFSIZ] = 0;
+ SDL_SetError("This is the error: %s (%f)", buffer, 1.0);
+ printf("Error 2: %s\n", SDL_GetError());
+ exit(0);
+}
+#endif
+
+
+/* keep this at the end of the file so it works with GCC builds that don't
+ support "#pragma GCC diagnostic push" ... we'll just leave the warning
+ disabled after this. */
#ifdef __GNUC__
-#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
#endif
/* This function has a bit more overhead than most error functions
@@ -220,63 +280,5 @@ SDL_GetErrorMsg(char *errstr, int maxlen)
}
return (errstr);
}
-#ifdef __GNUC__
-#pragma GCC diagnostic pop
-#endif
-
-/* Available for backwards compatibility */
-const char *
-SDL_GetError(void)
-{
- static char errmsg[SDL_ERRBUFIZE];
-
- return SDL_GetErrorMsg(errmsg, SDL_ERRBUFIZE);
-}
-
-void
-SDL_ClearError(void)
-{
- SDL_error *error;
-
- error = SDL_GetErrBuf();
- error->error = 0;
-}
-
-/* Very common errors go here */
-int
-SDL_Error(SDL_errorcode code)
-{
- switch (code) {
- case SDL_ENOMEM:
- return SDL_SetError("Out of memory");
- case SDL_EFREAD:
- return SDL_SetError("Error reading from datastream");
- case SDL_EFWRITE:
- return SDL_SetError("Error writing to datastream");
- case SDL_EFSEEK:
- return SDL_SetError("Error seeking in datastream");
- case SDL_UNSUPPORTED:
- return SDL_SetError("That operation is not supported");
- default:
- return SDL_SetError("Unknown SDL error");
- }
-}
-
-#ifdef TEST_ERROR
-int
-main(int argc, char *argv[])
-{
- char buffer[BUFSIZ + 1];
-
- SDL_SetError("Hi there!");
- printf("Error 1: %s\n", SDL_GetError());
- SDL_ClearError();
- SDL_memset(buffer, '1', BUFSIZ);
- buffer[BUFSIZ] = 0;
- SDL_SetError("This is the error: %s (%f)", buffer, 1.0);
- printf("Error 2: %s\n", SDL_GetError());
- exit(0);
-}
-#endif
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/render/opengles2/SDL_gles2funcs.h b/src/render/opengles2/SDL_gles2funcs.h
index 0ecfa7f..9d19fd2 100644
--- a/src/render/opengles2/SDL_gles2funcs.h
+++ b/src/render/opengles2/SDL_gles2funcs.h
@@ -53,7 +53,11 @@ SDL_PROC(void, glPixelStorei, (GLenum, GLint))
SDL_PROC(void, glReadPixels, (GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*))
SDL_PROC(void, glScissor, (GLint, GLint, GLsizei, GLsizei))
SDL_PROC(void, glShaderBinary, (GLsizei, const GLuint *, GLenum, const void *, GLsizei))
+#if __NACL__ || __ANDROID__
+SDL_PROC(void, glShaderSource, (GLuint, GLsizei, const GLchar **, const GLint *))
+#else
SDL_PROC(void, glShaderSource, (GLuint, GLsizei, const GLchar* const*, const GLint *))
+#endif
SDL_PROC(void, glTexImage2D, (GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *))
SDL_PROC(void, glTexParameteri, (GLenum, GLenum, GLint))
SDL_PROC(void, glTexSubImage2D, (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *))
diff --git a/src/test/SDL_test_common.c b/src/test/SDL_test_common.c
index 1d0b005..26f3311 100644
--- a/src/test/SDL_test_common.c
+++ b/src/test/SDL_test_common.c
@@ -1210,10 +1210,10 @@ SDLTest_PrintEvent(SDL_Event * event)
event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure);
break;
case SDL_DOLLARGESTURE:
- SDL_Log("SDL_EVENT: Dollar gesture detect: %"SDL_PRIs64, (Sint64) event->dgesture.gestureId);
+ SDL_Log("SDL_EVENT: Dollar gesture detect: %lld", (long long) event->dgesture.gestureId);
break;
case SDL_DOLLARRECORD:
- SDL_Log("SDL_EVENT: Dollar gesture record: %"SDL_PRIs64, (Sint64) event->dgesture.gestureId);
+ SDL_Log("SDL_EVENT: Dollar gesture record: %lld", (long long) event->dgesture.gestureId);
break;
case SDL_MULTIGESTURE:
SDL_Log("SDL_EVENT: Multi gesture fingers: %d", event->mgesture.numFingers);
diff --git a/src/test/SDL_test_harness.c b/src/test/SDL_test_harness.c
index 0fd0a31..a0ac353 100644
--- a/src/test/SDL_test_harness.c
+++ b/src/test/SDL_test_harness.c
@@ -485,7 +485,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
if (suiteFilter == 0 && testFilter == 0) {
SDLTest_LogError("Filter '%s' did not match any test suite/case.", filter);
SDLTest_Log("Exit code: 2");
- SDL_free(failedTests);
+ SDL_free((void *) failedTests);
return 2;
}
}
@@ -671,7 +671,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user
SDLTest_Log(" --seed %s --filter %s", runSeed, failedTests[testCounter]->name);
}
}
- SDL_free(failedTests);
+ SDL_free((void *) failedTests);
SDLTest_Log("Exit code: %d", runResult);
return runResult;
diff --git a/src/test/SDL_test_log.c b/src/test/SDL_test_log.c
index 00298b6..aaeefb2 100644
--- a/src/test/SDL_test_log.c
+++ b/src/test/SDL_test_log.c
@@ -41,6 +41,19 @@
#include "SDL_test.h"
+/* work around compiler warning on older GCCs. */
+#if (defined(__GNUC__) && (__GNUC__ <= 2))
+static size_t
+strftime_gcc2_workaround(char *s, size_t max, const char *fmt, const struct tm *tm)
+{
+ return strftime(s, max, fmt, tm);
+}
+#ifdef strftime
+#undef strftime
+#endif
+#define strftime strftime_gcc2_workaround
+#endif
+
/* !
* Converts unix timestamp to its ascii representation in localtime
*