Commit 110a0f7bb1c9c511f06fef45ebf99839a76a6bee

Ozkan Sezer 2020-10-14T23:01:01

os2: update include paths. add missing libc includes to geniconv.

diff --git a/src/core/os2/SDL_os2.c b/src/core/os2/SDL_os2.c
index d42e668..d834891 100644
--- a/src/core/os2/SDL_os2.c
+++ b/src/core/os2/SDL_os2.c
@@ -22,7 +22,7 @@
 
 #if defined(__OS2__)
 
-#include "core/os2/geniconv/geniconv.h"
+#include "geniconv/geniconv.h"
 
 // SDL_OS2Quit() will be called from SDL_QuitSubSystem().
 
diff --git a/src/core/os2/SDL_os2.h b/src/core/os2/SDL_os2.h
index a455c49..1ecaec1 100644
--- a/src/core/os2/SDL_os2.h
+++ b/src/core/os2/SDL_os2.h
@@ -1,31 +1,28 @@
-#ifndef _SDL_os2_h
-#define _SDL_os2_h
+#ifndef SDL_os2_h_
+#define SDL_os2_h_
 
 #include "SDL_log.h"
 #include "SDL_stdinc.h"
-#include ".\src\core\os2\geniconv\geniconv.h"
+#include "geniconv/geniconv.h"
 
 #if OS2DEBUG==SDLOUTPUT
-
 # define debug(s,...) SDL_LogDebug( SDL_LOG_CATEGORY_APPLICATION, \
                                     __func__"(): "##s, ##__VA_ARGS__ )
-
 #elif defined(OS2DEBUG)
-
 # define debug(s,...) printf( __func__"(): "##s"\n", ##__VA_ARGS__ )
 
 #else
 
 # define debug(s,...)
 
-#endif // OS2DEBUG
+#endif /* OS2DEBUG */
 
 
-// StrUTF8New() - geniconv\sys2utf8.c.
+// StrUTF8New() - geniconv/sys2utf8.c.
 #define OS2_SysToUTF8(S) StrUTF8New( 1, S, SDL_strlen( S ) + 1 )
 #define OS2_UTF8ToSys(S) StrUTF8New( 0, (char *)(S), SDL_strlen( S ) + 1 )
 
 // SDL_OS2Quit() will be called from SDL_QuitSubSystem().
 void SDL_OS2Quit();
 
-#endif // _SDL_os2_h
+#endif /* SDL_os2_h_ */
diff --git a/src/core/os2/geniconv/geniconv.c b/src/core/os2/geniconv/geniconv.c
index b82e903..8ce7046 100644
--- a/src/core/os2/geniconv/geniconv.c
+++ b/src/core/os2/geniconv/geniconv.c
@@ -7,7 +7,8 @@
 #define INCL_DOSMODULEMGR     /* Module Manager values */
 #define INCL_DOSERRORS        /* Error values */
 #include <os2.h>
-#include <iconv.h>
+
+#include "geniconv.h"
 
 //#define DEBUG
 
@@ -107,7 +108,6 @@ static void _init()
 }
 
 
-
 //           Public routines.
 //           ----------------
 
diff --git a/src/core/os2/geniconv/geniconv.h b/src/core/os2/geniconv/geniconv.h
index e22ce64..ca9f27f 100644
--- a/src/core/os2/geniconv/geniconv.h
+++ b/src/core/os2/geniconv/geniconv.h
@@ -37,16 +37,16 @@ int libiconv_close(iconv_t cd);
 // System codepage <-> UTF-8.
 
 // StrUTF8()
-// Coverts string from system cp. to UTF-8 (fToUTF8 is not 0) or from UTF-8 to
-// the system cp. (fToUTF8 is 0). Converted ASCIIZ string will be placed at the
+// Coverts string from system cp to UTF-8 (fToUTF8 is not 0) or from UTF-8 to
+// the system cp (fToUTF8 is 0). Converted ASCIIZ string will be placed at the
 // buffer pcDst, up to cbDst - 1 (for sys->utf8) or 2 (for utf8->sys) bytes.
 // Returns the number of bytes written into pcDst, not counting the terminating
 // 0 byte(s) or -1 on error.
 int StrUTF8(int fToUTF8, char *pcDst, int cbDst, char *pcSrc, int cbSrc);
 
 // StrUTF8New()
