summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/StreamingMemoryObject.cpp
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2014-11-13 13:55:13 +0000
committerAaron Ballman <aaron@aaronballman.com>2014-11-13 13:55:13 +0000
commitaf93cd8de92392790546c468a55a1e2b0b39480c (patch)
tree9b643aa1b29662f8ffd98f006f2ada787cfce0c4 /llvm/lib/Support/StreamingMemoryObject.cpp
parent493456e793610e4a7ea267a3f70417984ce11a1f (diff)
downloadbcm5719-llvm-af93cd8de92392790546c468a55a1e2b0b39480c.tar.gz
bcm5719-llvm-af93cd8de92392790546c468a55a1e2b0b39480c.zip
Fixing -Wtype-limits warnings with the asserts (the expression would always evaluate to true). Also fixing a -Wcast-qual warning, where the cast expression isn't required.
llvm-svn: 221888
Diffstat (limited to 'llvm/lib/Support/StreamingMemoryObject.cpp')
-rw-r--r--llvm/lib/Support/StreamingMemoryObject.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Support/StreamingMemoryObject.cpp b/llvm/lib/Support/StreamingMemoryObject.cpp
index f0eb83153e0..68beeef4dc7 100644
--- a/llvm/lib/Support/StreamingMemoryObject.cpp
+++ b/llvm/lib/Support/StreamingMemoryObject.cpp
@@ -59,9 +59,9 @@ uint64_t RawMemoryObject::readBytes(uint8_t *Buf, uint64_t Size,
if (End > BufferSize)
End = BufferSize;
+ assert(static_cast<int64_t>(End - Address) >= 0);
Size = End - Address;
- assert(Size >= 0);
- memcpy(Buf, (uint8_t *)(Address + FirstChar), Size);
+ memcpy(Buf, Address + FirstChar, Size);
return Size;
}
@@ -96,8 +96,8 @@ uint64_t StreamingMemoryObject::readBytes(uint8_t *Buf, uint64_t Size,
uint64_t End = Address + Size;
if (End > BytesRead)
End = BytesRead;
+ assert(static_cast<int64_t>(End - Address) >= 0);
Size = End - Address;
- assert(Size >= 0);
memcpy(Buf, &Bytes[Address + BytesSkipped], Size);
return Size;
}
OpenPOWER on IntegriCloud