summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Fonseca <jose.r.fonseca@gmail.com>2011-09-28 08:19:45 +0100
committerJosé Fonseca <jose.r.fonseca@gmail.com>2011-09-28 08:19:45 +0100
commit2e270694217ac61f3dc38869901e694572115495 (patch)
tree6182e67575a9b0ae94cbd8b9174fdb6303e3afec
parent9a81167c5a080083bd611c7f46b5b1e023e1499e (diff)
Fix signed/unsigned comparisons.
-rw-r--r--common/trace_loader.cpp14
-rw-r--r--common/trace_loader.hpp8
-rw-r--r--common/trace_parser.cpp2
-rw-r--r--common/trace_snappyfile.cpp8
4 files changed, 16 insertions, 16 deletions
diff --git a/common/trace_loader.cpp b/common/trace_loader.cpp
index c14d815..51f3b55 100644
--- a/common/trace_loader.cpp
+++ b/common/trace_loader.cpp
@@ -23,12 +23,12 @@ void Loader::setFrameMarker(Loader::FrameMarker marker)
m_frameMarker = marker;
}
-int Loader::numberOfFrames() const
+unsigned Loader::numberOfFrames() const
{
return m_frameBookmarks.size();
}
-int Loader::numberOfCallsInFrame(int frameIdx) const
+unsigned Loader::numberOfCallsInFrame(unsigned frameIdx) const
{
if (frameIdx > m_frameBookmarks.size()) {
return 0;
@@ -52,8 +52,8 @@ bool Loader::open(const char *filename)
Trace::Call *call;
ParseBookmark startBookmark;
- int numOfFrames = 0;
- int numOfCalls = 0;
+ unsigned numOfFrames = 0;
+ unsigned numOfCalls = 0;
int lastPercentReport = 0;
m_parser.getBookmark(startBookmark);
@@ -112,16 +112,16 @@ bool Loader::isCallAFrameMarker(const Trace::Call *call) const
return false;
}
-std::vector<Trace::Call *> Loader::frame(int idx)
+std::vector<Trace::Call *> Loader::frame(unsigned idx)
{
- int numOfCalls = numberOfCallsInFrame(idx);
+ unsigned numOfCalls = numberOfCallsInFrame(idx);
if (numOfCalls) {
const FrameBookmark &frameBookmark = m_frameBookmarks[idx];
std::vector<Trace::Call*> calls(numOfCalls);
m_parser.setBookmark(frameBookmark.start);
Trace::Call *call;
- int parsedCalls = 0;
+ unsigned parsedCalls = 0;
while ((call = m_parser.parse_call())) {
calls[parsedCalls] = call;
diff --git a/common/trace_loader.hpp b/common/trace_loader.hpp
index 9f74a9b..61cc855 100644
--- a/common/trace_loader.hpp
+++ b/common/trace_loader.hpp
@@ -29,13 +29,13 @@ public:
Loader::FrameMarker frameMarker() const;
void setFrameMarker(Loader::FrameMarker marker);
- int numberOfFrames() const;
- int numberOfCallsInFrame(int frameIdx) const;
+ unsigned numberOfFrames() const;
+ unsigned numberOfCallsInFrame(unsigned frameIdx) const;
bool open(const char *filename);
void close();
- std::vector<Trace::Call*> frame(int idx);
+ std::vector<Trace::Call*> frame(unsigned idx);
private:
struct FrameBookmark {
@@ -48,7 +48,7 @@ private:
{}
ParseBookmark start;
- int numberOfCalls;
+ unsigned numberOfCalls;
};
bool isCallAFrameMarker(const Trace::Call *call) const;
diff --git a/common/trace_parser.cpp b/common/trace_parser.cpp
index 2eff0cd..530c19a 100644
--- a/common/trace_parser.cpp
+++ b/common/trace_parser.cpp
@@ -228,7 +228,7 @@ FunctionSig *Parser::parse_function_sig(void) {
} else if (file->currentOffset() < sig->offset) {
/* skip over the signature */
skip_string(); /* name */
- int num_args = read_uint();
+ unsigned num_args = read_uint();
for (unsigned i = 0; i < num_args; ++i) {
skip_string(); /*arg_name*/
}
diff --git a/common/trace_snappyfile.cpp b/common/trace_snappyfile.cpp
index 4dbe42d..60711d2 100644
--- a/common/trace_snappyfile.cpp
+++ b/common/trace_snappyfile.cpp
@@ -122,18 +122,18 @@ bool SnappyFile::rawWrite(const void *buffer, size_t length)
m_cachePtr += length;
flushWriteCache();
} else {
- int sizeToWrite = length;
+ size_t sizeToWrite = length;
while (sizeToWrite >= freeCacheSize()) {
- int endSize = freeCacheSize();
- int offset = length - sizeToWrite;
+ size_t endSize = freeCacheSize();
+ size_t offset = length - sizeToWrite;
memcpy(m_cachePtr, (const char*)buffer + offset, endSize);
sizeToWrite -= endSize;
m_cachePtr += endSize;
flushWriteCache();
}
if (sizeToWrite) {
- int offset = length - sizeToWrite;
+ size_t offset = length - sizeToWrite;
memcpy(m_cachePtr, (const char*)buffer + offset, sizeToWrite);
m_cachePtr += sizeToWrite;
}