Clean up compiler warnings on the OSX build
authorGeoff Norton <grompf@gmail.com>
Thu, 12 Feb 2015 04:41:29 +0000 (20:41 -0800)
committerGeoff Norton <grompf@gmail.com>
Thu, 12 Feb 2015 04:41:29 +0000 (20:41 -0800)
src/pal/inc/pal_mstypes.h
src/pal/src/arch/i386/context.cpp
src/pal/src/cruntime/finite.cpp
src/pal/src/debug/debug.cpp
src/pal/src/file/path.cpp
src/pal/src/locale/locale.cpp
src/pal/src/misc/version.cpp

index fa73f1176cb95041592afdf88d6c174da5ac77d1..4b2ec49c5913634788d15a3087ef7908db4b2b67 100644 (file)
@@ -322,7 +322,9 @@ typedef unsigned __int64 DWORD_PTR, *PDWORD_PTR;
 /* maximum unsigned 64 bit value */
 #define ULONG_PTR_MAX     UI64(0xffffffffffffffff)
 
+#ifndef SIZE_MAX
 #define SIZE_MAX _UI64_MAX
+#endif
 
 #define __int3264   __int64
 
index d52952e4969e7d4f8c6f5cf51881ba9036d701b6..518539fffc17fa36f8d6d0f218e7b807b9ac9317 100644 (file)
@@ -982,7 +982,7 @@ CONTEXT_GetThreadContextFromPort(
             // so we can simply memcpy them across.
             memcpy(lpContext->ExtendedRegisters + CONTEXT_EXREG_XMM_OFFSET, &State.fpu_xmm0, 8 * 16);
         }
-#endif _X86_
+#endif
     }
 
 EXIT:
