diff options
author | Adeel <adeelbm@outlook.com> | 2019-02-24 12:14:06 -0800 |
---|---|---|
committer | Adeel <adeelbm@outlook.com> | 2019-02-24 15:53:32 -0800 |
commit | dc19f81f05dd2559af329c528c2f04e869d8ef1e (patch) | |
tree | a61fb44fa2b31ec85e2daf9e670f01a6c4f97e59 /src/debug | |
parent | 333232d98639df980133205c41791cb9dc7f3d34 (diff) | |
download | coreclr-dc19f81f05dd2559af329c528c2f04e869d8ef1e.tar.gz coreclr-dc19f81f05dd2559af329c528c2f04e869d8ef1e.tar.bz2 coreclr-dc19f81f05dd2559af329c528c2f04e869d8ef1e.zip |
Fix comparison and narrowing errors reported by GCC
Diffstat (limited to 'src/debug')
-rw-r--r-- | src/debug/createdump/crashinfo.cpp | 8 | ||||
-rw-r--r-- | src/debug/createdump/datatarget.cpp | 4 | ||||
-rw-r--r-- | src/debug/debug-pal/unix/twowaypipe.cpp | 8 |
3 files changed, 10 insertions, 10 deletions
diff --git a/src/debug/createdump/crashinfo.cpp b/src/debug/createdump/crashinfo.cpp index 4db2b00eeb..192ed82b43 100644 --- a/src/debug/createdump/crashinfo.cpp +++ b/src/debug/createdump/crashinfo.cpp @@ -317,7 +317,7 @@ CrashInfo::EnumerateModuleMappings() // Making something like: /proc/123/maps char mapPath[128]; int chars = snprintf(mapPath, sizeof(mapPath), "/proc/%d/maps", m_pid); - assert(chars > 0 && chars <= sizeof(mapPath)); + assert(chars > 0 && (size_t)chars <= sizeof(mapPath)); FILE* mapsFile = fopen(mapPath, "r"); if (mapsFile == nullptr) @@ -374,7 +374,7 @@ CrashInfo::EnumerateModuleMappings() std::string coreclrPath; coreclrPath.append(moduleName); size_t last = coreclrPath.rfind(MAKEDLLNAME_A("coreclr")); - if (last != -1) { + if (last != std::string::npos) { m_coreclrPath = coreclrPath.substr(0, last); } } @@ -909,7 +909,7 @@ CrashInfo::InsertMemoryRegion(const MemoryRegion& region) // time to avoid the overlapping pages. uint64_t numberPages = region.Size() / PAGE_SIZE; - for (int p = 0; p < numberPages; p++, start += PAGE_SIZE) + for (uint64_t p = 0; p < numberPages; p++, start += PAGE_SIZE) { MemoryRegion memoryRegionPage(region.Flags(), start, start + PAGE_SIZE); @@ -957,7 +957,7 @@ CrashInfo::ValidRegion(const MemoryRegion& region) uint64_t start = region.StartAddress(); uint64_t numberPages = region.Size() / PAGE_SIZE; - for (int p = 0; p < numberPages; p++, start += PAGE_SIZE) + for (uint64_t p = 0; p < numberPages; p++, start += PAGE_SIZE) { BYTE buffer[1]; uint32_t read; diff --git a/src/debug/createdump/datatarget.cpp b/src/debug/createdump/datatarget.cpp index b0fb6ebcf4..934545090d 100644 --- a/src/debug/createdump/datatarget.cpp +++ b/src/debug/createdump/datatarget.cpp @@ -151,7 +151,7 @@ DumpDataTarget::ReadVirtual( { assert(m_fd != -1); size_t read = pread64(m_fd, buffer, size, (off64_t)(ULONG_PTR)address); - if (read == -1) + if (read == (size_t)-1) { *done = 0; return E_FAIL; @@ -215,7 +215,7 @@ DumpDataTarget::GetThreadContext( memset(context, 0, contextSize); for (const ThreadInfo* thread : m_crashInfo->Threads()) { - if (thread->Tid() == threadID) + if (thread->Tid() == (pid_t)threadID) { thread->GetThreadContext(contextFlags, reinterpret_cast<CONTEXT*>(context)); return S_OK; diff --git a/src/debug/debug-pal/unix/twowaypipe.cpp b/src/debug/debug-pal/unix/twowaypipe.cpp index b0acb1df7b..91afd820fb 100644 --- a/src/debug/debug-pal/unix/twowaypipe.cpp +++ b/src/debug/debug-pal/unix/twowaypipe.cpp @@ -117,8 +117,8 @@ int TwoWayPipe::Read(void *buffer, DWORD bufferSize) while ((bytesRead = (int)read(m_inboundPipe, buffer, cb)) > 0) { totalBytesRead += bytesRead; - _ASSERTE(totalBytesRead <= bufferSize); - if (totalBytesRead >= bufferSize) + _ASSERTE(totalBytesRead <= (int)bufferSize); + if (totalBytesRead >= (int)bufferSize) { break; } @@ -144,8 +144,8 @@ int TwoWayPipe::Write(const void *data, DWORD dataSize) while ((bytesWritten = (int)write(m_outboundPipe, data, cb)) > 0) { totalBytesWritten += bytesWritten; - _ASSERTE(totalBytesWritten <= dataSize); - if (totalBytesWritten >= dataSize) + _ASSERTE(totalBytesWritten <= (int)dataSize); + if (totalBytesWritten >= (int)dataSize) { break; } |