-// Coverts string from system cp. to UTF-8 (fToUTF8 is not 0) or from UTF-8 to
-// the system cp. (fToUTF8 is 0). Memory for the new string is obtained by
+// Coverts string from system cp to UTF-8 (fToUTF8 is not 0) or from UTF-8 to
+// the system cp (fToUTF8 is 0). Memory for the new string is obtained by
 // using libc malloc().
 // Returns converted string, terminating two bytes 0 is appended to the result.
 // Returns null on error.
diff --git a/src/core/os2/geniconv/os2cp.c b/src/core/os2/geniconv/os2cp.c
index dd9e83a..2e356a2 100644
--- a/src/core/os2/geniconv/os2cp.c
+++ b/src/core/os2/geniconv/os2cp.c
@@ -1,10 +1,11 @@
-#include "os2cp.h"
 #define INCL_DOSNLS
 #define INCL_DOSERRORS
 #include <os2.h>
 #include <string.h>
 #include <ctype.h>
 
+#include "os2cp.h"
+
 typedef struct _CP2NAME {
   ULONG		ulCode;
   PSZ		pszName;
diff --git a/src/core/os2/geniconv/os2iconv.c b/src/core/os2/geniconv/os2iconv.c
index 1e2ba24..9e54f66 100644
--- a/src/core/os2/geniconv/os2iconv.c
+++ b/src/core/os2/geniconv/os2iconv.c
@@ -5,10 +5,10 @@
 */
 
 #define ICONV_THREAD_SAFE 1
-//#undef ICONV_THREAD_SAFE
 
-#include "iconv.h"
+#include "geniconv.h"
 #include <uconv.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #ifdef ICONV_THREAD_SAFE
diff --git a/src/core/os2/geniconv/sys2utf8.c b/src/core/os2/geniconv/sys2utf8.c
index 51ce4a1..4fe906c 100644
--- a/src/core/os2/geniconv/sys2utf8.c
+++ b/src/core/os2/geniconv/sys2utf8.c
@@ -1,4 +1,4 @@
-#include <iconv.h>
+#include "geniconv.h"
 #include <stdlib.h>
 
 int StrUTF8(int fToUTF8, char *pcDst, int cbDst, char *pcSrc, int cbSrc)
@@ -47,8 +47,7 @@ int StrUTF8(int fToUTF8, char *pcDst, int cbDst, char *pcSrc, int cbSrc)
 
   iconv_close( cd );
 
-  // Write trailing ZERO (1 byte for UTF-8, 2 bytes for the system cp.).
-
+  // Write trailing ZERO (1 byte for UTF-8, 2 bytes for the system cp).
   if ( fToUTF8 )
   {
     if ( cbDst < 1 )
diff --git a/src/core/os2/geniconv/test.c b/src/core/os2/geniconv/test.c
index efd0b95..84dc6f9 100644
--- a/src/core/os2/geniconv/test.c
+++ b/src/core/os2/geniconv/test.c
@@ -1,8 +1,9 @@
+#include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <geniconv.h>
+#include "geniconv.h"
 
-void main()
+int main(void)
 {
   char       acBuf[128];
   char       *inbuf = "Тест - проверка"; // KOI8-R string.
@@ -17,7 +18,7 @@ void main()
   if ( ic == (iconv_t)(-1) )
   {
     puts( "iconv_open() fail" );
-    return;
+    return 1;
   }
 
   iconv( ic, &inbuf, &inbytesleft, &outbuf, &outbytesleft );
@@ -42,4 +43,5 @@ void main()
   iconv_clean();
 
   puts( "Done." );
+  return 0;
 }
diff --git a/src/loadso/os2/SDL_sysloadso.c b/src/loadso/os2/SDL_sysloadso.c
index 7d08f94..4943ec1 100644
--- a/src/loadso/os2/SDL_sysloadso.c
+++ b/src/loadso/os2/SDL_sysloadso.c
@@ -26,7 +26,7 @@
 /* System dependent library loading routines                           */
 
 #include "SDL_loadso.h"
-#include ".\core\os2\SDL_os2.h"
+#include "../../core/os2/SDL_os2.h"
 
 #define INCL_DOSMODULEMGR
 #define INCL_DOSERRORS
diff --git a/src/video/os2/SDL_os2output.h b/src/video/os2/SDL_os2output.h
index 0e90c4f..5894b8d 100644
--- a/src/video/os2/SDL_os2output.h
+++ b/src/video/os2/SDL_os2output.h
@@ -21,7 +21,7 @@
 #ifndef _SDL_os2output_
 #define _SDL_os2output_
 
-#include ".\core\os2\SDL_os2.h"
+#include "../../core/os2/SDL_os2.h"
 
 typedef struct _VODATA *PVODATA;
 
@@ -51,4 +51,4 @@ typedef struct _OS2VIDEOOUTPUT {
 extern OS2VIDEOOUTPUT voDive;
 extern OS2VIDEOOUTPUT voVMan;
 
-#endif // _SDL_os2output_
+#endif /* _SDL_os2output_ */
diff --git a/src/video/os2/SDL_os2util.h b/src/video/os2/SDL_os2util.h
index 6aac3fd..3806914 100644
--- a/src/video/os2/SDL_os2util.h
+++ b/src/video/os2/SDL_os2util.h
@@ -30,9 +30,8 @@
 #define INCL_GPI
 #include <os2.h>
 
-/*#define debug(s,...) SDL_LogDebug( SDL_LOG_CATEGORY_VIDEO, \
-                                   __func__"(): "##s, ##__VA_ARGS__ )*/
+/*#define debug(s,...) SDL_LogDebug( SDL_LOG_CATEGORY_VIDEO, __func__"(): "##s, ##__VA_ARGS__ )*/
 
 HPOINTER utilCreatePointer(SDL_Surface *surface, ULONG ulHotX, ULONG ulHotY);
 
-#endif // _SDL_os2util_h
+#endif /* _SDL_os2util_h */
diff --git a/src/video/os2/SDL_os2video.h b/src/video/os2/SDL_os2video.h
index 633efa2..4ba4e99 100644
--- a/src/video/os2/SDL_os2video.h
+++ b/src/video/os2/SDL_os2video.h
@@ -24,7 +24,7 @@
 #define _SDL_os2video_h
 
 #include "../SDL_sysvideo.h"
-#include ".\core\os2\SDL_os2.h"
+#include "../../core/os2/SDL_os2.h"
 
 #define INCL_DOS
 #define INCL_DOSERRORS
@@ -34,8 +34,6 @@
 #define INCL_OS2MM
 #define INCL_DOSMEMMGR
 #include <os2.h>
-//#include <gradd.h>               // Defines FOURCC_xxxx
-
 
 #include "SDL_os2mouse.h"
 #include "SDL_os2output.h"
diff --git a/src/video/os2/SDL_os2vman.c b/src/video/os2/SDL_os2vman.c
index 394c695..fe1952d 100644
--- a/src/video/os2/SDL_os2vman.c
+++ b/src/video/os2/SDL_os2vman.c
@@ -25,13 +25,15 @@
 #define INCL_DOSMODULEMGR
 #define INCL_WIN
 #define INCL_GPI
-#define INCL_GPIBITMAPS         // GPI bit map functions
+#define INCL_GPIBITMAPS /* GPI bit map functions */
 #include <os2.h>
+#include <gradd.h>
+#if 0 /* not used */
 #define INCL_GRE_DEVICE
 #define INCL_GRE_DEVMISC
 #include <pmddi.h>
+#endif
 #include "SDL_os2output.h"
-#include "gradd.h"
 #include "SDL_os2video.h"
 
 typedef struct _VODATA {