ecere: Fixed warnings on Android
authorJerome St-Louis <jerome@ecere.com>
Sun, 13 Jul 2014 23:35:00 +0000 (19:35 -0400)
committerJerome St-Louis <jerome@ecere.com>
Sun, 13 Jul 2014 23:35:57 +0000 (19:35 -0400)
compiler/bootstrap/ecere/bootstrap/System.c
compiler/bootstrap/ecere/bootstrap/instance.c
ecere/src/com/instance.ec
ecere/src/gfx/drivers/OpenGLDisplayDriver.ec
ecere/src/gui/drivers/AndroidInterface.ec
ecere/src/sys/System.ec

index dee0a92..3701ed8 100644 (file)
@@ -824,7 +824,7 @@ __ecereNameSpace__ecere__com__eEnum_AddFixedValue(class, "veryFatal", 0);
 __ecereNameSpace__ecere__com__eEnum_AddFixedValue(class, "fatal", 1);
 __ecereNameSpace__ecere__com__eEnum_AddFixedValue(class, "major", 2);
 __ecereNameSpace__ecere__com__eEnum_AddFixedValue(class, "minor", 3);
-__ecereNameSpace__ecere__com__eSystem_RegisterDefine("ecere::sys::AllErrors", "ecere::sys::ErrorLevel::Minor", module, 1);
+__ecereNameSpace__ecere__com__eSystem_RegisterDefine("ecere::sys::AllErrors", "ecere::sys::ErrorLevel::minor", module, 1);
 class = __ecereNameSpace__ecere__com__eSystem_RegisterClass(2, "ecere::sys::ErrorCode", 0, 0, 0, (void *)0, (void *)0, module, 1, 1);
 if(((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->application == ((struct __ecereNameSpace__ecere__com__Module *)(((char *)__thisModule + sizeof(struct __ecereNameSpace__ecere__com__Instance))))->application && class)
 __ecereClass___ecereNameSpace__ecere__sys__ErrorCode = class;
index eddef66..8156c2c 100644 (file)
@@ -5786,7 +5786,7 @@ Unload = (void *)(__ecereDll_Unload_ecere);
 }
 else
 {
-char * libLocation = (((void *)0));
+const char * libLocation = (((void *)0));
 
 library = Instance_Module_Load(libLocation, name, (void *)(&Load), (void *)(&Unload));
 }
index 4cdae2d..c06d29b 100644 (file)
@@ -5352,7 +5352,7 @@ static Module Module_Load(Module fromModule, const char * name, AccessMode impor
       }
       else
       {
-         char * libLocation = null;
+         const char * libLocation = null;
 #if defined(__ANDROID__)
          libLocation = AndroidInterface_GetLibLocation();
 #endif
index b145fa6..510618b 100644 (file)
@@ -465,7 +465,7 @@ static bool egl_init_display(ANativeWindow* window)
       EGL_SAMPLES, 0, //2,*/
       EGL_NONE
    };
-   EGLint w, h, dummy, format;
+   EGLint w, h, format;
    EGLint numConfigs;
    EGLConfig config;
    EGLSurface surface;
@@ -811,13 +811,14 @@ void glesLoadMatrixd(double * i)
 
 void glesOrtho( double l, double r, double b, double t, double n, double f )
 {
-   Matrix m =
+   Matrix m
    { {
       (2 / (r - l)), 0, 0, 0,
       0, (2 / (t - b)), 0, 0,
       0, 0, (-2 / (f - n)), 0,
       (-(r + l) / (r - l)), (-(t + b) / (t - b)), (-(f + n) / (f - n)), 1
-   } }, res;
+   } };
+   Matrix res;
    res.Multiply(m, matrixStack[curStack][matrixIndex[curStack]]);
    matrixStack[curStack][matrixIndex[curStack]] = res;
    LoadCurMatrix();
@@ -837,13 +838,14 @@ void glesFrustum( double l, double r, double b, double t, double n, double f )
       double B = ((t + b) / (t - b));
       double C = (-(f + n) / (f - n));
       double D = (-2*f*n/(f-n));
-      Matrix m =
+      Matrix m
       { {
          (2.0*n / (r - l)), 0, 0, 0,
          0, (2.0*n / (t - b)), 0, 0,
          A, B,             C,-1,
          0, 0,             D, 0
-      } }, res;
+      } };
+      Matrix res;
       res.Multiply(m, matrixStack[curStack][matrixIndex[curStack]]);
       matrixStack[curStack][matrixIndex[curStack]] = res;
       LoadCurMatrix();
