Miscellaneous portability fixes.
authorTimo Korvola <tkorvola@iki.fi>
Tue, 20 Mar 2018 22:20:56 +0000 (00:20 +0200)
committerTimo Korvola <tkorvola@iki.fi>
Sat, 24 Mar 2018 18:27:07 +0000 (20:27 +0200)
src/sdl/sf_osfdlg.c
src/sdl/sf_sig.c
src/sdl/sf_util.c

index 24bd0093c92cee54deb8254250da8e1503ca4ddb..384d9da304eeb54ca0806dfcfeeb4d516fd8e36d 100644 (file)
@@ -1,6 +1,9 @@
 #include <stdio.h>\r
 #include <stdlib.h>\r
 #include <string.h>\r
+\r
+#include <sys/types.h>\r
+#include <sys/stat.h>\r
 #include <unistd.h>\r
 \r
 #define STATIC static\r
@@ -547,7 +550,7 @@ STATIC ENTRY * dodir(
 //printf("-%s\n",resdir);\r
     if (stat(resdir,&fst)) continue;\r
 //printf("--mode %x\n",fst.st_mode);\r
-    if (fst.st_mode & S_IFDIR)\r
+    if (S_ISDIR(fst.st_mode))\r
        addentry(p,&dirs);\r
     else\r
        {\r
index 31cd54794bdafaa9879745b3a474f80c7d8cbdef..112ff8db3d4964101f04faa62d4d098a77784fb7 100644 (file)
@@ -78,7 +78,7 @@ static void bt_sighandler(int sig, siginfo_t *info,
   void *trace[16];
   char *nam;
   int i, trace_size = 0;
-  ucontext_t *uc = (ucontext_t *)secret;
+//  ucontext_t *uc = (ucontext_t *)secret;
 
   if (sig == SIGINT)
     os_fatal("Emergency exit!\n\n(Signal SIGINT received)");
@@ -87,7 +87,7 @@ static void bt_sighandler(int sig, siginfo_t *info,
 
   printf("\nInterpreter bug!\nSignal %d ", sig);
   if ((nam = getsigname(sig))) printf("[%s] ",nam);
-  printf("from %p", (void *)uc->uc_mcontext.gregs[_PROG_COUNTER]);
+//  printf("from %p", (void *)uc->uc_mcontext.gregs[_PROG_COUNTER]);
 
   if (sig == SIGSEGV)
         printf(" [faulty address is %p]",info->si_addr);
@@ -96,7 +96,7 @@ static void bt_sighandler(int sig, siginfo_t *info,
 
   trace_size = backtrace(trace, 16);
   /* overwrite sigaction with caller's address */
-  trace[1] = (void *) uc->uc_mcontext.gregs[_PROG_COUNTER];
+//  trace[1] = (void *) uc->uc_mcontext.gregs[_PROG_COUNTER];
 
   /* skip first stack frame (points here) */
   printf("Backtrace:\n");
index 57cc7dd7f4012bdf4910f52e4159a5a25ce45eb2..86e83167e028fa3dec8786e6897666a129d53107 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <libgen.h>
 
+#include <SDL.h>
 #include <zlib.h>
 
 #ifdef __WIN32__
@@ -420,11 +421,12 @@ void os_process_arguments (int argc, char *argv[])
 #include <sys/time.h>
 #endif
 
-#ifdef WIN32
+void sf_sleep( int msecs)
+{
+  SDL_Delay(msecs);
+}
 
-void sf_sleep( int msecs){
-  Sleep(msecs);
-  }
+#ifdef WIN32
 
 unsigned long sf_ticks( void){
   return (GetTickCount());
@@ -432,12 +434,6 @@ unsigned long sf_ticks( void){
 
 #else
 
-//#include <unistd.h>
-
-void sf_sleep( int msecs){
-  usleep(msecs/1000);
-  }
-
 unsigned long sf_ticks (void) {
   struct timeval now;
   static struct timeval start;