From 6f0343d183605b84beb8def822482abcf15faa6f Mon Sep 17 00:00:00 2001 From: NathanSweet Date: Wed, 1 Oct 2014 17:03:13 +0200 Subject: [PATCH] Fixed long->int warnings. --- spine-c/src/spine/Atlas.c | 10 +++++----- spine-c/src/spine/SkeletonJson.c | 4 ++-- spine-c/src/spine/extension.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/spine-c/src/spine/Atlas.c b/spine-c/src/spine/Atlas.c index d51cc945a..f202c5dac 100644 --- a/spine-c/src/spine/Atlas.c +++ b/spine-c/src/spine/Atlas.c @@ -137,7 +137,7 @@ static int readTuple (const char* end, Str tuple[]) { } static char* mallocString (Str* str) { - int length = str->end - str->begin; + int length = (int)(str->end - str->begin); char* string = MALLOC(char, length + 1); memcpy(string, str->begin, length); string[length] = '\0'; @@ -145,7 +145,7 @@ static char* mallocString (Str* str) { } static int indexOf (const char** array, int count, Str* str) { - int length = str->end - str->begin; + int length = (int)(str->end - str->begin); int i; for (i = count - 1; i >= 0; i--) if (strncmp(array[i], str->begin, length) == 0) return i; @@ -157,7 +157,7 @@ static int equals (Str* str, const char* other) { } static int toInt (Str* str) { - return strtol(str->begin, (char**)&str->end, 10); + return (int)strtol(str->begin, (char**)&str->end, 10); } static spAtlas* abortAtlas (spAtlas* self) { @@ -174,7 +174,7 @@ spAtlas* spAtlas_create (const char* begin, int length, const char* dir, void* r int count; const char* end = begin + length; - int dirLength = strlen(dir); + int dirLength = (int)strlen(dir); int needsSlash = dirLength > 0 && dir[dirLength - 1] != '/' && dir[dirLength - 1] != '\\'; spAtlasPage *page = 0; @@ -307,7 +307,7 @@ spAtlas* spAtlas_createFromFile (const char* path, void* rendererObject) { const char* lastBackwardSlash = strrchr(path, '\\'); const char* lastSlash = lastForwardSlash > lastBackwardSlash ? lastForwardSlash : lastBackwardSlash; if (lastSlash == path) lastSlash++; /* Never drop starting slash. */ - dirLength = lastSlash ? lastSlash - path : 0; + dirLength = (int)(lastSlash ? lastSlash - path : 0); dir = MALLOC(char, dirLength + 1); memcpy(dir, path, dirLength); dir[dirLength] = '\0'; diff --git a/spine-c/src/spine/SkeletonJson.c b/spine-c/src/spine/SkeletonJson.c index 09a0cc04d..4fd5615cd 100644 --- a/spine-c/src/spine/SkeletonJson.c +++ b/spine-c/src/spine/SkeletonJson.c @@ -64,7 +64,7 @@ void _spSkeletonJson_setError (spSkeletonJson* self, Json* root, const char* val int length; FREE(self->error); strcpy(message, value1); - length = strlen(value1); + length = (int)strlen(value1); if (value2) strncat(message + length, value2, 256 - length); MALLOC_STR(self->error, message); if (root) Json_dispose(root); @@ -81,7 +81,7 @@ static float toColor (const char* value, int index) { digits[0] = *value; digits[1] = *(value + 1); digits[2] = '\0'; - color = strtoul(digits, &error, 16); + color = (int)strtoul(digits, &error, 16); if (*error != 0) return -1; return color / (float)255; } diff --git a/spine-c/src/spine/extension.c b/spine-c/src/spine/extension.c index 7920491e8..f45bb2d26 100644 --- a/spine-c/src/spine/extension.c +++ b/spine-c/src/spine/extension.c @@ -67,7 +67,7 @@ char* _readFile (const char* path, int* length) { if (!file) return 0; fseek(file, 0, SEEK_END); - *length = ftell(file); + *length = (int)ftell(file); fseek(file, 0, SEEK_SET); data = MALLOC(char, *length);