Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(517)

Unified Diff: src/images/bmpdecoderhelper.cpp

Issue 47513017: More Windows 64b compilation warning fixes (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Fix linux & mac builds Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/images/bmpdecoderhelper.h ('k') | src/pdf/SkPDFDevice.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/images/bmpdecoderhelper.cpp
===================================================================
--- src/images/bmpdecoderhelper.cpp (revision 12322)
+++ src/images/bmpdecoderhelper.cpp (working copy)
@@ -18,7 +18,7 @@
static const int kMaxDim = SHRT_MAX / 2;
bool BmpDecoderHelper::DecodeImage(const char* p,
- int len,
+ size_t len,
int max_pixels,
BmpDecoderCallback* callback) {
data_ = reinterpret_cast<const uint8*>(p);
@@ -153,7 +153,7 @@
rowLen += rowPad_;
}
- if (offset > 0 && offset > pos_ && offset < len_) {
+ if (offset > 0 && (size_t)offset > pos_ && (size_t)offset < len_) {
pos_ = offset;
}
// Deliberately off-by-one; a load of BMPs seem to have their last byte
@@ -182,7 +182,7 @@
static const uint8 RLE_DELTA = 2;
int x = 0;
int y = height_ - 1;
- while (pos_ < len_ - 1) {
+ while (pos_ + 1 < len_) {
uint8 cmd = GetByte();
if (cmd != RLE_ESCAPE) {
uint8 pixels = GetByte();
@@ -210,7 +210,7 @@
return;
}
} else if (cmd == RLE_DELTA) {
- if (pos_ < len_ - 1) {
+ if (pos_ + 1 < len_) {
uint8 dx = GetByte();
uint8 dy = GetByte();
x += dx;
@@ -336,7 +336,7 @@
}
uint8 BmpDecoderHelper::GetByte() {
- CHECK(pos_ >= 0 && pos_ <= len_);
+ CHECK(pos_ <= len_);
// We deliberately allow this off-by-one access to cater for BMPs with their
// last byte missing.
if (pos_ == len_) {
« no previous file with comments | « src/images/bmpdecoderhelper.h ('k') | src/pdf/SkPDFDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698