aboutsummaryrefslogtreecommitdiff
path: root/src/serialize.h
diff options
context:
space:
mode:
authorMatt Corallo <matt@bluematt.me>2012-07-02 16:29:14 +0200
committerMatt Corallo <matt@bluematt.me>2012-07-02 16:29:14 +0200
commit467b79391fd92d3af4893a702454e5d4b401263a (patch)
tree2b8a266cee29f353d356dfc5960127c50256a32c /src/serialize.h
parentda1103f4f8288cffc9ea475254fdeb258f04de77 (diff)
downloadbitcoin-467b79391fd92d3af4893a702454e5d4b401263a.tar.xz
Fix signed/unsigned warnings in {script,serialize}.h (fixes #1541)
Diffstat (limited to 'src/serialize.h')
-rw-r--r--src/serialize.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/serialize.h b/src/serialize.h
index 349a40bfe8..abc4f04a0d 100644
--- a/src/serialize.h
+++ b/src/serialize.h
@@ -809,7 +809,8 @@ public:
void insert(iterator it, const_iterator first, const_iterator last)
{
- if (it == vch.begin() + nReadPos && last - first <= nReadPos)
+ assert(last - first >= 0);
+ if (it == vch.begin() + nReadPos && (unsigned int)(last - first) <= nReadPos)
{
// special case for inserting at the front when there's room
nReadPos -= (last - first);
@@ -821,7 +822,8 @@ public:
void insert(iterator it, std::vector<char>::const_iterator first, std::vector<char>::const_iterator last)
{
- if (it == vch.begin() + nReadPos && last - first <= nReadPos)
+ assert(last - first >= 0);
+ if (it == vch.begin() + nReadPos && (unsigned int)(last - first) <= nReadPos)
{
// special case for inserting at the front when there's room
nReadPos -= (last - first);
@@ -834,7 +836,8 @@ public:
#if !defined(_MSC_VER) || _MSC_VER >= 1300
void insert(iterator it, const char* first, const char* last)
{
- if (it == vch.begin() + nReadPos && last - first <= nReadPos)
+ assert(last - first >= 0);
+ if (it == vch.begin() + nReadPos && (unsigned int)(last - first) <= nReadPos)
{
// special case for inserting at the front when there's room
nReadPos -= (last - first);