mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
Fixed long->int warnings.
This commit is contained in:
parent
c79fe82ef8
commit
6f0343d183
@ -137,7 +137,7 @@ static int readTuple (const char* end, Str tuple[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static char* mallocString (Str* str) {
|
static char* mallocString (Str* str) {
|
||||||
int length = str->end - str->begin;
|
int length = (int)(str->end - str->begin);
|
||||||
char* string = MALLOC(char, length + 1);
|
char* string = MALLOC(char, length + 1);
|
||||||
memcpy(string, str->begin, length);
|
memcpy(string, str->begin, length);
|
||||||
string[length] = '\0';
|
string[length] = '\0';
|
||||||
@ -145,7 +145,7 @@ static char* mallocString (Str* str) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int indexOf (const char** array, int count, 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;
|
int i;
|
||||||
for (i = count - 1; i >= 0; i--)
|
for (i = count - 1; i >= 0; i--)
|
||||||
if (strncmp(array[i], str->begin, length) == 0) return 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) {
|
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) {
|
static spAtlas* abortAtlas (spAtlas* self) {
|
||||||
@ -174,7 +174,7 @@ spAtlas* spAtlas_create (const char* begin, int length, const char* dir, void* r
|
|||||||
|
|
||||||
int count;
|
int count;
|
||||||
const char* end = begin + length;
|
const char* end = begin + length;
|
||||||
int dirLength = strlen(dir);
|
int dirLength = (int)strlen(dir);
|
||||||
int needsSlash = dirLength > 0 && dir[dirLength - 1] != '/' && dir[dirLength - 1] != '\\';
|
int needsSlash = dirLength > 0 && dir[dirLength - 1] != '/' && dir[dirLength - 1] != '\\';
|
||||||
|
|
||||||
spAtlasPage *page = 0;
|
spAtlasPage *page = 0;
|
||||||
@ -307,7 +307,7 @@ spAtlas* spAtlas_createFromFile (const char* path, void* rendererObject) {
|
|||||||
const char* lastBackwardSlash = strrchr(path, '\\');
|
const char* lastBackwardSlash = strrchr(path, '\\');
|
||||||
const char* lastSlash = lastForwardSlash > lastBackwardSlash ? lastForwardSlash : lastBackwardSlash;
|
const char* lastSlash = lastForwardSlash > lastBackwardSlash ? lastForwardSlash : lastBackwardSlash;
|
||||||
if (lastSlash == path) lastSlash++; /* Never drop starting slash. */
|
if (lastSlash == path) lastSlash++; /* Never drop starting slash. */
|
||||||
dirLength = lastSlash ? lastSlash - path : 0;
|
dirLength = (int)(lastSlash ? lastSlash - path : 0);
|
||||||
dir = MALLOC(char, dirLength + 1);
|
dir = MALLOC(char, dirLength + 1);
|
||||||
memcpy(dir, path, dirLength);
|
memcpy(dir, path, dirLength);
|
||||||
dir[dirLength] = '\0';
|
dir[dirLength] = '\0';
|
||||||
|
|||||||
@ -64,7 +64,7 @@ void _spSkeletonJson_setError (spSkeletonJson* self, Json* root, const char* val
|
|||||||
int length;
|
int length;
|
||||||
FREE(self->error);
|
FREE(self->error);
|
||||||
strcpy(message, value1);
|
strcpy(message, value1);
|
||||||
length = strlen(value1);
|
length = (int)strlen(value1);
|
||||||
if (value2) strncat(message + length, value2, 256 - length);
|
if (value2) strncat(message + length, value2, 256 - length);
|
||||||
MALLOC_STR(self->error, message);
|
MALLOC_STR(self->error, message);
|
||||||
if (root) Json_dispose(root);
|
if (root) Json_dispose(root);
|
||||||
@ -81,7 +81,7 @@ static float toColor (const char* value, int index) {
|
|||||||
digits[0] = *value;
|
digits[0] = *value;
|
||||||
digits[1] = *(value + 1);
|
digits[1] = *(value + 1);
|
||||||
digits[2] = '\0';
|
digits[2] = '\0';
|
||||||
color = strtoul(digits, &error, 16);
|
color = (int)strtoul(digits, &error, 16);
|
||||||
if (*error != 0) return -1;
|
if (*error != 0) return -1;
|
||||||
return color / (float)255;
|
return color / (float)255;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -67,7 +67,7 @@ char* _readFile (const char* path, int* length) {
|
|||||||
if (!file) return 0;
|
if (!file) return 0;
|
||||||
|
|
||||||
fseek(file, 0, SEEK_END);
|
fseek(file, 0, SEEK_END);
|
||||||
*length = ftell(file);
|
*length = (int)ftell(file);
|
||||||
fseek(file, 0, SEEK_SET);
|
fseek(file, 0, SEEK_SET);
|
||||||
|
|
||||||
data = MALLOC(char, *length);
|
data = MALLOC(char, *length);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user