changeset 1733:4314ee3dbeb1

Fixes for GBM unable to open files when compiled with GCC/Watcom on OS/2.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Wed, 16 May 2012 10:12:09 +0000
parents 03a76c4185a8
children b7165e93628c
files os2/dw.c
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/os2/dw.c	Wed May 16 08:56:19 2012 +0000
+++ b/os2/dw.c	Wed May 16 10:12:09 2012 +0000
@@ -6746,6 +6746,13 @@
    WinSendMsg(handle, WM_SETICON, (MPARAM)hptr, 0);
 }
 
+/* GBM seems to be compiled with VisualAge which defines O_BINARY and O_RDONLY
+ * as follows... but other compilers (GCC and Watcom at least) define them
+ * differently... so we add defines that are compatible with VAC here.
+ */
+#define GBM_O_BINARY        0x00008000
+#define GBM_O_RDONLY        0x00000004
+
 /* Internal function to load a bitmap from a file and return handles
  * to the bitmap, presentation space etc.
  */
@@ -6768,8 +6775,13 @@
         ULONG byteswidth;
 
         /* Try to open the file */
-        if((fd = _gbm_io_open(file, O_RDONLY|O_BINARY)) == -1)
+        if((fd = _gbm_io_open(file, GBM_O_RDONLY|GBM_O_BINARY)) == -1)
+        {
+#ifdef DEBUG
+            dw_debug("Failed to open file %s\n", file);
+#endif
             return 0;
+        }
 
         /* guess the source file type from the source filename */
         _gbm_query_n_filetypes(&ft);