summaryrefslogtreecommitdiff
path: root/samples/pdfium_test.cc
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-08-13 15:24:19 -0700
committerLei Zhang <thestig@chromium.org>2015-08-13 15:24:19 -0700
commit388a3b0b8d6f75d47978c08299300f121f04884c (patch)
treefadc1a463409d762d66f3f82ea75af497b9c3268 /samples/pdfium_test.cc
parent5312f9a6ed88e653f4cfb604d892ca18da75e721 (diff)
downloadpdfium-388a3b0b8d6f75d47978c08299300f121f04884c.tar.xz
Remove if checks after new.
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1287863002 .
Diffstat (limited to 'samples/pdfium_test.cc')
-rw-r--r--samples/pdfium_test.cc26
1 files changed, 12 insertions, 14 deletions
diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc
index 5a171c3933..cb8fef324e 100644
--- a/samples/pdfium_test.cc
+++ b/samples/pdfium_test.cc
@@ -144,22 +144,20 @@ static void WritePpm(const char* pdf_name, int num, const void* buffer_void,
// Source data is B, G, R, unused.
// Dest data is R, G, B.
char* result = new char[out_len];
- if (result) {
- for (int h = 0; h < height; ++h) {
- const char* src_line = buffer + (stride * h);
- char* dest_line = result + (width * h * 3);
- for (int w = 0; w < width; ++w) {
- // R
- dest_line[w * 3] = src_line[(w * 4) + 2];
- // G
- dest_line[(w * 3) + 1] = src_line[(w * 4) + 1];
- // B
- dest_line[(w * 3) + 2] = src_line[w * 4];
- }
+ for (int h = 0; h < height; ++h) {
+ const char* src_line = buffer + (stride * h);
+ char* dest_line = result + (width * h * 3);
+ for (int w = 0; w < width; ++w) {
+ // R
+ dest_line[w * 3] = src_line[(w * 4) + 2];
+ // G
+ dest_line[(w * 3) + 1] = src_line[(w * 4) + 1];
+ // B
+ dest_line[(w * 3) + 2] = src_line[w * 4];
}
- fwrite(result, out_len, 1, fp);
- delete [] result;
}
+ fwrite(result, out_len, 1, fp);
+ delete[] result;
fclose(fp);
}