From f00cccc76ecfd5424dbff34d51e84d96d2586894 Mon Sep 17 00:00:00 2001 From: Jeff Hill Date: Tue, 10 Oct 2000 21:38:38 +0000 Subject: [PATCH] fixed issues discovered by the Borland compiler --- src/libCom/osi/os/WIN32/osdProcess.c | 15 +++++++-------- src/libCom/osi/os/WIN32/osdThread.c | 9 +++++++-- src/libCom/osi/os/WIN32/osdTime.cpp | 6 ++++++ 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/libCom/osi/os/WIN32/osdProcess.c b/src/libCom/osi/os/WIN32/osdProcess.c index 82f236d6c..6ffa8f776 100644 --- a/src/libCom/osi/os/WIN32/osdProcess.c +++ b/src/libCom/osi/os/WIN32/osdProcess.c @@ -87,14 +87,13 @@ epicsShareFunc osiSpawnDetachedProcessReturn epicsShareAPI osiSpawnDetachedProce ); if ( W32status ) { - char *pFmtArgs[] = { - "Failed to start executable -", - (char *) pBaseExecutableName, - errStrMsgBuf, - "Changes may be required in your \"path\" environment variable.", - "PATH = ", - getenv ("path")}; - + char *pFmtArgs[6]; + pFmtArgs[0] = "Failed to start executable -"; + pFmtArgs[1] = (char *) pBaseExecutableName; + pFmtArgs[2] = errStrMsgBuf; + pFmtArgs[3] = "Changes may be required in your \"path\" environment variable."; + pFmtArgs[4] = "PATH = "; + pFmtArgs[5] = getenv ("path"); if ( pFmtArgs[5] == NULL ) { pFmtArgs[5] = ""; } diff --git a/src/libCom/osi/os/WIN32/osdThread.c b/src/libCom/osi/os/WIN32/osdThread.c index c6acb8a2a..8ebce21cc 100644 --- a/src/libCom/osi/os/WIN32/osdThread.c +++ b/src/libCom/osi/os/WIN32/osdThread.c @@ -109,8 +109,13 @@ epicsShareFunc void epicsShareAPI threadInit (void) return; } +#if 1 + /* not arch neutral, but at least supported by w95 and borland */ + if ( InterlockedExchange ( (LPLONG) &win32ThreadGlobalMutex, (LONG) win32ThreadGlobalMutexTmp ) ) { +#else /* not supported on W95, but the alternative requires assuming that pointer and integer are the same */ if (InterlockedCompareExchange ( (PVOID *) &win32ThreadGlobalMutex, (PVOID) win32ThreadGlobalMutexTmp, (PVOID)0 ) != 0) { +#endif CloseHandle (win32ThreadGlobalMutexTmp); /* wait for init to complete */ status = WaitForSingleObject (win32ThreadGlobalMutex, INFINITE); @@ -278,7 +283,7 @@ epicsShareFunc unsigned int epicsShareAPI threadGetStackSize (threadStackSizeCla /* * epicsWin32ThreadEntry() */ -static int WINAPI epicsWin32ThreadEntry (LPVOID lpParameter) +static unsigned WINAPI epicsWin32ThreadEntry (LPVOID lpParameter) { win32ThreadParam *pParm = (win32ThreadParam *) lpParameter; BOOL stat; @@ -294,7 +299,7 @@ static int WINAPI epicsWin32ThreadEntry (LPVOID lpParameter) */ free ( pParm ); - return ( stat ); /* this indirectly closes the thread handle */ + return ( (unsigned) stat ); /* this indirectly closes the thread handle */ } /* diff --git a/src/libCom/osi/os/WIN32/osdTime.cpp b/src/libCom/osi/os/WIN32/osdTime.cpp index 133b91576..0fa0039f2 100644 --- a/src/libCom/osi/os/WIN32/osdTime.cpp +++ b/src/libCom/osi/os/WIN32/osdTime.cpp @@ -123,8 +123,14 @@ static void osdTimeInit () return; } +#if 1 + /* not arch neutral, but at least supported by w95 and borland */ + if ( InterlockedExchange ( (LPLONG) &osdTimeMutex, (LONG) osdTimeMutexTmp ) ) { +#else + /* not supported on W95, but the alternative requires assuming that pointer and integer are the same */ if (InterlockedCompareExchange ( (PVOID *) &osdTimeMutex, (PVOID) osdTimeMutexTmp, (PVOID)0 ) != 0) { +#endif CloseHandle (osdTimeMutexTmp); /* wait for init to complete */ status = WaitForSingleObject (osdTimeMutex, INFINITE);