summaryrefslogtreecommitdiffstats
path: root/courgette/image_info.cc
diff options
context:
space:
mode:
authorsra@chromium.org <sra@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-27 19:12:32 +0000
committersra@chromium.org <sra@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-27 19:12:32 +0000
commit077d7bd678054e21c36d7c569f3041aae8b4267f (patch)
treeed030da10cfe96fca5817e72af9eab9f7467fae0 /courgette/image_info.cc
parent776f67ff177c12ba85f2095c8930ab90c577c79b (diff)
downloadchromium_src-077d7bd678054e21c36d7c569f3041aae8b4267f.zip
chromium_src-077d7bd678054e21c36d7c569f3041aae8b4267f.tar.gz
chromium_src-077d7bd678054e21c36d7c569f3041aae8b4267f.tar.bz2
When iterating over the sections in a file, omit sections that have no raw data in the file.
BUG=none TEST=none Review URL: http://codereview.chromium.org/113917 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17007 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'courgette/image_info.cc')
-rw-r--r--courgette/image_info.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/courgette/image_info.cc b/courgette/image_info.cc
index 5651f36..ed42f12 100644
--- a/courgette/image_info.cc
+++ b/courgette/image_info.cc
@@ -58,10 +58,12 @@ const Section* PEInfo::FindNextSection(uint32 fileOffset) const {
const Section* best = 0;
for (int i = 0; i < number_of_sections_; i++) {
const Section* section = &sections_[i];
- if (fileOffset <= section->file_offset_of_raw_data) {
- if (best == 0 ||
- section->file_offset_of_raw_data < best->file_offset_of_raw_data) {
- best = section;
+ if (section->size_of_raw_data > 0) { // i.e. has data in file.
+ if (fileOffset <= section->file_offset_of_raw_data) {
+ if (best == 0 ||
+ section->file_offset_of_raw_data < best->file_offset_of_raw_data) {
+ best = section;
+ }
}
}
}