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

Side by Side Diff: core/fxcodec/codec/fx_codec_jpx_unittest.cpp

Issue 2031653003: Get rid of NULLs in fpdfsdk/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium@nullptr_core
Patch Set: rebase Created 4 years, 6 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | core/fxcrt/fx_basic_bstring_unittest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdint.h> 5 #include <stdint.h>
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "core/fxcodec/codec/codec_int.h" 9 #include "core/fxcodec/codec/codec_int.h"
10 #include "testing/fx_string_testhelpers.h" 10 #include "testing/fx_string_testhelpers.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 static const OPJ_OFF_T kSkipError = static_cast<OPJ_OFF_T>(-1); 13 static const OPJ_OFF_T kSkipError = static_cast<OPJ_OFF_T>(-1);
14 static const OPJ_SIZE_T kReadError = static_cast<OPJ_SIZE_T>(-1); 14 static const OPJ_SIZE_T kReadError = static_cast<OPJ_SIZE_T>(-1);
15 static const OPJ_SIZE_T kWriteError = static_cast<OPJ_SIZE_T>(-1); 15 static const OPJ_SIZE_T kWriteError = static_cast<OPJ_SIZE_T>(-1);
16 16
17 static unsigned char stream_data[] = { 17 static unsigned char stream_data[] = {
18 0x00, 0x01, 0x02, 0x03, 18 0x00, 0x01, 0x02, 0x03,
19 0x84, 0x85, 0x86, 0x87, // Include some hi-bytes, too. 19 0x84, 0x85, 0x86, 0x87, // Include some hi-bytes, too.
20 }; 20 };
21 21
22 TEST(fxcodec, DecodeDataNullDecodeData) { 22 TEST(fxcodec, DecodeDataNullDecodeData) {
23 unsigned char buffer[16]; 23 unsigned char buffer[16];
24 DecodeData* ptr = nullptr; 24 DecodeData* ptr = nullptr;
25 25
26 // Error codes, not segvs, should callers pass us a NULL pointer. 26 // Error codes, not segvs, should callers pass us a nullptr pointer.
27 EXPECT_EQ(kReadError, opj_read_from_memory(buffer, sizeof(buffer), ptr)); 27 EXPECT_EQ(kReadError, opj_read_from_memory(buffer, sizeof(buffer), ptr));
28 EXPECT_EQ(kWriteError, opj_write_from_memory(buffer, sizeof(buffer), ptr)); 28 EXPECT_EQ(kWriteError, opj_write_from_memory(buffer, sizeof(buffer), ptr));
29 EXPECT_EQ(kSkipError, opj_skip_from_memory(1, ptr)); 29 EXPECT_EQ(kSkipError, opj_skip_from_memory(1, ptr));
30 EXPECT_FALSE(opj_seek_from_memory(1, ptr)); 30 EXPECT_FALSE(opj_seek_from_memory(1, ptr));
31 } 31 }
32 32
33 TEST(fxcodec, DecodeDataNullStream) { 33 TEST(fxcodec, DecodeDataNullStream) {
34 DecodeData dd(nullptr, 0); 34 DecodeData dd(nullptr, 0);
35 unsigned char buffer[16]; 35 unsigned char buffer[16];
36 36
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 EXPECT_NE(img.comps[0].h, img.comps[1].h); 523 EXPECT_NE(img.comps[0].h, img.comps[1].h);
524 EXPECT_NE(img.comps[0].w, img.comps[2].w); 524 EXPECT_NE(img.comps[0].w, img.comps[2].w);
525 EXPECT_NE(img.comps[0].h, img.comps[2].h); 525 EXPECT_NE(img.comps[0].h, img.comps[2].h);
526 } 526 }
527 FX_Free(img.comps[0].data); 527 FX_Free(img.comps[0].data);
528 FX_Free(img.comps[1].data); 528 FX_Free(img.comps[1].data);
529 FX_Free(img.comps[2].data); 529 FX_Free(img.comps[2].data);
530 } 530 }
531 FX_Free(img.comps); 531 FX_Free(img.comps);
532 } 532 }
OLDNEW
« no previous file with comments | « no previous file | core/fxcrt/fx_basic_bstring_unittest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698