From: Timo Korvola Date: Tue, 20 Mar 2018 22:20:56 +0000 (+0200) Subject: Miscellaneous portability fixes. X-Git-Url: https://scope-eye.net/git/?a=commitdiff_plain;h=64ccc13fd59dbd1e6f399bf72c0e1e53df8e3dd7;p=liskon_frotz.git Miscellaneous portability fixes. --- diff --git a/src/sdl/sf_osfdlg.c b/src/sdl/sf_osfdlg.c index 24bd009..384d9da 100644 --- a/src/sdl/sf_osfdlg.c +++ b/src/sdl/sf_osfdlg.c @@ -1,6 +1,9 @@ #include #include #include + +#include +#include #include #define STATIC static @@ -547,7 +550,7 @@ STATIC ENTRY * dodir( //printf("-%s\n",resdir); if (stat(resdir,&fst)) continue; //printf("--mode %x\n",fst.st_mode); - if (fst.st_mode & S_IFDIR) + if (S_ISDIR(fst.st_mode)) addentry(p,&dirs); else { diff --git a/src/sdl/sf_sig.c b/src/sdl/sf_sig.c index 31cd547..112ff8d 100644 --- a/src/sdl/sf_sig.c +++ b/src/sdl/sf_sig.c @@ -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"); diff --git a/src/sdl/sf_util.c b/src/sdl/sf_util.c index 57cc7dd..86e8316 100644 --- a/src/sdl/sf_util.c +++ b/src/sdl/sf_util.c @@ -5,6 +5,7 @@ #include +#include #include #ifdef __WIN32__ @@ -420,11 +421,12 @@ void os_process_arguments (int argc, char *argv[]) #include #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 - -void sf_sleep( int msecs){ - usleep(msecs/1000); - } - unsigned long sf_ticks (void) { struct timeval now; static struct timeval start;