extras; samples: Fixed warnings
authorJerome St-Louis <jerome@ecere.com>
Tue, 1 Jul 2014 07:46:25 +0000 (03:46 -0400)
committerJerome St-Louis <jerome@ecere.com>
Tue, 1 Jul 2014 07:46:25 +0000 (03:46 -0400)
54 files changed:
ecere/src/net/NetworkClientFile.ec
extras/audio/dsound.ec
extras/audio/mixer.ec
extras/fliPlay.ec
extras/gui/LicensesDialog.ec
extras/html/HTMLView.ec
extras/tiles/astar.ec
extras/tiles/sequence.ec
extras/tiles/sprite.ec
extras/tiles/tiles.ec
samples/3D/HiraganaCube/hiraganaCube.ec
samples/3D/ModelViewer/eModel.ec
samples/3D/ModelViewer/engineSettings.ec
samples/3D/hello3D/hello3D.ec
samples/3D/orbitWithMouse/orbitWithMouse.ec
samples/3D/rayTracedMandelbulb/mandelbulb.ec
samples/3D/terrainCameraDemo/demo.ec
samples/3D/walkAround/walkAround.ec
samples/audio/DirectBufferPlayer/wavPlayer.ec
samples/audio/S3MPlayer/S3MPlayer.ec
samples/db/MedDB/mainForm.ec
samples/db/MedDB/med.ec
samples/eC/ecas/ecas.ec
samples/eC/ecas/expression.ec
samples/eC/ecas/misc.ec
samples/eC/neural/neural.ec
samples/eC/neural/neurons.ec
samples/games/bomb/bomb.ec
samples/games/cards/poker/player.ec
samples/games/cards/poker/poker.ec
samples/games/cards/ruff/src/ai.ec
samples/games/cards/ruff/src/ruff.ec
samples/games/cards/ruff/src/server.ec
samples/games/cards/ruff/src/trump.ec
samples/games/cards/tongIts/tongits.ec
samples/games/chess/src/connect.ec
samples/games/cornerBlocks/cornerBlocks.ec
samples/games/crosswords/CrossWordsServer.ec
samples/games/stonePairs/stonePairs.ec
samples/guiAndGfx/fractals/GradientDesigner.ec
samples/guiAndGfx/screenShot/shot.ec
samples/net/SocketRx/socketRx.ec
samples/net/SocketSample/socketSample.ec
samples/net/SocketTx/socketTX.ec
samples/net/XMLSample/xmlSample.ec
samples/net/eCom/connection.ec
samples/net/eCom/mainPanel.ec
samples/net/eirc/console.ec
samples/net/eirc/eIRC.ec
samples/net/httpserver/http.ec
samples/net/networkFile/NetworkClient/client.ec
samples/net/networkFile/NetworkServer/server.ec
samples/net/smtp/smtp.ec
samples/threads/threadsAndListBoxes/blank.ec

