From 81f9eeef041f2974274751d7508598049ae32db2 Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Tue, 5 Sep 2017 15:33:18 -0400 Subject: Convert FX_STRSIZE int->size_t Change the underlying type for FX_STRSIZE to size_t from int. This will make the value unsigned and thus all values in the range of the type will be valid. This allows for the final remove of negative length strings, but also introduces a some casting and functional errors, since many parts of the code base assume that FX_STRSIZE is int or another signed type. This also CL fixes these errors. BUG=pdfium:828 Change-Id: I231dca59e96fc9330cbb099eecbdfc41fcf86f5b Reviewed-on: https://pdfium-review.googlesource.com/11830 Reviewed-by: Henrique Nakashima Reviewed-by: Tom Sepez Commit-Queue: Ryan Harrison --- core/fxcrt/cfx_seekablestreamproxy.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'core/fxcrt/cfx_seekablestreamproxy.cpp') diff --git a/core/fxcrt/cfx_seekablestreamproxy.cpp b/core/fxcrt/cfx_seekablestreamproxy.cpp index a67ec52c85..d3516e1794 100644 --- a/core/fxcrt/cfx_seekablestreamproxy.cpp +++ b/core/fxcrt/cfx_seekablestreamproxy.cpp @@ -105,9 +105,6 @@ void UTF16ToWChar(void* pBuffer, FX_STRSIZE iLength) { void SwapByteOrder(wchar_t* pStr, FX_STRSIZE iLength) { ASSERT(pStr); - if (iLength < 0) - iLength = FXSYS_wcslen(pStr); - uint16_t wch; if (sizeof(wchar_t) > 2) { while (iLength-- > 0) { @@ -230,7 +227,7 @@ FX_STRSIZE CFX_SeekableStreamProxy::ReadData(uint8_t* pBuffer, FX_STRSIZE CFX_SeekableStreamProxy::ReadString(wchar_t* pStr, FX_STRSIZE iMaxLength, bool* bEOS) { - if (!pStr || iMaxLength <= 0) + if (!pStr || iMaxLength == 0) return 0; if (m_IsWriteStream) -- cgit v1.2.3