From ebaee14229614bc928df5a265999e7ff8f17c905 Mon Sep 17 00:00:00 2001 From: zilmar Date: Mon, 28 Nov 2016 07:23:12 +1100 Subject: [PATCH] [Common] Fix some warnings --- Source/Common/MemoryManagement.cpp | 1 + Source/Common/SyncEvent.cpp | 1 + Source/Common/path.cpp | 10 +++++----- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Source/Common/MemoryManagement.cpp b/Source/Common/MemoryManagement.cpp index 18f5149d7..2d711e0c9 100644 --- a/Source/Common/MemoryManagement.cpp +++ b/Source/Common/MemoryManagement.cpp @@ -70,6 +70,7 @@ bool FreeAddressSpace(void* addr, size_t size) #else msync(addr, size, MS_SYNC); munmap(addr, size); + return true; #endif } diff --git a/Source/Common/SyncEvent.cpp b/Source/Common/SyncEvent.cpp index 6a3d2dcce..5241a086e 100644 --- a/Source/Common/SyncEvent.cpp +++ b/Source/Common/SyncEvent.cpp @@ -52,6 +52,7 @@ bool SyncEvent::IsTriggered(int32_t iWaitTime) } m_signalled = false; pthread_mutex_unlock((pthread_mutex_t*)m_Event); + return true; #endif } diff --git a/Source/Common/path.cpp b/Source/Common/path.cpp index 7d4a2f381..d0d686a2b 100644 --- a/Source/Common/path.cpp +++ b/Source/Common/path.cpp @@ -606,7 +606,7 @@ void CPath::SetComponents(const char * lpszDirectory, const char * lpszName, con if (lpszDirectory != NULL && lpszDirectory[0] != '\0') { if (lpszDirectory[0] != DIRECTORY_DELIMITER) { buff_fullname[0] = DIRECTORY_DELIMITER; } - strncat(buff_fullname,lpszDirectory,sizeof(buff_fullname)); + strncat(buff_fullname,lpszDirectory,sizeof(buff_fullname) - 1); std::string::size_type nLength = strlen(buff_fullname); if (buff_fullname[nLength - 1] != DIRECTORY_DELIMITER && nLength < sizeof(buff_fullname)) { @@ -615,15 +615,15 @@ void CPath::SetComponents(const char * lpszDirectory, const char * lpszName, con } if (lpszName != NULL) { - strncat(buff_fullname,lpszName,sizeof(buff_fullname)); + strncat(buff_fullname,lpszName,sizeof(buff_fullname) - 1); } if (lpszExtension != NULL && lpszExtension[0] != '\0') { if (lpszExtension[0] != '.') { - strncat(buff_fullname,".",sizeof(buff_fullname)); + strncat(buff_fullname,".",sizeof(buff_fullname)-1); } - strncat(buff_fullname,lpszExtension,sizeof(buff_fullname)); + strncat(buff_fullname,lpszExtension,sizeof(buff_fullname)-1); } buff_fullname[sizeof(buff_fullname) - 1] = 0; //Make sure it is null terminated m_strPath.erase(); @@ -1331,7 +1331,7 @@ bool CPath::FindNext() } #else dirent* pEntry; - while (pEntry = readdir((DIR*)m_OpenedDir)) + while ((pEntry = readdir((DIR*)m_OpenedDir))) { uint32_t dwFileAttributes = pEntry->d_type == DT_DIR ? FIND_ATTRIBUTE_SUBDIR : FIND_ATTRIBUTE_FILES;