index f03ac8d..1b179ce 100644 (file)
@@ -406,7 +406,7 @@ public class FileServerConnection : Socket
 {
    processAlone = true;
 public:
-   NetworkClientFile Open(char * fileName, FileOpenMode mode)
+   NetworkClientFile Open(const char * fileName, FileOpenMode mode)
    {
       NetworkClientFile f { };
       Request request;
@@ -480,7 +480,7 @@ private:
    }
 
    // Packet Sending Functions
-   void SendOpenPacket(char * fileName)
+   void SendOpenPacket(const char * fileName)
    {
       int len = strlen(fileName);
       OpenPacket packet = (OpenPacket) new0 byte[sizeof(class OpenPacket) + len];
index 3830a51..0fc828b 100644 (file)
@@ -34,7 +34,6 @@ static HMIXEROBJ hmx;
 
 public void OpenMixer()
 {
-   HMIXER        mixerHandle;
    WAVEFORMATEX  waveFormat = { 0 };
    waveFormat.nSamplesPerSec = 44100; //(cur_stream && cur_stream->audio_st && cur_stream->audio_st->codec) ? cur_stream->audio_st->codec->sample_rate : 44100;
    waveFormat.wBitsPerSample = 16;
@@ -45,7 +44,7 @@ public void OpenMixer()
    waveFormat.nAvgBytesPerSec = waveFormat.nBlockAlign * waveFormat.nSamplesPerSec;
 
    waveOutOpen(&hWaveOut, WAVE_MAPPER, &waveFormat, 0, 0, CALLBACK_NULL);
-   mixerOpen((HMIXER *)&hmx, (uint)hWaveOut, 0, 0, MIXER_OBJECTF_HWAVEOUT);
+   mixerOpen((HMIXER *)&hmx, (uint)(uintptr)hWaveOut, 0, 0, MIXER_OBJECTF_HWAVEOUT);
 }
 
 public void CloseMixer()
@@ -173,7 +172,7 @@ public int OpenAudio(AudioSpec wanted, AudioSpec result)
    result.size = dwNotifySize * NUM_PLAY_NOTIFICATIONS;
 
    g_pSoundManager.InitStreaming(&streamingSound, NUM_PLAY_NOTIFICATIONS, dwNotifySize, dSoundThread.g_hNotificationEvent,
-      wanted.callback, wanted.userdata, wanted.channels, wanted.freq, wanted.bits);
+      (void *)wanted.callback, wanted.userdata, wanted.channels, wanted.freq, wanted.bits);
    if(streamingSound)
    {
       streamingSound.volume = wanted.volume;
@@ -207,14 +206,14 @@ public void CloseAudio()
 
 static bool PlayBuffer( bool bLooped )
 {
-   void * pDSB;
+   //void * pDSB;
    if(!streamingSound)
       return false;
 
    if(streamingSound.Reset())
       return false;
 
-   pDSB = streamingSound.GetBuffer( 0 );
+   //pDSB = streamingSound.GetBuffer( 0 );
 
    SetEvent(dSoundThread.g_hNotificationEvent);
    return true;
@@ -301,7 +300,7 @@ static class StreamingSound
    int RestoreBuffer( IDirectSoundBuffer * pDSB, bool* pbWasRestored )
    {
       int hr;
-      uint dwStatus;
+      DWORD dwStatus;
 
       if( pDSB == null )
          return CO_E_NOTINITIALIZED;
@@ -346,7 +345,7 @@ static class StreamingSound
       {
          if( apDSBuffer[i] )
          {
-            uint dwStatus = 0;
+            DWORD dwStatus = 0;
             IDirectSoundBuffer_GetStatus(apDSBuffer[i], &dwStatus );
             if ( ( dwStatus & DSBSTATUS_PLAYING ) == 0 )
                break;
@@ -417,6 +416,7 @@ static class StreamingSound
       return result;
    }
 
+   /*
    int Stop()
    {
       int hr = 0;
@@ -429,23 +429,20 @@ static class StreamingSound
 
       return hr;
    }
+   */
 
    bool HandleWaveStreamNotification(  )
    {
-      uint dwCurrentPlayPos;
-      uint dwPlayDelta;
-      uint dwBytesWrittenToBuffer;
+      DWORD dwCurrentPlayPos;
       void * pDSLockedBuffer = null;
       void * pDSLockedBuffer2 = null;
-      uint dwDSLockedBufferSize;
-      uint dwDSLockedBufferSize2;
+      DWORD dwDSLockedBufferSize;
+      DWORD dwDSLockedBufferSize2;
       uint playCursor, writeCursor;
-      bool bRestored;
       uint start, size;
-
-      static uint cursor;
       bool written = true;
       int c;
+
       while(written)
       {
          written = false;
@@ -521,7 +518,6 @@ static class StreamingSound
 
    int Reset()
    {
-      int hr;
       bool bRestored;
       int result;
 
@@ -550,10 +546,8 @@ static class StreamingSound
 
    int FillBufferWithSound( IDirectSoundBuffer * pDSB, bool bRepeatWavIfBufferLarger )
    {
-      int hr;
-      void*   pDSLockedBuffer      = null; // Pointer to locked buffer memory
-      uint   dwDSLockedBufferSize = 0;    // Size of the locked DirectSound buffer
-      uint   dwWavDataRead        = 0;    // Amount of data read from the wav file
+      void * pDSLockedBuffer = null; // Pointer to locked buffer memory
+      DWORD dwDSLockedBufferSize = 0;    // Size of the locked DirectSound buffer
 
       if( pDSB == null )
          return CO_E_NOTINITIALIZED;
@@ -569,9 +563,7 @@ static class StreamingSound
 
       callback(data, pDSLockedBuffer, dwDSLockedBufferSize);
 
-      dwWavDataRead = dwDSLockedBufferSize;
-
-      printf("Filling 16 spots\n");
+      // printf("Filling 16 spots\n");
       IDirectSoundBuffer_Unlock(pDSB, pDSLockedBuffer, dwDSLockedBufferSize, null, 0 );
 
       //dwNextWriteOffset = dwNotifySize*2;
@@ -654,7 +646,6 @@ static class CSoundManager
    bool InitStreaming(StreamingSound * ppStreamingSound, uint dwNotifyCount, uint dwNotifySize, void * hNotifyEvent,
                       void (*callback)(void * data, void * buffer, int len), void * data, int nChannels, int freq,int bits)
    {
-      int hr;
       IDirectSoundBuffer * pDSBuffer = null;
       uint dwDSBufferSize = 0;
       DSBPOSITIONNOTIFY * aPosNotify = null;
index 8beeddc..cdcb335 100644 (file)
@@ -8,9 +8,9 @@ public define AUDIO_BUFFER_SIZE = 48000;
 
 struct WAVEHDR
 {
-   byte   format[4]           __attribute__((packed));
+   byte   format[4];
    uint32 f_len               __attribute__((packed));
-   byte   wave_fmt[8]         __attribute__((packed));
+   byte   wave_fmt[8];
    uint32 fmt_len             __attribute__((packed));
    uint16 fmt_tag             __attribute__((packed));
    uint16 channel             __attribute__((packed));
@@ -18,21 +18,21 @@ struct WAVEHDR
    uint32 avg_bytes_per_sec   __attribute__((packed));
    uint16 blk_align           __attribute__((packed));
    uint16 bits_per_sample     __attribute__((packed));
-   byte   data[4]             __attribute__((packed));
+   byte   data[4];
    uint32 data_len            __attribute__((packed));
 };
 
 public class Sound
 {
 public:
-   property String fileName { set { Load(value); } }
+   property const String fileName { set { Load(value); } }
 
    int frequency, bits, channels, length;
    byte * data;
 
    ~Sound() { delete data; }
 
-   bool Load(char * fileName)
+   bool Load(const char * fileName)
    {
       bool result = false;
       WAVEHDR header;
@@ -105,7 +105,7 @@ public class Mixer
          int chn = sound.channels;
          if(sound.bits == 16)
          {
-            short * sBuffer = sound.data;
+            short * sBuffer = (short *)sound.data;
             int se = 0;
             int s = v.pos;
             short sampleL = sBuffer[s];
index 0ebf97a..83c44da 100644 (file)
@@ -39,7 +39,12 @@ class FliPlay : Window
       {
          timer.Stop();
          if(!(animation.Load(value)))
-            Logf("Couldn't load animation %s.\n", value);
+         {
+            String s = PrintString("Couldn't load animation ", value, ".");
+            MessageBox { caption = "Ecere FLC Player", contents = s }.Modal();
+            Destroy(0);
+            delete s;
+         }
          else
          {
             image.Allocate(null, animation.width, animation.height, 0, pixelFormat8, true);
@@ -49,7 +54,6 @@ class FliPlay : Window
                animation.PlayFrame(image);
                timer.delay = animation.speed;
                timer.Start();
-
             }
          }
 
index 838a044..f1ee373 100644 (file)
@@ -19,7 +19,7 @@ class LicenseTab : Tab
       readOnly = true;
       noCaret = true;
    };
-   property char * sourceFile
+   property const char * sourceFile
    {
       set
       {
index c50114f..6314d7a 100644 (file)
@@ -1553,7 +1553,7 @@ class HTMLView : Window
       html.block.ClearEntries();
    }
 
-   property char * location
+   property const char * location
    {
       set
       {
index 9b66d19..8b7eb88 100644 (file)
@@ -46,7 +46,6 @@ void AStarTerminate(AStar * aStar)
 
 AStar * AStarInitialize(int width, int height, int stackSize)
 {
-   AStar * result = null;
    AStar * aStar = new0 AStar[1];
    if(aStar)
    {
index dab6df2..a230565 100644 (file)
@@ -61,7 +61,7 @@ Sequence * SequenceInit(uint16 numEvents)
    return result;
 }
 
-bool SequenceLoadTable(Sequence **sequences, int count, char *fileName)
+bool SequenceLoadTable(Sequence **sequences, int count, const char * fileName)
 {
    bool result = false;
    File f = FileOpen(fileName, read);
index 2842ebb..5835fc9 100644 (file)
@@ -36,7 +36,7 @@ class Sprite
       }
    }
 
-   bool Load(char *bmpname, char *sizefile, bool trans, bool usePaletteShades, ColorAlpha * palette, DisplaySystem displaySystem)
+   bool Load(const char *bmpname, const char *sizefile, bool trans, bool usePaletteShades, ColorAlpha * palette, DisplaySystem displaySystem)
    {
       bool result = false;
       File f = FileOpen(sizefile, read);
@@ -45,7 +45,7 @@ class Sprite
          Bitmap bmpFrames {};
          if(bmpFrames.Load(bmpname, null, null))
          {
-            f.Getc(&numFrames);
+            f.Getc((char *)&numFrames);
             f.Read(&maxWidth,  sizeof(uint16),1);
             f.Read(&maxHeight, sizeof(uint16),1);
             frames = new0 SpriteFrame[numFrames];
@@ -57,10 +57,10 @@ class Sprite
                for(c=0; c<numFrames; c++)
                {
                   byte width,height;
-                  f.Getc(&width);
-                  f.Getc(&height);
-                  f.Getc(&frames[c].xDis);
-                  f.Getc(&frames[c].yDis);
+                  f.Getc((char *)&width);
+                  f.Getc((char *)&height);
+                  f.Getc((char *)&frames[c].xDis);
+                  f.Getc((char *)&frames[c].yDis);
 
                   frames[c].bitmap = Bitmap {};
                   if(frames[c].bitmap.Allocate(null, width,height,0,bmpFrames.pixelFormat, false))
index f5d804a..e37cc32 100644 (file)
@@ -108,6 +108,7 @@ Direction MapDirection(int xd, int yd)
       return West;
    else if((xd<0)&&(yd<0))
       return NorthWest;
+   return North;
 }
 
 static void MapForward(Direction direction, Point result, uint16 distance)
index cab6200..9f8d2d3 100644 (file)
@@ -97,7 +97,7 @@ class Test3D : Window
    }
    bool OnLoadGraphics()
    {
-      char * hiragana[6] = { "あ", "い", "う", "え", "お", "ん" };
+      const char * hiragana[6] = { "あ", "い", "う", "え", "お", "ん" };
       int c;
 
       PrimitiveGroup group;
index cbef533..9b726e5 100644 (file)
@@ -30,11 +30,11 @@ class eModelApp : GuiApplication
          if(argc > 1)
          {
             selected = true;
-            strcpy(fileDialog.filePath, argv[1]);
+            fileDialog.filePath = argv[1];
          }
          else
          {
-            strcpy(fileDialog.filePath, "models/cow/cow.3DS");
+            fileDialog.filePath = "models/cow/cow.3DS";
             //selected = true;
          }
          while(selected || fileDialog.Modal() == ok)
@@ -103,7 +103,7 @@ class ModelViewer : Window
    FillModeValue fillMode;
    SkyBox sky { size = { 10000, 10000, 10000 }, folder = ":skycube", extension = "jpg" };
 
-   char * modelFile;
+   const char * modelFile;
 
    ModelViewer()
    {
index 14aec2f..289c987 100644 (file)
@@ -13,7 +13,7 @@ class EngineSettings : Window
    Resolution resolution;
    PixelFormat colorDepth;
    int refreshRate;
-   char * driver;
+   const char * driver;
    driver = "OpenGL";
 
    Picture ecereLogo { this, image = BitmapResource { ":ecere.png", alphaBlend = true }, anchor = { left = 30, top = 10 } };
index 241b02d..e50144d 100644 (file)
@@ -21,7 +21,7 @@ Light light
 
 class Hello3D : Window
 {
-   text = "Hello, 3D";
+   caption = "Hello, 3D";
    background = black;
    borderStyle = sizable;
    hasMaximize = true;
index 778225f..6ba501a 100644 (file)
@@ -20,7 +20,7 @@ class Window3D : struct
    Euler offset;
 };
 
-static char * iconFiles[] =
+static const char * iconFiles[] =
 {
    ":icon1.png",
    ":icon2.png",
@@ -992,7 +992,7 @@ class Desktop3D : Window
    bool OnKeyHit(Key key, unichar character)
    {
       static int id = 0;
-      static char * shotFileNames[] =
+      static const char * shotFileNames[] =
       {
          ":img1.jpg", ":img2.jpg", ":img3.jpg", ":img4.jpg", ":img5.jpg"
       };
@@ -1082,17 +1082,14 @@ class Desktop3D : Window
             if(poppingWindow) break;
             if(sliding == 1.0 && !dockHidden)
             {
-               Quaternion fa, ta;
-               Vector3D fp, tp;
-
                Window window = virtualDesktop.activeChild;
                if(window)
                {
                   Window3D window3D = Desktop3DGetWindowHandle(window);
 
                   camera.Update();
-                  fa = fromAngle = camera.cOrientation;
-                  fp = fromPosition = camera.cPosition;
+                  fromAngle = camera.cOrientation;
+                  fromPosition = camera.cPosition;
 
                   camera.type = lookAt;
                   camera.position = { 0,0,0 };
@@ -1105,8 +1102,8 @@ class Desktop3D : Window
                   dockHidden = true;
 
                   camera.Update();
-                  tp = toPosition = camera.cPosition;
-                  ta = toAngle = camera.cOrientation;
+                  toPosition = camera.cPosition;
+                  toAngle = camera.cOrientation;
 
                   camera.AdjustAngle(fromAngle);
                   camera.AdjustPosition(fromPosition);
@@ -1299,7 +1296,7 @@ static void Update3DWindow(Window window, Box box)
    int w = box.right - box.left + 1;
    int h = box.bottom - box.top + 1;
 
-   glBindTexture(GL_TEXTURE_2D, (int)window3D.bitmap.driverData);
+   glBindTexture(GL_TEXTURE_2D, (int)(intptr)window3D.bitmap.driverData);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 
index cfc7d21..d6b30dd 100644 (file)
@@ -200,8 +200,6 @@ class RenderThread : Thread
 
       for(y = start; y <= end && !view3D.abort; y++)
       {
-         Box box { 0, y, bitmap.width, y };
-
          for(x = 0; x < bitmap.width && !view3D.abort; x++)
          {
             Vector3D v, end;
@@ -489,7 +487,6 @@ class RTCube : RTObject
          {
             int c;
             bool visible = true;
-            int sign = 0;
             planes[plane].IntersectLine(ray, intersect);
             for(c = 0; c < 6; c++)
             {
@@ -622,7 +619,6 @@ class RTMandelbulb : RTCube
 
    void Compute()
    {
-      Quaternion q;
       bulb.size = size;
       bulb.power = power;
       RTCube::Compute();
@@ -633,8 +629,10 @@ class RTMandelbulb : RTCube
       double t = 0;
       int refine = 0;
       double refineDT = dt;
+      double refineDT10 = refineDT * 10;
       double stopT = MAXDOUBLE;
       bool firstPointInside = false;
+      Vector3D halfSize = { size.x / 2, size.y / 2, size.z / 2 };
       if(backwards && bulb.IsPointInside(l.p0, iters))
       {
          firstPointInside = true;
@@ -649,11 +647,11 @@ class RTMandelbulb : RTCube
             l.p0.y - l.delta.y * t,
             l.p0.z - l.delta.z * t
          };
-         if(p.x + refineDT*10 < -size.x / 2 || p.x - refineDT*10 > size.x / 2 ||
-            p.y + refineDT*10 < -size.y / 2 || p.y - refineDT*10 > size.y / 2 ||
-            p.z + refineDT*10 < -size.z / 2 || p.z - refineDT*10 > size.z / 2)
+         if(p.x + refineDT10 < -halfSize.x || p.x - refineDT10 > halfSize.x ||
+            p.y + refineDT10 < -halfSize.y || p.y - refineDT10 > halfSize.y ||
+            p.z + refineDT10 < -halfSize.z || p.z - refineDT10 > halfSize.z)
          {
-            Print("");
+            // Print("");
             break;
          }
 
@@ -663,6 +661,7 @@ class RTMandelbulb : RTCube
             stopT = t;
             t -= refineDT;
             refineDT /= 2;
+            refineDT10 = refineDT * 10;
          }
          if(t > stopT)
          {
@@ -786,25 +785,25 @@ class RTMandelbulb : RTCube
                      double d2 = (found[1] && found[2]) ? (distances[1] * distances[2]) : MAXDOUBLE;
                      double d3 = (found[2] && found[3]) ? (distances[2] * distances[3]) : MAXDOUBLE;
                      double d4 = (found[3] && found[0]) ? (distances[3] * distances[0]) : MAXDOUBLE;
-                     if(d1 < minDistance || d1 < d2 && d1 < d3 && d1 < d4)
+                     if(d1 < minDistance || (d1 < d2 && d1 < d3 && d1 < d4))
                      {
                         normalPlane.FromPoints(points[1], p, points[0]);
                         normal.Add(normal, normalPlane.normal);
                         count++;
                      }
-                     if(d2 < minDistance || d2 < d1 && d2 < d3 && d2 < d4)
+                     if(d2 < minDistance || (d2 < d1 && d2 < d3 && d2 < d4))
                      {
                         normalPlane.FromPoints(points[2], p, points[1]);
                         normal.Add(normal, normalPlane.normal);
                         count++;
                      }
-                     if(d1 < minDistance || d3 < d1 && d3 < d2 && d3 < d4)
+                     if(d1 < minDistance || (d3 < d1 && d3 < d2 && d3 < d4))
                      {
                         normalPlane.FromPoints(points[3], p, points[2]);
                         normal.Add(normal, normalPlane.normal);
                         count++;
                      }
-                     if(d4 < minDistance || d4 < d1 && d4 < d2 && d4 < d2)
+                     if(d4 < minDistance || (d4 < d1 && d4 < d2 && d4 < d2))
                      {
                         normalPlane.FromPoints(points[0], p, points[3]);
                         normal.Add(normal, normalPlane.normal);
index 138d484..7df9449 100644 (file)
@@ -131,7 +131,7 @@ static bool LoadTerrain(Terrain terrain, const char * fileName, Angle lat)
 
       // OutputTexture("res/texture.png");
 
-      if(terrain.Create(heightMap, 16, 1025, 2, resLon, RESOLUTION_LAT, 512,512))
+      if(terrain.Create(heightMap, 16, 1025, 2, resLon, (float)RESOLUTION_LAT, 512,512))
          result = true;
       delete f;
    }
index 128b955..0006983 100644 (file)
@@ -135,7 +135,7 @@ class WalkAroundForm : Window
       int i;
       for(i = 0; i < map.count; i++)
       {
-         int num = map[i] = GetRandom(0, 7);
+         map[i] = GetRandom(0, 7);
          elv[i] = GetRandom(1, 100);
       }
    }
@@ -144,7 +144,6 @@ class WalkAroundForm : Window
    {
       Bitmap textureFile { };
       int i, x, y;
-      PrimitiveGroup group;
 
       cowModel.Load(":cow.3DS", null, displaySystem);
       cowModel.Merge(displaySystem);
@@ -203,8 +202,6 @@ class WalkAroundForm : Window
          {
             int ix = y * width + x;
             int num = map[ix];
-            int xs = -((tileSize+gap) * width) / 2;
-            int ys = -((tileSize+gap) * height) / 2;
             float h = elv[ix];
             Cube cube { };
 
index 1d5bebb..b9c87db 100644 (file)
@@ -2,7 +2,7 @@ import "EcereAudio"
 
 class Form1 : Window
 {
-   text = "Form1";
+   caption = "Form1";
    background = activeBorder;
    borderStyle = sizable;
    hasMaximize = true;
@@ -15,7 +15,7 @@ class Form1 : Window
 
    Button button1
    {
-      this, text = "Play", position = { 200, 168 };
+      this, caption = "Play", position = { 200, 168 };
 
       bool NotifyClicked(Button button, int x, int y, Modifiers mods)
       {
index bcfa070..55280f7 100644 (file)
@@ -1,7 +1,7 @@
 import "EcereAudio"
 
 static uint16 periods[] = { 1712, 1616, 1524, 1440, 1356, 1280, 1208, 1140, 1076, 1016, 960, 907};
-static String notes[12] = { "C-", "C#", "D-", "D#", "E-", "F-", "F#", "G-", "G#", "A-", "A#", "B-"};
+static const String notes[12] = { "C-", "C#", "D-", "D#", "E-", "F-", "F#", "G-", "G#", "A-", "A#", "B-"};
 
 struct S3MHeader
 {
@@ -79,7 +79,7 @@ class S3M
    Array<Pattern> patterns { };
    Voice voices[32];
 
-   bool Load(char *fileName)
+   bool Load(const char *fileName)
    {
       int i,p,c;
       byte what, row, channel;
@@ -245,7 +245,7 @@ class S3M
                SND_SetVolume(volume, channel);
             SND_Play(ins.sound, channel);
             */
-            int c2spd = ins.header.c2spd;
+            //int c2spd = ins.header.c2spd;
             //double freq = pow(Do_, note) * pow(2, octave-4) / (c2spd/8363.0);
             double freq = 14317456.0 / note_st3period / 22150/2;
             //double freq = 500.0/note_st3period;
@@ -290,7 +290,7 @@ class S3M
    bool Play(Mixer mixer)
    {
       bool result = false;
-      int initSpeed = header.initSpeed;
+      // int initSpeed = header.initSpeed;
       Time time = /*pattern == 10*/ 1? speed/(1.1*45.5) : 0;
       Time current = GetTime();
 
index 3fcb2c3..782c4ce 100644 (file)
@@ -228,11 +228,12 @@ class MedTesting : Window
          FormConcentrations formConcentrations = row.formConcentrations;
 
          // if(commercialNames.OnCompare(*(void **)boxCommercialNames.data))
-         if(class(StringList)._vTbl[__ecereVMethodID_class_OnCompare](class(StringList), commercialNames, *(void **)boxCommercialNames.data))
+
+         if(((int (*)(Class, StringList, StringList))class(StringList)._vTbl[__ecereVMethodID_class_OnCompare])(class(StringList), commercialNames, *(void **)boxCommercialNames.data))
             boxCommercialNames.foreground = red;
 
          // if(genericName.OnCompare(*(void **)boxGenericName.data))
-         if(class(String)._vTbl[__ecereVMethodID_class_OnCompare](class(String), genericName, *(void **)boxGenericName.data))
+         if(((int (*)(Class, const String, const String))class(String)._vTbl[__ecereVMethodID_class_OnCompare])(class(String), genericName, *(void **)boxGenericName.data))
             boxGenericName.foreground = red;
 
          if(drugClass.OnCompare(boxClass.data))
index ba6e275..ca9741a 100644 (file)
@@ -49,7 +49,7 @@ public:
       }
       else
       {
-         class(double)._vTbl[__ecereVMethodID_class_OnGetString](class(double), &amount, amountString, null, null);
+         ((const char * (*)(Class, double *, char *, void *, bool *)) class(double)._vTbl[__ecereVMethodID_class_OnGetString])(class(double), &amount, amountString, null, null);
          if(form)
          {
             String formName = form.name;
index 60f9605..ae9cdee 100644 (file)
@@ -77,6 +77,7 @@ class Form1 : Window
       inputString.Deselect();
       inputString.AddS(button.text);
       inputString.Update(null);
+      return true;
    }
    Label statusLabel { this, size = { 274, 21 }, position = { 250, 45 } };
    Button ebutton { this, text = constant_string[e], NotifyClicked = TypeButton, size = { 20, 20 }, position = { 170, 45 } };
index 2e851d1..323d99c 100644 (file)
@@ -446,13 +446,10 @@ public:
    }
 
    //Note that FromString likes to toy with the string, but anything done to the string will be undone.
-   bool FromString(char *str, CASDictionary dictionary) {
+   bool FromString(const char *str, CASDictionary dictionary) {
       ExpressionFromString(this, str, dictionary);
       return Sanitize(this, dictionary);
    }
-   char *ToString(void) {
-
-   }
    const char *OpString(void) {
       if (type==prefix && prefix.op<PrefixOperator::enumSize)
          return prefix_op_string[prefix.op];
@@ -560,7 +557,6 @@ public:
       Expression op {type=binary};
       Expression w;
       ExpressionClass pc;
-      int order;
       if (s[1]==0) { //single-character operator
          switch (*s) {
             case '+':
@@ -733,9 +729,10 @@ private:
    }
 };
 
-void ExpressionFromString(Expression expr, char *str, CASDictionary dictionary) {
+void ExpressionFromString(Expression expr, const char *str, CASDictionary dictionary) {
    ExpressionTree tree {dictionary};
-   char *s, *p, *e; //token start and end
+   const char * s; //token start and end
+   char *p, *e;
    CASCharFlag flag;
    CASCharFlags cf = cascharflags;
    char borrow;
@@ -743,7 +740,7 @@ void ExpressionFromString(Expression expr, char *str, CASDictionary dictionary)
    expr.Free();
 
    s = str;
-   e = s;
+   e = (char *)s;
    while (*s) {
       for (;;) //for loop is used so multiple character types that merge into one token can be implemented in the future
       { //grab the next token
@@ -752,7 +749,7 @@ void ExpressionFromString(Expression expr, char *str, CASDictionary dictionary)
          flag = (CASCharFlag)f;
          break;
       }
-      p = s;
+      p = (char *)s;
       switch (flag) {
          case letter: {
             uint f;
@@ -765,7 +762,6 @@ void ExpressionFromString(Expression expr, char *str, CASDictionary dictionary)
             if (f != (uint)-1)
                tree.PushFunction((CASFunction)f);
             else do {
-               unsigned char c;
                uint con = (uint)-1;
                UTF8GetChar(p, &charlen);
                p += charlen;
index 5ca5403..00b7e8e 100644 (file)
@@ -54,35 +54,35 @@ class CharFlags {
    }
 };
 
-char *findfirst(const char *haystack, uint haystacklen, CharFlags cf) {
+const char *findfirst(const char *haystack, uint haystacklen, CharFlags cf) {
    const byte *h = (const byte*)haystack;
    while (haystacklen--) {
       if (cf.flags[(uint)*h++])
-         return h-1;
+         return (const char *)h-1;
    }
    return null;
 }
-char *findfirstnon(const char *haystack, uint haystacklen, CharFlags cf) {
+const char *findfirstnon(const char *haystack, uint haystacklen, CharFlags cf) {
    const byte *h = (const byte*)haystack;
    while (haystacklen--) {
       if (!cf.flags[(uint)*h++])
-         return h-1;
+         return (const char *)h-1;
    }
    return null;
 }
-char *findlast(const char *haystack, uint haystacklen, CharFlags cf) {
+const char *findlast(const char *haystack, uint haystacklen, CharFlags cf) {
    const byte *h = (const byte*)haystack + haystacklen;
    while (haystacklen--) {
       if (cf.flags[(uint)*--h])
-         return h;
+         return (const char *)h;
    }
    return null;
 }
-char *findlastnon(const char *haystack, uint haystacklen, CharFlags cf) {
+const char *findlastnon(const char *haystack, uint haystacklen, CharFlags cf) {
    const byte *h = (const byte*)haystack + haystacklen;
    while (haystacklen--) {
       if (!cf.flags[(uint)*--h])
-         return h;
+         return (const char *)h;
    }
    return null;
 }
index 7495e41..094d460 100644 (file)
@@ -46,7 +46,7 @@ static Example examples[] =
    { POOR, true, false, 1, HIDE   }
 };
 
-char * behaviors[4] = { "Run", "Hide", "Wander", "Attack" };
+const char * behaviors[4] = { "Run", "Hide", "Wander", "Attack" };
 
 #define NUM_EXAMPLES (sizeof(examples) / sizeof(Example))
 
@@ -98,11 +98,11 @@ class NeuralApp : Application
          for(h = 0; h<NUM_HIDDEN; h++)
          {
             Neuron * hidden = &hiddenNeurons[h];
-            Synapse * synapse = &input->axons._[h];
+            Synapse * synapse = &input->axons[h];
 
             if(!hidden->dendrons.size)
                hidden->dendrons.size = NUM_INPUT;
-            hidden->dendrons._[i] = synapse;
+            hidden->dendrons[i].ptr = synapse;
 
             synapse->dendron = input;
             synapse->axon = hidden;
@@ -119,11 +119,11 @@ class NeuralApp : Application
          for(o = 0; o<NUM_OUTPUT; o++)
          {
             Neuron * output = &outputNeurons[o];
-            Synapse * synapse = &hidden->axons._[o];
+            Synapse * synapse = &hidden->axons[o];
 
             if(!output->dendrons.size)
                output->dendrons.size = NUM_HIDDEN;
-            output->dendrons._[h] = synapse;
+            output->dendrons[h].ptr = synapse;
 
             synapse->dendron = hidden;
             synapse->axon = output;
index 6f6e9f3..b05aff7 100644 (file)
@@ -15,23 +15,11 @@ enum NeuronState
    TAUGHT
 };
 
-static struct SynapsePtr
+struct SynapsePtr
 {
-   Synapse * a;
+   Synapse * ptr; // TOFIX: Support pointers in generic types
 };
 
-class ArraySynapse : OldArray
-{
-   type = class(Synapse);
-   Synapse * _;
-};
-
-class ArraySynapsePtr : OldArray
-{
-   type = class(SynapsePtr);
-   Synapse ** _;
-}
-
 static double Sigmoid(double x)
 {
    return 1 / (1 + exp(-x));
@@ -50,16 +38,16 @@ double GetRandDouble(double lo, double hi)
 struct Neuron
 {
    double bias;
-   ArraySynapse axons;
-   ArraySynapsePtr dendrons;
+   Array<Synapse> axons;
+   Array<SynapsePtr> dendrons;
    double activation;
    double error;
    NeuronState state;
 
    void Init()
    {
-      axons = ArraySynapse { };
-      dendrons = ArraySynapsePtr { };
+      axons = { };
+      dendrons = { };
    }
 
    void Unactivate()
@@ -67,7 +55,7 @@ struct Neuron
       int c;
       for(c = 0; c<dendrons.size; c++)
       {
-         Synapse * synapse = dendrons._[c];
+         Synapse * synapse = dendrons[c].ptr;
          if(synapse->dendron->state != CLEARED)
             synapse->dendron->Unactivate();
       }
@@ -82,7 +70,7 @@ struct Neuron
          activation = bias;
          for(c = 0; c<dendrons.size; c++)
          {
-            Synapse * synapse = dendrons._[c];
+            Synapse * synapse = dendrons[c].ptr;
             if(synapse->dendron->state != ACTIVATED)
                synapse->dendron->Activate();
             activation += synapse->dendron->activation * synapse->weight;
@@ -100,7 +88,7 @@ struct Neuron
          error = 0;
          for(c = 0; c<axons.size; c++)
          {
-            Synapse * synapse = &axons._[c];
+            Synapse * synapse = &axons[c];
             if(synapse->axon->state != PROPAGATED)
                synapse->axon->BackPropagate();
             error += synapse->axon->error * synapse->weight;
@@ -117,7 +105,7 @@ struct Neuron
       {
          for(c = 0; c<dendrons.size; c++)
          {
-            Synapse * synapse = dendrons._[c];
+            Synapse * synapse = dendrons[c].ptr;
             if(state != TAUGHT)
                synapse->dendron->Teach(learnRate);
             synapse->weight += learnRate * error * synapse->dendron->activation;
index 7117533..d7ac9f5 100644 (file)
@@ -223,7 +223,7 @@ class Bomb : Window
 
             for(y=0; y<DIMY; y++)
                for(x=0; x<DIMX; x++)
-                  surface.Blit(gfx[board[y][x]],
+                  surface.Blit(gfx[(int)board[y][x]],
                      offX + x*mapSize.w, offY + y*mapSize.h, 0,0,
                      mapSize.w,mapSize.h);
             surface.Blit(gfx[PLAYER],
@@ -263,7 +263,7 @@ class Bomb : Window
          if(key == enter)
          {
             int l;
-            char * pwd = passEdit.contents;
+            const char * pwd = passEdit.contents;
             for(l=1; l<=NUMLEVELS; l++)
                if(!strcmpi(pwd,passwords[l]))
                {
index 3b89fef..7d4aa78 100644 (file)
@@ -52,7 +52,7 @@ class Player : Window
 
       for(c=0; c<numDown; c++)
       {
-         poker.DrawCard(surface, c*GAP, 0, (human || gameOver && !folded) ? POKER_Card(down[c]) : -1);
+         poker.DrawCard(surface, c*GAP, 0, (human || (gameOver && !folded)) ? POKER_Card(down[c]) : -1);
       }
       POKER_HandType(bestHand);
       for(c=0; c<numUp; c++)
index 0f94eea..741ad12 100644 (file)
@@ -11,7 +11,7 @@ import "player.ec"
 import "widow.ec"
 import "bet.ec"
 
-static String cardsNames[] =
+static const String cardsNames[] =
 {
    ":ac.png", ":ad.png", ":ah.png", ":as.png",    ":2c.png", ":2d.png", ":2h.png", ":2s.png",    ":3c.png", ":3d.png", ":3h.png", ":3s.png",
    ":4c.png", ":4d.png", ":4h.png", ":4s.png",    ":5c.png", ":5d.png", ":5h.png", ":5s.png",    ":6c.png", ":6d.png", ":6h.png", ":6s.png",
index 101c45c..d713f6a 100644 (file)
@@ -199,7 +199,7 @@ static bool AloneInKind(Player player, Card whichCard)
 
 enum TrumpFlag { AnyCard, NoTrump, PutTrump, Alone, DontNudify };
 
-static int Discard(Player player, char * numbers, TrumpFlag trumpFlag)
+static int Discard(Player player, const char * numbers, TrumpFlag trumpFlag)
 {
    RuffGame * game = player.game;
    Round * round = &game->rounds[game->round];
index 3e35566..5949e6d 100644 (file)
@@ -16,7 +16,7 @@ struct Card // class Card : uint16
    Kind kind;
 } Card;
 
-static String cardsNames[] =
+static const String cardsNames[] =
 {
    ":ac.png", ":ad.png", ":ah.png", ":as.png",    ":2c.png", ":2d.png", ":2h.png", ":2s.png",    ":3c.png", ":3d.png", ":3h.png", ":3s.png",
    ":4c.png", ":4d.png", ":4h.png", ":4s.png",    ":5c.png", ":5d.png", ":5h.png", ":5s.png",    ":6c.png", ":6d.png", ":6h.png", ":6s.png",
@@ -276,7 +276,7 @@ void Player_Ack4Cards(Player player, PlayerPosition winner, int scores0, int sco
    }
 }
 
-void Player_SetName(Player player, char * name)
+void Player_SetName(Player player, const char * name)
 {
    Ruff ruff = player.ruff;
    if(player.socket)
@@ -293,7 +293,7 @@ void Player_SetName(Player player, char * name)
 }
 
 // SERVER TO CLIENT : Informations
-void Player_InformPlayerInfo(Player player, PlayerPosition who, char *name)
+void Player_InformPlayerInfo(Player player, PlayerPosition who, const char *name)
 {
    Ruff ruff = player.ruff;
    RuffGame * game = &ruff.game;
index 01297dd..371c129 100644 (file)
@@ -341,7 +341,7 @@ void Server_PlayCard(RuffGame game, Player player, int card)
       Player_RequestCard(player);
 }
 
-void Server_SetName(RuffGame game, Player player, char * name)
+void Server_SetName(RuffGame game, Player player, const char * name)
 {
    int c;
    strcpy(player.name, name);
index d6deb1c..7f4a32c 100644 (file)
@@ -2,7 +2,7 @@ import "ruff.ec"
 
 class Trump : Kind
 {
-   char * OnGetString(char * string, void * fieldData, bool * needClass)
+   const char * OnGetString(char * string, void * fieldData, bool * needClass)
    {
       switch(this)
       {
index d5756cd..c5cad89 100644 (file)
@@ -1,6 +1,6 @@
 import "ecere"
 
-static String cardsNames[] =
+static const String cardsNames[] =
 {
    ":ac.png", ":ad.png", ":ah.png", ":as.png",    ":2c.png", ":2d.png", ":2h.png", ":2s.png",    ":3c.png", ":3d.png", ":3h.png", ":3s.png",
    ":4c.png", ":4d.png", ":4h.png", ":4s.png",    ":5c.png", ":5d.png", ":5h.png", ":5s.png",    ":6c.png", ":6d.png", ":6h.png", ":6s.png",
@@ -338,15 +338,13 @@ class TongIts : Window
 
    bool ChowClicked(Button button, int x, int y, Modifiers mods)
    {
-      int i, j, suit, number;
+      int i, j;
       int tempCtr = 0;
       int tempHouse[13];
       for(i=0;i<13;i++)
       {
          tempHouse[i]=0;
       }
-      suit = KIND(discard[discardCounter-1]);
-      number = NUMBER(discard[discardCounter-1]);
       tempHouse[tempCtr++] = discard[discardCounter-1];
       for(i=0;i<player[currentPlayer].numCards;i++)
       {
@@ -402,7 +400,7 @@ class TongIts : Window
             }
          }
          player[currentPlayer].numCards = j;
-         discard[discardCounter--];
+         discardCounter--;
          drawButton[currentPlayer].disabled = true;
          chowButton[currentPlayer].disabled = true;
          callButton[currentPlayer].disabled = true;
index d37095e..9c97efb 100644 (file)
@@ -3,11 +3,11 @@ import "chess.ec"
 class ConnectDialog : Window
 {
    minClientSize = Size { 300, 100 };
-   tabCycle = true, background = activeBorder, hasClose = true, text = "Connect to server";
+   tabCycle = true, background = activeBorder, hasClose = true, caption = "Connect to server";
 
    Button ok
    {
-      parent = this, bevel = true, isDefault = true, text = "OK",
+      parent = this, bevel = true, isDefault = true, caption = "OK",
       size = Size { w = 80 }, anchor = Anchor { horz = -48, bottom = 10 };
 
       bool NotifyClicked(Button button, int x, int y, Modifiers mods)
@@ -20,7 +20,7 @@ class ConnectDialog : Window
 
    Button cancel
    {
-      parent = this, bevel = true, text = "Cancel", size = Size { w = 80 }, hotKey = escape;
+      parent = this, bevel = true, caption = "Cancel", size = Size { w = 80 }, hotKey = escape;
       anchor = Anchor { horz = 48, bottom = 10 };
 
       bool NotifyClicked(Button button, int x, int y, Modifiers mods)
@@ -32,7 +32,7 @@ class ConnectDialog : Window
 
    EditBox address
    {
-      parent = this, textHorzScroll = true,  size = Size { w = 200 }, anchor = Anchor { top = 10 },
+      parent = this, textHorzScroll = true, size = Size { w = 200 }, anchor = Anchor { top = 10 },
       line.text = "localhost"
    };
 }
index 69cd119..01f5f36 100644 (file)
@@ -517,7 +517,8 @@ class CornerBlocks : Window
                                        bool result;
                                        gotMove = false;
                                        result = server.PlayPiece(p, direction, flip, x, y);
-                                       validMove = true;
+                                       if(result)
+                                          validMove = true;
                                     }
                                  }
                               }
@@ -676,7 +677,6 @@ class CornerBlocks : Window
          {
             if(gameStarted && colorPlayed == gameState.colorTurn)
             {
-               Piece * piece = &pieces[selectedPiece];
                if(gameState.ValidMove(gameState.colorTurn, selectedPiece, direction, flip, boardPos.x, boardPos.y))
                   server.PlayPiece(selectedPiece, direction, flip, boardPos.x, boardPos.y);
             }
@@ -734,7 +734,6 @@ class CornerBlocks : Window
       {
          Piece * piece = &pieces[selectedPiece];
          int mx = drag.x - offset.x, my = drag.y - offset.y;
-         int rx, ry;
          int x = squareDragged.x, y = squareDragged.y;
          int w,h;
          bool isDown = key == wheelDown || key == right || key == down;
@@ -1057,7 +1056,7 @@ class CornerBlocks : Window
       log.inactive = bool::true;
       visible = false;
 
-      bool ProcessCommand(char * command)
+      bool ProcessCommand(const char * command)
       {
          cornerBlocks.server.SendMessage(command);
          return false;
@@ -1096,7 +1095,7 @@ class CornerBlocksScores : Window
    void OnRedraw(Surface surface)
    {
       PlayerColor p;
-      char * s;
+      const char * s;
       int len;
       char temp[256];
       int grandTotals[4];
@@ -1209,7 +1208,7 @@ class CornerBlocksScores : Window
          {
             for(c = 0; c < numTies; c++)
             {
-               strcat(string, cornerBlocks.playerNames[c]);
+               strcat(string, cornerBlocks.playerNames[ties[c]]);
                if(c < numTies-2)
                   strcat(string, ", ");
                else if(c < numTies-1)
@@ -1397,7 +1396,6 @@ class CommunicationPanel : Window
 
                void GameStarted(GameInfo gameInfo)
                {
-                  int x,y;
                   int c, np = 0;
 
                   cornerBlocks.gameState.numPlayers = gameInfo.numPlayers;
@@ -1430,8 +1428,6 @@ class CommunicationPanel : Window
 
                void GameEnded()
                {
-                  int c;
-
                   panel.ListPlayers();
                   cornerBlocks.gameStarted = false;
                   cornerBlocks.btnPass.visible = false;
@@ -1505,15 +1501,15 @@ class CommunicationPanel : Window
                   }
                }
 
-               void NotifyMessage(String name, String msg)
+               void NotifyMessage(const String name, const String msg)
                {
                   EditBox log = cornerBlocks.chat.log;
-                  char * format = (log.numLines > 1 || log.line.count) ?
+                  const char * format = (log.numLines > 1 || log.line.count) ?
                      "\n%s: %s" : "%s: %s";
                   int len = strlen(msg);
                   // Avoid buffer overflow...
                   if(len >= MAX_F_STRING-100)
-                     msg[MAX_F_STRING-100] = 0;
+                     ((char *)msg)[MAX_F_STRING-100] = 0;
                   cornerBlocks.chat.Log(format, name, msg);
                }
             };
index d740aec..0f8ed20 100644 (file)
@@ -96,7 +96,7 @@ class Player
    }
 };
 
-static char * dicos[Languages] = { ":englishWords.txt", ":frenchWords.txt" };
+static const char * dicos[Languages] = { ":englishWords.txt", ":frenchWords.txt" };
 
 class CrossWordsGame
 {
@@ -137,7 +137,6 @@ class CrossWordsGame
    void GetTiles(int tilesPlayer, PlayedMove move)
    {
       Player player = players[tilesPlayer];
-      int c;
       move.numTiles = 0;
 
       while(player.numLetters < 7 && numLettersAvailable)
@@ -220,7 +219,7 @@ class CrossWordsGame
       }
    }
 
-   void LoadWords(char * fileName)
+   void LoadWords(const char * fileName)
    {
       File f = FileOpen(fileName, read);
       if(f)
@@ -296,8 +295,8 @@ class CrossWordsGame
       int numLetters = 0;
       Direction direction = horizontal;
 
-      int wordX;
-      int wordY;
+      //int wordX;
+      //int wordY;
       int firstX = MAXINT, lastX = MININT;
       int firstY = MAXINT, lastY = MININT;
       int first, last, where;
@@ -312,8 +311,8 @@ class CrossWordsGame
          {
             if(board[y][x] == empty && newBoard[y][x] != empty)
             {
-               wordX = x;
-               wordY = y;
+               //wordX = x;
+               //wordY = y;
                if(x < firstX) firstX = x;
                if(y < firstY) firstY = y;
                if(x > lastX) lastX = x;
index 2187ff6..b3c40f7 100644 (file)
@@ -88,7 +88,6 @@ class MainWindow : Window
    void OnRedraw(Surface surface)
    {
       Bitmap board = boardBmp.bitmap;
-      Bitmap remove = removeBmp.bitmap;
       Bitmap wStone = stoneBmps[Stone::white].bitmap;
 
       int x, y;
@@ -102,7 +101,6 @@ class MainWindow : Window
       for(c = black; c <= white; c++)
       {
          Bitmap stone = stoneBmps[c].bitmap;
-         int bx = (clientSize.w - board.width * scale)/2;
          int drawerX = (c == black) ? blackDrawer : whiteDrawer;
          int r;
 
index baec4d0..b7f0d1b 100644 (file)
@@ -6,7 +6,7 @@ import "ecere"
 
 /*
 static ColorKey defaultKeys[] =
-{ 
+{
    { navy, 0.0f },
    { green, 0.1f },
    { yellow, 0.2f },
@@ -22,7 +22,7 @@ static ColorKey defaultKeys[] =
 */
 /*
 static ColorKey defaultKeys[] =
-{ 
+{
    { navy, 0.0f },
    { Color { 146, 237, 237 }, 0.2f },
    { white, 0.3f },
@@ -87,7 +87,7 @@ class KeyHandle : Window
       startX = x;
 
       Capture();
-      
+
       return true;
    }
 
@@ -127,7 +127,7 @@ class KeyHandle : Window
             if(key->percent < 0) key->percent = 0;
             else if(key->percent > 1) key->percent = 1;
          }
-         
+
          designer.Update(null);
          designer.NotifyUpdate(designer.master);
       }
@@ -177,7 +177,7 @@ class KeyHandle : Window
          *key = designer.gradient.keys._[designer.gradient.keys.size-1];
          designer.gradient.keys.size--;
          qsort(designer.gradient.keys._, designer.gradient.keys.size, sizeof(ColorKey), CompareKeys);
-         Destroy(0);                  
+         Destroy(0);
 
          designer.Update(null);
          designer.NotifyUpdate(designer.master);
@@ -240,7 +240,7 @@ class GradientDesigner : Window
    void OnRedraw(Surface surface)
    {
       int c;
-      
+
       for(c = 0; c < gradient.keys.size; c++)
       {
          ColorKey * key = gradient.keys._ + c;
@@ -256,7 +256,7 @@ class GradientDesigner : Window
    ScrollBar smoothness
    {
       this, borderStyle = deep, clientSize = { 124, 18 }, position = { 16, 240 }, range = 100;
-      text = "Smoothness"; 
+      text = "Smoothness";
 
       void NotifyScrolling(ScrollBar scrollBar, ScrollBarAction action, int position, Key key)
       {
@@ -305,7 +305,7 @@ class GradientDesigner : Window
             ColorKey * key;
             int c;
             KeyHandle handle;
-            
+
             gradient.keys.size++;
             key = gradient.keys._ + gradient.keys.size - 1;
             x -= preview.position.x;
@@ -315,7 +315,7 @@ class GradientDesigner : Window
 
             handle = KeyHandle { this, percent = key->percent, position = { key->percent * preview.size.w + preview.position.x - handleWidth/2, preview.position.y - 30 }, background = key->color };
             handle.Create();
-            
+
             qsort(gradient.keys._, gradient.keys.size, sizeof(ColorKey), CompareKeys);
 
             for(c = 0; c < gradient.keys.size; c++)
index 3051b2e..11b357d 100644 (file)
@@ -1,5 +1,5 @@
 /********************************************************
-   This sample demonstrates takes a screenshot of the
+   This sample takes a screenshot of the
    desktop and saves it to a bitmap file.
 ********************************************************/
 import "ecere"
index b3efe57..d1dee6f 100644 (file)
@@ -22,7 +22,7 @@ class SampleService : Service
 
 class SampleSocket : Socket
 {
-   unsigned int OnReceive(unsigned char * buffer, unsigned int count)
+   unsigned int OnReceive(const unsigned char * buffer, unsigned int count)
    {
       // We only process the data if we've received enough bytes to make up the message
       // This first if just checks if we have reveived enough bytes for the header
@@ -34,8 +34,8 @@ class SampleSocket : Socket
          if(count >= size)
          {
             // We've received a complete message, so we change the contents of the recvString EditBox
-            log.PutS(packet->string);
-            log.PutS("\n");
+            logBox.PutS(packet->string);
+            logBox.PutS("\n");
             // and we return the size of the message we've processed.
             // If more data is already buffered, this method will be called again right away.
             return size;
@@ -50,7 +50,7 @@ class SampleSocket : Socket
 // The service
 SampleService service { port = samplePort };
 
-EditBox log
+EditBox logBox
 {
    caption = "RX Sample";
    hasClose = true;
index c5040d8..28aa56f 100644 (file)
@@ -43,7 +43,7 @@ class SampleSocket : Socket
       form.UpdateButtonStates();
    }
 
-   unsigned int OnReceive(unsigned char * buffer, unsigned int count)
+   unsigned int OnReceive(const unsigned char * buffer, unsigned int count)
    {
       // We only process the data if we've received enough bytes to make up the message
       // This first if just checks if we have reveived enough bytes for the header
@@ -101,7 +101,7 @@ class SocketSample : Window
       bool NotifyClicked(Button button, int x, int y, Modifiers mods)
       {
          // We build up a SamplePacket here with our message from the sentString EditBox
-         String string = sentString.contents;
+         const String string = sentString.contents;
          int len = strlen(string);
          int size = sizeof(SamplePacket) + len;
          SamplePacket * packet = (SamplePacket *)new byte[size];
index f7efda0..57fcc78 100644 (file)
@@ -26,7 +26,7 @@ class TXApp : GuiApplication
       if(socket.Connect("localhost", samplePort))
       {
          // We build up a SamplePacket here with our message
-         String string = "Hello !";
+         const String string = "Hello !";
          int len = strlen(string);
          int size = sizeof(SamplePacket) + len;
          SamplePacket * packet = (SamplePacket *)new byte[size];
index 5bd3f23..7b7f2b9 100644 (file)
@@ -33,9 +33,9 @@ TrackXMLParser parser { };
 
 class TrackingSocket : Socket
 {
-   unsigned int OnReceive(unsigned char * buffer, unsigned int count)
+   unsigned int OnReceive(const byte * buffer, unsigned int count)
    {
-      parser.Parse(buffer, count);
+      parser.Parse((char *)buffer, count);
 
       // Update Things Here
       return count;
@@ -46,7 +46,7 @@ class TrackXMLParser : XMLParser
 {
    Track object;
 
-   void ProcessKeyword(char * keyWord)
+   void ProcessKeyword(const char * keyWord)
    {
       if(!strcmpi(keyWord, "object"))
       {
@@ -106,7 +106,7 @@ class MyParser : XMLParser
 {
    MyTag tag;
 
-   void ProcessCharacterData(char * data)
+   void ProcessCharacterData(const char * data)
    {
       switch(tag)
       {
@@ -116,7 +116,7 @@ class MyParser : XMLParser
       }
    }
 
-   void ProcessKeyword(char * keyWord)
+   void ProcessKeyword(const char * keyWord)
    {
       NamedLink64 nl;
       EnumClassData tagData = class(MyTag).data;
index c953949..333a293 100644 (file)
@@ -93,7 +93,7 @@ class Connection : Window
       this, text = "Send", size = Size { 80, 20 }, anchor = Anchor { right = 10, top = 40 }, hotKey = altS, disabled = true;
       bool NotifyClicked(Button button, int x, int y, Modifiers mods)
       {
-         char * fileName = sendFile.line.text;
+         const char * fileName = sendFile.line.text;
 
          fileSend = FileOpen(fileName, read);
          if(fileSend)
@@ -203,7 +203,7 @@ class Connection : Window
             for(line = message.firstLine; line; line = line.next)
             {
                eComPacket * packet;
-               char * string = line.text;
+               const char * string = line.text;
                int size = strlen(string);
 
                packet = (eComPacket *)new byte[sizeof(eComPacket) + size];
@@ -255,7 +255,7 @@ class Connection : Window
    char recvFileName[MAX_FILENAME];
 
    char * displayedName;
-   char * localName;
+   const char * localName;
 
    void SendBlock(uint blockSize)
    {
@@ -277,7 +277,7 @@ class Connection : Window
       }
    }
 
-   void SendName(char * name)
+   void SendName(const char * name)
    {
       eComPacket * namePacket = (eComPacket *)new byte[sizeof(eComPacket) + strlen(name)];
       localName = name;
@@ -325,7 +325,7 @@ class ConnectionSocket : Socket
    Connection connection;
    MainPanel mainPanel;
 
-   uint OnReceive(byte * buffer, uint count)
+   uint OnReceive(const byte * buffer, uint count)
    {
       if(count >= sizeof(eComPacket))
       {
index e9a5e79..2ae6688 100644 (file)
@@ -89,7 +89,7 @@ class MainPanel : Window
 
       void NotifyUpdate(EditBox editBox)
       {
-         char * string = nameBox.contents;
+         const char * string = nameBox.contents;
          OldLink link;
          for(link = connections.first; link; link = link.next)
             ((Connection)link.data).SendName(string);
@@ -142,7 +142,7 @@ class MainPanel : Window
       connections.Delete(connections.FindLink(connection));
    }
 
-   void OnConnect(Connection connection, char * inetAddress, char * address)
+   void OnConnect(Connection connection, const char * inetAddress, const char * address)
    {
       log.End();
       log.Printf("\nConnected to %s (%s)", inetAddress, address);
index c70cbc5..77057cc 100644 (file)
@@ -26,7 +26,7 @@ class Console : Window
    {
       this, textHorzScroll = true; size.h = editHeight, anchor = { left = 0, right = 0, bottom = 0 };
    };
-   virtual bool ProcessCommand(char * command);
+   virtual bool ProcessCommand(const char * command);
 
    Bitmap bitmap;
    OldList commands;
@@ -68,7 +68,7 @@ class Console : Window
          /* CONSOLE MOVEMENT */
          if(shown && moving)
          {
-            int movement = (int)(diffTime * (movement * speed));
+            int movement = (int)(diffTime * (this.movement * speed));
 
             if(movement)
             {
@@ -182,7 +182,7 @@ class Console : Window
          case enter:
          {
             Item string;
-            char * lineBuffer;
+            const char * lineBuffer;
             char * buffer;
 
             // Process Command in command edit box here
@@ -220,7 +220,7 @@ class Console : Window
 
    bool OnKeyHit(Key key, unichar ch)
    {
-      char * lineBuffer = commandBox.line.text;
+      const char * lineBuffer = commandBox.line.text;
       char * buffer;
 
       switch((SmartKey)key)
@@ -250,7 +250,7 @@ class Console : Window
                   doneLooping = false;
                   command = command.prev;
                   commandBox.Clear();
-                  commandBox.PutS(((byte *) command) + sizeof(class Item));
+                  commandBox.PutS(((const char *) command) + sizeof(class Item));
                }
             }
             return false;
@@ -273,7 +273,7 @@ class Console : Window
                   doneLooping = false;
                   command = command.next;
                   commandBox.Clear();
-                  commandBox.PutS(((byte *) command) + sizeof(class Item));
+                  commandBox.PutS(((const char *) command) + sizeof(class Item));
                }
             }
             return false;
@@ -298,7 +298,7 @@ class Console : Window
       }
    }
 
-   void Log(char * format, ...)
+   void Log(const char * format, ...)
    {
       if(this)
       {
index b26ff79..f74d0ac 100644 (file)
@@ -19,11 +19,11 @@ static Console console
    // height = 480;
    referenceHeight = 480;
 
-   bool ProcessCommand(char * command)
+   bool ProcessCommand(const char * command)
    {
       bool result = false;
       char *tokens[10];
-      int count = Tokenize(command, 10, tokens, false);
+      int count = Tokenize((char *)command, 10, tokens, false);
 
 
       // ==== OFFLINE ====
@@ -124,11 +124,11 @@ static const char * const_NickName = "[User1491]";
 
 class IRCSocket : Socket
 {
-   uint OnReceive(byte * recvBuffer, uint recvCount)
+   uint OnReceive(const byte * recvBuffer, uint recvCount)
    {
       int count;
-      byte buffer[513];
-      byte *tokens[10];
+      char buffer[513];
+      char *tokens[10];
 
       count = Min(recvCount, 512);
       memcpy(buffer, recvBuffer, count);
@@ -172,10 +172,10 @@ class IRCSocket : Socket
 
 class IdentSocket : Socket
 {
-   uint OnReceive(byte * recvBuffer, uint recvCount)
+   uint OnReceive(const byte * recvBuffer, uint recvCount)
    {
       int count;
-      byte buffer[1024];
+      char buffer[1024];
       count = Min(recvCount, 1023);
       memcpy(buffer, recvBuffer, count);
       if(count > 1)
index 2cc8542..ea181e4 100644 (file)
@@ -1,6 +1,6 @@
 import "ecere"
 
-static char * indexNames[] =
+static const char * indexNames[] =
 {
    "index.html",
    "index.htm",
@@ -14,7 +14,7 @@ static char * indexNames[] =
 
 #define NUM_INDEX    (sizeof(indexNames) / sizeof(char *))
 
-static void WriteFileName(File f, char * fileName)
+static void WriteFileName(File f, const char * fileName)
 {
    byte ch;
    int c;
@@ -59,7 +59,7 @@ static void CreateDirectoryListing(File f, char * directory)
    f.Puts("\r\n</BODY></HTML>\r\n");
 }
 
-static char * GetString(char * string, char * what, int count)
+static const char * GetString(const char * string, const char * what, int count)
 {
    int c;
    bool result = true;
@@ -88,9 +88,9 @@ class HTTPClient : Socket
       }
       if(c<count)
       {
-         char * string = (char *)buffer;
+         const char * string = (const char *)buffer;
 
-         if((string = GetString((char *)buffer, "GET ", count)))
+         if((string = GetString(string, "GET ", count)))
          {
             char reply[1024];
             char path[MAX_LOCATION];
index 255ce3a..2e5cc60 100644 (file)
@@ -13,7 +13,7 @@ class ClientApp : GuiApplication
          if(f)
          {
             int newsize;
-            uint * indexfs = null;
+            byte * indexfs = null;
             int c;
 
             f.Seek(0, end);
index 90f7448..2e2f953 100644 (file)
@@ -86,7 +86,7 @@ enum PacketType { open, close, read, size };
 
 class NetworkServer : Service
 {
-   OldList clients { offset = (uint)&((ClientConnection)0).prev };
+   OldList clients { offset = (uint)(uintptr)&((ClientConnection)0).prev };
    void OnAccept()
    {
       ClientConnection socket { this };
index b4e52a6..dcd7790 100644 (file)
@@ -1,6 +1,7 @@
 import "ecere"
 
 define app = ((MyApp)__thisModule);
+ConsoleFile con { };
 
 class SMTPSocket : Socket
 {
@@ -9,10 +10,7 @@ class SMTPSocket : Socket
    {
       int c;
       for(c = 0; c<count; c++)
-      {
-         //putch(buffer[c]);
-         putc(buffer[c]);
-      }
+         con.Putc(buffer[c]);
       replied = true;
       return count;
    }
@@ -31,7 +29,7 @@ class SMTPSocket : Socket
    }
 };
 
-void Send(char * host, char * to, char * from, File file)
+void Send(const char * host, const char * to, const char * from, File file)
 {
    SMTPSocket socket { };
    incref socket;
@@ -74,6 +72,6 @@ class MyApp : GuiApplication
       if(f)
          Send("mail.mailserver.com", "destaddress@destdomain.com", "srcaddress@srcdomain.com", f);
       delete f;
-      getch();
+      system("pause");
    }
 }
index 6a13f41..1b903de 100644 (file)
@@ -15,7 +15,7 @@ class AddThread : Thread
       return 0;
    }
 
-   void AddItem(char * string, Seconds delay)
+   void AddItem(const char * string, Seconds delay)
    {
       this.delay = delay;
       strcpy(this.string,string);
@@ -38,7 +38,7 @@ class MySocket : Socket
       AddThread{}.AddItem(addPacket.string, addPacket.delay);
    }
 
-   void AddItem(char * string, Seconds delay)
+   void AddItem(const char * string, Seconds delay)
    {
       int len = strlen(string);
       uint size = sizeof(class AddPacket) + len;
@@ -63,7 +63,7 @@ class MyServer : Service
 
 class Form1 : Window
 {
-   text = "Form1";
+   caption = "Form1";
    background = activeBorder;
    borderStyle = sizable;
    hasMaximize = true;
@@ -74,7 +74,7 @@ class Form1 : Window
 
    Button deleteBtn
    {
-      this, text = "Delete", hotKey = del, size = Size { 51, 21 }, position = Point { 424, 152 }, disabled = true;
+      this, caption = "Delete", hotKey = del, size = Size { 51, 21 }, position = Point { 424, 152 }, disabled = true;
 
       bool NotifyClicked(Button button, int x, int y, Modifiers mods)
       {
@@ -85,7 +85,7 @@ class Form1 : Window
    };
    Button addBtn
    {
-      parent = this, text = "Add", isDefault = true, size = Size { 31, 21 }, position = Point { 432, 120 };
+      parent = this, caption = "Add", isDefault = true, size = Size { 31, 21 }, position = Point { 432, 120 };
 
       bool NotifyClicked(Button button, int x, int y, Modifiers mods)
       {
@@ -96,7 +96,7 @@ class Form1 : Window
    };
    Button addBtn2
    {
-      this, text = "Add2", position = Point { 496, 120 };
+      this, caption = "Add2", position = Point { 496, 120 };
 
       bool NotifyClicked(Button button, int x, int y, Modifiers mods)
       {
@@ -107,7 +107,7 @@ class Form1 : Window
    };
    ListBox listBox1
    {
-      this, alwaysHighLight = true, text = "listBox1", hasVertScroll = true, size = Size { 172, 268 }, position = Point { 56, 72 };
+      this, alwaysHighLight = true, caption = "listBox1", hasVertScroll = true, size = Size { 172, 268 }, position = Point { 56, 72 };
 
       bool NotifySelect(ListBox listBox, DataRow row, Modifiers mods)
       {
@@ -115,7 +115,7 @@ class Form1 : Window
          return true;
       }
    };
-   EditBox editBox1 { parent = this, text = "What to add", contents = "Value", hotKey = w, size = Size { 84, 19 }, position = Point { 304, 120 } };
+   EditBox editBox1 { parent = this, caption = "What to add", contents = "Value", hotKey = w, size = Size { 84, 19 }, position = Point { 304, 120 } };
    Label label1 { labeledWindow = editBox1, parent = this, size = Size { 68, 13 }, position = Point { 304, 96 } };
    MySocket socket {};
    MySocket socket2 {};
@@ -135,7 +135,7 @@ class Form1 : Window
       {
          char temp[256];
          sprintf(temp, "Error: The value \"%s\" is already in the list!", string);
-         MessageBox { text = "Test App", contents = temp }.Create();
+         MessageBox { caption = "Test App", contents = temp }.Create();
       }
    }