changeset 44:f0073a47c31d

Fix various warnings.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 06 Aug 2013 00:04:37 +0300
parents d00b967c48f2
children d85542c96791
files src/ggets.c src/main.c
diffstat 2 files changed, 12 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- 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;
--- 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);
     }