diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-04-03 15:05:11 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-04-03 20:39:56 +0000 |
commit | 1c5d0b48ec7a6443ba72fec2a58a65fc6d694aca (patch) | |
tree | 315955cce6b29093dcddfc48c0811957a172bedf /core | |
parent | 2ae80f52cec81c080515724f99deb06b2fee3cc9 (diff) | |
download | pdfium-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')
74 files changed, 373 insertions, 390 deletions
diff --git a/core/fdrm/crypto/fx_crypt.cpp b/core/fdrm/crypto/fx_crypt.cpp index 4010ff49ee..d1a1aae471 100644 --- a/core/fdrm/crypto/fx_crypt.cpp +++ b/core/fdrm/crypto/fx_crypt.cpp @@ -204,7 +204,7 @@ void CRYPT_MD5Update(CRYPT_md5_context* ctx, ctx->total[0] &= 0xFFFFFFFF; ctx->total[1] += ctx->total[0] < length << 3; if (left && length >= fill) { - FXSYS_memcpy((void*)(ctx->buffer + left), (void*)input, fill); + memcpy((void*)(ctx->buffer + left), (void*)input, fill); md5_process(ctx, ctx->buffer); length -= fill; input += fill; @@ -216,7 +216,7 @@ void CRYPT_MD5Update(CRYPT_md5_context* ctx, input += 64; } if (length) { - FXSYS_memcpy((void*)(ctx->buffer + left), (void*)input, length); + memcpy((void*)(ctx->buffer + left), (void*)input, length); } } diff --git a/core/fdrm/crypto/fx_crypt_aes.cpp b/core/fdrm/crypto/fx_crypt_aes.cpp index 8484b6f4a5..e900dbd3e4 100644 --- a/core/fdrm/crypto/fx_crypt_aes.cpp +++ b/core/fdrm/crypto/fx_crypt_aes.cpp @@ -762,7 +762,7 @@ static void aes_decrypt_cbc(unsigned char* dest, unsigned int iv[4], x[4], ct[4]; int i; ASSERT((len & 15) == 0); - FXSYS_memcpy(iv, ctx->iv, sizeof(iv)); + memcpy(iv, ctx->iv, sizeof(iv)); while (len > 0) { for (i = 0; i < 4; i++) { x[i] = ct[i] = GET_32BIT_MSB_FIRST(src + 4 * i); @@ -776,7 +776,7 @@ static void aes_decrypt_cbc(unsigned char* dest, src += 16; len -= 16; } - FXSYS_memcpy(ctx->iv, iv, sizeof(iv)); + memcpy(ctx->iv, iv, sizeof(iv)); } static void aes_encrypt(AESContext* ctx, unsigned int* block) { ctx->encrypt(ctx, block); @@ -788,7 +788,7 @@ static void aes_encrypt_cbc(unsigned char* dest, unsigned int iv[4]; int i; ASSERT((len & 15) == 0); - FXSYS_memcpy(iv, ctx->iv, sizeof(iv)); + memcpy(iv, ctx->iv, sizeof(iv)); while (len > 0) { for (i = 0; i < 4; i++) { iv[i] ^= GET_32BIT_MSB_FIRST(src + 4 * i); @@ -801,7 +801,7 @@ static void aes_encrypt_cbc(unsigned char* dest, src += 16; len -= 16; } - FXSYS_memcpy(ctx->iv, iv, sizeof(iv)); + memcpy(ctx->iv, iv, sizeof(iv)); } void CRYPT_AESSetKey(void* context, uint32_t blocklen, diff --git a/core/fdrm/crypto/fx_crypt_sha.cpp b/core/fdrm/crypto/fx_crypt_sha.cpp index 51f9588e04..f79b831277 100644 --- a/core/fdrm/crypto/fx_crypt_sha.cpp +++ b/core/fdrm/crypto/fx_crypt_sha.cpp @@ -90,11 +90,11 @@ void CRYPT_SHA1Update(CRYPT_sha1_context* s, s->lenlo += lenw; s->lenhi += (s->lenlo < lenw); if (s->blkused && s->blkused + len < 64) { - FXSYS_memcpy(s->block + s->blkused, q, len); + memcpy(s->block + s->blkused, q, len); s->blkused += len; } else { while (s->blkused + len >= 64) { - FXSYS_memcpy(s->block + s->blkused, q, 64 - s->blkused); + memcpy(s->block + s->blkused, q, 64 - s->blkused); q += 64 - s->blkused; len -= 64 - s->blkused; for (i = 0; i < 16; i++) { @@ -106,7 +106,7 @@ void CRYPT_SHA1Update(CRYPT_sha1_context* s, SHATransform(s->h, wordblock); s->blkused = 0; } - FXSYS_memcpy(s->block, q, len); + memcpy(s->block, q, len); s->blkused = len; } } @@ -123,7 +123,7 @@ void CRYPT_SHA1Finish(CRYPT_sha1_context* s, uint8_t digest[20]) { } lenhi = (s->lenhi << 3) | (s->lenlo >> (32 - 3)); lenlo = (s->lenlo << 3); - FXSYS_memset(c, 0, pad); + memset(c, 0, pad); c[0] = 0x80; CRYPT_SHA1Update(s, c, pad); c[0] = (lenhi >> 24) & 0xFF; @@ -307,7 +307,7 @@ void CRYPT_SHA256Update(CRYPT_sha256_context* ctx, ctx->total[1]++; } if (left && length >= fill) { - FXSYS_memcpy((void*)(ctx->buffer + left), (void*)input, fill); + memcpy((void*)(ctx->buffer + left), (void*)input, fill); sha256_process(ctx, ctx->buffer); length -= fill; input += fill; @@ -319,7 +319,7 @@ void CRYPT_SHA256Update(CRYPT_sha256_context* ctx, input += 64; } if (length) { - FXSYS_memcpy((void*)(ctx->buffer + left), (void*)input, length); + memcpy((void*)(ctx->buffer + left), (void*)input, length); } } @@ -385,7 +385,7 @@ void CRYPT_SHA384Start(CRYPT_sha384_context* ctx) { if (!ctx) return; - FXSYS_memset(ctx, 0, sizeof(CRYPT_sha384_context)); + memset(ctx, 0, sizeof(CRYPT_sha384_context)); ctx->state[0] = FX_ato64i("cbbb9d5dc1059ed8"); ctx->state[1] = FX_ato64i("629a292a367cd507"); ctx->state[2] = FX_ato64i("9159015a3070dd17"); @@ -556,7 +556,7 @@ void CRYPT_SHA384Update(CRYPT_sha384_context* ctx, ctx->total[1]++; } if (left && length >= fill) { - FXSYS_memcpy((void*)(ctx->buffer + left), (void*)input, fill); + memcpy((void*)(ctx->buffer + left), (void*)input, fill); sha384_process(ctx, ctx->buffer); length -= fill; input += fill; @@ -568,14 +568,14 @@ void CRYPT_SHA384Update(CRYPT_sha384_context* ctx, input += 128; } if (length) { - FXSYS_memcpy((void*)(ctx->buffer + left), (void*)input, length); + memcpy((void*)(ctx->buffer + left), (void*)input, length); } } void CRYPT_SHA384Finish(CRYPT_sha384_context* ctx, uint8_t digest[48]) { uint32_t last, padn; uint8_t msglen[16]; - FXSYS_memset(msglen, 0, 16); + memset(msglen, 0, 16); uint64_t high, low; high = (ctx->total[0] >> 29) | (ctx->total[1] << 3); low = (ctx->total[0] << 3); @@ -607,7 +607,7 @@ void CRYPT_SHA512Start(void* context) { return; } CRYPT_sha384_context* ctx = (CRYPT_sha384_context*)context; - FXSYS_memset(ctx, 0, sizeof(CRYPT_sha384_context)); + memset(ctx, 0, sizeof(CRYPT_sha384_context)); ctx->state[0] = FX_ato64i("6a09e667f3bcc908"); ctx->state[1] = FX_ato64i("bb67ae8584caa73b"); ctx->state[2] = FX_ato64i("3c6ef372fe94f82b"); @@ -627,7 +627,7 @@ void CRYPT_SHA512Finish(void* context, uint8_t digest[64]) { CRYPT_sha384_context* ctx = (CRYPT_sha384_context*)context; uint32_t last, padn; uint8_t msglen[16]; - FXSYS_memset(msglen, 0, 16); + memset(msglen, 0, 16); uint64_t high, low; high = (ctx->total[0] >> 29) | (ctx->total[1] << 3); low = (ctx->total[0] << 3); diff --git a/core/fpdfapi/edit/fpdf_edit_create.cpp b/core/fpdfapi/edit/fpdf_edit_create.cpp index e6fe6b4a59..59d3de35a9 100644 --- a/core/fpdfapi/edit/fpdf_edit_create.cpp +++ b/core/fpdfapi/edit/fpdf_edit_create.cpp @@ -778,7 +778,7 @@ bool CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator, bool bEOF) { return false; } char offset_buf[20]; - FXSYS_memset(offset_buf, 0, sizeof(offset_buf)); + memset(offset_buf, 0, sizeof(offset_buf)); FXSYS_i64toa(m_PrevOffset, offset_buf, 10); int32_t offset_len = (int32_t)FXSYS_strlen(offset_buf); if (pFile->AppendBlock(offset_buf, offset_len) < 0) { @@ -1715,7 +1715,7 @@ int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause* pPause) { return -1; char offset_buf[20]; - FXSYS_memset(offset_buf, 0, sizeof(offset_buf)); + memset(offset_buf, 0, sizeof(offset_buf)); FXSYS_i64toa(prev, offset_buf, 10); if (m_File.AppendBlock(offset_buf, FXSYS_strlen(offset_buf)) < 0) return -1; @@ -1785,7 +1785,7 @@ int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause* pPause) { return -1; char offset_buf[20]; - FXSYS_memset(offset_buf, 0, sizeof(offset_buf)); + memset(offset_buf, 0, sizeof(offset_buf)); FXSYS_i64toa(m_XrefStart, offset_buf, 10); if (m_File.AppendBlock(offset_buf, FXSYS_strlen(offset_buf)) < 0) return -1; diff --git a/core/fpdfapi/font/cpdf_fontencoding.cpp b/core/fpdfapi/font/cpdf_fontencoding.cpp index be4eaff13b..2cc6445ab2 100644 --- a/core/fpdfapi/font/cpdf_fontencoding.cpp +++ b/core/fpdfapi/font/cpdf_fontencoding.cpp @@ -1646,7 +1646,7 @@ uint32_t PDF_FindCode(const uint16_t* pCodes, uint16_t unicode) { } // namespace CPDF_FontEncoding::CPDF_FontEncoding() { - FXSYS_memset(m_Unicodes, 0, sizeof(m_Unicodes)); + memset(m_Unicodes, 0, sizeof(m_Unicodes)); } int CPDF_FontEncoding::CharCodeFromUnicode(wchar_t unicode) const { @@ -1660,7 +1660,7 @@ int CPDF_FontEncoding::CharCodeFromUnicode(wchar_t unicode) const { CPDF_FontEncoding::CPDF_FontEncoding(int PredefinedEncoding) { const uint16_t* pSrc = PDF_UnicodesForPredefinedCharSet(PredefinedEncoding); if (!pSrc) { - FXSYS_memset(m_Unicodes, 0, sizeof(m_Unicodes)); + memset(m_Unicodes, 0, sizeof(m_Unicodes)); } else { for (int i = 0; i < 256; i++) m_Unicodes[i] = pSrc[i]; @@ -1668,8 +1668,7 @@ CPDF_FontEncoding::CPDF_FontEncoding(int PredefinedEncoding) { } bool CPDF_FontEncoding::IsIdentical(CPDF_FontEncoding* pAnother) const { - return FXSYS_memcmp(m_Unicodes, pAnother->m_Unicodes, sizeof(m_Unicodes)) == - 0; + return memcmp(m_Unicodes, pAnother->m_Unicodes, sizeof(m_Unicodes)) == 0; } std::unique_ptr<CPDF_Object> CPDF_FontEncoding::Realize( diff --git a/core/fpdfapi/font/cpdf_simplefont.cpp b/core/fpdfapi/font/cpdf_simplefont.cpp index 94a690f221..a3597824bd 100644 --- a/core/fpdfapi/font/cpdf_simplefont.cpp +++ b/core/fpdfapi/font/cpdf_simplefont.cpp @@ -13,9 +13,9 @@ #include "third_party/base/numerics/safe_math.h" CPDF_SimpleFont::CPDF_SimpleFont() : m_BaseEncoding(PDFFONT_ENCODING_BUILTIN) { - FXSYS_memset(m_CharWidth, 0xff, sizeof(m_CharWidth)); - FXSYS_memset(m_GlyphIndex, 0xff, sizeof(m_GlyphIndex)); - FXSYS_memset(m_ExtGID, 0xff, sizeof(m_ExtGID)); + memset(m_CharWidth, 0xff, sizeof(m_CharWidth)); + memset(m_GlyphIndex, 0xff, sizeof(m_GlyphIndex)); + memset(m_ExtGID, 0xff, sizeof(m_ExtGID)); for (size_t i = 0; i < FX_ArraySize(m_CharBBox); ++i) m_CharBBox[i] = FX_RECT(-1, -1, -1, -1); } diff --git a/core/fpdfapi/font/cpdf_type1font.cpp b/core/fpdfapi/font/cpdf_type1font.cpp index a264a780c3..e3d96dad37 100644 --- a/core/fpdfapi/font/cpdf_type1font.cpp +++ b/core/fpdfapi/font/cpdf_type1font.cpp @@ -151,7 +151,7 @@ void CPDF_Type1Font::LoadGlyphMap() { if (bGotOne) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ if (!bCoreText) - FXSYS_memcpy(m_ExtGID, m_GlyphIndex, 256); + memcpy(m_ExtGID, m_GlyphIndex, 256); #endif return; } @@ -182,7 +182,7 @@ void CPDF_Type1Font::LoadGlyphMap() { } #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ if (!bCoreText) - FXSYS_memcpy(m_ExtGID, m_GlyphIndex, 256); + memcpy(m_ExtGID, m_GlyphIndex, 256); #endif return; } @@ -207,7 +207,7 @@ void CPDF_Type1Font::LoadGlyphMap() { FT_UnicodeFromCharCode(PDFFONT_ENCODING_STANDARD, charcode); } char name_glyph[256]; - FXSYS_memset(name_glyph, 0, sizeof(name_glyph)); + memset(name_glyph, 0, sizeof(name_glyph)); FXFT_Get_Glyph_Name(m_Font.GetFace(), m_GlyphIndex[charcode], name_glyph, 256); name_glyph[255] = 0; @@ -272,7 +272,7 @@ void CPDF_Type1Font::LoadGlyphMap() { FT_UnicodeFromCharCode(PDFFONT_ENCODING_STANDARD, charcode); if (unicode == 0) { char name_glyph[256]; - FXSYS_memset(name_glyph, 0, sizeof(name_glyph)); + memset(name_glyph, 0, sizeof(name_glyph)); FXFT_Get_Glyph_Name(m_Font.GetFace(), m_GlyphIndex[charcode], name_glyph, 256); name_glyph[255] = 0; @@ -286,7 +286,7 @@ void CPDF_Type1Font::LoadGlyphMap() { } #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ if (!bCoreText) - FXSYS_memcpy(m_ExtGID, m_GlyphIndex, 256); + memcpy(m_ExtGID, m_GlyphIndex, 256); #endif return; @@ -315,7 +315,7 @@ void CPDF_Type1Font::LoadGlyphMap() { } #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ if (!bCoreText) - FXSYS_memcpy(m_ExtGID, m_GlyphIndex, 256); + memcpy(m_ExtGID, m_GlyphIndex, 256); #endif } diff --git a/core/fpdfapi/font/cpdf_type3font.cpp b/core/fpdfapi/font/cpdf_type3font.cpp index 59702aed6a..da3b183c13 100644 --- a/core/fpdfapi/font/cpdf_type3font.cpp +++ b/core/fpdfapi/font/cpdf_type3font.cpp @@ -24,7 +24,7 @@ CPDF_Type3Font::CPDF_Type3Font() m_pPageResources(nullptr), m_pFontResources(nullptr), m_CharLoadingDepth(0) { - FXSYS_memset(m_CharWidthL, 0, sizeof(m_CharWidthL)); + memset(m_CharWidthL, 0, sizeof(m_CharWidthL)); } CPDF_Type3Font::~CPDF_Type3Font() {} diff --git a/core/fpdfapi/font/fpdf_font.cpp b/core/fpdfapi/font/fpdf_font.cpp index 706ae62cd9..23b46759d8 100644 --- a/core/fpdfapi/font/fpdf_font.cpp +++ b/core/fpdfapi/font/fpdf_font.cpp @@ -71,8 +71,8 @@ CPDF_Font* CFX_StockFontArray::SetFont(uint32_t index, } CPDF_FontGlobals::CPDF_FontGlobals() { - FXSYS_memset(m_EmbeddedCharsets, 0, sizeof(m_EmbeddedCharsets)); - FXSYS_memset(m_EmbeddedToUnicodes, 0, sizeof(m_EmbeddedToUnicodes)); + memset(m_EmbeddedCharsets, 0, sizeof(m_EmbeddedCharsets)); + memset(m_EmbeddedToUnicodes, 0, sizeof(m_EmbeddedToUnicodes)); } CPDF_FontGlobals::~CPDF_FontGlobals() {} diff --git a/core/fpdfapi/font/fpdf_font_cid.cpp b/core/fpdfapi/font/fpdf_font_cid.cpp index ddc0c12b7d..64b041738e 100644 --- a/core/fpdfapi/font/fpdf_font_cid.cpp +++ b/core/fpdfapi/font/fpdf_font_cid.cpp @@ -413,8 +413,8 @@ void CPDF_CMapParser::ParseWord(const CFX_ByteStringC& word) { FX_Free(m_pCMap->m_pLeadingBytes); m_pCMap->m_pLeadingBytes = FX_Alloc2D(uint8_t, nSegs, sizeof(CMap_CodeRange)); - FXSYS_memcpy(m_pCMap->m_pLeadingBytes, m_CodeRanges.data(), - nSegs * sizeof(CMap_CodeRange)); + memcpy(m_pCMap->m_pLeadingBytes, m_CodeRanges.data(), + nSegs * sizeof(CMap_CodeRange)); } else if (nSegs == 1) { m_pCMap->m_CodingScheme = (m_CodeRanges[0].m_CharSize == 2) ? CPDF_CMap::TwoBytes @@ -577,8 +577,8 @@ void CPDF_CMap::LoadEmbedded(const uint8_t* pData, uint32_t size) { if (m_CodingScheme == MixedFourBytes && parser.m_AddMaps.GetSize()) { m_pAddMapping = FX_Alloc(uint8_t, parser.m_AddMaps.GetSize() + 4); *(uint32_t*)m_pAddMapping = parser.m_AddMaps.GetSize() / 8; - FXSYS_memcpy(m_pAddMapping + 4, parser.m_AddMaps.GetBuffer(), - parser.m_AddMaps.GetSize()); + memcpy(m_pAddMapping + 4, parser.m_AddMaps.GetBuffer(), + parser.m_AddMaps.GetSize()); FXSYS_qsort(m_pAddMapping + 4, parser.m_AddMaps.GetSize() / 8, 8, CompareDWORD); } @@ -720,7 +720,7 @@ int CPDF_CMap::AppendChar(char* str, uint32_t charcode) const { iSize = 1; } if (iSize > 1) { - FXSYS_memset(str, 0, sizeof(uint8_t) * iSize); + memset(str, 0, sizeof(uint8_t) * iSize); } str[iSize - 1] = (uint8_t)charcode; return iSize; diff --git a/core/fpdfapi/page/cpdf_color.cpp b/core/fpdfapi/page/cpdf_color.cpp index 46771513f4..f0e433c243 100644 --- a/core/fpdfapi/page/cpdf_color.cpp +++ b/core/fpdfapi/page/cpdf_color.cpp @@ -71,7 +71,7 @@ void CPDF_Color::SetValue(float* comps) { if (!m_pBuffer) return; if (m_pCS->GetFamily() != PDFCS_PATTERN) - FXSYS_memcpy(m_pBuffer, comps, m_pCS->CountComponents() * sizeof(float)); + memcpy(m_pBuffer, comps, m_pCS->CountComponents() * sizeof(float)); } void CPDF_Color::SetValue(CPDF_Pattern* pPattern, float* comps, int ncomps) { @@ -94,7 +94,7 @@ void CPDF_Color::SetValue(CPDF_Pattern* pPattern, float* comps, int ncomps) { pvalue->m_nComps = ncomps; pvalue->m_pPattern = pPattern; if (ncomps) - FXSYS_memcpy(pvalue->m_Comps, comps, ncomps * sizeof(float)); + memcpy(pvalue->m_Comps, comps, ncomps * sizeof(float)); pvalue->m_pCountedPattern = nullptr; if (pPattern && pPattern->document()) { @@ -120,7 +120,7 @@ void CPDF_Color::Copy(const CPDF_Color* pSrc) { return; m_pBuffer = m_pCS->CreateBuf(); - FXSYS_memcpy(m_pBuffer, pSrc->m_pBuffer, m_pCS->GetBufSize()); + memcpy(m_pBuffer, pSrc->m_pBuffer, m_pCS->GetBufSize()); if (m_pCS->GetFamily() != PDFCS_PATTERN) return; diff --git a/core/fpdfapi/page/cpdf_contentparser.cpp b/core/fpdfapi/page/cpdf_contentparser.cpp index 7ceb509348..46e2c52c75 100644 --- a/core/fpdfapi/page/cpdf_contentparser.cpp +++ b/core/fpdfapi/page/cpdf_contentparser.cpp @@ -142,7 +142,7 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause) { m_pData = FX_Alloc(uint8_t, m_Size); uint32_t pos = 0; for (const auto& stream : m_StreamArray) { - FXSYS_memcpy(m_pData + pos, stream->GetData(), stream->GetSize()); + memcpy(m_pData + pos, stream->GetData(), stream->GetSize()); pos += stream->GetSize(); m_pData[pos++] = ' '; } diff --git a/core/fpdfapi/page/cpdf_image.cpp b/core/fpdfapi/page/cpdf_image.cpp index 4fc1c344ef..da49fab8b1 100644 --- a/core/fpdfapi/page/cpdf_image.cpp +++ b/core/fpdfapi/page/cpdf_image.cpp @@ -269,8 +269,8 @@ void CPDF_Image::SetImage(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap) { mask_buf.reset(FX_Alloc2D(uint8_t, maskHeight, maskWidth)); mask_size = maskHeight * maskWidth; // Safe since checked alloc returned. for (int32_t a = 0; a < maskHeight; a++) { - FXSYS_memcpy(mask_buf.get() + a * maskWidth, - pMaskBitmap->GetScanline(a), maskWidth); + memcpy(mask_buf.get() + a * maskWidth, pMaskBitmap->GetScanline(a), + maskWidth); } } pMaskDict->SetNewFor<CPDF_Number>("Length", mask_size); @@ -288,7 +288,7 @@ void CPDF_Image::SetImage(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap) { uint8_t* pDest = dest_buf; if (bCopyWithoutAlpha) { for (int32_t i = 0; i < BitmapHeight; i++) { - FXSYS_memcpy(pDest, src_buf, dest_pitch); + memcpy(pDest, src_buf, dest_pitch); pDest += dest_pitch; src_buf += src_pitch; } diff --git a/core/fpdfapi/page/cpdf_meshstream.cpp b/core/fpdfapi/page/cpdf_meshstream.cpp index c0074f84cc..b0a21c627a 100644 --- a/core/fpdfapi/page/cpdf_meshstream.cpp +++ b/core/fpdfapi/page/cpdf_meshstream.cpp @@ -210,7 +210,7 @@ std::tuple<float, float, float> CPDF_MeshStream::ReadColor() { } float result[kMaxComponents]; - FXSYS_memset(result, 0, sizeof(result)); + memset(result, 0, sizeof(result)); int nResults; for (const auto& func : m_funcs) { if (func && func->CountOutputs() <= kMaxComponents) diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp index 59de3c50cb..30686133c2 100644 --- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp +++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp @@ -326,11 +326,11 @@ void CPDF_StreamContentParser::AddNameParam(const CFX_ByteStringC& bsName) { } else { param.m_Type = ContentParam::NAME; if (bsName.Find('#') == -1) { - FXSYS_memcpy(param.m_Name.m_Buffer, bsName.raw_str(), bsName.GetLength()); + memcpy(param.m_Name.m_Buffer, bsName.raw_str(), bsName.GetLength()); param.m_Name.m_Len = bsName.GetLength(); } else { CFX_ByteString str = PDF_NameDecode(bsName); - FXSYS_memcpy(param.m_Name.m_Buffer, str.c_str(), str.GetLength()); + memcpy(param.m_Name.m_Buffer, str.c_str(), str.GetLength()); param.m_Name.m_Len = str.GetLength(); } } diff --git a/core/fpdfapi/page/cpdf_streamparser.cpp b/core/fpdfapi/page/cpdf_streamparser.cpp index f3a04fb117..3c4e534116 100644 --- a/core/fpdfapi/page/cpdf_streamparser.cpp +++ b/core/fpdfapi/page/cpdf_streamparser.cpp @@ -53,7 +53,7 @@ uint32_t DecodeAllScanlines(std::unique_ptr<CCodec_ScanlineDecoder> pDecoder, if (!pLine) break; - FXSYS_memcpy(dest_buf + row * pitch, pLine, pitch); + memcpy(dest_buf + row * pitch, pLine, pitch); } return pDecoder->GetSrcOffset(); } @@ -184,7 +184,7 @@ std::unique_ptr<CPDF_Stream> CPDF_StreamParser::ReadInlineStream( if (OrigSize > m_Size - m_Pos) OrigSize = m_Size - m_Pos; pData.reset(FX_Alloc(uint8_t, OrigSize)); - FXSYS_memcpy(pData.get(), m_pBuf + m_Pos, OrigSize); + memcpy(pData.get(), m_pBuf + m_Pos, OrigSize); dwStreamSize = OrigSize; m_Pos += OrigSize; } else { @@ -217,7 +217,7 @@ std::unique_ptr<CPDF_Stream> CPDF_StreamParser::ReadInlineStream( } m_Pos = dwSavePos; pData.reset(FX_Alloc(uint8_t, dwStreamSize)); - FXSYS_memcpy(pData.get(), m_pBuf + m_Pos, dwStreamSize); + memcpy(pData.get(), m_pBuf + m_Pos, dwStreamSize); m_Pos += dwStreamSize; } pDict->SetNewFor<CPDF_Number>("Length", (int)dwStreamSize); diff --git a/core/fpdfapi/page/fpdf_page_colors.cpp b/core/fpdfapi/page/fpdf_page_colors.cpp index adee5ff84b..ffb8da3a10 100644 --- a/core/fpdfapi/page/fpdf_page_colors.cpp +++ b/core/fpdfapi/page/fpdf_page_colors.cpp @@ -27,8 +27,7 @@ float NormalizeChannel(float fVal) { } bool DetectSRGB(const uint8_t* pData, uint32_t dwSize) { - return dwSize == 3144 && - FXSYS_memcmp(pData + 0x190, "sRGB IEC61966-2.1", 17) == 0; + return dwSize == 3144 && memcmp(pData + 0x190, "sRGB IEC61966-2.1", 17) == 0; } } // namespace diff --git a/core/fpdfapi/page/fpdf_page_func.cpp b/core/fpdfapi/page/fpdf_page_func.cpp index 8ea4194eaa..9be1edb7ff 100644 --- a/core/fpdfapi/page/fpdf_page_func.cpp +++ b/core/fpdfapi/page/fpdf_page_func.cpp @@ -801,8 +801,8 @@ bool CPDF_Function::Init(CPDF_Object* pObj) { if (m_pRanges && m_nOutputs > old_outputs) { m_pRanges = FX_Realloc(float, m_pRanges, m_nOutputs * 2); if (m_pRanges) { - FXSYS_memset(m_pRanges + (old_outputs * 2), 0, - sizeof(float) * (m_nOutputs - old_outputs) * 2); + memset(m_pRanges + (old_outputs * 2), 0, + sizeof(float) * (m_nOutputs - old_outputs) * 2); } } return true; diff --git a/core/fpdfapi/parser/cpdf_crypto_handler.cpp b/core/fpdfapi/parser/cpdf_crypto_handler.cpp index 61f78c4ee5..4fc7b3039b 100644 --- a/core/fpdfapi/parser/cpdf_crypto_handler.cpp +++ b/core/fpdfapi/parser/cpdf_crypto_handler.cpp @@ -21,7 +21,7 @@ void CPDF_CryptoHandler::CryptBlock(bool bEncrypt, uint8_t* dest_buf, uint32_t& dest_size) { if (m_Cipher == FXCIPHER_NONE) { - FXSYS_memcpy(dest_buf, src_buf, src_size); + memcpy(dest_buf, src_buf, src_size); return; } uint8_t realkey[16]; @@ -31,7 +31,7 @@ void CPDF_CryptoHandler::CryptBlock(bool bEncrypt, PopulateKey(objnum, gennum, key1); if (m_Cipher == FXCIPHER_AES) { - FXSYS_memcpy(key1 + m_KeyLen + 5, "sAlT", 4); + memcpy(key1 + m_KeyLen + 5, "sAlT", 4); } CRYPT_MD5Generate( key1, m_Cipher == FXCIPHER_AES ? m_KeyLen + 9 : m_KeyLen + 5, realkey); @@ -49,13 +49,12 @@ void CPDF_CryptoHandler::CryptBlock(bool bEncrypt, iv[i] = (uint8_t)rand(); } CRYPT_AESSetIV(m_pAESContext, iv); - FXSYS_memcpy(dest_buf, iv, 16); + memcpy(dest_buf, iv, 16); int nblocks = src_size / 16; CRYPT_AESEncrypt(m_pAESContext, dest_buf + 16, src_buf, nblocks * 16); uint8_t padding[16]; - FXSYS_memcpy(padding, src_buf + nblocks * 16, src_size % 16); - FXSYS_memset(padding + src_size % 16, 16 - src_size % 16, - 16 - src_size % 16); + memcpy(padding, src_buf + nblocks * 16, src_size % 16); + memset(padding + src_size % 16, 16 - src_size % 16, 16 - src_size % 16); CRYPT_AESEncrypt(m_pAESContext, dest_buf + nblocks * 16 + 16, padding, 16); dest_size = 32 + nblocks * 16; @@ -68,7 +67,7 @@ void CPDF_CryptoHandler::CryptBlock(bool bEncrypt, } else { ASSERT(dest_size == src_size); if (dest_buf != src_buf) { - FXSYS_memcpy(dest_buf, src_buf, src_size); + memcpy(dest_buf, src_buf, src_size); } CRYPT_ArcFourCryptBlock(dest_buf, dest_size, realkey, realkeylen); } @@ -104,7 +103,7 @@ void* CPDF_CryptoHandler::CryptStart(uint32_t objnum, PopulateKey(objnum, gennum, key1); if (m_Cipher == FXCIPHER_AES) { - FXSYS_memcpy(key1 + m_KeyLen + 5, "sAlT", 4); + memcpy(key1 + m_KeyLen + 5, "sAlT", 4); } uint8_t realkey[16]; CRYPT_MD5Generate( @@ -162,8 +161,8 @@ bool CPDF_CryptoHandler::CryptStream(void* context, if (copy_size > src_left) { copy_size = src_left; } - FXSYS_memcpy(pContext->m_Block + pContext->m_BlockOffset, src_buf + src_off, - copy_size); + memcpy(pContext->m_Block + pContext->m_BlockOffset, src_buf + src_off, + copy_size); src_off += copy_size; src_left -= copy_size; pContext->m_BlockOffset += copy_size; @@ -212,9 +211,9 @@ bool CPDF_CryptoHandler::CryptFinish(void* context, dest_buf.AppendBlock(block_buf, 16); pContext->m_BlockOffset = 0; } - FXSYS_memset(pContext->m_Block + pContext->m_BlockOffset, - (uint8_t)(16 - pContext->m_BlockOffset), - 16 - pContext->m_BlockOffset); + memset(pContext->m_Block + pContext->m_BlockOffset, + (uint8_t)(16 - pContext->m_BlockOffset), + 16 - pContext->m_BlockOffset); CRYPT_AESEncrypt(pContext->m_Context, block_buf, pContext->m_Block, 16); dest_buf.AppendBlock(block_buf, 16); } else if (pContext->m_BlockOffset == 16) { @@ -255,7 +254,7 @@ bool CPDF_CryptoHandler::Init(CPDF_Dictionary* pEncryptDict, return false; } if (m_Cipher != FXCIPHER_NONE) { - FXSYS_memcpy(m_EncryptKey, key, m_KeyLen); + memcpy(m_EncryptKey, key, m_KeyLen); } if (m_Cipher == FXCIPHER_AES) { m_pAESContext = FX_Alloc(uint8_t, 2048); @@ -288,7 +287,7 @@ bool CPDF_CryptoHandler::Init(int cipher, const uint8_t* key, int keylen) { } m_Cipher = cipher; m_KeyLen = keylen; - FXSYS_memcpy(m_EncryptKey, key, keylen); + memcpy(m_EncryptKey, key, keylen); if (m_Cipher == FXCIPHER_AES) { m_pAESContext = FX_Alloc(uint8_t, 2048); } @@ -333,7 +332,7 @@ CPDF_CryptoHandler::~CPDF_CryptoHandler() { void CPDF_CryptoHandler::PopulateKey(uint32_t objnum, uint32_t gennum, uint8_t* key) { - FXSYS_memcpy(key, m_EncryptKey, m_KeyLen); + memcpy(key, m_EncryptKey, m_KeyLen); key[m_KeyLen + 0] = (uint8_t)objnum; key[m_KeyLen + 1] = (uint8_t)(objnum >> 8); key[m_KeyLen + 2] = (uint8_t)(objnum >> 16); diff --git a/core/fpdfapi/parser/cpdf_document.cpp b/core/fpdfapi/parser/cpdf_document.cpp index 975592d044..b336acaf84 100644 --- a/core/fpdfapi/parser/cpdf_document.cpp +++ b/core/fpdfapi/parser/cpdf_document.cpp @@ -961,7 +961,7 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTW* pLogFont, bool bVert, bool bTranslateName) { LOGFONTA lfa; - FXSYS_memcpy(&lfa, pLogFont, (char*)lfa.lfFaceName - (char*)&lfa); + memcpy(&lfa, pLogFont, (char*)lfa.lfFaceName - (char*)&lfa); CFX_ByteString face = CFX_ByteString::FromUnicode(pLogFont->lfFaceName); if (face.GetLength() >= LF_FACESIZE) return nullptr; diff --git a/core/fpdfapi/parser/cpdf_object_unittest.cpp b/core/fpdfapi/parser/cpdf_object_unittest.cpp index 3b5374b637..1923992d7a 100644 --- a/core/fpdfapi/parser/cpdf_object_unittest.cpp +++ b/core/fpdfapi/parser/cpdf_object_unittest.cpp @@ -162,8 +162,8 @@ class PDFObjectsTest : public testing::Test { // streams need to be handled. if (!stream1->IsMemoryBased() || !stream2->IsMemoryBased()) return false; - return FXSYS_memcmp(stream1->GetRawData(), stream2->GetRawData(), - stream1->GetRawSize()) == 0; + return memcmp(stream1->GetRawData(), stream2->GetRawData(), + stream1->GetRawSize()) == 0; } case CPDF_Object::REFERENCE: return obj1->AsReference()->GetRefObjNum() == diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp index 323f91779c..cac678762d 100644 --- a/core/fpdfapi/parser/cpdf_parser.cpp +++ b/core/fpdfapi/parser/cpdf_parser.cpp @@ -1217,7 +1217,7 @@ void CPDF_Parser::GetIndirectBinary(uint32_t objnum, } pBuffer = FX_Alloc(uint8_t, size); - FXSYS_memcpy(pBuffer, pData + thisoff + offset, size); + memcpy(pBuffer, pData + thisoff + offset, size); return; } return; diff --git a/core/fpdfapi/parser/cpdf_security_handler.cpp b/core/fpdfapi/parser/cpdf_security_handler.cpp index cfc51350d9..44042cb47c 100644 --- a/core/fpdfapi/parser/cpdf_security_handler.cpp +++ b/core/fpdfapi/parser/cpdf_security_handler.cpp @@ -66,8 +66,8 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt, CRYPT_MD5Generate(digest, copy_len, digest); } } - FXSYS_memset(key, 0, keylen); - FXSYS_memcpy(key, digest, copy_len); + memset(key, 0, keylen); + memcpy(key, digest, copy_len); } } // namespace @@ -303,7 +303,7 @@ void Revision6_Hash(const uint8_t* password, } FX_Free(aes); if (hash) { - FXSYS_memcpy(hash, input, 32); + memcpy(hash, input, 32); } } @@ -337,7 +337,7 @@ bool CPDF_SecurityHandler::AES256_CheckPassword(const uint8_t* password, CRYPT_SHA256Finish(&sha, digest); } - if (FXSYS_memcmp(digest, pkey, 32) != 0) + if (memcmp(digest, pkey, 32) != 0) return false; if (!key) @@ -364,7 +364,7 @@ bool CPDF_SecurityHandler::AES256_CheckPassword(const uint8_t* password, std::vector<uint8_t> aes(2048); CRYPT_AESSetKey(aes.data(), 16, digest, 32, false); uint8_t iv[16]; - FXSYS_memset(iv, 0, 16); + memset(iv, 0, 16); CRYPT_AESSetIV(aes.data(), iv); CRYPT_AESDecrypt(aes.data(), key, ekey.raw_str(), 32); CRYPT_AESSetKey(aes.data(), 16, key, 32, false); @@ -374,10 +374,10 @@ bool CPDF_SecurityHandler::AES256_CheckPassword(const uint8_t* password, return false; uint8_t perms_buf[16]; - FXSYS_memset(perms_buf, 0, sizeof(perms_buf)); + memset(perms_buf, 0, sizeof(perms_buf)); size_t copy_len = std::min(sizeof(perms_buf), static_cast<size_t>(perms.GetLength())); - FXSYS_memcpy(perms_buf, perms.raw_str(), copy_len); + memcpy(perms_buf, perms.raw_str(), copy_len); uint8_t buf[16]; CRYPT_AESDecrypt(aes.data(), buf, perms_buf, 16); if (buf[9] != 'a' || buf[10] != 'd' || buf[11] != 'b') @@ -425,7 +425,7 @@ bool CPDF_SecurityHandler::CheckUserPassword(const uint8_t* password, } uint8_t ukeybuf[32]; if (m_Revision == 2) { - FXSYS_memcpy(ukeybuf, defpasscode, 32); + memcpy(ukeybuf, defpasscode, 32); CRYPT_ArcFourCryptBlock(ukeybuf, 32, key, key_len); } else { uint8_t test[32], tmpkey[32]; @@ -433,9 +433,9 @@ bool CPDF_SecurityHandler::CheckUserPassword(const uint8_t* password, if (copy_len > (uint32_t)ukey.GetLength()) { copy_len = ukey.GetLength(); } - FXSYS_memset(test, 0, sizeof(test)); - FXSYS_memset(tmpkey, 0, sizeof(tmpkey)); - FXSYS_memcpy(test, ukey.c_str(), copy_len); + memset(test, 0, sizeof(test)); + memset(tmpkey, 0, sizeof(tmpkey)); + memcpy(test, ukey.c_str(), copy_len); for (int32_t i = 19; i >= 0; i--) { for (int j = 0; j < key_len; j++) tmpkey[j] = key[j] ^ static_cast<uint8_t>(i); @@ -450,9 +450,9 @@ bool CPDF_SecurityHandler::CheckUserPassword(const uint8_t* password, CRYPT_MD5Update(&md5, (uint8_t*)id.c_str(), id.GetLength()); } CRYPT_MD5Finish(&md5, ukeybuf); - return FXSYS_memcmp(test, ukeybuf, 16) == 0; + return memcmp(test, ukeybuf, 16) == 0; } - if (FXSYS_memcmp((void*)ukey.c_str(), ukeybuf, 16) == 0) { + if (memcmp((void*)ukey.c_str(), ukeybuf, 16) == 0) { return true; } return false; @@ -473,25 +473,25 @@ CFX_ByteString CPDF_SecurityHandler::GetUserPassword(const uint8_t* owner_pass, } } uint8_t enckey[32]; - FXSYS_memset(enckey, 0, sizeof(enckey)); + memset(enckey, 0, sizeof(enckey)); uint32_t copy_len = key_len; if (copy_len > sizeof(digest)) { copy_len = sizeof(digest); } - FXSYS_memcpy(enckey, digest, copy_len); + memcpy(enckey, digest, copy_len); int okeylen = okey.GetLength(); if (okeylen > 32) { okeylen = 32; } uint8_t okeybuf[64]; - FXSYS_memset(okeybuf, 0, sizeof(okeybuf)); - FXSYS_memcpy(okeybuf, okey.c_str(), okeylen); + memset(okeybuf, 0, sizeof(okeybuf)); + memcpy(okeybuf, okey.c_str(), okeylen); if (m_Revision == 2) { CRYPT_ArcFourCryptBlock(okeybuf, okeylen, enckey, key_len); } else { for (int32_t i = 19; i >= 0; i--) { uint8_t tempkey[32]; - FXSYS_memset(tempkey, 0, sizeof(tempkey)); + memset(tempkey, 0, sizeof(tempkey)); for (int j = 0; j < m_KeyLen; j++) tempkey[j] = enckey[j] ^ static_cast<uint8_t>(i); CRYPT_ArcFourCryptBlock(okeybuf, okeylen, tempkey, key_len); @@ -567,7 +567,7 @@ void CPDF_SecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CRYPT_MD5Generate(digest, 16, digest); } uint8_t enckey[32]; - FXSYS_memcpy(enckey, digest, key_len); + memcpy(enckey, digest, key_len); for (uint32_t i = 0; i < 32; i++) { passcode[i] = i < user_size ? user_pass[i] : defpasscode[i - user_size]; } @@ -587,7 +587,7 @@ void CPDF_SecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, key_len, false, pIdArray); if (m_Revision < 3) { uint8_t tempbuf[32]; - FXSYS_memcpy(tempbuf, defpasscode, 32); + memcpy(tempbuf, defpasscode, 32); CRYPT_ArcFourCryptBlock(tempbuf, 32, m_EncryptKey, key_len); pEncryptDict->SetNewFor<CPDF_String>("U", CFX_ByteString(tempbuf, 32), false); @@ -660,7 +660,7 @@ void CPDF_SecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptDict, } CRYPT_SHA256Finish(&sha2, digest1); } - FXSYS_memcpy(digest1 + 32, digest, 16); + memcpy(digest1 + 32, digest, 16); pEncryptDict->SetNewFor<CPDF_String>(bOwner ? "O" : "U", CFX_ByteString(digest1, 48), false); if (m_Revision >= 6) { @@ -678,7 +678,7 @@ void CPDF_SecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptDict, uint8_t* aes = FX_Alloc(uint8_t, 2048); CRYPT_AESSetKey(aes, 16, digest1, 32, true); uint8_t iv[16]; - FXSYS_memset(iv, 0, 16); + memset(iv, 0, 16); CRYPT_AESSetIV(aes, iv); CRYPT_AESEncrypt(aes, digest1, key, 32); FX_Free(aes); @@ -706,7 +706,7 @@ void CPDF_SecurityHandler::AES256_SetPerms(CPDF_Dictionary* pEncryptDict, uint8_t* aes = FX_Alloc(uint8_t, 2048); CRYPT_AESSetKey(aes, 16, key, 32, true); uint8_t iv[16], buf1[16]; - FXSYS_memset(iv, 0, 16); + memset(iv, 0, 16); CRYPT_AESSetIV(aes, iv); CRYPT_AESEncrypt(aes, buf1, buf, 16); FX_Free(aes); diff --git a/core/fpdfapi/parser/cpdf_stream.cpp b/core/fpdfapi/parser/cpdf_stream.cpp index d62b45641b..532fd753f8 100644 --- a/core/fpdfapi/parser/cpdf_stream.cpp +++ b/core/fpdfapi/parser/cpdf_stream.cpp @@ -57,7 +57,7 @@ void CPDF_Stream::InitStream(const uint8_t* pData, m_pFile = nullptr; m_pDataBuf.reset(FX_Alloc(uint8_t, size)); if (pData) - FXSYS_memcpy(m_pDataBuf.get(), pData, size); + memcpy(m_pDataBuf.get(), pData, size); m_dwSize = size; if (m_pDict) m_pDict->SetNewFor<CPDF_Number>("Length", static_cast<int>(m_dwSize)); @@ -101,7 +101,7 @@ void CPDF_Stream::SetData(const uint8_t* pData, uint32_t size) { m_bMemoryBased = true; m_pDataBuf.reset(FX_Alloc(uint8_t, size)); if (pData) - FXSYS_memcpy(m_pDataBuf.get(), pData, size); + memcpy(m_pDataBuf.get(), pData, size); m_dwSize = size; if (!m_pDict) m_pDict = pdfium::MakeUnique<CPDF_Dictionary>(); @@ -117,7 +117,7 @@ bool CPDF_Stream::ReadRawData(FX_FILESIZE offset, return m_pFile->ReadBlock(buf, offset, size); if (m_pDataBuf) - FXSYS_memcpy(buf, m_pDataBuf.get() + offset, size); + memcpy(buf, m_pDataBuf.get() + offset, size); return true; } diff --git a/core/fpdfapi/parser/cpdf_stream_acc.cpp b/core/fpdfapi/parser/cpdf_stream_acc.cpp index 423de7c571..59ac289b7c 100644 --- a/core/fpdfapi/parser/cpdf_stream_acc.cpp +++ b/core/fpdfapi/parser/cpdf_stream_acc.cpp @@ -82,6 +82,6 @@ std::unique_ptr<uint8_t, FxFreeDeleter> CPDF_StreamAcc::DetachData() { return p; } std::unique_ptr<uint8_t, FxFreeDeleter> p(FX_Alloc(uint8_t, m_dwSize)); - FXSYS_memcpy(p.get(), m_pData, m_dwSize); + memcpy(p.get(), m_pData, m_dwSize); return p; } diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.cpp b/core/fpdfapi/parser/cpdf_syntax_parser.cpp index 54fb89a48b..67c0977cfe 100644 --- a/core/fpdfapi/parser/cpdf_syntax_parser.cpp +++ b/core/fpdfapi/parser/cpdf_syntax_parser.cpp @@ -645,13 +645,13 @@ std::unique_ptr<CPDF_Stream> CPDF_SyntaxParser::ReadStream( m_Pos = pos.ValueOrDie(); m_Pos += ReadEOLMarkers(m_Pos); - FXSYS_memset(m_WordBuffer, 0, kEndStreamStr.GetLength() + 1); + memset(m_WordBuffer, 0, kEndStreamStr.GetLength() + 1); GetNextWordInternal(nullptr); // Earlier version of PDF specification doesn't require EOL marker before // 'endstream' keyword. If keyword 'endstream' follows the bytes in // specified length, it signals the end of stream. - if (FXSYS_memcmp(m_WordBuffer, kEndStreamStr.raw_str(), - kEndStreamStr.GetLength()) == 0) { + if (memcmp(m_WordBuffer, kEndStreamStr.raw_str(), + kEndStreamStr.GetLength()) == 0) { bSearchForKeyword = false; } } @@ -750,14 +750,13 @@ std::unique_ptr<CPDF_Stream> CPDF_SyntaxParser::ReadStream( auto pStream = pdfium::MakeUnique<CPDF_Stream>(std::move(pData), len, std::move(pDict)); streamStartPos = m_Pos; - FXSYS_memset(m_WordBuffer, 0, kEndObjStr.GetLength() + 1); + memset(m_WordBuffer, 0, kEndObjStr.GetLength() + 1); GetNextWordInternal(nullptr); int numMarkers = ReadEOLMarkers(m_Pos); if (m_WordSize == static_cast<unsigned int>(kEndObjStr.GetLength()) && numMarkers != 0 && - FXSYS_memcmp(m_WordBuffer, kEndObjStr.raw_str(), - kEndObjStr.GetLength()) == 0) { + memcmp(m_WordBuffer, kEndObjStr.raw_str(), kEndObjStr.GetLength()) == 0) { m_Pos = streamStartPos; } return pStream; diff --git a/core/fpdfapi/parser/fpdf_parser_decode.cpp b/core/fpdfapi/parser/fpdf_parser_decode.cpp index af1f452afd..a1698aedde 100644 --- a/core/fpdfapi/parser/fpdf_parser_decode.cpp +++ b/core/fpdfapi/parser/fpdf_parser_decode.cpp @@ -114,7 +114,7 @@ uint32_t A85Decode(const uint8_t* src_buf, continue; if (ch == 'z') { - FXSYS_memset(dest_buf + dest_size, 0, 4); + memset(dest_buf + dest_size, 0, 4); state = 0; res = 0; dest_size += 4; @@ -226,9 +226,9 @@ uint32_t RunLengthDecode(const uint8_t* src_buf, if (buf_left < copy_len) { uint32_t delta = copy_len - buf_left; copy_len = buf_left; - FXSYS_memset(dest_buf + dest_count + copy_len, '\0', delta); + memset(dest_buf + dest_count + copy_len, '\0', delta); } - FXSYS_memcpy(dest_buf + dest_count, src_buf + i + 1, copy_len); + memcpy(dest_buf + dest_count, src_buf + i + 1, copy_len); dest_count += src_buf[i] + 1; i += src_buf[i] + 2; } else { @@ -236,7 +236,7 @@ uint32_t RunLengthDecode(const uint8_t* src_buf, if (i < src_size - 1) { fill = src_buf[i + 1]; } - FXSYS_memset(dest_buf + dest_count, fill, 257 - src_buf[i]); + memset(dest_buf + dest_count, fill, 257 - src_buf[i]); dest_count += 257 - src_buf[i]; i += 2; } diff --git a/core/fpdfapi/render/cpdf_dibsource.cpp b/core/fpdfapi/render/cpdf_dibsource.cpp index cb8e9c9eee..12bfadb19d 100644 --- a/core/fpdfapi/render/cpdf_dibsource.cpp +++ b/core/fpdfapi/render/cpdf_dibsource.cpp @@ -999,7 +999,7 @@ const uint8_t* CPDF_DIBSource::GetScanline(int line) const { } if (!pSrcLine) { uint8_t* pLineBuf = m_pMaskedLine ? m_pMaskedLine : m_pLineBuf; - FXSYS_memset(pLineBuf, 0xFF, m_Pitch); + memset(pLineBuf, 0xFF, m_Pitch); return pLineBuf; } if (m_bpc * m_nComponents == 1) { @@ -1030,13 +1030,13 @@ const uint8_t* CPDF_DIBSource::GetScanline(int line) const { } return m_pMaskedLine; } else { - FXSYS_memcpy(m_pLineBuf, pSrcLine, src_pitch_value); + memcpy(m_pLineBuf, pSrcLine, src_pitch_value); } return m_pLineBuf; } if (m_bpc * m_nComponents <= 8) { if (m_bpc == 8) { - FXSYS_memcpy(m_pLineBuf, pSrcLine, src_pitch_value); + memcpy(m_pLineBuf, pSrcLine, src_pitch_value); } else { uint64_t src_bit_pos = 0; for (int col = 0; col < m_Width; col++) { @@ -1088,7 +1088,7 @@ const uint8_t* CPDF_DIBSource::GetScanline(int line) const { : 0; } } else { - FXSYS_memset(m_pMaskedLine, 0xFF, m_Pitch); + memset(m_pMaskedLine, 0xFF, m_Pitch); } } if (m_pColorSpace) { @@ -1149,7 +1149,7 @@ void CPDF_DIBSource::DownSampleScanline(int line, int orig_Bpp = m_bpc * m_nComponents / 8; int dest_Bpp = dest_bpp / 8; if (!pSrcLine) { - FXSYS_memset(dest_scan, 0xFF, dest_Bpp * clip_width); + memset(dest_scan, 0xFF, dest_Bpp * clip_width); return; } diff --git a/core/fpdfapi/render/cpdf_docrenderdata.cpp b/core/fpdfapi/render/cpdf_docrenderdata.cpp index 1c430e8f0f..b34fa2caef 100644 --- a/core/fpdfapi/render/cpdf_docrenderdata.cpp +++ b/core/fpdfapi/render/cpdf_docrenderdata.cpp @@ -110,7 +110,7 @@ CPDF_TransferFunc* CPDF_DocRenderData::GetTransferFunc(CPDF_Object* pObj) { CPDF_TransferFunc* pTransfer = pTransferCounter->get(); m_TransferFuncMap[pObj] = pTransferCounter; float output[kMaxOutputs]; - FXSYS_memset(output, 0, sizeof(output)); + memset(output, 0, sizeof(output)); float input; int noutput; for (int v = 0; v < 256; ++v) { diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp index f2d888bdeb..97bb0ac4a2 100644 --- a/core/fpdfapi/render/cpdf_renderstatus.cpp +++ b/core/fpdfapi/render/cpdf_renderstatus.cpp @@ -137,7 +137,7 @@ void DrawAxialShading(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap, std::max(CountOutputs(funcs), pCS->CountComponents()); CFX_FixedBufGrow<float, 16> result_array(total_results); float* pResults = result_array; - FXSYS_memset(pResults, 0, total_results * sizeof(float)); + memset(pResults, 0, total_results * sizeof(float)); uint32_t rgb_array[SHADING_STEPS]; for (int i = 0; i < SHADING_STEPS; i++) { float input = (t_max - t_min) * i / SHADING_STEPS + t_min; @@ -220,7 +220,7 @@ void DrawRadialShading(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap, std::max(CountOutputs(funcs), pCS->CountComponents()); CFX_FixedBufGrow<float, 16> result_array(total_results); float* pResults = result_array; - FXSYS_memset(pResults, 0, total_results * sizeof(float)); + memset(pResults, 0, total_results * sizeof(float)); uint32_t rgb_array[SHADING_STEPS]; for (int i = 0; i < SHADING_STEPS; i++) { float input = (t_max - t_min) * i / SHADING_STEPS + t_min; @@ -345,7 +345,7 @@ void DrawFuncShading(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap, std::max(CountOutputs(funcs), pCS->CountComponents()); CFX_FixedBufGrow<float, 16> result_array(total_results); float* pResults = result_array; - FXSYS_memset(pResults, 0, total_results * sizeof(float)); + memset(pResults, 0, total_results * sizeof(float)); for (int row = 0; row < height; row++) { uint32_t* dib_buf = (uint32_t*)(pBitmap->GetBuffer() + row * pitch); for (int column = 0; column < width; column++) { @@ -487,7 +487,7 @@ void DrawFreeGouraudShading( return; CPDF_MeshVertex triangle[3]; - FXSYS_memset(triangle, 0, sizeof(triangle)); + memset(triangle, 0, sizeof(triangle)); while (!stream.BitStream()->IsEOF()) { CPDF_MeshVertex vertex; @@ -685,7 +685,7 @@ int BiInterpolImpl(int c0, } struct Coon_Color { - Coon_Color() { FXSYS_memset(comp, 0, sizeof(int) * 3); } + Coon_Color() { memset(comp, 0, sizeof(int) * 3); } int comp[3]; void BiInterpol(Coon_Color colors[4], @@ -848,11 +848,11 @@ void DrawCoonPatchMeshes( for (i = 0; i < 4; i++) { tempCoords[i] = coords[(flag * 3 + i) % 12]; } - FXSYS_memcpy(coords, tempCoords, sizeof(tempCoords)); + memcpy(coords, tempCoords, sizeof(tempCoords)); Coon_Color tempColors[2]; tempColors[0] = patch.patch_colors[flag]; tempColors[1] = patch.patch_colors[(flag + 1) % 4]; - FXSYS_memcpy(patch.patch_colors, tempColors, sizeof(Coon_Color) * 2); + memcpy(patch.patch_colors, tempColors, sizeof(Coon_Color) * 2); } for (i = iStartPoint; i < point_count; i++) { if (!stream.CanReadCoords()) @@ -2586,7 +2586,7 @@ CFX_RetainPtr<CFX_DIBitmap> CPDF_RenderStatus::LoadSMask( if (!num_floats.IsValid()) { return nullptr; } - FXSYS_memset(pFloats, 0, num_floats.ValueOrDie()); + memset(pFloats, 0, num_floats.ValueOrDie()); size_t count = pBC->GetCount() > 8 ? 8 : pBC->GetCount(); for (size_t i = 0; i < count; i++) { pFloats[i] = pBC->GetNumberAt(i); @@ -2651,7 +2651,7 @@ CFX_RetainPtr<CFX_DIBitmap> CPDF_RenderStatus::LoadSMask( dest_buf[i] = transfers[src_buf[i]]; } } else { - FXSYS_memcpy(dest_buf, src_buf, dest_pitch * height); + memcpy(dest_buf, src_buf, dest_pitch * height); } return pMask; } diff --git a/core/fpdftext/cpdf_textpagefind.cpp b/core/fpdftext/cpdf_textpagefind.cpp index e268975aa7..7eaac35194 100644 --- a/core/fpdftext/cpdf_textpagefind.cpp +++ b/core/fpdftext/cpdf_textpagefind.cpp @@ -381,7 +381,7 @@ bool CPDF_TextPageFind::ExtractSubString(CFX_WideString& rString, int nLen = lpchEnd ? (int)(lpchEnd - lpszFullString) : (int)FXSYS_wcslen(lpszFullString); ASSERT(nLen >= 0); - FXSYS_memcpy(rString.GetBuffer(nLen), lpszFullString, nLen * sizeof(wchar_t)); + memcpy(rString.GetBuffer(nLen), lpszFullString, nLen * sizeof(wchar_t)); rString.ReleaseBuffer(); return true; } diff --git a/core/fxcodec/codec/ccodec_bmpmodule.cpp b/core/fxcodec/codec/ccodec_bmpmodule.cpp index d891a37ee4..660e89c4a0 100644 --- a/core/fxcodec/codec/ccodec_bmpmodule.cpp +++ b/core/fxcodec/codec/ccodec_bmpmodule.cpp @@ -56,7 +56,7 @@ FXBMP_Context* CCodec_BmpModule::Start() { if (!p) return nullptr; - FXSYS_memset(p, 0, sizeof(FXBMP_Context)); + memset(p, 0, sizeof(FXBMP_Context)); if (!p) return nullptr; diff --git a/core/fxcodec/codec/ccodec_gifmodule.cpp b/core/fxcodec/codec/ccodec_gifmodule.cpp index b7352ba53c..caa21e1424 100644 --- a/core/fxcodec/codec/ccodec_gifmodule.cpp +++ b/core/fxcodec/codec/ccodec_gifmodule.cpp @@ -88,7 +88,7 @@ FXGIF_Context* CCodec_GifModule::Start() { if (!p) return nullptr; - FXSYS_memset(p, 0, sizeof(FXGIF_Context)); + memset(p, 0, sizeof(FXGIF_Context)); p->m_AllocFunc = gif_alloc_func; p->m_FreeFunc = gif_free_func; p->gif_ptr = nullptr; @@ -177,7 +177,7 @@ int32_t CCodec_GifModule::LoadFrame(FXGIF_Context* ctx, buf += size; size = *buf++; if (size == 20) { - FXSYS_memcpy(pAttribute->m_strTime, buf, size); + memcpy(pAttribute->m_strTime, buf, size); } } } diff --git a/core/fxcodec/codec/ccodec_pngmodule.cpp b/core/fxcodec/codec/ccodec_pngmodule.cpp index 2b8f95799e..ae34b53413 100644 --- a/core/fxcodec/codec/ccodec_pngmodule.cpp +++ b/core/fxcodec/codec/ccodec_pngmodule.cpp @@ -55,7 +55,7 @@ static void _png_load_bmp_attribute(png_structp png_ptr, png_timep t = nullptr; png_get_tIME(png_ptr, info_ptr, &t); if (t) { - FXSYS_memset(pAttribute->m_strTime, 0, sizeof(pAttribute->m_strTime)); + memset(pAttribute->m_strTime, 0, sizeof(pAttribute->m_strTime)); FXSYS_snprintf((char*)pAttribute->m_strTime, sizeof(pAttribute->m_strTime), "%4u:%2u:%2u %2u:%2u:%2u", t->year, t->month, t->day, t->hour, t->minute, t->second); @@ -73,16 +73,16 @@ static void _png_load_bmp_attribute(png_structp png_ptr, for (i = 0; i < num_text; i++) { len = FXSYS_strlen(text[i].key); buf = "Time"; - if (!FXSYS_memcmp(buf, text[i].key, std::min(len, FXSYS_strlen(buf)))) { + if (!memcmp(buf, text[i].key, std::min(len, FXSYS_strlen(buf)))) { if (!bTime) { - FXSYS_memset(pAttribute->m_strTime, 0, sizeof(pAttribute->m_strTime)); - FXSYS_memcpy( + memset(pAttribute->m_strTime, 0, sizeof(pAttribute->m_strTime)); + memcpy( pAttribute->m_strTime, text[i].text, std::min(sizeof(pAttribute->m_strTime) - 1, text[i].text_length)); } } else { buf = "Author"; - if (!FXSYS_memcmp(buf, text[i].key, std::min(len, FXSYS_strlen(buf)))) { + if (!memcmp(buf, text[i].key, std::min(len, FXSYS_strlen(buf)))) { pAttribute->m_strAuthor = CFX_ByteString(reinterpret_cast<uint8_t*>(text[i].text), static_cast<FX_STRSIZE>(text[i].text_length)); diff --git a/core/fxcodec/codec/ccodec_tiffmodule.cpp b/core/fxcodec/codec/ccodec_tiffmodule.cpp index 0a0b56ce94..cc51677abd 100644 --- a/core/fxcodec/codec/ccodec_tiffmodule.cpp +++ b/core/fxcodec/codec/ccodec_tiffmodule.cpp @@ -74,15 +74,15 @@ void* _TIFFrealloc(void* ptr, tmsize_t size) { } void _TIFFmemset(void* ptr, int val, tmsize_t size) { - FXSYS_memset(ptr, val, (size_t)size); + memset(ptr, val, (size_t)size); } void _TIFFmemcpy(void* des, const void* src, tmsize_t size) { - FXSYS_memcpy(des, src, (size_t)size); + memcpy(des, src, (size_t)size); } int _TIFFmemcmp(const void* ptr1, const void* ptr2, tmsize_t size) { - return FXSYS_memcmp(ptr1, ptr2, (size_t)size); + return memcmp(ptr1, ptr2, (size_t)size); } int _TIFFIfMultiplicationOverflow(tmsize_t op1, tmsize_t op2) { @@ -199,7 +199,7 @@ void Tiff_Exif_GetStringInfo(TIFF* tif_ctx, return; FX_STRSIZE size = FXSYS_strlen(buf); uint8_t* ptr = FX_Alloc(uint8_t, size + 1); - FXSYS_memcpy(ptr, buf, size); + memcpy(ptr, buf, size); ptr[size] = 0; pAttr->m_Exif[tag] = ptr; } diff --git a/core/fxcodec/codec/fx_codec.cpp b/core/fxcodec/codec/fx_codec.cpp index 0d886b43cb..900fed2d87 100644 --- a/core/fxcodec/codec/fx_codec.cpp +++ b/core/fxcodec/codec/fx_codec.cpp @@ -254,7 +254,7 @@ CFX_DIBAttribute::CFX_DIBAttribute() m_pGifLocalPalette(nullptr), m_nGifLocalPalNum(0), m_nBmpCompressType(0) { - FXSYS_memset(m_strTime, 0, sizeof(m_strTime)); + memset(m_strTime, 0, sizeof(m_strTime)); } CFX_DIBAttribute::~CFX_DIBAttribute() { for (const auto& pair : m_Exif) @@ -361,7 +361,7 @@ bool CCodec_RLScanlineDecoder::Create(const uint8_t* src_buf, return CheckDestSize(); } bool CCodec_RLScanlineDecoder::v_Rewind() { - FXSYS_memset(m_pScanline, 0, m_Pitch); + memset(m_pScanline, 0, m_Pitch); m_SrcOffset = 0; m_bEOD = false; m_Operator = 0; @@ -375,7 +375,7 @@ uint8_t* CCodec_RLScanlineDecoder::v_GetNextLine() { return nullptr; } } - FXSYS_memset(m_pScanline, 0, m_Pitch); + memset(m_pScanline, 0, m_Pitch); uint32_t col_pos = 0; bool eol = false; while (m_SrcOffset < m_SrcSize && !eol) { @@ -389,7 +389,7 @@ uint8_t* CCodec_RLScanlineDecoder::v_GetNextLine() { copy_len = m_SrcSize - m_SrcOffset; m_bEOD = true; } - FXSYS_memcpy(m_pScanline + col_pos, m_pSrcBuf + m_SrcOffset, copy_len); + memcpy(m_pScanline + col_pos, m_pSrcBuf + m_SrcOffset, copy_len); col_pos += copy_len; UpdateOperator((uint8_t)copy_len); } else if (m_Operator > 128) { @@ -402,7 +402,7 @@ uint8_t* CCodec_RLScanlineDecoder::v_GetNextLine() { duplicate_len = m_dwLineBytes - col_pos; eol = true; } - FXSYS_memset(m_pScanline + col_pos, fill, duplicate_len); + memset(m_pScanline + col_pos, fill, duplicate_len); col_pos += duplicate_len; UpdateOperator((uint8_t)duplicate_len); } else { diff --git a/core/fxcodec/codec/fx_codec_fax.cpp b/core/fxcodec/codec/fx_codec_fax.cpp index 7865da925e..641e0fd9d1 100644 --- a/core/fxcodec/codec/fx_codec_fax.cpp +++ b/core/fxcodec/codec/fx_codec_fax.cpp @@ -123,7 +123,7 @@ void FaxFillBits(uint8_t* dest_buf, int columns, int startpos, int endpos) { dest_buf[last_byte] -= 1 << (7 - i); if (last_byte > first_byte + 1) - FXSYS_memset(dest_buf + first_byte + 1, 0, last_byte - first_byte - 1); + memset(dest_buf + first_byte + 1, 0, last_byte - first_byte - 1); } inline bool NextBit(const uint8_t* src_buf, int* bitpos) { @@ -502,7 +502,7 @@ CCodec_FaxDecoder::CCodec_FaxDecoder(const uint8_t* src_buf, CCodec_FaxDecoder::~CCodec_FaxDecoder() {} bool CCodec_FaxDecoder::v_Rewind() { - FXSYS_memset(m_RefBuf.data(), 0xff, m_RefBuf.size()); + memset(m_RefBuf.data(), 0xff, m_RefBuf.size()); m_bitpos = 0; return true; } @@ -513,7 +513,7 @@ uint8_t* CCodec_FaxDecoder::v_GetNextLine() { if (m_bitpos >= bitsize) return nullptr; - FXSYS_memset(m_ScanlineBuf.data(), 0xff, m_ScanlineBuf.size()); + memset(m_ScanlineBuf.data(), 0xff, m_ScanlineBuf.size()); if (m_Encoding < 0) { FaxG4GetRow(m_pSrcBuf, bitsize, &m_bitpos, m_ScanlineBuf.data(), m_RefBuf, m_OrigWidth); @@ -570,9 +570,9 @@ void FaxG4Decode(const uint8_t* src_buf, int bitpos = *pbitpos; for (int iRow = 0; iRow < height; iRow++) { uint8_t* line_buf = dest_buf + iRow * pitch; - FXSYS_memset(line_buf, 0xff, pitch); + memset(line_buf, 0xff, pitch); FaxG4GetRow(src_buf, src_size << 3, &bitpos, line_buf, ref_buf, width); - FXSYS_memcpy(ref_buf.data(), line_buf, pitch); + memcpy(ref_buf.data(), line_buf, pitch); } *pbitpos = bitpos; } @@ -756,7 +756,7 @@ CCodec_FaxEncoder::CCodec_FaxEncoder(const uint8_t* src_buf, int pitch) : m_Cols(width), m_Rows(height), m_Pitch(pitch), m_pSrcBuf(src_buf) { m_RefLine.resize(m_Pitch); - FXSYS_memset(m_RefLine.data(), 0xff, m_Pitch); + memset(m_RefLine.data(), 0xff, m_Pitch); m_pLineBuf = FX_Alloc2D(uint8_t, m_Pitch, 8); m_DestBuf.EstimateSize(0, 10240); } @@ -772,13 +772,13 @@ void CCodec_FaxEncoder::Encode( uint8_t last_byte = 0; for (int i = 0; i < m_Rows; i++) { const uint8_t* scan_line = m_pSrcBuf + i * m_Pitch; - FXSYS_memset(m_pLineBuf, 0, m_Pitch * 8); + memset(m_pLineBuf, 0, m_Pitch * 8); m_pLineBuf[0] = last_byte; FaxEncode2DLine(m_pLineBuf, &dest_bitpos, scan_line, m_RefLine, m_Cols); m_DestBuf.AppendBlock(m_pLineBuf, dest_bitpos / 8); last_byte = m_pLineBuf[dest_bitpos / 8]; dest_bitpos %= 8; - FXSYS_memcpy(m_RefLine.data(), scan_line, m_Pitch); + memcpy(m_RefLine.data(), scan_line, m_Pitch); } if (dest_bitpos) m_DestBuf.AppendByte(last_byte); diff --git a/core/fxcodec/codec/fx_codec_flate.cpp b/core/fxcodec/codec/fx_codec_flate.cpp index dd9c4c9fa6..2ac316100a 100644 --- a/core/fxcodec/codec/fx_codec_flate.cpp +++ b/core/fxcodec/codec/fx_codec_flate.cpp @@ -52,7 +52,7 @@ bool FlateCompress(unsigned char* dest_buf, void* FlateInit() { z_stream* p = FX_Alloc(z_stream, 1); - FXSYS_memset(p, 0, sizeof(z_stream)); + memset(p, 0, sizeof(z_stream)); p->zalloc = my_alloc_func; p->zfree = my_free_func; inflateInit(p); @@ -80,7 +80,7 @@ uint32_t FlateOutput(void* context, uint32_t written = post_pos - pre_pos; if (written < dest_size) - FXSYS_memset(dest_buf + written, '\0', dest_size - written); + memset(dest_buf + written, '\0', dest_size - written); return ret; } @@ -290,7 +290,7 @@ void PNG_PredictLine(uint8_t* pDestData, int BytesPerPixel = (bpc * nColors + 7) / 8; uint8_t tag = pSrcData[0]; if (tag == 0) { - FXSYS_memmove(pDestData, pSrcData + 1, row_size); + memmove(pDestData, pSrcData + 1, row_size); return; } for (int byte = 0; byte < row_size; byte++) { @@ -372,7 +372,7 @@ bool PNG_Predictor(uint8_t*& data_buf, if ((row + 1) * (move_size + 1) > (int)data_size) { move_size = last_row_size - 1; } - FXSYS_memmove(pDestData, pSrcData + 1, move_size); + memmove(pDestData, pSrcData + 1, move_size); pSrcData += move_size + 1; pDestData += move_size; byte_cnt += move_size; @@ -603,7 +603,7 @@ void FlateUncompress(const uint8_t* src_buf, tmp_buf_size = last_buf_size; uint32_t cp_size = std::min(tmp_buf_size, remaining); - FXSYS_memcpy(result_buf + result_pos, tmp_buf, cp_size); + memcpy(result_buf + result_pos, tmp_buf, cp_size); result_pos += cp_size; remaining -= cp_size; @@ -736,7 +736,7 @@ uint8_t* CCodec_FlateScanlineDecoder::v_GetNextLine() { FlateOutput(m_pFlate, m_pPredictRaw, m_PredictPitch + 1); PNG_PredictLine(m_pScanline, m_pPredictRaw, m_pLastLine, m_BitsPerComponent, m_Colors, m_Columns); - FXSYS_memcpy(m_pLastLine, m_pScanline, m_PredictPitch); + memcpy(m_pLastLine, m_pScanline, m_PredictPitch); } else { FlateOutput(m_pFlate, m_pScanline, m_Pitch); TIFF_PredictLine(m_pScanline, m_PredictPitch, m_bpc, m_nComps, @@ -747,9 +747,8 @@ uint8_t* CCodec_FlateScanlineDecoder::v_GetNextLine() { size_t read_leftover = m_LeftOver > bytes_to_go ? bytes_to_go : m_LeftOver; if (read_leftover) { - FXSYS_memcpy(m_pScanline, - m_pPredictBuffer + m_PredictPitch - m_LeftOver, - read_leftover); + memcpy(m_pScanline, m_pPredictBuffer + m_PredictPitch - m_LeftOver, + read_leftover); m_LeftOver -= read_leftover; bytes_to_go -= read_leftover; } @@ -758,7 +757,7 @@ uint8_t* CCodec_FlateScanlineDecoder::v_GetNextLine() { FlateOutput(m_pFlate, m_pPredictRaw, m_PredictPitch + 1); PNG_PredictLine(m_pPredictBuffer, m_pPredictRaw, m_pLastLine, m_BitsPerComponent, m_Colors, m_Columns); - FXSYS_memcpy(m_pLastLine, m_pPredictBuffer, m_PredictPitch); + memcpy(m_pLastLine, m_pPredictBuffer, m_PredictPitch); } else { FlateOutput(m_pFlate, m_pPredictBuffer, m_PredictPitch); TIFF_PredictLine(m_pPredictBuffer, m_PredictPitch, m_BitsPerComponent, @@ -766,8 +765,8 @@ uint8_t* CCodec_FlateScanlineDecoder::v_GetNextLine() { } size_t read_bytes = m_PredictPitch > bytes_to_go ? bytes_to_go : m_PredictPitch; - FXSYS_memcpy(m_pScanline + m_Pitch - bytes_to_go, m_pPredictBuffer, - read_bytes); + memcpy(m_pScanline + m_Pitch - bytes_to_go, m_pPredictBuffer, + read_bytes); m_LeftOver += m_PredictPitch - read_bytes; bytes_to_go -= read_bytes; } @@ -873,7 +872,7 @@ bool CCodec_FlateModule::PngEncode(const uint8_t* src_buf, uint8_t** dest_buf, uint32_t* dest_size) { uint8_t* pSrcBuf = FX_Alloc(uint8_t, src_size); - FXSYS_memcpy(pSrcBuf, src_buf, src_size); + memcpy(pSrcBuf, src_buf, src_size); PNG_PredictorEncode(&pSrcBuf, &src_size); bool ret = Encode(pSrcBuf, src_size, dest_buf, dest_size); FX_Free(pSrcBuf); diff --git a/core/fxcodec/codec/fx_codec_jbig.cpp b/core/fxcodec/codec/fx_codec_jbig.cpp index 926541f07d..dc82305616 100644 --- a/core/fxcodec/codec/fx_codec_jbig.cpp +++ b/core/fxcodec/codec/fx_codec_jbig.cpp @@ -62,7 +62,7 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode( pJbig2Context->m_dest_buf = dest_buf; pJbig2Context->m_dest_pitch = dest_pitch; pJbig2Context->m_pPause = pPause; - FXSYS_memset(dest_buf, 0, height * dest_pitch); + memset(dest_buf, 0, height * dest_pitch); pJbig2Context->m_pContext = pdfium::MakeUnique<CJBig2_Context>( global_stream, src_stream, pJBig2DocumentContext->GetSymbolDictCache(), pPause, false); diff --git a/core/fxcodec/codec/fx_codec_jpeg.cpp b/core/fxcodec/codec/fx_codec_jpeg.cpp index 0431560529..584148d148 100644 --- a/core/fxcodec/codec/fx_codec_jpeg.cpp +++ b/core/fxcodec/codec/fx_codec_jpeg.cpp @@ -185,9 +185,9 @@ CCodec_JpegDecoder::CCodec_JpegDecoder() { m_pScanlineBuf = nullptr; m_bStarted = false; m_bInited = false; - FXSYS_memset(&cinfo, 0, sizeof(cinfo)); - FXSYS_memset(&jerr, 0, sizeof(jerr)); - FXSYS_memset(&src, 0, sizeof(src)); + memset(&cinfo, 0, sizeof(cinfo)); + memset(&jerr, 0, sizeof(jerr)); + memset(&src, 0, sizeof(src)); m_nDefaultScaleDenom = 1; } @@ -253,8 +253,7 @@ bool CCodec_JpegDecoder::Create(const uint8_t* src_buf, src.fill_input_buffer = _src_fill_buffer; src.resync_to_restart = _src_resync; m_bJpegTransform = ColorTransform; - if (src_size > 1 && - FXSYS_memcmp(src_buf + src_size - 2, "\xFF\xD9", 2) != 0) { + if (src_size > 1 && memcmp(src_buf + src_size - 2, "\xFF\xD9", 2) != 0) { ((uint8_t*)src_buf)[src_size - 2] = 0xFF; ((uint8_t*)src_buf)[src_size - 1] = 0xD9; } diff --git a/core/fxcodec/codec/fx_codec_jpx_opj.cpp b/core/fxcodec/codec/fx_codec_jpx_opj.cpp index 4fc3d689f1..30e79deeeb 100644 --- a/core/fxcodec/codec/fx_codec_jpx_opj.cpp +++ b/core/fxcodec/codec/fx_codec_jpx_opj.cpp @@ -564,9 +564,9 @@ void color_apply_icc_profile(opj_image_t* image) { image->comps[1] = image->comps[0]; image->comps[2] = image->comps[0]; image->comps[1].data = FX_Alloc(int, (size_t)max); - FXSYS_memset(image->comps[1].data, 0, sizeof(int) * (size_t)max); + memset(image->comps[1].data, 0, sizeof(int) * (size_t)max); image->comps[2].data = FX_Alloc(int, (size_t)max); - FXSYS_memset(image->comps[2].data, 0, sizeof(int) * (size_t)max); + memset(image->comps[2].data, 0, sizeof(int) * (size_t)max); image->numcomps += 2; r = image->comps[0].data; for (int i = 0; i < max; ++i) { @@ -707,7 +707,7 @@ bool CJPX_Decoder::Init(const unsigned char* src_data, uint32_t src_size) { opj_set_default_decoder_parameters(¶meters); parameters.decod_format = 0; parameters.cod_format = 3; - if (FXSYS_memcmp(m_SrcData, szJP2Header, sizeof(szJP2Header)) == 0) { + if (memcmp(m_SrcData, szJP2Header, sizeof(szJP2Header)) == 0) { l_codec = opj_create_decompress(OPJ_CODEC_JP2); parameters.decod_format = 1; } else { @@ -788,7 +788,7 @@ bool CJPX_Decoder::Decode(uint8_t* dest_buf, if (pitch<(int)(image->comps[0].w * 8 * image->numcomps + 31)>> 5 << 2) return false; - FXSYS_memset(dest_buf, 0xff, image->y1 * pitch); + memset(dest_buf, 0xff, image->y1 * pitch); std::vector<uint8_t*> channel_bufs(image->numcomps); std::vector<int> adjust_comps(image->numcomps); for (uint32_t i = 0; i < image->numcomps; i++) { diff --git a/core/fxcodec/codec/fx_codec_progress.cpp b/core/fxcodec/codec/fx_codec_progress.cpp index e06c592cdc..d8b123b254 100644 --- a/core/fxcodec/codec/fx_codec_progress.cpp +++ b/core/fxcodec/codec/fx_codec_progress.cpp @@ -331,7 +331,7 @@ bool CCodec_ProgressiveDecoder::JpegReadMoreData(CCodec_JpegModule* pJpegModule, } else { uint32_t dwConsume = m_SrcSize - dwAvail; if (dwAvail) { - FXSYS_memmove(m_pSrcBuf, m_pSrcBuf + dwConsume, dwAvail); + memmove(m_pSrcBuf, m_pSrcBuf + dwConsume, dwAvail); } if (dwSize > dwConsume) { dwSize = dwConsume; @@ -593,7 +593,7 @@ bool CCodec_ProgressiveDecoder::GifReadMoreData(ICodec_GifModule* pGifModule, } else { uint32_t dwConsume = m_SrcSize - dwAvail; if (dwAvail) { - FXSYS_memmove(m_pSrcBuf, m_pSrcBuf + dwConsume, dwAvail); + memmove(m_pSrcBuf, m_pSrcBuf + dwConsume, dwAvail); } if (dwSize > dwConsume) { dwSize = dwConsume; @@ -682,7 +682,7 @@ bool CCodec_ProgressiveDecoder::GifInputRecordPositionBuf( case 3: { uint8_t gray = FXRGB2GRAY(FXARGB_R(argb), FXARGB_G(argb), FXARGB_B(argb)); - FXSYS_memset(pScanline, gray, sizeX); + memset(pScanline, gray, sizeX); break; } case 8: { @@ -724,11 +724,11 @@ void CCodec_ProgressiveDecoder::GifReadScanline(int32_t row_num, if (m_GifTransIndex != -1 && m_pDeviceBitmap->HasAlpha()) { pal_index = m_GifTransIndex; } - FXSYS_memset(m_pDecodeBuf, pal_index, m_SrcWidth); + memset(m_pDecodeBuf, pal_index, m_SrcWidth); bool bLastPass = (row_num % 2) == 1; int32_t line = row_num + m_GifFrameRect.top; int32_t left = m_GifFrameRect.left; - FXSYS_memcpy(m_pDecodeBuf + left, row_buf, img_width); + memcpy(m_pDecodeBuf + left, row_buf, img_width); int src_top = m_clipBox.top; int src_bottom = m_clipBox.bottom; int des_top = m_startY; @@ -762,7 +762,7 @@ void CCodec_ProgressiveDecoder::GifReadScanline(int32_t row_num, uint8_t* scan_des = (uint8_t*)pDIBitmap->GetScanline(cur_row) + des_ScanOffet; uint32_t size = m_sizeX * des_Bpp; - FXSYS_memmove(scan_des, scan_src, size); + memmove(scan_des, scan_src, size); } } if (bLastPass) @@ -872,7 +872,7 @@ bool CCodec_ProgressiveDecoder::BmpReadMoreData(ICodec_BmpModule* pBmpModule, } else { uint32_t dwConsume = m_SrcSize - dwAvail; if (dwAvail) { - FXSYS_memmove(m_pSrcBuf, m_pSrcBuf + dwConsume, dwAvail); + memmove(m_pSrcBuf, m_pSrcBuf + dwConsume, dwAvail); } if (dwSize > dwConsume) { dwSize = dwConsume; @@ -897,7 +897,7 @@ void CCodec_ProgressiveDecoder::BmpReadScanline(int32_t row_num, uint8_t* row_buf) { CFX_RetainPtr<CFX_DIBitmap> pDIBitmap = m_pDeviceBitmap; ASSERT(pDIBitmap); - FXSYS_memcpy(m_pDecodeBuf, row_buf, m_ScanlineSize); + memcpy(m_pDecodeBuf, row_buf, m_ScanlineSize); int src_top = m_clipBox.top; int src_bottom = m_clipBox.bottom; int des_top = m_startY; @@ -941,7 +941,7 @@ void CCodec_ProgressiveDecoder::ResampleVertBT( uint8_t* scan_des = (uint8_t*)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet; uint32_t size = m_sizeX * des_Bpp; - FXSYS_memmove(scan_des, scan_src, size); + memmove(scan_des, scan_src, size); } return; } @@ -1017,7 +1017,7 @@ bool CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType, } FX_Free(m_pSrcBuf); m_pSrcBuf = FX_Alloc(uint8_t, size); - FXSYS_memset(m_pSrcBuf, 0, size); + memset(m_pSrcBuf, 0, size); m_SrcSize = size; switch (imageType) { case FXCODEC_IMAGE_BMP: { @@ -1059,8 +1059,8 @@ bool CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType, FX_Free(m_pSrcPalette); if (m_SrcPaletteNumber) { m_pSrcPalette = FX_Alloc(FX_ARGB, m_SrcPaletteNumber); - FXSYS_memcpy(m_pSrcPalette, pPalette, - m_SrcPaletteNumber * sizeof(uint32_t)); + memcpy(m_pSrcPalette, pPalette, + m_SrcPaletteNumber * sizeof(uint32_t)); } else { m_pSrcPalette = nullptr; } @@ -1150,7 +1150,7 @@ bool CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType, if (m_pSrcBuf && input_size > m_SrcSize) { FX_Free(m_pSrcBuf); m_pSrcBuf = FX_Alloc(uint8_t, input_size); - FXSYS_memset(m_pSrcBuf, 0, input_size); + memset(m_pSrcBuf, 0, input_size); m_SrcSize = input_size; } bResult = m_pFile->ReadBlock(m_pSrcBuf, m_offSet, input_size); @@ -1531,7 +1531,7 @@ void CCodec_ProgressiveDecoder::ReSampleScanline( pPixelWeights->m_Weights[j - pPixelWeights->m_SrcStart]; des_g += pixel_weight * src_scan[j]; } - FXSYS_memset(des_scan, (uint8_t)(des_g >> 16), 3); + memset(des_scan, (uint8_t)(des_g >> 16), 3); des_scan += des_Bpp; } break; case 8: { @@ -1664,7 +1664,7 @@ void CCodec_ProgressiveDecoder::ResampleVert( uint8_t* scan_des = (uint8_t*)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet; uint32_t size = m_sizeX * des_Bpp; - FXSYS_memmove(scan_des, scan_src, size); + memmove(scan_des, scan_src, size); } } return; @@ -1739,7 +1739,7 @@ void CCodec_ProgressiveDecoder::ResampleVert( uint8_t* scan_des = (uint8_t*)pDeviceBitmap->GetScanline(des_row) + des_ScanOffet; uint32_t size = m_sizeX * des_Bpp; - FXSYS_memmove(scan_des, scan_src, size); + memmove(scan_des, scan_src, size); } } return; @@ -1755,7 +1755,7 @@ void CCodec_ProgressiveDecoder::ResampleVert( uint8_t* scan_des = (uint8_t*)pDeviceBitmap->GetScanline(des_row + i) + des_ScanOffet; uint32_t size = m_sizeX * des_Bpp; - FXSYS_memmove(scan_des, scan_src, size); + memmove(scan_des, scan_src, size); } } } @@ -1912,7 +1912,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode( scanline_size = (scanline_size * m_SrcComponents + 3) / 4 * 4; FX_Free(m_pDecodeBuf); m_pDecodeBuf = FX_Alloc(uint8_t, scanline_size); - FXSYS_memset(m_pDecodeBuf, 0, scanline_size); + memset(m_pDecodeBuf, 0, scanline_size); m_WeightHorz.Calc(m_sizeX, 0, m_sizeX, m_clipBox.Width(), 0, m_clipBox.Width(), m_bInterpol); m_WeightVert.Calc(m_sizeY, m_clipBox.Height()); @@ -1977,7 +1977,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode( int scanline_size = (m_SrcWidth * m_SrcComponents + 3) / 4 * 4; FX_Free(m_pDecodeBuf); m_pDecodeBuf = FX_Alloc(uint8_t, scanline_size); - FXSYS_memset(m_pDecodeBuf, 0, scanline_size); + memset(m_pDecodeBuf, 0, scanline_size); m_WeightHorzOO.Calc(m_sizeX, m_clipBox.Width(), m_bInterpol); m_WeightVert.Calc(m_sizeY, m_clipBox.Height()); m_status = FXCODEC_STATUS_DECODE_TOBECONTINUE; @@ -1996,7 +1996,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode( int scanline_size = (m_SrcWidth + 3) / 4 * 4; FX_Free(m_pDecodeBuf); m_pDecodeBuf = FX_Alloc(uint8_t, scanline_size); - FXSYS_memset(m_pDecodeBuf, 0, scanline_size); + memset(m_pDecodeBuf, 0, scanline_size); m_WeightHorz.Calc(m_sizeX, 0, m_sizeX, m_clipBox.Width(), 0, m_clipBox.Width(), m_bInterpol); m_WeightVert.Calc(m_sizeY, m_clipBox.Height()); @@ -2027,7 +2027,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode( m_ScanlineSize = (m_SrcWidth * m_SrcComponents + 3) / 4 * 4; FX_Free(m_pDecodeBuf); m_pDecodeBuf = FX_Alloc(uint8_t, m_ScanlineSize); - FXSYS_memset(m_pDecodeBuf, 0, m_ScanlineSize); + memset(m_pDecodeBuf, 0, m_ScanlineSize); m_WeightHorz.Calc(m_sizeX, 0, m_sizeX, m_clipBox.Width(), 0, m_clipBox.Width(), m_bInterpol); m_WeightVert.Calc(m_sizeY, m_clipBox.Height()); @@ -2102,7 +2102,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode(IFX_Pause* pPause) { if (m_pSrcBuf && input_size > m_SrcSize) { FX_Free(m_pSrcBuf); m_pSrcBuf = FX_Alloc(uint8_t, input_size); - FXSYS_memset(m_pSrcBuf, 0, input_size); + memset(m_pSrcBuf, 0, input_size); m_SrcSize = input_size; } bool bResult = m_pFile->ReadBlock(m_pSrcBuf, m_offSet, input_size); diff --git a/core/fxcodec/jbig2/JBig2_Define.h b/core/fxcodec/jbig2/JBig2_Define.h index 86df248786..2934de4e9b 100644 --- a/core/fxcodec/jbig2/JBig2_Define.h +++ b/core/fxcodec/jbig2/JBig2_Define.h @@ -9,9 +9,9 @@ #include "core/fxcrt/fx_system.h" -#define JBIG2_memset FXSYS_memset -#define JBIG2_memcmp FXSYS_memcmp -#define JBIG2_memcpy FXSYS_memcpy +#define JBIG2_memset memset +#define JBIG2_memcmp memcmp +#define JBIG2_memcpy memcpy #define JBIG2_OOB 1 struct JBig2RegionInfo { diff --git a/core/fxcodec/lbmp/fx_bmp.cpp b/core/fxcodec/lbmp/fx_bmp.cpp index 73a62d4192..e4fa17dc89 100644 --- a/core/fxcodec/lbmp/fx_bmp.cpp +++ b/core/fxcodec/lbmp/fx_bmp.cpp @@ -47,7 +47,7 @@ void bmp_error(bmp_decompress_struct_p bmp_ptr, const char* err_msg) { } bmp_decompress_struct_p bmp_create_decompress() { bmp_decompress_struct_p bmp_ptr = FX_Alloc(bmp_decompress_struct, 1); - FXSYS_memset(bmp_ptr, 0, sizeof(bmp_decompress_struct)); + memset(bmp_ptr, 0, sizeof(bmp_decompress_struct)); bmp_ptr->decode_status = BMP_D_STATUS_HEADER; bmp_ptr->bmp_header_ptr = FX_Alloc(BmpFileHeader, 1); return bmp_ptr; @@ -233,7 +233,7 @@ int32_t bmp_read_header(bmp_decompress_struct_p bmp_ptr) { } bmp_ptr->out_row_buffer = FX_Alloc(uint8_t, bmp_ptr->out_row_bytes); - FXSYS_memset(bmp_ptr->out_row_buffer, 0, bmp_ptr->out_row_bytes); + memset(bmp_ptr->out_row_buffer, 0, bmp_ptr->out_row_bytes); bmp_save_decoding_status(bmp_ptr, BMP_D_STATUS_PAL); } if (bmp_ptr->decode_status == BMP_D_STATUS_PAL) { @@ -388,7 +388,7 @@ int32_t bmp_decode_rgb(bmp_decompress_struct_p bmp_ptr) { case 8: case 24: case 32: - FXSYS_memcpy(bmp_ptr->out_row_buffer, des_buf, bmp_ptr->src_row_bytes); + memcpy(bmp_ptr->out_row_buffer, des_buf, bmp_ptr->src_row_bytes); break; } row_buf = bmp_ptr->out_row_buffer; @@ -429,7 +429,7 @@ int32_t bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr) { : (bmp_ptr->height - 1 - bmp_ptr->row_num++), bmp_ptr->out_row_buffer); bmp_ptr->col_num = 0; - FXSYS_memset(bmp_ptr->out_row_buffer, 0, bmp_ptr->out_row_bytes); + memset(bmp_ptr->out_row_buffer, 0, bmp_ptr->out_row_bytes); bmp_save_decoding_status(bmp_ptr, BMP_D_STATUS_DATA); continue; } @@ -458,7 +458,7 @@ int32_t bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr) { return 0; } while (bmp_ptr->row_num < bmp_row_num_next) { - FXSYS_memset(bmp_ptr->out_row_buffer, 0, bmp_ptr->out_row_bytes); + memset(bmp_ptr->out_row_buffer, 0, bmp_ptr->out_row_bytes); bmp_ptr->bmp_get_row_fn( bmp_ptr, bmp_ptr->imgTB_flag ? bmp_ptr->row_num++ @@ -479,8 +479,8 @@ int32_t bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr) { bmp_ptr->skip_size = skip_size_org; return 2; } - FXSYS_memcpy(bmp_ptr->out_row_buffer + bmp_ptr->col_num, - second_byte_ptr, *first_byte_ptr); + memcpy(bmp_ptr->out_row_buffer + bmp_ptr->col_num, second_byte_ptr, + *first_byte_ptr); bmp_ptr->col_num += (int32_t)(*first_byte_ptr); } } @@ -495,8 +495,8 @@ int32_t bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr) { bmp_ptr->skip_size = skip_size_org; return 2; } - FXSYS_memset(bmp_ptr->out_row_buffer + bmp_ptr->col_num, - *second_byte_ptr, *first_byte_ptr); + memset(bmp_ptr->out_row_buffer + bmp_ptr->col_num, *second_byte_ptr, + *first_byte_ptr); bmp_ptr->col_num += (int32_t)(*first_byte_ptr); } } @@ -533,7 +533,7 @@ int32_t bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr) { : (bmp_ptr->height - 1 - bmp_ptr->row_num++), bmp_ptr->out_row_buffer); bmp_ptr->col_num = 0; - FXSYS_memset(bmp_ptr->out_row_buffer, 0, bmp_ptr->out_row_bytes); + memset(bmp_ptr->out_row_buffer, 0, bmp_ptr->out_row_bytes); bmp_save_decoding_status(bmp_ptr, BMP_D_STATUS_DATA); continue; } @@ -562,7 +562,7 @@ int32_t bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr) { return 0; } while (bmp_ptr->row_num < bmp_row_num_next) { - FXSYS_memset(bmp_ptr->out_row_buffer, 0, bmp_ptr->out_row_bytes); + memset(bmp_ptr->out_row_buffer, 0, bmp_ptr->out_row_bytes); bmp_ptr->bmp_get_row_fn( bmp_ptr, bmp_ptr->imgTB_flag ? bmp_ptr->row_num++ @@ -669,7 +669,7 @@ bmp_compress_struct_p bmp_create_compress() { bmp_compress_struct_p bmp_ptr; bmp_ptr = FX_Alloc(bmp_compress_struct, 1); if (bmp_ptr) { - FXSYS_memset(bmp_ptr, 0, sizeof(bmp_compress_struct)); + memset(bmp_ptr, 0, sizeof(bmp_compress_struct)); } return bmp_ptr; } @@ -734,7 +734,7 @@ static void bmp_encode_bitfields(bmp_compress_struct_p bmp_ptr, dst_pos = bmp_ptr->file_header.bfOffBits; dst_size += size; dst_buf = FX_Realloc(uint8_t, dst_buf, dst_size); - FXSYS_memset(&dst_buf[dst_pos], 0, size); + memset(&dst_buf[dst_pos], 0, size); uint32_t mask_red; uint32_t mask_green; uint32_t mask_blue; @@ -818,11 +818,10 @@ static void bmp_encode_rgb(bmp_compress_struct_p bmp_ptr, dst_pos = bmp_ptr->file_header.bfOffBits; dst_size += size; dst_buf = FX_Realloc(uint8_t, dst_buf, dst_size); - FXSYS_memset(&dst_buf[dst_pos], 0, size); + memset(&dst_buf[dst_pos], 0, size); for (int32_t row_num = bmp_ptr->src_row - 1; row_num > -1; row_num--) { - FXSYS_memcpy(&dst_buf[dst_pos], - &bmp_ptr->src_buf[row_num * bmp_ptr->src_pitch], - bmp_ptr->src_pitch); + memcpy(&dst_buf[dst_pos], &bmp_ptr->src_buf[row_num * bmp_ptr->src_pitch], + bmp_ptr->src_pitch); dst_pos += dst_pitch; } dst_size = dst_pos; @@ -847,7 +846,7 @@ static void bmp_encode_rle8(bmp_compress_struct_p bmp_ptr, dst_pos = bmp_ptr->file_header.bfOffBits; dst_size += size; dst_buf = FX_Realloc(uint8_t, dst_buf, dst_size); - FXSYS_memset(&dst_buf[dst_pos], 0, size); + memset(&dst_buf[dst_pos], 0, size); for (int32_t row_num = bmp_ptr->src_row - 1, i = 0; row_num > -1;) { index = row_num * bmp_ptr->src_pitch; rle[0] = bmp_rle8_search(&bmp_ptr->src_buf[index + i], size - index - i); @@ -892,7 +891,7 @@ static void bmp_encode_rle4(bmp_compress_struct_p bmp_ptr, dst_pos = bmp_ptr->file_header.bfOffBits; dst_size += size; dst_buf = FX_Realloc(uint8_t, dst_buf, dst_size); - FXSYS_memset(&dst_buf[dst_pos], 0, size); + memset(&dst_buf[dst_pos], 0, size); for (int32_t row_num = bmp_ptr->src_row - 1, i = 0; row_num > -1; rle[1] = 0) { index = row_num * bmp_ptr->src_pitch; @@ -933,10 +932,10 @@ bool bmp_encode_image(bmp_compress_struct_p bmp_ptr, if (!dst_buf) return false; - FXSYS_memset(dst_buf, 0, dst_size); + memset(dst_buf, 0, dst_size); bmp_ptr->file_header.bfOffBits = head_size; if (bmp_ptr->pal_ptr && pal_size) { - FXSYS_memcpy(&dst_buf[head_size], bmp_ptr->pal_ptr, pal_size); + memcpy(&dst_buf[head_size], bmp_ptr->pal_ptr, pal_size); bmp_ptr->file_header.bfOffBits += pal_size; } WriteInfoHeader(&bmp_ptr->info_header, dst_buf); diff --git a/core/fxcodec/lgif/fx_gif.cpp b/core/fxcodec/lgif/fx_gif.cpp index 52cb81bcab..3d5d0e2325 100644 --- a/core/fxcodec/lgif/fx_gif.cpp +++ b/core/fxcodec/lgif/fx_gif.cpp @@ -52,8 +52,8 @@ void CGifLZWDecoder::ClearTable() { code_size_cur = code_size + 1; code_next = code_end + 1; code_old = (uint16_t)-1; - FXSYS_memset(code_table, 0, sizeof(tag_Table) * GIF_MAX_LZW_CODE); - FXSYS_memset(stack, 0, GIF_MAX_LZW_CODE); + memset(code_table, 0, sizeof(tag_Table) * GIF_MAX_LZW_CODE); + memset(stack, 0, GIF_MAX_LZW_CODE); for (uint16_t i = 0; i < code_clear; i++) { code_table[i].suffix = (uint8_t)i; } @@ -90,11 +90,11 @@ int32_t CGifLZWDecoder::Decode(uint8_t* des_buf, uint32_t& des_size) { uint32_t i = 0; if (stack_size != 0) { if (des_size < stack_size) { - FXSYS_memcpy(des_buf, &stack[GIF_MAX_LZW_CODE - stack_size], des_size); + memcpy(des_buf, &stack[GIF_MAX_LZW_CODE - stack_size], des_size); stack_size -= (uint16_t)des_size; return 3; } - FXSYS_memcpy(des_buf, &stack[GIF_MAX_LZW_CODE - stack_size], stack_size); + memcpy(des_buf, &stack[GIF_MAX_LZW_CODE - stack_size], stack_size); des_buf += stack_size; i += stack_size; stack_size = 0; @@ -161,13 +161,11 @@ int32_t CGifLZWDecoder::Decode(uint8_t* des_buf, uint32_t& des_size) { } code_old = code; if (i + stack_size > des_size) { - FXSYS_memcpy(des_buf, &stack[GIF_MAX_LZW_CODE - stack_size], - des_size - i); + memcpy(des_buf, &stack[GIF_MAX_LZW_CODE - stack_size], des_size - i); stack_size -= (uint16_t)(des_size - i); return 3; } - FXSYS_memcpy(des_buf, &stack[GIF_MAX_LZW_CODE - stack_size], - stack_size); + memcpy(des_buf, &stack[GIF_MAX_LZW_CODE - stack_size], stack_size); des_buf += stack_size; i += stack_size; stack_size = 0; @@ -192,7 +190,7 @@ static bool gif_grow_buf(uint8_t*& dst_buf, uint32_t& dst_len, uint32_t size) { dst_len = size; dst_buf = FX_Realloc(uint8_t, dst_buf, dst_len); } - FXSYS_memset(dst_buf + len_org, 0, dst_len - len_org); + memset(dst_buf + len_org, 0, dst_len - len_org); return !!dst_buf; } return true; @@ -229,7 +227,7 @@ static inline uint8_t gif_cut_buf(const uint8_t* buf, return buf[offset++]; } CGifLZWEncoder::CGifLZWEncoder() { - FXSYS_memset(this, 0, sizeof(CGifLZWEncoder)); + memset(this, 0, sizeof(CGifLZWEncoder)); } CGifLZWEncoder::~CGifLZWEncoder() {} void CGifLZWEncoder::ClearTable() { @@ -272,9 +270,9 @@ void CGifLZWEncoder::WriteBlock(uint8_t*& dst_buf, longjmp(jmp, 1); } dst_buf[offset++] = index_buf_len; - FXSYS_memcpy(&dst_buf[offset], index_buf, index_buf_len); + memcpy(&dst_buf[offset], index_buf, index_buf_len); offset += index_buf_len; - FXSYS_memset(index_buf, 0, GIF_DATA_BLOCK); + memset(index_buf, 0, GIF_DATA_BLOCK); index_buf_len = 0; } void CGifLZWEncoder::EncodeString(uint32_t index, @@ -391,7 +389,7 @@ void CGifLZWEncoder::Finish(uint8_t*& dst_buf, } gif_decompress_struct_p gif_create_decompress() { gif_decompress_struct_p gif_ptr = FX_Alloc(gif_decompress_struct, 1); - FXSYS_memset(gif_ptr, 0, sizeof(gif_decompress_struct)); + memset(gif_ptr, 0, sizeof(gif_decompress_struct)); gif_ptr->decode_status = GIF_D_STATUS_SIG; gif_ptr->img_ptr_arr_ptr = new std::vector<GifImage*>; gif_ptr->cmt_data_ptr = new CFX_ByteString; @@ -439,7 +437,7 @@ void gif_destroy_decompress(gif_decompress_struct_pp gif_ptr_ptr) { } gif_compress_struct_p gif_create_compress() { gif_compress_struct_p gif_ptr = FX_Alloc(gif_compress_struct, 1); - FXSYS_memset(gif_ptr, 0, sizeof(gif_compress_struct)); + memset(gif_ptr, 0, sizeof(gif_compress_struct)); gif_ptr->img_encoder_ptr = new CGifLZWEncoder; gif_ptr->header_ptr = FX_Alloc(GifHeader, 1); if (!gif_ptr->header_ptr) { @@ -447,8 +445,8 @@ gif_compress_struct_p gif_create_compress() { FX_Free(gif_ptr); return nullptr; } - FXSYS_memcpy(gif_ptr->header_ptr->signature, GIF_SIGNATURE, 3); - FXSYS_memcpy(gif_ptr->header_ptr->version, "89a", 3); + memcpy(gif_ptr->header_ptr->signature, GIF_SIGNATURE, 3); + memcpy(gif_ptr->header_ptr->version, "89a", 3); gif_ptr->lsd_ptr = FX_Alloc(GifLSD, 1); if (!gif_ptr->lsd_ptr) { FX_Free(gif_ptr->header_ptr); @@ -456,7 +454,7 @@ gif_compress_struct_p gif_create_compress() { FX_Free(gif_ptr); return nullptr; } - FXSYS_memset(gif_ptr->lsd_ptr, 0, sizeof(GifLSD)); + memset(gif_ptr->lsd_ptr, 0, sizeof(GifLSD)); gif_ptr->image_info_ptr = FX_Alloc(GifImageInfo, 1); if (!gif_ptr->image_info_ptr) { FX_Free(gif_ptr->lsd_ptr); @@ -465,7 +463,7 @@ gif_compress_struct_p gif_create_compress() { FX_Free(gif_ptr); return nullptr; } - FXSYS_memset(gif_ptr->image_info_ptr, 0, sizeof(GifImageInfo)); + memset(gif_ptr->image_info_ptr, 0, sizeof(GifImageInfo)); gif_ptr->gce_ptr = FX_Alloc(GifGCE, 1); if (!gif_ptr->gce_ptr) { FX_Free(gif_ptr->image_info_ptr); @@ -485,7 +483,7 @@ gif_compress_struct_p gif_create_compress() { FX_Free(gif_ptr); return nullptr; } - FXSYS_memset(gif_ptr->pte_ptr, 0, sizeof(GifPTE)); + memset(gif_ptr->pte_ptr, 0, sizeof(GifPTE)); gif_ptr->pte_ptr->block_size = 12; return gif_ptr; } @@ -548,7 +546,7 @@ int32_t gif_read_header(gif_decompress_struct_p gif_ptr) { ((GifGF*)&gif_lsd_ptr->global_flag)->color_resolution; FX_Free(gif_ptr->global_pal_ptr); gif_ptr->global_pal_ptr = (GifPalette*)FX_Alloc(uint8_t, global_pal_size); - FXSYS_memcpy(gif_ptr->global_pal_ptr, global_pal_ptr, global_pal_size); + memcpy(gif_ptr->global_pal_ptr, global_pal_ptr, global_pal_size); } gif_ptr->width = (int)GetWord_LSBFirst((uint8_t*)&gif_lsd_ptr->width); gif_ptr->height = (int)GetWord_LSBFirst((uint8_t*)&gif_lsd_ptr->height); @@ -690,7 +688,7 @@ int32_t gif_decode_extension(gif_decompress_struct_p gif_ptr) { return 2; } GifPlainText* gif_pt_ptr = FX_Alloc(GifPlainText, 1); - FXSYS_memset(gif_pt_ptr, 0, sizeof(GifPlainText)); + memset(gif_pt_ptr, 0, sizeof(GifPlainText)); gif_takeover_gce_ptr(gif_ptr, &gif_pt_ptr->gce_ptr); gif_pt_ptr->pte_ptr = FX_Alloc(GifPTE, 1); gif_pt_ptr->string_ptr = new CFX_ByteString; @@ -781,7 +779,7 @@ int32_t gif_decode_image_info(gif_decompress_struct_p gif_ptr) { return 2; GifImage* gif_image_ptr = FX_Alloc(GifImage, 1); - FXSYS_memset(gif_image_ptr, 0, sizeof(GifImage)); + memset(gif_image_ptr, 0, sizeof(GifImage)); gif_image_ptr->image_info_ptr = FX_Alloc(GifImageInfo, 1); gif_image_ptr->image_info_ptr->left = GetWord_LSBFirst((uint8_t*)&gif_img_info_ptr->left); @@ -819,8 +817,7 @@ int32_t gif_decode_image_info(gif_decompress_struct_p gif_ptr) { gif_image_ptr->local_pal_ptr = (GifPalette*)gif_ptr->gif_ask_buf_for_pal_fn(gif_ptr, loc_pal_size); if (gif_image_ptr->local_pal_ptr) { - FXSYS_memcpy((uint8_t*)gif_image_ptr->local_pal_ptr, loc_pal_ptr, - loc_pal_size); + memcpy((uint8_t*)gif_image_ptr->local_pal_ptr, loc_pal_ptr, loc_pal_size); } } uint8_t* code_size_ptr = nullptr; @@ -1065,8 +1062,8 @@ static bool gif_write_header(gif_compress_struct_p gif_ptr, if (!dst_buf) return false; - FXSYS_memset(dst_buf, 0, dst_len); - FXSYS_memcpy(dst_buf, gif_ptr->header_ptr, sizeof(GifHeader)); + memset(dst_buf, 0, dst_len); + memcpy(dst_buf, gif_ptr->header_ptr, sizeof(GifHeader)); gif_ptr->cur_offset += sizeof(GifHeader); SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset, gif_ptr->lsd_ptr->width); gif_ptr->cur_offset += 2; @@ -1080,7 +1077,7 @@ static bool gif_write_header(gif_compress_struct_p gif_ptr, if (!gif_grow_buf(dst_buf, dst_len, gif_ptr->cur_offset + size)) { return false; } - FXSYS_memcpy(&dst_buf[gif_ptr->cur_offset], gif_ptr->global_pal, size); + memcpy(&dst_buf[gif_ptr->cur_offset], gif_ptr->global_pal, size); gif_ptr->cur_offset += size; } return true; @@ -1101,13 +1098,13 @@ void interlace_buf(const uint8_t* buf, uint32_t pitch, uint32_t height) { j = 3; } temp = FX_Alloc(uint8_t, pitch); - FXSYS_memcpy(temp, &buf[pitch * row], pitch); + memcpy(temp, &buf[pitch * row], pitch); pass[j].push_back(temp); row++; } for (size_t i = 0, row = 0; i < 4; i++) { for (size_t j = 0; j < pass[i].size(); j++, row++) { - FXSYS_memcpy((uint8_t*)&buf[pitch * row], pass[i][j], pitch); + memcpy((uint8_t*)&buf[pitch * row], pass[i][j], pitch); FX_Free(pass[i][j]); } } @@ -1120,13 +1117,13 @@ static void gif_write_block_data(const uint8_t* src_buf, uint32_t src_offset = 0; while (src_len > GIF_DATA_BLOCK) { dst_buf[dst_offset++] = GIF_DATA_BLOCK; - FXSYS_memcpy(&dst_buf[dst_offset], &src_buf[src_offset], GIF_DATA_BLOCK); + memcpy(&dst_buf[dst_offset], &src_buf[src_offset], GIF_DATA_BLOCK); dst_offset += GIF_DATA_BLOCK; src_offset += GIF_DATA_BLOCK; src_len -= GIF_DATA_BLOCK; } dst_buf[dst_offset++] = (uint8_t)src_len; - FXSYS_memcpy(&dst_buf[dst_offset], &src_buf[src_offset], src_len); + memcpy(&dst_buf[dst_offset], &src_buf[src_offset], src_len); dst_offset += src_len; } static bool gif_write_data(gif_compress_struct_p gif_ptr, @@ -1135,7 +1132,7 @@ static bool gif_write_data(gif_compress_struct_p gif_ptr, if (!gif_grow_buf(dst_buf, dst_len, gif_ptr->cur_offset + GIF_DATA_BLOCK)) { return false; } - if (FXSYS_memcmp(gif_ptr->header_ptr->version, "89a", 3) == 0) { + if (memcmp(gif_ptr->header_ptr->version, "89a", 3) == 0) { dst_buf[gif_ptr->cur_offset++] = GIF_SIG_EXTENSION; dst_buf[gif_ptr->cur_offset++] = GIF_BLOCK_GCE; gif_ptr->gce_ptr->block_size = 4; @@ -1169,7 +1166,7 @@ static bool gif_write_data(gif_compress_struct_p gif_ptr, if (!gif_grow_buf(dst_buf, dst_len, pal_size + gif_ptr->cur_offset)) { return false; } - FXSYS_memcpy(&dst_buf[gif_ptr->cur_offset], gif_ptr->local_pal, pal_size); + memcpy(&dst_buf[gif_ptr->cur_offset], gif_ptr->local_pal, pal_size); gif_ptr->cur_offset += pal_size; } if (lf.interlace) { @@ -1196,7 +1193,7 @@ static bool gif_write_data(gif_compress_struct_p gif_ptr, } gif_ptr->img_encoder_ptr->Finish(dst_buf, dst_len, gif_ptr->cur_offset); dst_buf[gif_ptr->cur_offset++] = 0; - if (FXSYS_memcmp(gif_ptr->header_ptr->version, "89a", 3) == 0 && + if (memcmp(gif_ptr->header_ptr->version, "89a", 3) == 0 && gif_ptr->cmt_data_ptr) { dst_buf[gif_ptr->cur_offset++] = GIF_SIG_EXTENSION; dst_buf[gif_ptr->cur_offset++] = GIF_BLOCK_CE; @@ -1204,7 +1201,7 @@ static bool gif_write_data(gif_compress_struct_p gif_ptr, dst_len, gif_ptr->cur_offset); dst_buf[gif_ptr->cur_offset++] = 0; } - if (FXSYS_memcmp(gif_ptr->header_ptr->version, "89a", 3) == 0 && + if (memcmp(gif_ptr->header_ptr->version, "89a", 3) == 0 && gif_ptr->pte_data_ptr) { dst_buf[gif_ptr->cur_offset++] = GIF_SIG_EXTENSION; dst_buf[gif_ptr->cur_offset++] = GIF_BLOCK_PTE; 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(); diff --git a/core/fxge/android/cfpf_skiafontdescriptor.h b/core/fxge/android/cfpf_skiafontdescriptor.h index 56f8a34fa5..f653050feb 100644 --- a/core/fxge/android/cfpf_skiafontdescriptor.h +++ b/core/fxge/android/cfpf_skiafontdescriptor.h @@ -27,7 +27,7 @@ class CFPF_SkiaFontDescriptor { FX_Free(m_pFamily); int32_t iSize = FXSYS_strlen(pFamily); m_pFamily = FX_Alloc(char, iSize + 1); - FXSYS_memcpy(m_pFamily, pFamily, iSize * sizeof(char)); + memcpy(m_pFamily, pFamily, iSize * sizeof(char)); m_pFamily[iSize] = 0; } char* m_pFamily; diff --git a/core/fxge/android/cfpf_skiafontmgr.cpp b/core/fxge/android/cfpf_skiafontmgr.cpp index 00d989e55c..534f41a548 100644 --- a/core/fxge/android/cfpf_skiafontmgr.cpp +++ b/core/fxge/android/cfpf_skiafontmgr.cpp @@ -371,7 +371,7 @@ FXFT_Face CFPF_SkiaFontMgr::GetFontFace( if (iFaceIndex < 0) return nullptr; FXFT_StreamRec streamRec; - FXSYS_memset(&streamRec, 0, sizeof(FXFT_StreamRec)); + memset(&streamRec, 0, sizeof(FXFT_StreamRec)); streamRec.size = pFileRead->GetSize(); streamRec.descriptor.pointer = static_cast<void*>(pFileRead.Get()); streamRec.read = FPF_SkiaStream_Read; diff --git a/core/fxge/android/cfpf_skiapathfont.h b/core/fxge/android/cfpf_skiapathfont.h index f8ddc6c83a..8b7a4f9fb4 100644 --- a/core/fxge/android/cfpf_skiapathfont.h +++ b/core/fxge/android/cfpf_skiapathfont.h @@ -24,7 +24,7 @@ class CFPF_SkiaPathFont : public CFPF_SkiaFontDescriptor { FX_Free(m_pPath); int32_t iSize = FXSYS_strlen(pPath); m_pPath = FX_Alloc(char, iSize + 1); - FXSYS_memcpy(m_pPath, pPath, iSize * sizeof(char)); + memcpy(m_pPath, pPath, iSize * sizeof(char)); m_pPath[iSize] = 0; } char* m_pPath; diff --git a/core/fxge/dib/cfx_bitmapcomposer.cpp b/core/fxge/dib/cfx_bitmapcomposer.cpp index 7124ba9d46..8dd87b1def 100644 --- a/core/fxge/dib/cfx_bitmapcomposer.cpp +++ b/core/fxge/dib/cfx_bitmapcomposer.cpp @@ -95,7 +95,7 @@ void CFX_BitmapComposer::DoCompose(uint8_t* dest_scan, m_pAddClipScan[i] = clip_scan[i] * m_BitmapAlpha / 255; } } else { - FXSYS_memset(m_pAddClipScan, m_BitmapAlpha, dest_width); + memset(m_pAddClipScan, m_BitmapAlpha, dest_width); } clip_scan = m_pAddClipScan; } diff --git a/core/fxge/dib/cfx_bitmapstorer.cpp b/core/fxge/dib/cfx_bitmapstorer.cpp index ac876b16b7..4e1cb3bc38 100644 --- a/core/fxge/dib/cfx_bitmapstorer.cpp +++ b/core/fxge/dib/cfx_bitmapstorer.cpp @@ -32,11 +32,11 @@ void CFX_BitmapStorer::ComposeScanline(int line, ? const_cast<uint8_t*>(m_pBitmap->m_pAlphaMask->GetScanline(line)) : nullptr; if (dest_buf) - FXSYS_memcpy(dest_buf, scanline, m_pBitmap->GetPitch()); + memcpy(dest_buf, scanline, m_pBitmap->GetPitch()); if (dest_alpha_buf) { - FXSYS_memcpy(dest_alpha_buf, scan_extra_alpha, - m_pBitmap->m_pAlphaMask->GetPitch()); + memcpy(dest_alpha_buf, scan_extra_alpha, + m_pBitmap->m_pAlphaMask->GetPitch()); } } diff --git a/core/fxge/dib/cfx_dibitmap.cpp b/core/fxge/dib/cfx_dibitmap.cpp index 0adc088b53..b97917dba7 100644 --- a/core/fxge/dib/cfx_dibitmap.cpp +++ b/core/fxge/dib/cfx_dibitmap.cpp @@ -90,7 +90,7 @@ bool CFX_DIBitmap::Copy(const CFX_RetainPtr<CFX_DIBSource>& pSrc) { SetPalette(pSrc->GetPalette()); SetAlphaMask(pSrc->m_pAlphaMask); for (int row = 0; row < pSrc->GetHeight(); row++) - FXSYS_memcpy(m_pBuffer + row * m_Pitch, pSrc->GetScanline(row), m_Pitch); + memcpy(m_pBuffer + row * m_Pitch, pSrc->GetScanline(row), m_Pitch); return true; } @@ -130,20 +130,19 @@ void CFX_DIBitmap::Clear(uint32_t color) { } switch (GetFormat()) { case FXDIB_1bppMask: - FXSYS_memset(m_pBuffer, (color & 0xff000000) ? 0xff : 0, - m_Pitch * m_Height); + memset(m_pBuffer, (color & 0xff000000) ? 0xff : 0, m_Pitch * m_Height); break; case FXDIB_1bppRgb: { int index = FindPalette(color); - FXSYS_memset(m_pBuffer, index ? 0xff : 0, m_Pitch * m_Height); + memset(m_pBuffer, index ? 0xff : 0, m_Pitch * m_Height); break; } case FXDIB_8bppMask: - FXSYS_memset(m_pBuffer, color >> 24, m_Pitch * m_Height); + memset(m_pBuffer, color >> 24, m_Pitch * m_Height); break; case FXDIB_8bppRgb: { int index = FindPalette(color); - FXSYS_memset(m_pBuffer, index, m_Pitch * m_Height); + memset(m_pBuffer, index, m_Pitch * m_Height); break; } case FXDIB_Rgb: @@ -151,7 +150,7 @@ void CFX_DIBitmap::Clear(uint32_t color) { int a, r, g, b; ArgbDecode(color, a, r, g, b); if (r == g && g == b) { - FXSYS_memset(m_pBuffer, r, m_Pitch * m_Height); + memset(m_pBuffer, r, m_Pitch * m_Height); } else { int byte_pos = 0; for (int col = 0; col < m_Width; col++) { @@ -160,7 +159,7 @@ void CFX_DIBitmap::Clear(uint32_t color) { m_pBuffer[byte_pos++] = r; } for (int row = 1; row < m_Height; row++) { - FXSYS_memcpy(m_pBuffer + row * m_Pitch, m_pBuffer, m_Pitch); + memcpy(m_pBuffer + row * m_Pitch, m_pBuffer, m_Pitch); } } break; @@ -177,7 +176,7 @@ void CFX_DIBitmap::Clear(uint32_t color) { ((uint32_t*)m_pBuffer)[i] = color; } for (int row = 1; row < m_Height; row++) { - FXSYS_memcpy(m_pBuffer + row * m_Pitch, m_pBuffer, m_Pitch); + memcpy(m_pBuffer + row * m_Pitch, m_pBuffer, m_Pitch); } break; } @@ -227,7 +226,7 @@ bool CFX_DIBitmap::TransferBitmap( m_pBuffer + (dest_top + row) * m_Pitch + dest_left * Bpp; const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * Bpp; - FXSYS_memcpy(dest_scan, src_scan, width * Bpp); + memcpy(dest_scan, src_scan, width * Bpp); } } } else { @@ -336,10 +335,10 @@ bool CFX_DIBitmap::TransferMask(int dest_left, for (int col = 0; col < width; col++) { int src_bitpos = src_left + col; if (src_scan[src_bitpos / 8] & (1 << (7 - src_bitpos % 8))) { - FXSYS_memcpy(dest_color_pos, color_p, comps); + memcpy(dest_color_pos, color_p, comps); *dest_alpha_pos = 0xff; } else { - FXSYS_memset(dest_color_pos, 0, comps); + memset(dest_color_pos, 0, comps); *dest_alpha_pos = 0; } dest_color_pos += comps; @@ -348,7 +347,7 @@ bool CFX_DIBitmap::TransferMask(int dest_left, } else { src_scan += src_left; for (int col = 0; col < width; col++) { - FXSYS_memcpy(dest_color_pos, color_p, comps); + memcpy(dest_color_pos, color_p, comps); dest_color_pos += comps; *dest_alpha_pos++ = (alpha * (*src_scan++) / 255); } @@ -505,12 +504,12 @@ bool CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, int value) { } int Bpp = GetBPP() / 8; if (Bpp == 1) { - FXSYS_memset(m_pBuffer, value, m_Height * m_Pitch); + memset(m_pBuffer, value, m_Height * m_Pitch); return true; } if (destChannel == FXDIB_Alpha && m_pAlphaMask) { - FXSYS_memset(m_pAlphaMask->GetBuffer(), value, - m_pAlphaMask->GetHeight() * m_pAlphaMask->GetPitch()); + memset(m_pAlphaMask->GetBuffer(), value, + m_pAlphaMask->GetHeight() * m_pAlphaMask->GetPitch()); return true; } for (int row = 0; row < m_Height; row++) { @@ -601,7 +600,7 @@ bool CFX_DIBitmap::GetGrayData(void* pIccTransform) { if (!pMask->Create(m_Width, m_Height, FXDIB_8bppMask)) return false; - FXSYS_memset(pMask->GetBuffer(), gray[0], pMask->GetPitch() * m_Height); + memset(pMask->GetBuffer(), gray[0], pMask->GetPitch() * m_Height); for (int row = 0; row < m_Height; row++) { uint8_t* src_pos = m_pBuffer + row * m_Pitch; uint8_t* dest_pos = (uint8_t*)pMask->GetScanline(row); @@ -1230,7 +1229,7 @@ bool CFX_DIBitmap::CompositeRect(int left, for (int row = rect.top; row < rect.bottom; row++) { uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left; if (src_alpha == 255) { - FXSYS_memset(dest_scan, gray, width); + memset(dest_scan, gray, width); } else { for (int col = 0; col < width; col++) { *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha); @@ -1262,7 +1261,7 @@ bool CFX_DIBitmap::CompositeRect(int left, uint8_t left_flag = *dest_scan_top & (255 << (8 - left_shift)); uint8_t right_flag = *dest_scan_top_r & (255 >> right_shift); if (new_width) { - FXSYS_memset(dest_scan_top + 1, index ? 255 : 0, new_width - 1); + memset(dest_scan_top + 1, index ? 255 : 0, new_width - 1); if (!index) { *dest_scan_top &= left_flag; *dest_scan_top_r &= right_flag; @@ -1310,7 +1309,7 @@ bool CFX_DIBitmap::CompositeRect(int left, m_pAlphaMask ? (uint8_t*)m_pAlphaMask->GetScanline(row) + rect.left : nullptr; if (dest_scan_alpha) { - FXSYS_memset(dest_scan_alpha, 0xff, width); + memset(dest_scan_alpha, 0xff, width); } if (Bpp == 4) { uint32_t* scan = (uint32_t*)dest_scan; @@ -1357,7 +1356,7 @@ bool CFX_DIBitmap::CompositeRect(int left, uint8_t back_alpha = *dest_scan_alpha; if (back_alpha == 0) { *dest_scan_alpha++ = src_alpha; - FXSYS_memcpy(dest_scan, color_p, Bpp); + memcpy(dest_scan, color_p, Bpp); dest_scan += Bpp; continue; } @@ -1417,7 +1416,7 @@ bool CFX_DIBitmap::ConvertFormat(FXDIB_Format dest_format) { } CFX_RetainPtr<CFX_DIBitmap> pAlphaMask; if (dest_format == FXDIB_Argb) { - FXSYS_memset(dest_buf, 0xff, dest_pitch * m_Height + 4); + memset(dest_buf, 0xff, dest_pitch * m_Height + 4); if (m_pAlphaMask) { for (int row = 0; row < m_Height; row++) { uint8_t* pDstScanline = dest_buf + row * dest_pitch + 3; diff --git a/core/fxge/dib/cfx_dibsource.cpp b/core/fxge/dib/cfx_dibsource.cpp index 4b76b02ee7..1a11632759 100644 --- a/core/fxge/dib/cfx_dibsource.cpp +++ b/core/fxge/dib/cfx_dibsource.cpp @@ -63,7 +63,7 @@ CFX_RetainPtr<CFX_DIBitmap> CFX_DIBSource::Clone(const FX_RECT* pClip) const { for (int row = rect.top; row < rect.bottom; row++) { const uint8_t* src_scan = GetScanline(row) + rect.left * m_bpp / 8; uint8_t* dest_scan = (uint8_t*)pNewBitmap->GetScanline(row - rect.top); - FXSYS_memcpy(dest_scan, src_scan, copy_len); + memcpy(dest_scan, src_scan, copy_len); } } return pNewBitmap; @@ -103,8 +103,8 @@ bool CFX_DIBSource::BuildAlphaMask() { m_pAlphaMask = nullptr; return false; } - FXSYS_memset(m_pAlphaMask->GetBuffer(), 0xff, - m_pAlphaMask->GetHeight() * m_pAlphaMask->GetPitch()); + memset(m_pAlphaMask->GetBuffer(), 0xff, + m_pAlphaMask->GetHeight() * m_pAlphaMask->GetPitch()); return true; } @@ -203,7 +203,7 @@ void CFX_DIBSource::SetPalette(const uint32_t* pSrc) { if (!m_pPalette) m_pPalette.reset(FX_Alloc(uint32_t, pal_size)); pal_size = std::min(pal_size, kPaletteSize); - FXSYS_memcpy(m_pPalette.get(), pSrc, pal_size * sizeof(uint32_t)); + memcpy(m_pPalette.get(), pSrc, pal_size * sizeof(uint32_t)); } void CFX_DIBSource::GetPalette(uint32_t* pal, int alpha) const { @@ -272,9 +272,9 @@ bool CFX_DIBSource::SetAlphaMask(const CFX_RetainPtr<CFX_DIBSource>& pAlphaMask, return false; } for (int row = 0; row < m_Height; row++) { - FXSYS_memcpy(const_cast<uint8_t*>(m_pAlphaMask->GetScanline(row)), - pAlphaMask->GetScanline(row + rect.top) + rect.left, - m_pAlphaMask->m_Pitch); + memcpy(const_cast<uint8_t*>(m_pAlphaMask->GetScanline(row)), + pAlphaMask->GetScanline(row + rect.top) + rect.left, + m_pAlphaMask->m_Pitch); } return true; } @@ -293,11 +293,11 @@ CFX_RetainPtr<CFX_DIBitmap> CFX_DIBSource::FlipImage(bool bXFlip, uint8_t* dest_scan = pDestBuffer + m_Pitch * (bYFlip ? (m_Height - row - 1) : row); if (!bXFlip) { - FXSYS_memcpy(dest_scan, src_scan, m_Pitch); + memcpy(dest_scan, src_scan, m_Pitch); continue; } if (m_bpp == 1) { - FXSYS_memset(dest_scan, 0, m_Pitch); + memset(dest_scan, 0, m_Pitch); for (int col = 0; col < m_Width; col++) if (src_scan[col / 8] & (1 << (7 - col % 8))) { int dest_col = m_Width - col - 1; @@ -337,7 +337,7 @@ CFX_RetainPtr<CFX_DIBitmap> CFX_DIBSource::FlipImage(bool bXFlip, uint8_t* dest_scan = pDestBuffer + dest_pitch * (bYFlip ? (m_Height - row - 1) : row); if (!bXFlip) { - FXSYS_memcpy(dest_scan, src_scan, dest_pitch); + memcpy(dest_scan, src_scan, dest_pitch); continue; } dest_scan += (m_Width - 1); @@ -418,7 +418,7 @@ CFX_RetainPtr<CFX_DIBitmap> CFX_DIBSource::SwapXY( int col_start = bYFlip ? m_Width - dest_clip.bottom : dest_clip.top; int col_end = bYFlip ? m_Width - dest_clip.top : dest_clip.bottom; if (GetBPP() == 1) { - FXSYS_memset(dest_buf, 0xff, dest_pitch * result_height); + memset(dest_buf, 0xff, dest_pitch * result_height); for (int row = row_start; row < row_end; row++) { const uint8_t* src_scan = GetScanline(row); int dest_col = (bXFlip ? dest_clip.right - (row - row_start) - 1 : row) - diff --git a/core/fxge/dib/cfx_scanlinecompositor.cpp b/core/fxge/dib/cfx_scanlinecompositor.cpp index 1e2a282c1f..ff7dd06c3e 100644 --- a/core/fxge/dib/cfx_scanlinecompositor.cpp +++ b/core/fxge/dib/cfx_scanlinecompositor.cpp @@ -198,7 +198,7 @@ void CompositeRow_Rgb2Mask(uint8_t* dest_scan, int width, const uint8_t* clip_scan) { if (!clip_scan) { - FXSYS_memset(dest_scan, 0xff, width); + memset(dest_scan, 0xff, width); return; } for (int i = 0; i < width; ++i) { @@ -872,7 +872,7 @@ void CompositeRow_Rgb2Rgb_NoBlend_NoClip(uint8_t* dest_scan, int dest_Bpp, int src_Bpp) { if (dest_Bpp == src_Bpp) { - FXSYS_memcpy(dest_scan, src_scan, width * dest_Bpp); + memcpy(dest_scan, src_scan, width * dest_Bpp); return; } for (int col = 0; col < width; col++) { @@ -3386,7 +3386,7 @@ void ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format, int palsize = 1 << (src_format & 0xff); pDestPalette = FX_Alloc(uint32_t, palsize); if (isDstCmyk == isSrcCmyk) { - FXSYS_memcpy(pDestPalette, pSrcPalette, palsize * sizeof(uint32_t)); + memcpy(pDestPalette, pSrcPalette, palsize * sizeof(uint32_t)); } else { for (int i = 0; i < palsize; i++) { FX_CMYK cmyk = pSrcPalette[i]; diff --git a/core/fxge/dib/fx_dib_convert.cpp b/core/fxge/dib/fx_dib_convert.cpp index d3cff24326..17eae7e3af 100644 --- a/core/fxge/dib/fx_dib_convert.cpp +++ b/core/fxge/dib/fx_dib_convert.cpp @@ -155,7 +155,7 @@ bool ConvertBuffer_1bppMask2Gray(uint8_t* dest_buf, reset_gray = 0x00; for (int row = 0; row < height; row++) { uint8_t* dest_scan = dest_buf + row * dest_pitch; - FXSYS_memset(dest_scan, reset_gray, width); + memset(dest_scan, reset_gray, width); const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row); for (int col = src_left; col < src_left + width; col++) { if (src_scan[col / 8] & (1 << (7 - col % 8))) { @@ -177,7 +177,7 @@ bool ConvertBuffer_8bppMask2Gray(uint8_t* dest_buf, for (int row = 0; row < height; row++) { uint8_t* dest_scan = dest_buf + row * dest_pitch; const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left; - FXSYS_memcpy(dest_scan, src_scan, width); + memcpy(dest_scan, src_scan, width); } return true; } @@ -217,7 +217,7 @@ bool ConvertBuffer_1bppPlt2Gray(uint8_t* dest_buf, for (int row = 0; row < height; row++) { uint8_t* dest_scan = dest_buf + row * dest_pitch; - FXSYS_memset(dest_scan, gray[0], width); + memset(dest_scan, gray[0], width); const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row); for (int col = src_left; col < src_left + width; col++) { if (src_scan[col / 8] & (1 << (7 - col % 8))) { @@ -313,7 +313,7 @@ void ConvertBuffer_IndexCopy(uint8_t* dest_buf, if (pSrcBitmap->GetBPP() == 1) { for (int row = 0; row < height; row++) { uint8_t* dest_scan = dest_buf + row * dest_pitch; - FXSYS_memset(dest_scan, 0, width); + memset(dest_scan, 0, width); const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row); for (int col = src_left; col < src_left + width; col++) { if (src_scan[col / 8] & (1 << (7 - col % 8))) { @@ -327,7 +327,7 @@ void ConvertBuffer_IndexCopy(uint8_t* dest_buf, uint8_t* dest_scan = dest_buf + row * dest_pitch; const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left; - FXSYS_memcpy(dest_scan, src_scan, width); + memcpy(dest_scan, src_scan, width); } } } @@ -355,7 +355,7 @@ bool ConvertBuffer_Plt2PltRgb8(uint8_t* dest_buf, dst_plt[i] = FXARGB_MAKE(0xff, r, g, b); } } else { - FXSYS_memcpy(dst_plt, src_plt, plt_size * 4); + memcpy(dst_plt, src_plt, plt_size * 4); } return true; } @@ -418,7 +418,7 @@ bool ConvertBuffer_Rgb2PltRgb8(uint8_t* dest_buf, } } } - FXSYS_memcpy(dst_plt, pPalette, sizeof(uint32_t) * 256); + memcpy(dst_plt, pPalette, sizeof(uint32_t) * 256); return true; } @@ -587,7 +587,7 @@ bool ConvertBuffer_24bppRgb2Rgb24( uint8_t* dest_scan = dest_buf + row * dest_pitch; const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left * 3; - FXSYS_memcpy(dest_scan, src_scan, width * 3); + memcpy(dest_scan, src_scan, width * 3); } return true; } diff --git a/core/fxge/dib/fx_dib_engine.cpp b/core/fxge/dib/fx_dib_engine.cpp index 9a5a7c1351..a232142681 100644 --- a/core/fxge/dib/fx_dib_engine.cpp +++ b/core/fxge/dib/fx_dib_engine.cpp @@ -274,7 +274,7 @@ CStretchEngine::CStretchEngine(IFX_ScanlineComposer* pDestBitmap, return; } if (dest_format == FXDIB_Rgb32) { - FXSYS_memset(m_pDestScanline, 255, size); + memset(m_pDestScanline, 255, size); } m_InterPitch = (m_DestClip.Width() * m_DestBpp + 31) / 32 * 4; m_ExtraMaskPitch = (m_DestClip.Width() * 8 + 31) / 32 * 4; diff --git a/core/fxge/ge/cfx_facecache.cpp b/core/fxge/ge/cfx_facecache.cpp index 0e9e40135a..69be8a1535 100644 --- a/core/fxge/ge/cfx_facecache.cpp +++ b/core/fxge/ge/cfx_facecache.cpp @@ -57,8 +57,8 @@ void ContrastAdjust(uint8_t* pDataIn, if (temp == 0 || temp == 255) { int rowbytes = std::min(abs(nSrcRowBytes), nDstRowBytes); for (row = 0; row < nHeight; row++) { - FXSYS_memcpy(pDataOut + row * nDstRowBytes, pDataIn + row * nSrcRowBytes, - rowbytes); + memcpy(pDataOut + row * nDstRowBytes, pDataIn + row * nSrcRowBytes, + rowbytes); } return; } @@ -206,14 +206,14 @@ CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(const CFX_Font* pFont, } } } else { - FXSYS_memset(pDestBuf, 0, dest_pitch * bmheight); + memset(pDestBuf, 0, dest_pitch * bmheight); if (anti_alias == FXFT_RENDER_MODE_MONO && FXFT_Get_Bitmap_PixelMode(FXFT_Get_Glyph_Bitmap(m_Face)) == FXFT_PIXEL_MODE_MONO) { int rowbytes = abs(src_pitch) > dest_pitch ? dest_pitch : abs(src_pitch); for (int row = 0; row < bmheight; row++) { - FXSYS_memcpy(pDestBuf + row * dest_pitch, pSrcBuf + row * src_pitch, - rowbytes); + memcpy(pDestBuf + row * dest_pitch, pSrcBuf + row * src_pitch, + rowbytes); } } else { ContrastAdjust(pSrcBuf, pDestBuf, bmwidth, bmheight, src_pitch, diff --git a/core/fxge/ge/cfx_fontmapper.cpp b/core/fxge/ge/cfx_fontmapper.cpp index e04e581434..9b2e1aa583 100644 --- a/core/fxge/ge/cfx_fontmapper.cpp +++ b/core/fxge/ge/cfx_fontmapper.cpp @@ -280,7 +280,7 @@ CFX_FontMapper::CFX_FontMapper(CFX_FontMgr* mgr) : m_bListLoaded(false), m_pFontMgr(mgr) { m_MMFaces[0] = nullptr; m_MMFaces[1] = nullptr; - FXSYS_memset(m_FoxitFaces, 0, sizeof(m_FoxitFaces)); + memset(m_FoxitFaces, 0, sizeof(m_FoxitFaces)); } CFX_FontMapper::~CFX_FontMapper() { diff --git a/core/fxge/ge/cfx_graphstatedata.cpp b/core/fxge/ge/cfx_graphstatedata.cpp index 8c5508f2f2..82fede176a 100644 --- a/core/fxge/ge/cfx_graphstatedata.cpp +++ b/core/fxge/ge/cfx_graphstatedata.cpp @@ -34,7 +34,7 @@ void CFX_GraphStateData::Copy(const CFX_GraphStateData& src) { m_LineWidth = src.m_LineWidth; if (m_DashCount) { m_DashArray = FX_Alloc(float, m_DashCount); - FXSYS_memcpy(m_DashArray, src.m_DashArray, m_DashCount * sizeof(float)); + memcpy(m_DashArray, src.m_DashArray, m_DashCount * sizeof(float)); } } diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp index 1dc8ab2c7b..81ca95fbe8 100644 --- a/core/fxge/skia/fx_skia_device.cpp +++ b/core/fxge/skia/fx_skia_device.cpp @@ -1753,11 +1753,11 @@ bool CFX_SkiaDeviceDriver::DrawShading(const CPDF_ShadingPattern* pPattern, SkPoint tempCubics[4]; for (int i = 0; i < (int)SK_ARRAY_COUNT(tempCubics); i++) tempCubics[i] = cubics[(flag * 3 + i) % 12]; - FXSYS_memcpy(cubics, tempCubics, sizeof(tempCubics)); + memcpy(cubics, tempCubics, sizeof(tempCubics)); SkColor tempColors[2]; tempColors[0] = colors[flag]; tempColors[1] = colors[(flag + 1) % 4]; - FXSYS_memcpy(colors, tempColors, sizeof(tempColors)); + memcpy(colors, tempColors, sizeof(tempColors)); } for (int i = iStartPoint; i < (int)SK_ARRAY_COUNT(cubics); i++) { CFX_PointF point = stream.ReadCoords(); diff --git a/core/fxge/win32/cfx_psrenderer.cpp b/core/fxge/win32/cfx_psrenderer.cpp index 40c643ea14..46af33710c 100644 --- a/core/fxge/win32/cfx_psrenderer.cpp +++ b/core/fxge/win32/cfx_psrenderer.cpp @@ -260,8 +260,8 @@ void CFX_PSRenderer::SetGraphState(const CFX_GraphStateData* pGraphState) { } if (!m_bGraphStateSet || m_CurGraphState.m_DashCount != pGraphState->m_DashCount || - FXSYS_memcmp(m_CurGraphState.m_DashArray, pGraphState->m_DashArray, - sizeof(float) * m_CurGraphState.m_DashCount)) { + memcmp(m_CurGraphState.m_DashArray, pGraphState->m_DashArray, + sizeof(float) * m_CurGraphState.m_DashCount)) { buf << "["; for (int i = 0; i < pGraphState->m_DashCount; ++i) { buf << pGraphState->m_DashArray[i] << " "; @@ -392,7 +392,7 @@ bool CFX_PSRenderer::DrawDIBits(const CFX_RetainPtr<CFX_DIBSource>& pSource, uint8_t* src_buf = FX_Alloc(uint8_t, src_size); for (int row = 0; row < height; row++) { const uint8_t* src_scan = pSource->GetScanline(row); - FXSYS_memcpy(src_buf + row * pitch, src_scan, pitch); + memcpy(src_buf + row * pitch, src_scan, pitch); } std::unique_ptr<uint8_t, FxFreeDeleter> output_buf; uint32_t output_size; @@ -471,7 +471,7 @@ bool CFX_PSRenderer::DrawDIBits(const CFX_RetainPtr<CFX_DIBSource>& pSource, src_scan += 3; } } else { - FXSYS_memcpy(dest_scan, src_scan, src_pitch); + memcpy(dest_scan, src_scan, src_pitch); } } uint8_t* compressed_buf; diff --git a/core/fxge/win32/cpsoutput.cpp b/core/fxge/win32/cpsoutput.cpp index 24df15226b..7a8434ec33 100644 --- a/core/fxge/win32/cpsoutput.cpp +++ b/core/fxge/win32/cpsoutput.cpp @@ -29,7 +29,7 @@ void CPSOutput::OutputPS(const char* str, int len) { char buffer[1026]; int send_len = std::min(len, 1024); *(reinterpret_cast<uint16_t*>(buffer)) = send_len; - FXSYS_memcpy(buffer + 2, str + sent_len, send_len); + memcpy(buffer + 2, str + sent_len, send_len); // TODO(thestig/rbpotter): Do PASSTHROUGH for non-Chromium usage. // ExtEscape(m_hDC, PASSTHROUGH, send_len + 2, buffer, 0, nullptr); diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp index de17c0d0b5..a27ac6fbd2 100644 --- a/core/fxge/win32/fx_win32_device.cpp +++ b/core/fxge/win32/fx_win32_device.cpp @@ -446,7 +446,7 @@ void CFX_Win32FontInfo::AddInstalledFont(const LOGFONTA* plf, bool CFX_Win32FontInfo::EnumFontList(CFX_FontMapper* pMapper) { m_pMapper = pMapper; LOGFONTA lf; - FXSYS_memset(&lf, 0, sizeof(LOGFONTA)); + memset(&lf, 0, sizeof(LOGFONTA)); lf.lfCharSet = FXFONT_DEFAULT_CHARSET; lf.lfFaceName[0] = 0; lf.lfPitchAndFamily = 0; @@ -879,7 +879,7 @@ bool CGdiDeviceDriver::GDI_StretchBitMask( BITMAPINFOHEADER bmiHeader; uint32_t bmiColors[2]; } bmi; - FXSYS_memset(&bmi.bmiHeader, 0, sizeof(BITMAPINFOHEADER)); + memset(&bmi.bmiHeader, 0, sizeof(BITMAPINFOHEADER)); bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmi.bmiHeader.biBitCount = 1; bmi.bmiHeader.biCompression = BI_RGB; @@ -1180,7 +1180,7 @@ bool CGdiDisplayDriver::GetDIBits(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap, BitBlt(hDCMemory, 0, 0, width, height, m_hDC, left, top, SRCCOPY); SelectObject(hDCMemory, holdbmp); BITMAPINFO bmi; - FXSYS_memset(&bmi, 0, sizeof bmi); + memset(&bmi, 0, sizeof bmi); bmi.bmiHeader.biSize = sizeof bmi.bmiHeader; bmi.bmiHeader.biBitCount = pBitmap->GetBPP(); bmi.bmiHeader.biHeight = -height; diff --git a/core/fxge/win32/fx_win32_dib.cpp b/core/fxge/win32/fx_win32_dib.cpp index 9815457bbd..f2c47265f7 100644 --- a/core/fxge/win32/fx_win32_dib.cpp +++ b/core/fxge/win32/fx_win32_dib.cpp @@ -19,7 +19,7 @@ CFX_ByteString CFX_WindowsDIB::GetBitmapInfo( len += sizeof(DWORD) * (int)(1 << pBitmap->GetBPP()); } BITMAPINFOHEADER* pbmih = (BITMAPINFOHEADER*)result.GetBuffer(len); - FXSYS_memset(pbmih, 0, sizeof(BITMAPINFOHEADER)); + memset(pbmih, 0, sizeof(BITMAPINFOHEADER)); pbmih->biSize = sizeof(BITMAPINFOHEADER); pbmih->biBitCount = pBitmap->GetBPP(); pbmih->biCompression = BI_RGB; @@ -70,15 +70,15 @@ CFX_RetainPtr<CFX_DIBitmap> _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi, if (!pBitmap->Create(width, height, format)) return nullptr; - FXSYS_memcpy(pBitmap->GetBuffer(), pData, pitch * height); + memcpy(pBitmap->GetBuffer(), pData, pitch * height); if (bBottomUp) { uint8_t* temp_buf = FX_Alloc(uint8_t, pitch); int top = 0, bottom = height - 1; while (top < bottom) { - FXSYS_memcpy(temp_buf, pBitmap->GetBuffer() + top * pitch, pitch); - FXSYS_memcpy(pBitmap->GetBuffer() + top * pitch, - pBitmap->GetBuffer() + bottom * pitch, pitch); - FXSYS_memcpy(pBitmap->GetBuffer() + bottom * pitch, temp_buf, pitch); + memcpy(temp_buf, pBitmap->GetBuffer() + top * pitch, pitch); + memcpy(pBitmap->GetBuffer() + top * pitch, + pBitmap->GetBuffer() + bottom * pitch, pitch); + memcpy(pBitmap->GetBuffer() + bottom * pitch, temp_buf, pitch); top++; bottom--; } @@ -189,7 +189,7 @@ CFX_RetainPtr<CFX_DIBitmap> CFX_WindowsDIB::LoadDIBitmap( CFX_WindowsDIB::CFX_WindowsDIB(HDC hDC, int width, int height) { Create(width, height, FXDIB_Rgb, (uint8_t*)1); BITMAPINFOHEADER bmih; - FXSYS_memset(&bmih, 0, sizeof bmih); + memset(&bmih, 0, sizeof bmih); bmih.biSize = sizeof bmih; bmih.biBitCount = 24; bmih.biHeight = -height; diff --git a/core/fxge/win32/fx_win32_gdipext.cpp b/core/fxge/win32/fx_win32_gdipext.cpp index 41f9ba55ad..6a3527f393 100644 --- a/core/fxge/win32/fx_win32_gdipext.cpp +++ b/core/fxge/win32/fx_win32_gdipext.cpp @@ -1297,7 +1297,7 @@ class GpStream final : public IStream { } bytes_left = m_InterStream.GetLength() - m_ReadPos; bytes_out = std::min(pdfium::base::checked_cast<size_t>(cb), bytes_left); - FXSYS_memcpy(Output, m_InterStream.GetBuffer() + m_ReadPos, bytes_out); + memcpy(Output, m_InterStream.GetBuffer() + m_ReadPos, bytes_out); m_ReadPos += (int32_t)bytes_out; if (pcbRead) { *pcbRead = (ULONG)bytes_out; @@ -1508,11 +1508,11 @@ CFX_RetainPtr<CFX_DIBitmap> CGdiplusExt::LoadDIBitmap(WINDIB_Open_Args_ args) { int dest_pitch = (width * pInfo->pbmi->bmiHeader.biBitCount + 31) / 32 * 4; LPBYTE pData = FX_Alloc2D(BYTE, dest_pitch, height); if (dest_pitch == pInfo->Stride) { - FXSYS_memcpy(pData, pInfo->pScan0, dest_pitch * height); + memcpy(pData, pInfo->pScan0, dest_pitch * height); } else { for (int i = 0; i < height; i++) { - FXSYS_memcpy(pData + dest_pitch * i, pInfo->pScan0 + pInfo->Stride * i, - dest_pitch); + memcpy(pData + dest_pitch * i, pInfo->pScan0 + pInfo->Stride * i, + dest_pitch); } } CFX_RetainPtr<CFX_DIBitmap> pDIBitmap = _FX_WindowsDIB_LoadFromBuf( |