Fixed more warnings.
authorJerome St-Louis <jerome@ecere.com>
Sun, 1 Jun 2014 21:30:45 +0000 (17:30 -0400)
committerJerome St-Louis <jerome@ecere.com>
Sun, 1 Jun 2014 21:30:45 +0000 (17:30 -0400)
ecere/src/gfx/3D/Object.ec
ecere/src/gfx/3D/models/Object3DSFormat.ec
ecere/src/gfx/Bitmap.ec
ecere/src/gfx/drivers/LFBDisplayDriver.ec
ecere/src/sys/Date.ec
ecere/src/sys/GlobalAppSettings.ec
ecere/src/sys/Time.ec
ide/src/designer/Sheet.ec
samples/games/chess/src/chess.ec
samples/games/chess/src/chess2D.ec
samples/games/chess/src/chess3D.ec

index 4549435..70511d9 100644 (file)
@@ -749,7 +749,7 @@ public:
 
    bool AddName(Object object, const char * name)
    {
-      bool result;
+      bool result = false;
       if(this)
       {
          char * newName = CopyString(name);
@@ -854,7 +854,7 @@ public:
             while(true)
             {
                int nIndices = 0;
-               PrimitiveGroupType type;
+               PrimitiveGroupType type = (PrimitiveGroupType)-1;
                Material material = null;
                bool foundGroup = false;
 
@@ -1273,7 +1273,7 @@ public:
 private:
    Object()
    {
-      children.offset = (uint)&((Object)0).prev;
+      children.offset = (uint)(uintptr)&((Object)0).prev;
       transform.scaling = { 1, 1, 1 };
       transform.orientation = { 1,0,0,0 };
       flags.transform = true;
index 619579c..afac62c 100644 (file)
@@ -1685,7 +1685,7 @@ static bool ReadKeyFrameChunks(FileInfo * info, void * data)
       case FRM_MESHINFO:
       {
          ObjectInfoBlock block { };
-         Object object;
+         Object object = null;
 
          ReadChunks(ReadFrameInfoBlock, info, &block);
 
@@ -1719,7 +1719,8 @@ static bool ReadKeyFrameChunks(FileInfo * info, void * data)
                }
                delete block.dummyName;
             }
-            object.parent = info->rootObject;
+            if(object)
+               object.parent = info->rootObject;
          }
          else
             object = info->rootObject.Find(block.name);
@@ -1770,7 +1771,7 @@ static bool ReadKeyFrameChunks(FileInfo * info, void * data)
       case FRM_CAMERA:
       {
          ObjectInfoBlock block { };
-         Object object;
+         Object object = null;
 
          ReadChunks(ReadFrameInfoBlock, info, &block);
 
@@ -1800,7 +1801,8 @@ static bool ReadKeyFrameChunks(FileInfo * info, void * data)
                }
                delete block.dummyName;
             }
-            object.parent = info->rootObject;
+            if(object)
+               object.parent = info->rootObject;
          }
          else
             object = info->rootObject.Find(block.name);
@@ -1834,7 +1836,7 @@ static bool ReadKeyFrameChunks(FileInfo * info, void * data)
       case FRM_CAMERATARGET:
       {
          ObjectInfoBlock block { };
-         Object object;
+         Object object = null;
          char targetName[MAXNAMELEN];
 
          ReadChunks(ReadFrameInfoBlock, info, &block);
@@ -1866,7 +1868,8 @@ static bool ReadKeyFrameChunks(FileInfo * info, void * data)
                }
                delete block.dummyName;
             }
-            object.parent = info->rootObject;
+            if(object)
+               object.parent = info->rootObject;
          }
          else
             object = info->rootObject.Find(targetName);
@@ -1910,7 +1913,7 @@ static bool ReadKeyFrameChunks(FileInfo * info, void * data)
       case FRM_SPOTLIGHT:
       {
          ObjectInfoBlock block { };
-         Object object;
+         Object object = null;
 
          ReadChunks(ReadFrameInfoBlock, info, &block);
 
@@ -1940,7 +1943,8 @@ static bool ReadKeyFrameChunks(FileInfo * info, void * data)
                }
                delete block.dummyName;
             }
-            object.parent = info->rootObject;
+            if(object)
+               object.parent = info->rootObject;
          }
          else
             object = info->rootObject.Find(block.name);
