summaryrefslogtreecommitdiff
path: root/core/fxcrt
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-04-03 15:05:11 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-04-03 20:39:56 +0000
commit1c5d0b48ec7a6443ba72fec2a58a65fc6d694aca (patch)
tree315955cce6b29093dcddfc48c0811957a172bedf /core/fxcrt
parent2ae80f52cec81c080515724f99deb06b2fee3cc9 (diff)
downloadpdfium-1c5d0b48ec7a6443ba72fec2a58a65fc6d694aca.tar.xz
Drop FXSYS_ from mem methods
This Cl drops the FXSYS_ from mem methods which are the same on all platforms. Bug: pdfium:694 Change-Id: I9d5ae905997dbaaec5aa0b2ae4c07358ed9c6236 Reviewed-on: https://pdfium-review.googlesource.com/3613 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxcrt')
-rw-r--r--core/fxcrt/cfx_bytestring.cpp32
-rw-r--r--core/fxcrt/cfx_checksumcontext.cpp2
-rw-r--r--core/fxcrt/cfx_string_data_template.h8
-rw-r--r--core/fxcrt/cfx_widestring.cpp4
-rw-r--r--core/fxcrt/fx_basic.h2
-rw-r--r--core/fxcrt/fx_basic_buffer.cpp19
-rw-r--r--core/fxcrt/fx_extension.cpp10
-rw-r--r--core/fxcrt/fx_system.h4
-rw-r--r--core/fxcrt/fxcrt_posix.cpp2
-rw-r--r--core/fxcrt/xml/cfx_saxreader.cpp9
10 files changed, 43 insertions, 49 deletions
diff --git a/core/fxcrt/cfx_bytestring.cpp b/core/fxcrt/cfx_bytestring.cpp
index 2d3f0ab46a..cca8ad6be4 100644
--- a/core/fxcrt/cfx_bytestring.cpp
+++ b/core/fxcrt/cfx_bytestring.cpp
@@ -196,7 +196,7 @@ bool CFX_ByteString::operator==(const char* ptr) const {
return m_pData->m_nDataLength == 0;
return FXSYS_strlen(ptr) == m_pData->m_nDataLength &&
- FXSYS_memcmp(ptr, m_pData->m_String, m_pData->m_nDataLength) == 0;
+ memcmp(ptr, m_pData->m_String, m_pData->m_nDataLength) == 0;
}
bool CFX_ByteString::operator==(const CFX_ByteStringC& str) const {
@@ -204,7 +204,7 @@ bool CFX_ByteString::operator==(const CFX_ByteStringC& str) const {
return str.IsEmpty();
return m_pData->m_nDataLength == str.GetLength() &&
- FXSYS_memcmp(m_pData->m_String, str.c_str(), str.GetLength()) == 0;
+ memcmp(m_pData->m_String, str.c_str(), str.GetLength()) == 0;
}
bool CFX_ByteString::operator==(const CFX_ByteString& other) const {
@@ -218,16 +218,16 @@ bool CFX_ByteString::operator==(const CFX_ByteString& other) const {
return false;
return other.m_pData->m_nDataLength == m_pData->m_nDataLength &&
- FXSYS_memcmp(other.m_pData->m_String, m_pData->m_String,
- m_pData->m_nDataLength) == 0;
+ memcmp(other.m_pData->m_String, m_pData->m_String,
+ m_pData->m_nDataLength) == 0;
}
bool CFX_ByteString::operator<(const CFX_ByteString& str) const {
if (m_pData == str.m_pData)
return false;
- int result = FXSYS_memcmp(c_str(), str.c_str(),
- std::min(GetLength(), str.GetLength()));
+ int result =
+ memcmp(c_str(), str.c_str(), std::min(GetLength(), str.GetLength()));
return result < 0 || (result == 0 && GetLength() < str.GetLength());
}
@@ -368,8 +368,8 @@ FX_STRSIZE CFX_ByteString::Delete(FX_STRSIZE nIndex, FX_STRSIZE nCount) {
}
ReallocBeforeWrite(nOldLength);
int nCharsToCopy = nOldLength - mLength + 1;
- FXSYS_memmove(m_pData->m_String + nIndex, m_pData->m_String + mLength,
- nCharsToCopy);
+ memmove(m_pData->m_String + nIndex, m_pData->m_String + mLength,
+ nCharsToCopy);
m_pData->m_nDataLength = nOldLength - nCount;
}
return m_pData->m_nDataLength;
@@ -472,8 +472,8 @@ FX_STRSIZE CFX_ByteString::Insert(FX_STRSIZE nIndex, char ch) {
nNewLength++;
ReallocBeforeWrite(nNewLength);
- FXSYS_memmove(m_pData->m_String + nIndex + 1, m_pData->m_String + nIndex,
- nNewLength - nIndex);
+ memmove(m_pData->m_String + nIndex + 1, m_pData->m_String + nIndex,
+ nNewLength - nIndex);
m_pData->m_String[nIndex] = ch;
m_pData->m_nDataLength = nNewLength;
return nNewLength;
@@ -630,13 +630,13 @@ FX_STRSIZE CFX_ByteString::Replace(const CFX_ByteStringC& pOld,
for (FX_STRSIZE i = 0; i < nCount; i++) {
const char* pTarget = FX_strstr(pStart, (FX_STRSIZE)(pEnd - pStart),
pOld.c_str(), nSourceLen);
- FXSYS_memcpy(pDest, pStart, pTarget - pStart);
+ memcpy(pDest, pStart, pTarget - pStart);
pDest += pTarget - pStart;
- FXSYS_memcpy(pDest, pNew.c_str(), pNew.GetLength());
+ memcpy(pDest, pNew.c_str(), pNew.GetLength());
pDest += pNew.GetLength();
pStart = pTarget + nSourceLen;
}
- FXSYS_memcpy(pDest, pStart, pEnd - pStart);
+ memcpy(pDest, pStart, pEnd - pStart);
m_pData.Swap(pNewData);
return nCount;
}
@@ -750,8 +750,8 @@ void CFX_ByteString::TrimLeft(const CFX_ByteStringC& pTargets) {
if (pos) {
ReallocBeforeWrite(len);
FX_STRSIZE nDataLength = len - pos;
- FXSYS_memmove(m_pData->m_String, m_pData->m_String + pos,
- (nDataLength + 1) * sizeof(char));
+ memmove(m_pData->m_String, m_pData->m_String + pos,
+ (nDataLength + 1) * sizeof(char));
m_pData->m_nDataLength = nDataLength;
}
}
@@ -798,7 +798,7 @@ FX_STRSIZE FX_ftoa(float d, char* buf) {
int i = scaled / scale;
FXSYS_itoa(i, buf2, 10);
FX_STRSIZE len = FXSYS_strlen(buf2);
- FXSYS_memcpy(buf + buf_size, buf2, len);
+ memcpy(buf + buf_size, buf2, len);
buf_size += len;
int fraction = scaled % scale;
if (fraction == 0) {
diff --git a/core/fxcrt/cfx_checksumcontext.cpp b/core/fxcrt/cfx_checksumcontext.cpp
index 994d18604a..97d0af2d75 100644
--- a/core/fxcrt/cfx_checksumcontext.cpp
+++ b/core/fxcrt/cfx_checksumcontext.cpp
@@ -129,7 +129,7 @@ void CFX_ChecksumContext::FinishChecksum() {
m_pSAXReader.reset();
if (m_pByteContext) {
uint8_t digest[20];
- FXSYS_memset(digest, 0, 20);
+ memset(digest, 0, 20);
CRYPT_SHA1Finish(m_pByteContext.get(), digest);
int32_t nLen = Base64EncodeA(digest, 20, nullptr);
char* pBuffer = m_bsChecksum.GetBuffer(nLen);
diff --git a/core/fxcrt/cfx_string_data_template.h b/core/fxcrt/cfx_string_data_template.h
index 5167e31b5a..e39f6a5dfd 100644
--- a/core/fxcrt/cfx_string_data_template.h
+++ b/core/fxcrt/cfx_string_data_template.h
@@ -65,13 +65,13 @@ class CFX_StringDataTemplate {
void CopyContents(const CFX_StringDataTemplate& other) {
ASSERT(other.m_nDataLength <= m_nAllocLength);
- FXSYS_memcpy(m_String, other.m_String,
- (other.m_nDataLength + 1) * sizeof(CharType));
+ memcpy(m_String, other.m_String,
+ (other.m_nDataLength + 1) * sizeof(CharType));
}
void CopyContents(const CharType* pStr, FX_STRSIZE nLen) {
ASSERT(nLen >= 0 && nLen <= m_nAllocLength);
- FXSYS_memcpy(m_String, pStr, nLen * sizeof(CharType));
+ memcpy(m_String, pStr, nLen * sizeof(CharType));
m_String[nLen] = 0;
}
@@ -79,7 +79,7 @@ class CFX_StringDataTemplate {
const CharType* pStr,
FX_STRSIZE nLen) {
ASSERT(offset >= 0 && nLen >= 0 && offset + nLen <= m_nAllocLength);
- FXSYS_memcpy(m_String + offset, pStr, nLen * sizeof(CharType));
+ memcpy(m_String + offset, pStr, nLen * sizeof(CharType));
m_String[offset + nLen] = 0;
}
diff --git a/core/fxcrt/cfx_widestring.cpp b/core/fxcrt/cfx_widestring.cpp
index 2298db68f9..eb6bc66e73 100644
--- a/core/fxcrt/cfx_widestring.cpp
+++ b/core/fxcrt/cfx_widestring.cpp
@@ -954,8 +954,8 @@ void CFX_WideString::TrimLeft(const CFX_WideStringC& pTargets) {
if (pos) {
ReallocBeforeWrite(len);
FX_STRSIZE nDataLength = len - pos;
- FXSYS_memmove(m_pData->m_String, m_pData->m_String + pos,
- (nDataLength + 1) * sizeof(wchar_t));
+ memmove(m_pData->m_String, m_pData->m_String + pos,
+ (nDataLength + 1) * sizeof(wchar_t));
m_pData->m_nDataLength = nDataLength;
}
}
diff --git a/core/fxcrt/fx_basic.h b/core/fxcrt/fx_basic.h
index 77df71e125..ed2f579579 100644
--- a/core/fxcrt/fx_basic.h
+++ b/core/fxcrt/fx_basic.h
@@ -184,7 +184,7 @@ class CFX_FixedBufGrow {
m_pGrowData.reset(FX_Alloc(DataType, data_size));
return;
}
- FXSYS_memset(m_FixedData, 0, sizeof(DataType) * FixedSize);
+ memset(m_FixedData, 0, sizeof(DataType) * FixedSize);
}
operator DataType*() { return m_pGrowData ? m_pGrowData.get() : m_FixedData; }
diff --git a/core/fxcrt/fx_basic_buffer.cpp b/core/fxcrt/fx_basic_buffer.cpp
index 341d9013ae..701676f71e 100644
--- a/core/fxcrt/fx_basic_buffer.cpp
+++ b/core/fxcrt/fx_basic_buffer.cpp
@@ -28,9 +28,8 @@ void CFX_BinaryBuf::Delete(int start_index, int count) {
start_index > m_DataSize - count) {
return;
}
- FXSYS_memmove(m_pBuffer.get() + start_index,
- m_pBuffer.get() + start_index + count,
- m_DataSize - start_index - count);
+ memmove(m_pBuffer.get() + start_index, m_pBuffer.get() + start_index + count,
+ m_DataSize - start_index - count);
m_DataSize -= count;
}
@@ -72,9 +71,9 @@ void CFX_BinaryBuf::AppendBlock(const void* pBuf, FX_STRSIZE size) {
ExpandBuf(size);
if (pBuf) {
- FXSYS_memcpy(m_pBuffer.get() + m_DataSize, pBuf, size);
+ memcpy(m_pBuffer.get() + m_DataSize, pBuf, size);
} else {
- FXSYS_memset(m_pBuffer.get() + m_DataSize, 0, size);
+ memset(m_pBuffer.get() + m_DataSize, 0, size);
}
m_DataSize += size;
}
@@ -86,12 +85,12 @@ void CFX_BinaryBuf::InsertBlock(FX_STRSIZE pos,
return;
ExpandBuf(size);
- FXSYS_memmove(m_pBuffer.get() + pos + size, m_pBuffer.get() + pos,
- m_DataSize - pos);
+ memmove(m_pBuffer.get() + pos + size, m_pBuffer.get() + pos,
+ m_DataSize - pos);
if (pBuf) {
- FXSYS_memcpy(m_pBuffer.get() + pos, pBuf, size);
+ memcpy(m_pBuffer.get() + pos, pBuf, size);
} else {
- FXSYS_memset(m_pBuffer.get() + pos, 0, size);
+ memset(m_pBuffer.get() + pos, 0, size);
}
m_DataSize += size;
}
@@ -254,7 +253,7 @@ int32_t CFX_FileBufferArchive::AppendBlock(const void* pBuf, size_t size) {
size_t temp_size = size;
while (temp_size) {
size_t buf_size = std::min(kBufSize - m_Length, temp_size);
- FXSYS_memcpy(m_pBuffer.get() + m_Length, buffer, buf_size);
+ memcpy(m_pBuffer.get() + m_Length, buffer, buf_size);
m_Length += buf_size;
if (m_Length == kBufSize) {
if (!Flush()) {
diff --git a/core/fxcrt/fx_extension.cpp b/core/fxcrt/fx_extension.cpp
index f8abff376f..f13922e2da 100644
--- a/core/fxcrt/fx_extension.cpp
+++ b/core/fxcrt/fx_extension.cpp
@@ -216,7 +216,7 @@ bool CFX_MemoryStream::ReadBlock(void* buffer,
m_nCurPos = newPos.ValueOrDie();
if (m_dwFlags & FX_MEMSTREAM_Consecutive) {
- FXSYS_memcpy(buffer, m_Blocks[0] + (size_t)offset, size);
+ memcpy(buffer, m_Blocks[0] + (size_t)offset, size);
return true;
}
size_t nStartBlock = (size_t)offset / m_nGrowSize;
@@ -226,7 +226,7 @@ bool CFX_MemoryStream::ReadBlock(void* buffer,
if (nRead > size) {
nRead = size;
}
- FXSYS_memcpy(buffer, m_Blocks[(int)nStartBlock] + (size_t)offset, nRead);
+ memcpy(buffer, m_Blocks[(int)nStartBlock] + (size_t)offset, nRead);
buffer = ((uint8_t*)buffer) + nRead;
size -= nRead;
nStartBlock++;
@@ -267,7 +267,7 @@ bool CFX_MemoryStream::WriteBlock(const void* buffer,
m_Blocks[0] = FX_Realloc(uint8_t, m_Blocks[0], m_nTotalSize);
}
}
- FXSYS_memcpy(m_Blocks[0] + (size_t)offset, buffer, size);
+ memcpy(m_Blocks[0] + (size_t)offset, buffer, size);
if (m_nCurSize < m_nCurPos) {
m_nCurSize = m_nCurPos;
}
@@ -291,7 +291,7 @@ bool CFX_MemoryStream::WriteBlock(const void* buffer,
if (nWrite > size) {
nWrite = size;
}
- FXSYS_memcpy(m_Blocks[(int)nStartBlock] + (size_t)offset, buffer, nWrite);
+ memcpy(m_Blocks[(int)nStartBlock] + (size_t)offset, buffer, nWrite);
buffer = ((uint8_t*)buffer) + nWrite;
size -= nWrite;
nStartBlock++;
@@ -597,7 +597,7 @@ void FX_Random_GenerateBase(uint32_t* pBuffer, int32_t iCount) {
::GetSystemTime(&st1);
do {
::GetSystemTime(&st2);
- } while (FXSYS_memcmp(&st1, &st2, sizeof(SYSTEMTIME)) == 0);
+ } while (memcmp(&st1, &st2, sizeof(SYSTEMTIME)) == 0);
uint32_t dwHash1 =
FX_HashCode_GetA(CFX_ByteStringC((uint8_t*)&st1, sizeof(st1)), true);
uint32_t dwHash2 =
diff --git a/core/fxcrt/fx_system.h b/core/fxcrt/fx_system.h
index dcf70451c9..b52cb6adf3 100644
--- a/core/fxcrt/fx_system.h
+++ b/core/fxcrt/fx_system.h
@@ -171,10 +171,6 @@ extern "C" {
#define FXSYS_wcslen(ptr) ((FX_STRSIZE)wcslen(ptr))
#endif // __cplusplus
-#define FXSYS_memcmp memcmp
-#define FXSYS_memcpy memcpy
-#define FXSYS_memmove memmove
-#define FXSYS_memset memset
#define FXSYS_qsort qsort
#define FXSYS_bsearch bsearch
diff --git a/core/fxcrt/fxcrt_posix.cpp b/core/fxcrt/fxcrt_posix.cpp
index a96f164c7f..562c70c23e 100644
--- a/core/fxcrt/fxcrt_posix.cpp
+++ b/core/fxcrt/fxcrt_posix.cpp
@@ -66,7 +66,7 @@ FX_FILESIZE CFXCRT_FileAccess_Posix::GetSize() const {
return 0;
}
struct stat s;
- FXSYS_memset(&s, 0, sizeof(s));
+ memset(&s, 0, sizeof(s));
fstat(m_nFD, &s);
return s.st_size;
}
diff --git a/core/fxcrt/xml/cfx_saxreader.cpp b/core/fxcrt/xml/cfx_saxreader.cpp
index 287eaaa5b8..c571e8be96 100644
--- a/core/fxcrt/xml/cfx_saxreader.cpp
+++ b/core/fxcrt/xml/cfx_saxreader.cpp
@@ -628,14 +628,13 @@ void CFX_SAXReader::SkipNode() {
m_iDataLength = m_iDataPos;
m_iDataPos = 0;
if (m_iDataLength >= 9 &&
- FXSYS_memcmp(m_pszData, "[CDATA[", 7 * sizeof(uint8_t)) == 0 &&
- FXSYS_memcmp(m_pszData + m_iDataLength - 2, "]]",
- 2 * sizeof(uint8_t)) == 0) {
+ memcmp(m_pszData, "[CDATA[", 7 * sizeof(uint8_t)) == 0 &&
+ memcmp(m_pszData + m_iDataLength - 2, "]]",
+ 2 * sizeof(uint8_t)) == 0) {
Pop();
m_iDataLength -= 9;
m_dwDataOffset += 7;
- FXSYS_memmove(m_pszData, m_pszData + 7,
- m_iDataLength * sizeof(uint8_t));
+ memmove(m_pszData, m_pszData + 7, m_iDataLength * sizeof(uint8_t));
m_bCharData = true;
if (m_pHandler) {
NotifyData();