Fixed long->int warnings.

This commit is contained in:
NathanSweet 2014-10-01 17:03:13 +02:00
parent c79fe82ef8
commit 6f0343d183
3 changed files with 8 additions and 8 deletions

View File

@ -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';

View File

@ -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;
}

View File

@ -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);