# HG changeset patch # User Matti Hamalainen # Date 1375736677 -10800 # Node ID f0073a47c31d6dc209e6b6f2a3cf43669148ebfe # Parent d00b967c48f2b0ed0c31687e62c39312240c4cd2 Fix various warnings. diff -r d00b967c48f2 -r f0073a47c31d src/ggets.c --- a/src/ggets.c Tue Aug 06 00:04:30 2013 +0300 +++ b/src/ggets.c Tue Aug 06 00:04:37 2013 +0300 @@ -43,14 +43,14 @@ char *buffer, *temp; *ln = NULL; /* default */ - if (NULL == (buffer = malloc(INITSIZE))) return NOMEM; + if ((buffer = (char *) malloc(INITSIZE)) == NULL) return NOMEM; cursize = INITSIZE; ix = 0; - while ((EOF != (ch = getc(f))) && ('\n' != ch)) { + while ((ch = getc(f)) != EOF && ch != '\n') { if (ix >= (cursize - 1)) { /* extend buffer */ cursize += DELTASIZE; - if (NULL == (temp = realloc(buffer, (size_t)cursize))) { + if ((temp = (char *) realloc(buffer, (size_t)cursize)) == NULL) { /* ran out of memory, return partial line */ buffer[ix] = '\0'; *ln = buffer; @@ -60,13 +60,14 @@ } buffer[ix++] = ch; } - if ((EOF == ch) && (0 == ix)) { + + if (ch == EOF && ix == 0) { free(buffer); return EOF; } buffer[ix] = '\0'; - if (NULL == (temp = realloc(buffer, (size_t)ix + 1))) { + if ((temp = (char *) realloc(buffer, (size_t)ix + 1)) == NULL) { *ln = buffer; /* without reducing it */ } else *ln = temp; diff -r d00b967c48f2 -r f0073a47c31d src/main.c --- a/src/main.c Tue Aug 06 00:04:30 2013 +0300 +++ b/src/main.c Tue Aug 06 00:04:37 2013 +0300 @@ -1404,7 +1404,8 @@ void stbi_flip_y(int w, int h, int comp, stbi_uc *data) { - size_t y, i, stride = w * comp; + int y; + size_t i, stride = w * comp; uint8 *out = data; for (y = 0; y < (h>>1); ++y) { @@ -1455,7 +1456,7 @@ GLuint LoadTexture(const char* pFilename, int invert) { - if(!load_textures) return; + if(!load_textures) return 0; if (strcmp(pFilename,"") == 0) return 99999; printf(" - LoadTexture(\"%s\")", pFilename); @@ -1526,18 +1527,16 @@ { int texIndex = 0; aiReturn texFound = AI_SUCCESS; - aiString path; // filename while (texFound == AI_SUCCESS) { texFound = scene->mMaterials[m]->GetTexture(aiTextureType_DIFFUSE, texIndex, &path); - GLuint texnum = LoadTexture(path.data, 0); - textureIdMap[path.data] = texnum; + textureIdMap[path.data] = LoadTexture(path.data, 0); texIndex++; } } - //return success; + return true; } @@ -1700,7 +1699,7 @@ if(AI_SUCCESS == mtl->GetTexture(aiTextureType_DIFFUSE, texIndex, &texPath)) { //bind texture - GLuint texId = textureIdMap.at(texPath.data); + GLuint texId = (GLuint) textureIdMap.at(texPath.data); if (texId != 99999) glBindTexture(GL_TEXTURE_2D, texId); }