We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3741 - more compatible initializers for arrays
Summary: more compatible initializers for arrays
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: HG 2.0
Hardware: All All
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-08-13 10:54 UTC by Ozkan Sezer
Modified: 2017-08-14 04:15 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ozkan Sezer 2017-08-13 10:54:25 UTC
An array defined like  int xPositions[] = {-1, 0, 1, w-1, w, w+1 };
errors with Open Watcom: it strictly wants constants.  Small patch
like below makes things more compatible.

diff -r f7abcb63e51e test/testautomation_mouse.c
--- a/test/testautomation_mouse.c	Sun Aug 13 01:00:01 2017 -0400
+++ b/test/testautomation_mouse.c	Sun Aug 13 11:28:11 2017 +0300
@@ -447,11 +447,23 @@ mouse_warpMouseInWindow(void *arg)
 {
     const int w = MOUSE_TESTWINDOW_WIDTH, h = MOUSE_TESTWINDOW_HEIGHT;
     int numPositions = 6;
-    int xPositions[] = {-1, 0, 1, w-1, w, w+1 };
-    int yPositions[] = {-1, 0, 1, h-1, h, h+1 };
+    int xPositions[6];
+    int yPositions[6];
     int x, y, i, j;
     SDL_Window *window;
 
+    xPositions[0] = -1;
+    xPositions[1] = 0;
+    xPositions[2] = 1;
+    xPositions[3] = w-1;
+    xPositions[4] = w;
+    xPositions[5] = w+1;
+    yPositions[0] = -1;
+    yPositions[1] = 0;
+    yPositions[2] = 1;
+    yPositions[3] = h-1;
+    yPositions[4] = h;
+    yPositions[5] = h+1;
     /* Create test window */
     window = _createMouseSuiteTestWindow();
     if (window == NULL) return TEST_ABORTED;
diff -r f7abcb63e51e test/testmessage.c
--- a/test/testmessage.c	Sun Aug 13 01:00:01 2017 -0400
+++ b/test/testmessage.c	Sun Aug 13 11:28:11 2017 +0300
@@ -46,12 +46,13 @@ button_messagebox(void *eventNumber)
         "Custom MessageBox",
         "This is a custom messagebox",
         2,
-        buttons,
+        NULL,/* buttons */
         NULL /* Default color scheme */
     };
 
     int button = -1;
     int success = 0;
+    data.buttons = buttons;
     if (eventNumber) {
         data.message = "This is a custom messagebox from a background thread.";
     }
Comment 1 Sam Lantinga 2017-08-14 04:15:57 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/6dd70238edb7