@@ -1045,7 +1047,6 @@ static bool stippleEnabled;
 void glesLineStipple( int i, unsigned short j )
 {
    uint texture[1*16];
-   int c;
    int x;
    for(x = 0; x < 16; x++)
    {
@@ -1177,9 +1178,9 @@ void GLBufferData(int type, GLenum target, int size, const GLvoid *data, GLenum
 {
 #ifdef __ANDROID__
    if(type == GL_DOUBLE)
-      glesBufferDatad(target, size, data, usage);
+      glesBufferDatad(target, size, (void *)data, usage);
    else if(type == GL_UNSIGNED_INT)
-      glesBufferDatai(target, size, data, usage);
+      glesBufferDatai(target, size, (void *)data, usage);
    else
       glBufferData(target, size, data, usage);
 #else
@@ -1214,7 +1215,7 @@ class OGLDisplay : struct
    int imageBuffers[2];
    byte * pboMemory1, * pboMemory2;
    */
-#else
+#elif !defined(__ANDROID__)
    GLXContext glContext;
 
    Pixmap pixmap;
@@ -1248,7 +1249,7 @@ class OGLSystem : struct
    HDC hdc;
    HGLRC glrc;
    HWND hwnd;
-#else
+#elif !defined(__ANDROID__)
    XVisualInfo * visualInfo;
    GLXContext glContext;
    GLXDrawable glxDrawable;
@@ -1297,6 +1298,7 @@ class OpenGLDisplayDriver : DisplayDriver
 
    bool LockSystem(DisplaySystem displaySystem)
    {
+#if !defined(__ANDROID__)
       OGLSystem oglSystem = displaySystem.driverData;
       if(useSingleGLContext) return true;
    #if defined(__WIN32__)
@@ -1304,11 +1306,10 @@ class OpenGLDisplayDriver : DisplayDriver
    #elif defined(__unix__) || defined(__APPLE__)
       //if(previous) return true;
       // printf("Making SYSTEM current\n");
-#if !defined(__ANDROID__)
       glXMakeCurrent(xGlobalDisplay, (GLXDrawable)oglSystem.glxDrawable, oglSystem.glContext);
-#endif
       //previous = oglSystem.glContext;
    #endif
+#endif
       return true;
    }
 
@@ -1329,19 +1330,17 @@ class OpenGLDisplayDriver : DisplayDriver
 
    bool Lock(Display display)
    {
+#if !defined(__ANDROID__)
       OGLDisplay oglDisplay = display.driverData;
-
       if(useSingleGLContext) return true;
    #if defined(__WIN32__)
       wglMakeCurrent(oglDisplay.hdc, oglDisplay.glrc);
    #elif defined(__unix__) || defined(__APPLE__)
       // if(previous) glXMakeCurrent(xGlobalDisplay, None, null);
       // printf("   Making DISPLAY current\n");
-      #if defined(__ANDROID__)
-      #else
       glXMakeCurrent(xGlobalDisplay, (GLXDrawable)display.window, oglDisplay.glContext);
-      #endif
    #endif
+#endif
       return true;
    }
 
@@ -1649,7 +1648,9 @@ class OpenGLDisplayDriver : DisplayDriver
    {
       bool result = false;
       OGLDisplay oglDisplay = display.driverData;
+#if !defined(__ANDROID__)
       OGLSystem oglSystem = display.displaySystem.driverData;
+#endif
       if(!oglDisplay)
          oglDisplay = display.driverData = OGLDisplay { };
       //printf("Inside CreateDisplay\n");
@@ -3926,11 +3927,14 @@ IS_GLGetContext(DisplaySystem displaySystem)
 {
    if(displaySystem)
    {
-      OGLSystem system = displaySystem.driverData;
 #if defined(__WIN32__)
+      OGLSystem system = displaySystem.driverData;
       return system.glrc;
-#else
+#elif !defined(__ANDROID__)
+      OGLSystem system = displaySystem.driverData;
       return system.glContext;
+#else
+      return eglContext;
 #endif
    }
    return null;
index 6764e72..ce34dee 100644 (file)
@@ -128,11 +128,11 @@ private:
          AInputEvent* event = null;
          if(AInputQueue_getEvent(inputQueue, &event) >= 0)
          {
-            int handled = 0;
+            //int handled = 0;
             LOGV("New input event: type=%d\n", AInputEvent_getType(event));
             if(AInputQueue_preDispatchEvent(inputQueue, event))
                return;
-            handled = onInputEvent(event);
+            /*handled = */onInputEvent(event);
             //AInputQueue_finishEvent(inputQueue, event, handled);
          }
          else
@@ -199,7 +199,7 @@ private:
 
    void pre_exec_cmd(AppCommand cmd)
    {
-      PrintLn("pre_exec_cmd: ", (int)cmd);
+      PrintLn("pre_exec_cmd: ", cmd);
       switch(cmd)
       {
          case inputChanged:
@@ -242,7 +242,7 @@ private:
 
    void post_exec_cmd(AppCommand cmd)
    {
-      PrintLn("post_exec_cmd: ", (int)cmd);
+      PrintLn("post_exec_cmd: ", cmd);
       switch(cmd)
       {
          case termWindow:
@@ -755,10 +755,6 @@ class AndroidInterface : Interface
 
    void GetMousePosition(int *x, int *y)
    {
-      int rootWindow, childWindow;
-      int mx, my;
-      unsigned int state;
-
       *x = mouseX;
       *y = mouseY;
    }
@@ -875,7 +871,7 @@ class AndroidInterface : Interface
 
    bool GetKeyState(Key key)
    {
-      int keyState = 0;
+      bool keyState = false;
       return keyState;
    }
 
@@ -1041,8 +1037,8 @@ static Key keyCodeTable[] =
     0, //AKEYCODE_BUTTON_START    = 108,
     0, //AKEYCODE_BUTTON_SELECT   = 109,
     0, //AKEYCODE_BUTTON_MODE     = 110,
-    escape, //AKEYCODE_BUTTON_ESCAPE     = 111,
-    del //AKEYCODE_BUTTON_ESCAPE     = 112,
+    escape, //AKEYCODE_BUTTON_ESCAPE = 111,
+    del, //AKEYCODE_BUTTON_ESCAPE    = 112,
     leftControl, // = 113
     rightControl, // = 114
     capsLock, // = 115
@@ -1079,21 +1075,21 @@ class AndroidActivity : AndroidAppGlue
       if(type == AINPUT_EVENT_TYPE_MOTION)
       {
          uint actionAndIndex = AMotionEvent_getAction(event);
-         uint source = AInputEvent_getSource(event);
+         //uint source = AInputEvent_getSource(event);
          uint action = actionAndIndex & AMOTION_EVENT_ACTION_MASK;
-         uint index  = (actionAndIndex & AMOTION_EVENT_ACTION_POINTER_INDEX_MASK) >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
-         uint flags = AMotionEvent_getFlags(event);
+         //uint index  = (actionAndIndex & AMOTION_EVENT_ACTION_POINTER_INDEX_MASK) >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
+         //uint flags = AMotionEvent_getFlags(event);
          uint meta = AMotionEvent_getMetaState(event);
-         uint edge = AMotionEvent_getEdgeFlags(event);
-         int64 downTime = AMotionEvent_getDownTime(event);     // nanotime
-         int64 eventTime = AMotionEvent_getDownTime(event);
+         //uint edge = AMotionEvent_getEdgeFlags(event);
+         //int64 downTime = AMotionEvent_getDownTime(event);     // nanotime
+         //int64 eventTime = AMotionEvent_getDownTime(event);
          //float axis;
          Modifiers keyFlags = 0;
          int x = (int)AMotionEvent_getX(event, 0);
          int y = (int)AMotionEvent_getY(event, 0);
          bool shift = (meta & AMETA_SHIFT_ON) ? true : false;
          bool alt = (meta & AMETA_ALT_ON) ? true : false;
-         bool sym = (meta & AMETA_SYM_ON) ? true : false;
+         //bool sym = (meta & AMETA_SYM_ON) ? true : false;
 
          keyFlags.shift = shift;
          keyFlags.alt = alt;
@@ -1134,14 +1130,14 @@ class AndroidActivity : AndroidAppGlue
       else if(type == AINPUT_EVENT_TYPE_KEY)
       {
          uint action = AKeyEvent_getAction(event);
-         uint flags = AKeyEvent_getFlags(event);
+         //uint flags = AKeyEvent_getFlags(event);
          uint keyCode = AKeyEvent_getKeyCode(event);
          uint meta = AKeyEvent_getMetaState(event);
          Key key = keyCodeTable[keyCode];
          bool shift = (meta & AMETA_SHIFT_ON) ? true : false;
          bool alt = (meta & AMETA_ALT_ON || meta & AMETA_ALT_LEFT_ON || meta & AMETA_ALT_RIGHT_ON) ? true : false;
-         bool metaMeta = (meta & AMETA_META_ON || meta & AMETA_META_LEFT_ON || meta & AMETA_META_RIGHT_ON) ? true : false;
-         bool sym = (meta & AMETA_SYM_ON) ? true : false;
+         //bool metaMeta = (meta & AMETA_META_ON || meta & AMETA_META_LEFT_ON || meta & AMETA_META_RIGHT_ON) ? true : false;
+         //bool sym = (meta & AMETA_SYM_ON) ? true : false;
          //unichar ch = AKeyEvent_getUnichar(event);
          unichar ch = 0;
 
@@ -1274,7 +1270,7 @@ class AndroidActivity : AndroidAppGlue
             guiApp = (GuiApplication)__androidCurrentModule;
 
             {
-               String skin = guiApp.skin;
+               const String skin = guiApp.skin;
                *&guiApp.currentSkin = null;
                guiApp.SelectSkin(skin);
             }
index 75c5f0d..1f168a0 100644 (file)
@@ -86,7 +86,7 @@ public enum ErrorLevel
    minor = 3
 };
 
-public define AllErrors = ErrorLevel::Minor;
+public define AllErrors = ErrorLevel::minor;
 
 public class ErrorCode
 {