summaryrefslogtreecommitdiff
path: root/core/fxcodec/codec
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2017-09-27 10:53:11 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-09-27 16:11:38 +0000
commit875e98c581952478f3a3ccef9b2f2e3ed06c5346 (patch)
tree8e0d7e032056bf4c73d6da43c0f3ce4eadb74dfd /core/fxcodec/codec
parentcc3a3ee3ebcc1baabdfa7ffca5876dbbfa3980c1 (diff)
downloadpdfium-875e98c581952478f3a3ccef9b2f2e3ed06c5346.tar.xz
Remove FX_STRSIZE and replace with size_t
BUG=pdfium:828 Change-Id: I5c40237433ebabaeabdb43aec9cdf783e41dfe16 Reviewed-on: https://pdfium-review.googlesource.com/13230 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'core/fxcodec/codec')
-rw-r--r--core/fxcodec/codec/ccodec_jpegmodule.h2
-rw-r--r--core/fxcodec/codec/ccodec_pngmodule.cpp8
-rw-r--r--core/fxcodec/codec/ccodec_tiffmodule.cpp8
-rw-r--r--core/fxcodec/codec/fx_codec_jpeg.cpp6
4 files changed, 13 insertions, 11 deletions
diff --git a/core/fxcodec/codec/ccodec_jpegmodule.h b/core/fxcodec/codec/ccodec_jpegmodule.h
index cc59924747..ca561317aa 100644
--- a/core/fxcodec/codec/ccodec_jpegmodule.h
+++ b/core/fxcodec/codec/ccodec_jpegmodule.h
@@ -60,7 +60,7 @@ class CCodec_JpegModule {
#if _FX_OS_ == _FX_OS_WIN32_ || _FX_OS_ == _FX_OS_WIN64_
static bool JpegEncode(const RetainPtr<CFX_DIBSource>& pSource,
uint8_t** dest_buf,
- FX_STRSIZE* dest_size);
+ size_t* dest_size);
#endif
};
diff --git a/core/fxcodec/codec/ccodec_pngmodule.cpp b/core/fxcodec/codec/ccodec_pngmodule.cpp
index a08e72f86d..d500745ca7 100644
--- a/core/fxcodec/codec/ccodec_pngmodule.cpp
+++ b/core/fxcodec/codec/ccodec_pngmodule.cpp
@@ -74,7 +74,7 @@ static void _png_load_bmp_attribute(png_structp png_ptr,
#endif
#if defined(PNG_TEXT_SUPPORTED)
int i;
- FX_STRSIZE len;
+ size_t len;
const char* buf;
int num_text;
png_textp text = nullptr;
@@ -86,8 +86,10 @@ static void _png_load_bmp_attribute(png_structp png_ptr,
buf = "Author";
if (!memcmp(buf, text[i].key, std::min(len, FXSYS_strlen(buf)))) {
pAttribute->m_strAuthor =
- ByteString(reinterpret_cast<uint8_t*>(text[i].text),
- static_cast<FX_STRSIZE>(text[i].text_length));
+ text[i].text_length > 0
+ ? ByteString(reinterpret_cast<uint8_t*>(text[i].text),
+ static_cast<size_t>(text[i].text_length))
+ : ByteString();
}
}
}
diff --git a/core/fxcodec/codec/ccodec_tiffmodule.cpp b/core/fxcodec/codec/ccodec_tiffmodule.cpp
index 07d189200e..f11c480bd7 100644
--- a/core/fxcodec/codec/ccodec_tiffmodule.cpp
+++ b/core/fxcodec/codec/ccodec_tiffmodule.cpp
@@ -81,15 +81,15 @@ void* _TIFFrealloc(void* ptr, tmsize_t size) {
}
void _TIFFmemset(void* ptr, int val, tmsize_t size) {
- memset(ptr, val, (size_t)size);
+ memset(ptr, val, static_cast<size_t>(size));
}
void _TIFFmemcpy(void* des, const void* src, tmsize_t size) {
- memcpy(des, src, (size_t)size);
+ memcpy(des, src, static_cast<size_t>(size));
}
int _TIFFmemcmp(const void* ptr1, const void* ptr2, tmsize_t size) {
- return memcmp(ptr1, ptr2, (size_t)size);
+ return memcmp(ptr1, ptr2, static_cast<size_t>(size));
}
int _TIFFIfMultiplicationOverflow(tmsize_t op1, tmsize_t op2) {
@@ -201,7 +201,7 @@ void Tiff_Exif_GetStringInfo(TIFF* tif_ctx,
TIFFGetField(tif_ctx, tag, &buf);
if (!buf)
return;
- FX_STRSIZE size = FXSYS_strlen(buf);
+ size_t size = FXSYS_strlen(buf);
uint8_t* ptr = FX_Alloc(uint8_t, size + 1);
memcpy(ptr, buf, size);
ptr[size] = 0;
diff --git a/core/fxcodec/codec/fx_codec_jpeg.cpp b/core/fxcodec/codec/fx_codec_jpeg.cpp
index b77fc87394..b1dffbb210 100644
--- a/core/fxcodec/codec/fx_codec_jpeg.cpp
+++ b/core/fxcodec/codec/fx_codec_jpeg.cpp
@@ -369,7 +369,7 @@ static void _error_fatal1(j_common_ptr cinfo) {
}
static void _src_skip_data1(struct jpeg_decompress_struct* cinfo, long num) {
- if (cinfo->src->bytes_in_buffer < (size_t)num) {
+ if (cinfo->src->bytes_in_buffer < static_cast<size_t>(num)) {
auto* pContext = reinterpret_cast<CJpegContext*>(cinfo->client_data);
pContext->m_SkipSize = (unsigned int)(num - cinfo->src->bytes_in_buffer);
cinfo->src->bytes_in_buffer = 0;
@@ -510,7 +510,7 @@ uint32_t CCodec_JpegModule::GetAvailInput(Context* pContext,
#define JPEG_BLOCK_SIZE 1048576
bool CCodec_JpegModule::JpegEncode(const RetainPtr<CFX_DIBSource>& pSource,
uint8_t** dest_buf,
- FX_STRSIZE* dest_size) {
+ size_t* dest_size) {
struct jpeg_error_mgr jerr;
jerr.error_exit = _error_do_nothing;
jerr.emit_message = _error_do_nothing1;
@@ -603,7 +603,7 @@ bool CCodec_JpegModule::JpegEncode(const RetainPtr<CFX_DIBSource>& pSource,
jpeg_finish_compress(&cinfo);
jpeg_destroy_compress(&cinfo);
FX_Free(line_buf);
- *dest_size = dest_buf_length - (FX_STRSIZE)dest.free_in_buffer;
+ *dest_size = dest_buf_length - static_cast<size_t>(dest.free_in_buffer);
return true;
}