@@ -1974,7 +1978,7 @@ static bool ReadKeyFrameChunks(FileInfo * info, void * data)
       case FRM_SPOTLIGHTTARGET:
       {
          ObjectInfoBlock block { };
-         Object object;
+         Object object = null;
          char targetName[MAXNAMELEN];
 
          ReadChunks(ReadFrameInfoBlock, info, &block);
@@ -2007,7 +2011,8 @@ static bool ReadKeyFrameChunks(FileInfo * info, void * data)
                }
                delete block.dummyName;
             }
-            object.parent = info->rootObject;
+            if(object)
+               object.parent = info->rootObject;
          }
          else
             object = info->rootObject.Find(targetName);
index a0e890a..99fd856 100644 (file)
@@ -53,7 +53,7 @@ static subclass(BitmapFormat) FindFormat(const char * type)
 public ColorAlpha * LoadPalette(const char * fileName, const char * type)
 {
    char ext[MAX_EXTENSION];
-   subclass(BitmapFormat) format;
+   subclass(BitmapFormat) format = null;
    ColorAlpha * palette = null;
    int typeToTry = -1;
    Bitmap bitmap { };
@@ -511,7 +511,7 @@ public:
    {
       bool result = false;
       char ext[MAX_EXTENSION];
-      subclass(BitmapFormat) format;
+      subclass(BitmapFormat) format = null;
       int typeToTry = -1;
       const char * guessedType = type;
 
@@ -787,7 +787,7 @@ public:
    bool Save(const char * fileName, const char * type, void * options)
    {
       char ext[MAX_EXTENSION];
-      subclass(BitmapFormat) format;
+      subclass(BitmapFormat) format = null;
 
       if(!type)
          type = strlwr(GetExtension(fileName, ext));
index f8ed6f0..cd129dd 100644 (file)
@@ -1999,7 +1999,7 @@ public class LFBDisplayDriver : DisplayDriver
                            int c;
                            for(c = 0; c < w; c++, dest++)
                            {
-                              Color destColor;
+                              Color destColor = 0;
                               if(pixelFormat == pixelFormat565)      { destColor = (Color)*(Color565 *)dest; }
                               else if(pixelFormat == pixelFormat555) { destColor = (Color)*(Color555 *)dest; }
                               else if(pixelFormat == pixelFormat444) { destColor = (Color)*(Color444 *)dest; }
@@ -3181,8 +3181,8 @@ public class LFBDisplayDriver : DisplayDriver
          int c, nb, glyphIndex = 0;
          unichar lastPack = 0;
          GlyphPack pack = font.asciiPack;
-         int wc;
-         uint * glyphs;
+         int wc = 0;
+         uint * glyphs = null;
          int numGlyphs = 0;
          bool rightToLeft = false;
          int fontEntryNum = 0;
@@ -3193,7 +3193,7 @@ public class LFBDisplayDriver : DisplayDriver
 
          for(c = 0; c < len || (numGlyphs && (rightToLeft ? (glyphIndex >= 0) : (glyphIndex < numGlyphs)));)
          {
-            uint glyphNo;
+            uint glyphNo = 0;
             uint packNo;
             if(numGlyphs && (rightToLeft ? (glyphIndex >= 0) : (glyphIndex < numGlyphs)))
             {
index e011a75..fce06ab 100644 (file)
@@ -111,7 +111,7 @@ public struct Date
       bool gotAlphaMonth = false;
       DateTime time;
       int year, day;
-      Month month;
+      Month month = 0;
       int numerics[3];
       int len[3];
       int count = 0;
index e4c27f0..5589071 100644 (file)
@@ -631,7 +631,7 @@ public:
          {
             case stringList:
             {
-               Container<String> list = value;
+               Container<String> list = (void *)value;
                Iterator<String> item { list };
                item.Next();
                while(item.pointer)
index c586035..fc2abf0 100644 (file)
@@ -682,7 +682,7 @@ public struct DateTime
       int c;
       bool foundDayOfTheWeek = false;
       bool foundDate = false;
-      DayOfTheWeek dayOfTheWeek;
+      DayOfTheWeek dayOfTheWeek = 0;
       int day = 0;
       int minute = 0;
       int second = 0;
index 0fc943f..06d30d4 100644 (file)
@@ -1079,7 +1079,7 @@ class Sheet : Window
                      BitMember bitMember = (BitMember) member;
                      if(subDataType)
                      {
-                        DataValue value { 0 };
+                        DataValue value { 0 };
                         value.ui = ((uint (*)(void *))(void *)prop.Get)(object);
                         value.ui &= ~ (uint)bitMember.mask;
                         value.ui |= *(uint32 *)setValue << bitMember.pos;
@@ -1735,7 +1735,8 @@ public:
          bool result = false;
          void * dataPtr, * data = null, * subData = null;
          void * propObject = null;
-         DataValue valueData = { 0 }, valueSubData = { 0 };
+         DataValue valueData { 0 };
+         DataValue valueSubData { 0 };
          uint bitValue;
 
          if(!mainDataType)
index f120c1c..63383a8 100644 (file)
@@ -3,7 +3,7 @@
 
    Copyright (c) 2001 Jerome Jacovella-St-Louis
    All Rights Reserved.
-   
+
    chess.ec - Chess Main Window
 ****************************************************************************/
 #ifdef ECERE_STATIC
@@ -81,7 +81,7 @@ class Chess : Window
    MenuItem * driverItems;
 
    ChessState chessState;
-   
+
    StatusField stateField { statusBar, width = stateWidth};
    StatusField turnField { statusBar, width = turnWidth };
 
@@ -91,7 +91,7 @@ class Chess : Window
    AIThread aiThread { chess = this };
 
    // Windows
-   
+
    ListBox moveList
    {
       parent = this,
@@ -112,7 +112,7 @@ class Chess : Window
       text = "2D Chess Board",
       chessState = &chessState
    };
-    
+
    Chess3D chess3D
    {
       parent = this,
@@ -148,9 +148,9 @@ class Chess : Window
             chessState.isLocalPlayer[Black] = false;
 
             EnableMenus();
-         
+
             RandomSeed((int)(GetTime() * 10000));
-         
+
             NewGame();
          }
          return true;
@@ -268,7 +268,7 @@ class Chess : Window
 
    //  Help Menu
    MenuItem aboutItem
-   { 
+   {
       helpMenu, "About...\tF1", a, f1;
       bool NotifySelect(MenuItem selection, Modifiers mods)
       {
@@ -276,12 +276,12 @@ class Chess : Window
          return true;
       }
    };
-         
+
    // --- Chess Utilities ---
    bool MakeMove(int x1, int y1, int x2, int y2, PieceType promotion)
    {
       bool valid = false;
-      
+
       PieceType type = chessState.board[y1][x1].type;
       Player player = chessState.board[y1][x1].player;
 
@@ -296,15 +296,15 @@ class Chess : Window
             promotion = (PieceType)Promotion { master = this }.Modal();
          }
       }
-      
+
       if(StateMakeMove(chessState, x1,y1,x2,y2, promotion, true, null))
       {
          valid = true;
-         
+
          if(chessState.isLocalPlayer[player] && !local && !ai)
          {
             ChessPacket packet
-            { 
+            {
                type = Position,
                player = player,
                x1 = (byte)x1,
@@ -334,7 +334,7 @@ class Chess : Window
             GenerateMoveList(chessState, stack);
 
             delete stack.moves;
-            
+
             if(Check(chessState, chessState.turn, -1, -1))
             {
                if(stack.count)
@@ -367,10 +367,10 @@ class Chess : Window
                turnField.text = "";
          }
       }
-   
+
       chess2D.Update(null);
       chess3D.Update(null);
-      return valid;   
+      return valid;
    }
 
    void ProcessUserMove(int x1, int y1, int x2, int y2)
@@ -479,7 +479,7 @@ class Chess : Window
    #endif
       chessState.turn = White;
 
-      chessState.castled[White] = 
+      chessState.castled[White] =
       chessState.castled[Black] = false;
 
       // EN PASSANT STATUS
@@ -555,7 +555,7 @@ class Chess : Window
       MakeMoveChar('f',7, 'h',8);
       // 14
       MakeMoveChar('d',1, 'd',2);
-      MakeMoveChar('e',7, 'e',6);      
+      MakeMoveChar('e',7, 'e',6);
    */
    }
 
@@ -563,7 +563,7 @@ class Chess : Window
    {
       MakeMove(x1 - 'a', y1 - 1, x2 - 'a', y2 - 1, Queen);
    }
-   
+
    void EnableMenus()
    {
       stopItem.disabled = !hosting;
@@ -593,7 +593,7 @@ class Chess : Window
       {
          driverItems[c] = MenuItem { viewMenu, app.drivers[c], NotifySelect = SetDisplayDriver };
          driverItems[c].id = c;
-         driverItems[c].isRadio = true;         
+         driverItems[c].isRadio = true;
       }
       // this.SetPalette(palette, true);
 
@@ -606,12 +606,12 @@ class Chess : Window
 
    bool EndGame()
    {
-      if(chessState.gameRunning && 
+      if(chessState.gameRunning &&
          (chessState.state == Normal || chessState.state == Check))
       {
-         if(MessageBox { type = okCancel, contents = "Quit current game?", 
+         if(MessageBox { type = okCancel, contents = "Quit current game?",
             master = this, text = "ECERE Chess" }.Modal() == cancel)
-            return false;   
+            return false;
       }
       if(sockets[SERVER_COLOR])
          sockets[SERVER_COLOR].Disconnect(0);
@@ -642,8 +642,8 @@ class Chess : Window
       delete sockets[White];
       delete driverItems;
    }
-            
-   void Connect(char * address)
+
+   void Connect(const char * address)
    {
       ChessSocket socket { chess = this };
       if(socket.Connect(address, CHESS_PORT))
@@ -684,7 +684,7 @@ class ChessSocket : Socket
       chess.chess2D.Update(null);
       chess.chess3D.Update(null);
    }
-   
+
    uint OnReceive(const byte * buffer, uint count)
    {
       if(count >= sizeof(ChessPacket))
@@ -719,7 +719,7 @@ class ChessService : Service
 {
    Chess chess;
    property Chess chess { set { chess = value; } }
-   
+
    void OnAccept()
    {
       if(!chess.chessState->gameRunning)
index b88af3d..364469f 100644 (file)
@@ -17,7 +17,7 @@ define SQUARE_H = 90;
 define BOARD_WIDTH = SQUARE_W * 8;
 define BOARD_HEIGHT = SQUARE_H * 8;
 
-static char * names[12] =
+static const char * names[12] =
 {
    "whitePawn", "whiteKnight", "whiteBishop", "whiteRook", "whiteQueen", "whiteKing",
    "blackPawn", "blackKnight", "blackBishop", "blackRook", "blackQueen", "blackKing"
index 37336a9..838531b 100644 (file)
@@ -1,6 +1,6 @@
 import "chess.ec"
 
-static char * names[Player][PieceType] =
+static const char * names[Player][PieceType] =
 {
    { "", "WhitePawn", "WhiteKnigh", "WhiteBisho", "WhiteRook", "WhiteQueen", "WhiteKing" },
    { "", "BlackPawn", "BlackKnigh", "BlackBisho", "BlackRook", "BlackQueen", "BlackKing" }
@@ -64,7 +64,7 @@ class Chess3D : Window
 
       if(type)
       {
-         char * name = names[player][type];
+         const char * name = names[player][type];
          Object object = chessSet.Find(name);
          if(object)
          {
@@ -77,7 +77,7 @@ class Chess3D : Window
                PieceType overType = overAtBoard.type;
                if(overType)
                {
-                  char * name = names[overPlayer][overType];
+                  const char * name = names[overPlayer][overType];
                   Object over = chessSet.Find(name);
                   if(over)
                      height = over.max.y - over.min.y;
@@ -93,7 +93,7 @@ class Chess3D : Window
 
             object.UpdateTransform();
 
-            object.tag = (void *)(((y)*8)+(x)+1);
+            object.tag = (void *)(intptr)(((y)*8)+(x)+1);
             display.DrawObject(object);
          }
       }
@@ -172,7 +172,7 @@ class Chess3D : Window
       if(display.GetHits(list))
       {
          HitRecord hit = list.first;
-         int tag = ((int)hit.tags[0]) - 1;
+         int tag = ((int)(intptr)hit.tags[0]) - 1;
          int sx = tag & 7, sy = tag >> 3;
 
          if(pieceSelected)