index 8fdab72e141d418e0776d89a4a0c654f9ec0cbba..115a20becb9d2a3d8feb72415f2a7466bb3df2a0 100644 (file)
@@ -63,7 +63,7 @@ _finite(
 #if defined(_IA64_) && defined (_HPUX_)
     ret = !isnan(x) && x != PAL_POSINF && x != PAL_NEGINF;
 #else
-    ret = finite(x);
+    ret = isfinite(x);
 #endif
     LOGEXIT("_finite returns int %d\n", ret);
     PERF_EXIT(_finite);
index 9b032c11fcc0b0b7533290bfcf7cc2ba7f2f4e38..a9fa01978f0c204f2c0bf3977f3d9a94076cb1ca 100644 (file)
@@ -71,8 +71,10 @@ SET_DEFAULT_DEBUG_CHANNEL(DEBUG);
 
 /* ------------------- Constant definitions ----------------------------------*/
 
+#if !HAVE_VM_READ && !HAVE_PROCFS_CTL
 const BOOL DBG_ATTACH       = TRUE;
 const BOOL DBG_DETACH       = FALSE;
+#endif
 static const char PAL_OUTPUTDEBUGSTRING[]    = "PAL_OUTPUTDEBUGSTRING";
 
 #ifdef _DEBUG
index c3dcfd8e49c3a3067982fc2634e7293d054a950e..81ee86abff5712e283d6e0597f0ce46c5cb61397 100644 (file)
@@ -474,94 +474,6 @@ GetTempPathA(
         return 0;
     }
 
-#ifdef __APPLE__
-    // Retrieve the Temporary Items folder.
-    DWORD palError = ERROR_SUCCESS;
-    FSRef tempFolderFSRef;
-    OSErr err = FSFindFolder(kUserDomain, kTemporaryFolderType, true /* fCreate */,
-        &tempFolderFSRef);
-    if (err != noErr)
-        palError = ERROR_INTERNAL_ERROR;
-    else
-    {
-        CFURLRef tempFolderURLRef = CFURLCreateFromFSRef(kCFAllocatorDefault, &tempFolderFSRef);
-        if (tempFolderURLRef == NULL)
-            palError = ERROR_OUTOFMEMORY;
-        else
-        {
-            CFStringRef tempFolderPathRef = CFURLCopyFileSystemPath(tempFolderURLRef, kCFURLPOSIXPathStyle);
-            CFRelease(tempFolderURLRef);
-            CFIndex tempFolderPathLenWide;
-            if (tempFolderPathRef == NULL)
-                palError = ERROR_OUTOFMEMORY;
-            else if ((tempFolderPathLenWide = CFStringGetLength(tempFolderPathRef)) == 0)
-            {
-                palError = ERROR_INTERNAL_ERROR;
-                CFRelease(tempFolderPathRef);
-            }
-            else
-            {
-                // String needs to terminate with a slash.
-                if (CFStringGetCharacterAtIndex(tempFolderPathRef, tempFolderPathLenWide) != '/')
-                {
-                    CFStringRef altTempFolderPathRef = CFStringCreateWithFormat(kCFAllocatorDefault, 
-                        NULL, CFSTR("%@/"), tempFolderPathRef);
-                    if (altTempFolderPathRef == NULL)
-                    {
-                        palError = ERROR_OUTOFMEMORY;
-                    }
-                    else
-                    {
-                        CFRelease(tempFolderPathRef);
-                        tempFolderPathRef = altTempFolderPathRef;
-                    }
-                }
-                if (palError != ERROR_SUCCESS)
-                {}
-                else if (!CFStringGetFileSystemRepresentation(tempFolderPathRef, lpBuffer, nBufferLength))
-                {
-                    // Too small or failed conversion.
-                    CFIndex tempFolderPathLenMax = CFStringGetMaximumSizeOfFileSystemRepresentation(tempFolderPathRef);
-                    char *lpBigBuffer = CorUnix::InternalNewArray<char>(CorUnix::InternalGetCurrentThread(), tempFolderPathLenMax);
-                    if (!lpBigBuffer)
-                    {
-                        palError = ERROR_OUTOFMEMORY;
-                    }
-                    else
-                    {
-                        if (!CFStringGetFileSystemRepresentation(tempFolderPathRef, lpBigBuffer, tempFolderPathLenMax))
-                        {
-                            // failed conversion.
-                            ERROR("Could not convert temp folder ref to 8-bit string.\n");
-                            palError = ERROR_INTERNAL_ERROR;
-                        }
-                        else
-                        {
-                            if (!ClrSafeInt<DWORD>::addition(strlen(lpBigBuffer), 1, dwPathLen))
-                            {
-                                ERROR("Integer overflow in buffer math.\n");
-                                palError = ERROR_INTERNAL_ERROR;
-                            }
-                            else
-                            {
-                                ERROR("Buffer is too small, need %d characters.\n", dwPathLen);
-                                palError = ERROR_INSUFFICIENT_BUFFER;
-                            }
-                        }
-                        CorUnix::InternalDeleteArray<char>(CorUnix::InternalGetCurrentThread(), lpBigBuffer);
-                    }
-                }
-                else
-                {
-                    dwPathLen = strlen(lpBuffer);
-                }
-                CFRelease(tempFolderPathRef);
-            }
-        }
-    }
-    if (palError != ERROR_SUCCESS)
-        SetLastError(palError);
-#else
        // GetTempPath is supposed to include the trailing slash.
     const char *defaultDir = "/tmp/";
 
@@ -582,7 +494,6 @@ GetTempPathA(
         ERROR("Buffer is too small, need %d characters\n", dwPathLen);
         SetLastError( ERROR_INSUFFICIENT_BUFFER );
     }
-#endif // __APPLE__
 
     LOGEXIT("GetTempPathA returns DWORD %u\n", dwPathLen);
     PERF_EXIT(GetTempPathA);
index 22db31a966bf984fa2fa0c7f9c7fe1a8803abcb5..976903058b66792f5733feb174734828808e6465 100644 (file)
@@ -323,8 +323,8 @@ static CFStringRef MapFormatPattern(CFStringRef cfStringFormat, const struct For
                 }
 
                 /* find the map entry corresponding to the count we have found (there must be one) */
-                while (!((entry->count & ORMORE) != 0 && count >= (entry->count & ~ORMORE) ||
-                         (entry->count & ORMORE) == 0 && count == entry->count))
+                while (!(((entry->count & ORMORE) != 0 && count >= (entry->count & ~ORMORE)) ||
+                         ((entry->count & ORMORE) == 0 && count == entry->count)))
                 {
                     entry++;
                     if (entry->uniChar != uniChar)
index 04c5cd8e2836a1ffe209bcf5532b5de40c43e8d0..c9afc5ea4a4675cb373018959b487dc3bef4bdbb 100644 (file)
@@ -41,7 +41,7 @@ static DWORD /* PAL_ERROR */ CFStringToVers(CFStringRef versTupleStr, DWORD *pve
 
     /* check to make sure it wasn't a failed conversion */
     CFStringRef convertBackStr = CFStringCreateWithFormat(kCFAllocatorDefault, NULL,
-        CFSTR("%lu"), vers);
+        CFSTR("%u"), vers);
         
     if (!convertBackStr)
         return ERROR_NOT_ENOUGH_MEMORY;