ecere: Clang warning fixes
authorJerome St-Louis <jerome@ecere.com>
Thu, 24 Mar 2016 00:19:18 +0000 (20:19 -0400)
committerJerome St-Louis <jerome@ecere.com>
Thu, 28 Jul 2016 22:23:13 +0000 (18:23 -0400)
- Mainly uninitialized warnings

ecere/src/gfx/3D/models/Object3DSFormat.ec
ecere/src/gui/Window.ec
ecere/src/gui/controls/ListBox.ec
ecere/src/sys/EARArchive.ec

index fdbf6e1..5866f22 100644 (file)
@@ -225,7 +225,7 @@ static int ReadASCIIZ(File f, char ** string)
 
 static float ReadFloat(File f)
 {
-   float floatValue;
+   float floatValue = 0;
    f.Read(&floatValue, sizeof(float), 1);
    BIGENDSWAP_DWORD(floatValue);
    return floatValue;
@@ -233,7 +233,7 @@ static float ReadFloat(File f)
 
 static uint16 ReadWORD(File f)
 {
-   uint16 wordValue;
+   uint16 wordValue = 0;
    f.Read(&wordValue, sizeof(uint16), 1);
    BIGENDSWAP_WORD(wordValue);
    return wordValue;
@@ -241,7 +241,7 @@ static uint16 ReadWORD(File f)
 
 static uint ReadDWORD(File f)
 {
-   uint dwordValue;
+   uint dwordValue = 0;
    f.Read(&dwordValue, sizeof(uint), 1);
    BIGENDSWAP_DWORD(dwordValue);
    return dwordValue;
@@ -277,7 +277,7 @@ static bool ReadRGB(FileInfo * info, ColorRGB * rgb)
 {
    if(info->chunkId == RGB_BYTE || info->chunkId == RGB_BYTE_GAMMA)
    {
-      byte value;
+      byte value = 0;
       info->f.Getc((char *)&value); rgb->r = value / 255.0f;
       info->f.Getc((char *)&value); rgb->g = value / 255.0f;
       info->f.Getc((char *)&value); rgb->b = value / 255.0f;
@@ -327,7 +327,7 @@ struct SharedSourceVertexInfo
          if(face > b.face) return 1;
       }
       if(index == b.index) return 0;
-      if(WELD_TRESHOLD)
+      if(WELD_TRESHOLD > 0)
       {
          if(value.x < b.value.x - WELD_TRESHOLD) return -1;
          if(value.x > b.value.x + WELD_TRESHOLD) return 1;
@@ -485,7 +485,7 @@ static void ComputeNormals(Mesh mesh, FileInfo * info, Object object)
          }
 
          // Optional code to compensate auto-welding with a limit angle cutoff between faces of same smoothing group
-         if(SMOOTH_CUTOFF && WELD_TRESHOLD)
+         if(SMOOTH_CUTOFF && WELD_TRESHOLD > 0)
          {
             for(i : svInfo.faces)
             {
@@ -521,7 +521,7 @@ static void ComputeNormals(Mesh mesh, FileInfo * info, Object object)
                {
                   bool valid = true;
 
-                  if(SMOOTH_CUTOFF && WELD_TRESHOLD)
+                  if(SMOOTH_CUTOFF && WELD_TRESHOLD > 0)
                   {
                      int origIndexB = -1;
                      int k;
@@ -593,7 +593,7 @@ static void ComputeNormals(Mesh mesh, FileInfo * info, Object object)
                   }
                }
             }
-            if(!SMOOTH_CUTOFF || !WELD_TRESHOLD) break;
+            if(!SMOOTH_CUTOFF || !(WELD_TRESHOLD > 0)) break;
          }
          // normal.Scale(normal, 1.0f / numShared);
          normal.Scale(normal, 1.0 / dotSum);
@@ -613,7 +613,7 @@ static void ComputeNormals(Mesh mesh, FileInfo * info, Object object)
          }
 
          // Auto welding/smoothing requires extra vertices because angle is too steep
-         if(SMOOTH_CUTOFF && WELD_TRESHOLD)
+         if(SMOOTH_CUTOFF && WELD_TRESHOLD > 0)
          {
             SharedDestVertexInfo newSharedInfo = null;
             int index;
index ab0c2a0..cb700af 100644 (file)
@@ -6260,7 +6260,7 @@ private:
             guiApp.interfaceDriver.SetMousePosition(guiApp.windowMovingStart.x, guiApp.windowMovingStart.y);
          else
          {
-            int x, y;
+            int x = 0, y = 0;
             guiApp.interfaceDriver.GetMousePosition(&x, &y);
             guiApp.windowMovingStart.x += x - absPosition.x;
             guiApp.windowMovingStart.y += y - absPosition.y;
index b0d0664..96c7582 100644 (file)
@@ -592,7 +592,7 @@ public:
       if(this)
       {
          ListBoxCell cell = listBox.GetCell(&this, &field);
-         if(cell && cell.isSet && cell.data)
+         if(cell && cell.isSet)
          {
             if((field.dataType.type == normalClass || field.dataType.type == noHeadClass))
                return cell.data[0];
@@ -882,8 +882,8 @@ private:
          if(sortField.dataType.type == normalClass || sortField.dataType.type == noHeadClass)
          {
             result = ((int (*)(void *, void *, void *))(void *)sortField.dataType._vTbl[__ecereVMethodID_class_OnCompare])(sortField.dataType,
-               (cell1.isSet && cell1.data) ? cell1.data[0] : null,
-               (cell2.isSet && cell2.data) ? cell2.data[0] : null);
+               cell1.isSet ? cell1.data[0] : null,
+               cell2.isSet ? cell2.data[0] : null);
          }
          else
          {
index a45267d..e368f34 100644 (file)
@@ -1518,7 +1518,7 @@ class EARFileSystem : FileSystem
             EAREntry entry { };
             if(EARGetEntry(f, entry, name, null).isDirectory)
             {
-               uint first, last;
+               uint first = 0, last = 0;
 
                sprintf(d.path, "<%s>%s", archive, name);
                d.f = f;