From e00660b5fa41956db06c557807b68a1117d1b70b Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 13 Aug 2015 15:40:18 -0700 Subject: Merge to XFA: Remove if checks after new. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1287863002 . (cherry picked from commit 388a3b0b8d6f75d47978c08299300f121f04884c) Review URL: https://codereview.chromium.org/1292653002 . --- samples/pdfium_test.cc | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'samples/pdfium_test.cc') diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc index 7ecd9a2aee..83a8f7620b 100644 --- a/samples/pdfium_test.cc +++ b/samples/pdfium_test.cc @@ -145,22 +145,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); } -- cgit v1.2.3