diff options
Diffstat (limited to 'lib/System')
-rw-r--r-- | lib/System/Path.cpp | 7 | ||||
-rw-r--r-- | lib/System/Unix/Memory.inc | 2 | ||||
-rw-r--r-- | lib/System/Unix/Path.inc | 4 | ||||
-rw-r--r-- | lib/System/Unix/Program.inc | 2 | ||||
-rw-r--r-- | lib/System/Unix/Signals.inc | 3 |
5 files changed, 10 insertions, 8 deletions
diff --git a/lib/System/Path.cpp b/lib/System/Path.cpp index e8fd5f2963..086c9f0238 100644 --- a/lib/System/Path.cpp +++ b/lib/System/Path.cpp @@ -124,7 +124,8 @@ Path::isDynamicLibrary() const { if (canRead()) { std::string Magic; if (getMagicNumber(Magic, 64)) - switch (IdentifyFileType(Magic.c_str(), Magic.length())) { + switch (IdentifyFileType(Magic.c_str(), + static_cast<unsigned>(Magic.length()))) { default: return false; case Mach_O_FixedVirtualMemorySharedLib_FileType: case Mach_O_DynamicallyLinkedSharedLib_FileType: @@ -167,7 +168,7 @@ Path::isBitcodeFile() const { bool Path::hasMagicNumber(const std::string &Magic) const { std::string actualMagic; - if (getMagicNumber(actualMagic, Magic.size())) + if (getMagicNumber(actualMagic, static_cast<unsigned>(Magic.size()))) return Magic == actualMagic; return false; } @@ -204,7 +205,7 @@ static std::string getDirnameCharSep(const std::string& path, char Sep) { // If the path is all slashes, return a single slash. // Otherwise, remove all trailing slashes. - signed pos = path.size() - 1; + signed pos = static_cast<signed>(path.size()) - 1; while (pos >= 0 && path[pos] == Sep) --pos; diff --git a/lib/System/Unix/Memory.inc b/lib/System/Unix/Memory.inc index afa8f03117..0b74f74f7b 100644 --- a/lib/System/Unix/Memory.inc +++ b/lib/System/Unix/Memory.inc @@ -28,7 +28,7 @@ llvm::sys::Memory::AllocateRWX(unsigned NumBytes, const MemoryBlock* NearBlock, std::string *ErrMsg) { if (NumBytes == 0) return MemoryBlock(); - long pageSize = Process::GetPageSize(); + unsigned pageSize = Process::GetPageSize(); unsigned NumPages = (NumBytes+pageSize-1)/pageSize; int fd = -1; diff --git a/lib/System/Unix/Path.inc b/lib/System/Unix/Path.inc index aca4b936e8..9f4b5914ce 100644 --- a/lib/System/Unix/Path.inc +++ b/lib/System/Unix/Path.inc @@ -566,7 +566,7 @@ Path::createDirectoryOnDisk( bool create_parents, std::string* ErrMsg ) { path.copy(pathname,MAXPATHLEN); // Null-terminate the last component - int lastchar = path.length() - 1 ; + size_t lastchar = path.length() - 1 ; if (pathname[lastchar] != '/') ++lastchar; @@ -639,7 +639,7 @@ Path::eraseFromDisk(bool remove_contents, std::string *ErrStr) const { // Otherwise, try to just remove the one directory. char pathname[MAXPATHLEN]; path.copy(pathname, MAXPATHLEN); - int lastchar = path.length() - 1 ; + size_t lastchar = path.length() - 1; if (pathname[lastchar] == '/') pathname[lastchar] = 0; else diff --git a/lib/System/Unix/Program.inc b/lib/System/Unix/Program.inc index 91baefb329..d0dade1f8c 100644 --- a/lib/System/Unix/Program.inc +++ b/lib/System/Unix/Program.inc @@ -58,7 +58,7 @@ Program::FindProgramByName(const std::string& progName) { return Path(); // Now we have a colon separated list of directories to search; try them. - unsigned PathLen = strlen(PathStr); + size_t PathLen = strlen(PathStr); while (PathLen) { // Find the first colon... const char *Colon = std::find(PathStr, PathStr+PathLen, ':'); diff --git a/lib/System/Unix/Signals.inc b/lib/System/Unix/Signals.inc index 3314a43e74..79236cdad9 100644 --- a/lib/System/Unix/Signals.inc +++ b/lib/System/Unix/Signals.inc @@ -65,7 +65,8 @@ static void* StackTrace[256]; static void PrintStackTrace() { #ifdef HAVE_BACKTRACE // Use backtrace() to output a backtrace on Linux systems with glibc. - int depth = backtrace(StackTrace, array_lengthof(StackTrace)); + int depth = backtrace(StackTrace, + static_cast<int>(array_lengthof(StackTrace))); backtrace_symbols_fd(StackTrace, depth, STDERR_FILENO); #endif } |