From 677b8fffb0c76c009ad808ed91a27738e5420254 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 11 Jun 2015 12:05:04 -0700 Subject: Kill FXSYS_mem{cpy,cmp,set.move}{32,8}. At one point in time, it may have made sense to indicate the expected alignment of the memory you're about to copy, but that was last century. The compiler will take care of it just fine. I stopped short of removing the FXSYS_ wrapper macros entirely. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1179693003. --- core/src/fpdfapi/fpdf_page/fpdf_page.cpp | 4 ++-- core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp | 10 +++++----- core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp | 2 +- core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp | 18 +++++++++--------- core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp | 14 +++++++------- core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp | 8 ++++---- core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp | 2 +- 7 files changed, 29 insertions(+), 29 deletions(-) (limited to 'core/src/fpdfapi/fpdf_page') diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp index 688066e3a3..8c6de8e341 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp @@ -586,9 +586,9 @@ void CPDF_TextObject::SetData(int nChars, FX_DWORD* pCharCodes, FX_FLOAT* pCharP m_pCharCodes = (FX_DWORD*)(uintptr_t) * pCharCodes; } else { m_pCharCodes = FX_Alloc(FX_DWORD, nChars); - FXSYS_memcpy32(m_pCharCodes, pCharCodes, sizeof(FX_DWORD)*nChars); + FXSYS_memcpy(m_pCharCodes, pCharCodes, sizeof(FX_DWORD)*nChars); m_pCharPos = FX_Alloc(FX_FLOAT, nChars - 1); - FXSYS_memcpy32(m_pCharPos, pCharPos, sizeof(FX_FLOAT) * (nChars - 1)); + FXSYS_memcpy(m_pCharPos, pCharPos, sizeof(FX_FLOAT) * (nChars - 1)); } RecalcPositionData(); } diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp index dc3d454656..8dd1359846 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp @@ -526,7 +526,7 @@ CPDF_IccProfile::CPDF_IccProfile(const uint8_t* pData, FX_DWORD dwSize): m_pTransform(NULL), m_nSrcComponents(0) { - if (dwSize == 3144 && FXSYS_memcmp32(pData + 0x190, "sRGB IEC61966-2.1", 17) == 0) { + if (dwSize == 3144 && FXSYS_memcmp(pData + 0x190, "sRGB IEC61966-2.1", 17) == 0) { m_bsRGB = TRUE; m_nSrcComponents = 3; } @@ -1351,7 +1351,7 @@ void CPDF_Color::SetValue(FX_FLOAT* comps) return; } if (m_pCS->GetFamily() != PDFCS_PATTERN) { - FXSYS_memcpy32(m_pBuffer, comps, m_pCS->CountComponents() * sizeof(FX_FLOAT)); + FXSYS_memcpy(m_pBuffer, comps, m_pCS->CountComponents() * sizeof(FX_FLOAT)); } } void CPDF_Color::SetValue(CPDF_Pattern* pPattern, FX_FLOAT* comps, int ncomps) @@ -1377,7 +1377,7 @@ void CPDF_Color::SetValue(CPDF_Pattern* pPattern, FX_FLOAT* comps, int ncomps) pvalue->m_nComps = ncomps; pvalue->m_pPattern = pPattern; if (ncomps) { - FXSYS_memcpy32(pvalue->m_Comps, comps, ncomps * sizeof(FX_FLOAT)); + FXSYS_memcpy(pvalue->m_Comps, comps, ncomps * sizeof(FX_FLOAT)); } pvalue->m_pCountedPattern = NULL; if (pPattern && pPattern->m_pDocument) @@ -1403,7 +1403,7 @@ void CPDF_Color::Copy(const CPDF_Color* pSrc) return; } m_pBuffer = m_pCS->CreateBuf(); - FXSYS_memcpy32(m_pBuffer, pSrc->m_pBuffer, m_pCS->GetBufSize()); + FXSYS_memcpy(m_pBuffer, pSrc->m_pBuffer, m_pCS->GetBufSize()); if (m_pCS->GetFamily() == PDFCS_PATTERN) { PatternValue* pvalue = (PatternValue*)m_pBuffer; if (pvalue->m_pPattern && pvalue->m_pPattern->m_pDocument) { @@ -1453,5 +1453,5 @@ FX_BOOL CPDF_Color::IsEqual(const CPDF_Color& other) const if (m_pCS != other.m_pCS || m_pCS == NULL) { return FALSE; } - return FXSYS_memcmp32(m_pBuffer, other.m_pBuffer, m_pCS->GetBufSize()) == 0; + return FXSYS_memcmp(m_pBuffer, other.m_pBuffer, m_pCS->GetBufSize()) == 0; } diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp index 2cfb02869c..f1a8433f3c 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp @@ -873,7 +873,7 @@ FX_BOOL CPDF_Function::Init(CPDF_Object* pObj) if (m_pRanges && m_nOutputs > (int)old_outputs) { m_pRanges = FX_Realloc(FX_FLOAT, m_pRanges, m_nOutputs * 2); if (m_pRanges) { - FXSYS_memset32(m_pRanges + (old_outputs * 2), 0, sizeof(FX_FLOAT) * (m_nOutputs - old_outputs) * 2); + FXSYS_memset(m_pRanges + (old_outputs * 2), 0, sizeof(FX_FLOAT) * (m_nOutputs - old_outputs) * 2); } } return ret; diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp index 8752acf536..178db75cf8 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp @@ -61,7 +61,7 @@ CPDF_ClipPathData::CPDF_ClipPathData(const CPDF_ClipPathData& src) m_pPathList[i] = src.m_pPathList[i]; } m_pTypeList = FX_Alloc(uint8_t, alloc_size); - FXSYS_memcpy32(m_pTypeList, src.m_pTypeList, m_PathCount); + FXSYS_memcpy(m_pTypeList, src.m_pTypeList, m_PathCount); } else { m_pPathList = NULL; m_pTypeList = NULL; @@ -156,7 +156,7 @@ void CPDF_ClipPath::AppendPath(CPDF_Path path, int type, FX_BOOL bAutoMerge) } delete[] pData->m_pPathList; uint8_t* pNewType = FX_Alloc(uint8_t, pData->m_PathCount + 8); - FXSYS_memcpy32(pNewType, pData->m_pTypeList, pData->m_PathCount); + FXSYS_memcpy(pNewType, pData->m_pTypeList, pData->m_PathCount); if (pData->m_pTypeList) { FX_Free(pData->m_pTypeList); } @@ -178,7 +178,7 @@ void CPDF_ClipPath::DeletePath(int index) pData->m_pPathList[i] = pData->m_pPathList[i + 1]; } pData->m_pPathList[pData->m_PathCount - 1].SetNull(); - FXSYS_memmove32(pData->m_pTypeList + index, pData->m_pTypeList + index + 1, pData->m_PathCount - index - 1); + FXSYS_memmove(pData->m_pTypeList + index, pData->m_pTypeList + index + 1, pData->m_PathCount - index - 1); pData->m_PathCount --; } #define FPDF_CLIPPATH_MAX_TEXTS 1024 @@ -193,7 +193,7 @@ void CPDF_ClipPath::AppendTexts(CPDF_TextObject** pTexts, int count) } CPDF_TextObject** pNewList = FX_Alloc(CPDF_TextObject*, pData->m_TextCount + count + 1); if (pData->m_pTextList) { - FXSYS_memcpy32(pNewList, pData->m_pTextList, pData->m_TextCount * sizeof(CPDF_TextObject*)); + FXSYS_memcpy(pNewList, pData->m_pTextList, pData->m_TextCount * sizeof(CPDF_TextObject*)); FX_Free(pData->m_pTextList); } pData->m_pTextList = pNewList; @@ -294,7 +294,7 @@ CPDF_TextStateData::CPDF_TextStateData(const CPDF_TextStateData& src) if (this == &src) { return; } - FXSYS_memcpy32(this, &src, sizeof(CPDF_TextStateData)); + FXSYS_memcpy(this, &src, sizeof(CPDF_TextStateData)); if (m_pDocument && m_pFont) { m_pFont = m_pDocument->GetPageData()->GetFont(m_pFont->GetFontDict(), FALSE); } @@ -348,7 +348,7 @@ FX_FLOAT CPDF_TextState::GetShearAngle() const } CPDF_GeneralStateData::CPDF_GeneralStateData() { - FXSYS_memset32(this, 0, sizeof(CPDF_GeneralStateData)); + FXSYS_memset(this, 0, sizeof(CPDF_GeneralStateData)); FXSYS_strcpy((FX_CHAR*)m_BlendMode, "Normal"); m_StrokeAlpha = 1.0f; m_FillAlpha = 1.0f; @@ -357,7 +357,7 @@ CPDF_GeneralStateData::CPDF_GeneralStateData() } CPDF_GeneralStateData::CPDF_GeneralStateData(const CPDF_GeneralStateData& src) { - FXSYS_memcpy32(this, &src, sizeof(CPDF_GeneralStateData)); + FXSYS_memcpy(this, &src, sizeof(CPDF_GeneralStateData)); if (src.m_pTransferFunc && src.m_pTransferFunc->m_pPDFDoc) { CPDF_DocRenderData* pDocCache = src.m_pTransferFunc->m_pPDFDoc->GetRenderData(); if (!pDocCache) { @@ -422,7 +422,7 @@ void CPDF_GeneralStateData::SetBlendMode(const CFX_ByteStringC& blend_mode) if (blend_mode.GetLength() > 15) { return; } - FXSYS_memcpy32(m_BlendMode, blend_mode.GetPtr(), blend_mode.GetLength()); + FXSYS_memcpy(m_BlendMode, blend_mode.GetPtr(), blend_mode.GetLength()); m_BlendMode[blend_mode.GetLength()] = 0; m_BlendType = ::GetBlendType(blend_mode); } @@ -553,7 +553,7 @@ void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS, CPDF_StreamContentParser case FXBSTR_ID('S', 'M', 'a', 's'): if (pObject && pObject->GetType() == PDFOBJ_DICTIONARY) { pGeneralState->m_pSoftMask = pObject; - FXSYS_memcpy32(pGeneralState->m_SMaskMatrix, &pParser->m_pCurStates->m_CTM, sizeof(CPDF_Matrix)); + FXSYS_memcpy(pGeneralState->m_SMaskMatrix, &pParser->m_pCurStates->m_CTM, sizeof(CPDF_Matrix)); } else { pGeneralState->m_pSoftMask = NULL; } diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp index ebe75484e0..87605470b0 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp @@ -20,7 +20,7 @@ CPDF_StreamContentParser::CPDF_StreamContentParser() m_PathCurrentX = m_PathCurrentY = 0.0f; m_bResourceMissing = FALSE; m_bColored = FALSE; - FXSYS_memset32(m_Type3Data, 0, sizeof(FX_FLOAT) * 6); + FXSYS_memset(m_Type3Data, 0, sizeof(FX_FLOAT) * 6); m_ParamCount = 0; m_ParamStartPos = 0; m_bAbort = FALSE; @@ -122,11 +122,11 @@ void CPDF_StreamContentParser::AddNameParam(const FX_CHAR* name, int len) } else { m_ParamBuf1[index].m_Type = PDFOBJ_NAME; if (FXSYS_memchr(name, '#', len) == NULL) { - FXSYS_memcpy32(m_ParamBuf1[index].m_Name.m_Buffer, name, len); + FXSYS_memcpy(m_ParamBuf1[index].m_Name.m_Buffer, name, len); m_ParamBuf1[index].m_Name.m_Len = len; } else { CFX_ByteString str = PDF_NameDecode(CFX_ByteStringC(name, len)); - FXSYS_memcpy32(m_ParamBuf1[index].m_Name.m_Buffer, str.c_str(), str.GetLength()); + FXSYS_memcpy(m_ParamBuf1[index].m_Name.m_Buffer, str.c_str(), str.GetLength()); m_ParamBuf1[index].m_Name.m_Len = str.GetLength(); } } @@ -442,7 +442,7 @@ static CFX_ByteStringC _PDF_FindFullName(const _FX_BSTR* table, int count, const { int i = 0; while (i < count) { - if (abbr.GetLength() == table[i + 1].m_Size && FXSYS_memcmp32(abbr.GetPtr(), table[i + 1].m_Ptr, abbr.GetLength()) == 0) { + if (abbr.GetLength() == table[i + 1].m_Size && FXSYS_memcmp(abbr.GetPtr(), table[i + 1].m_Ptr, abbr.GetLength()) == 0) { return CFX_ByteStringC(table[i].m_Ptr, table[i].m_Size); } i += 2; @@ -500,7 +500,7 @@ static CFX_ByteStringC _PDF_FindAbbrName(const _FX_BSTR* table, int count, const { int i = 0; while (i < count) { - if (fullName.GetLength() == table[i].m_Size && FXSYS_memcmp32(fullName.GetPtr(), table[i].m_Ptr, fullName.GetLength()) == 0) { + if (fullName.GetLength() == table[i].m_Size && FXSYS_memcmp(fullName.GetPtr(), table[i].m_Ptr, fullName.GetLength()) == 0) { return CFX_ByteStringC(table[i + 1].m_Ptr, table[i + 1].m_Size); } i += 2; @@ -1495,7 +1495,7 @@ void CPDF_StreamContentParser::AddPathPoint(FX_FLOAT x, FX_FLOAT y, int flag) int newsize = m_PathPointCount + 256; FX_PATHPOINT* pNewPoints = FX_Alloc(FX_PATHPOINT, newsize); if (m_PathAllocSize) { - FXSYS_memcpy32(pNewPoints, m_pPathPoints, m_PathAllocSize * sizeof(FX_PATHPOINT)); + FXSYS_memcpy(pNewPoints, m_pPathPoints, m_PathAllocSize * sizeof(FX_PATHPOINT)); FX_Free(m_pPathPoints); } m_pPathPoints = pNewPoints; @@ -1524,7 +1524,7 @@ void CPDF_StreamContentParser::AddPathObject(int FillType, FX_BOOL bStroke) CPDF_Path Path; CFX_PathData* pPathData = Path.New(); pPathData->SetPointCount(PathPointCount); - FXSYS_memcpy32(pPathData->GetPoints(), m_pPathPoints, sizeof(FX_PATHPOINT) * PathPointCount); + FXSYS_memcpy(pPathData->GetPoints(), m_pPathPoints, sizeof(FX_PATHPOINT) * PathPointCount); CFX_AffineMatrix matrix = m_pCurStates->m_CTM; matrix.Concat(m_mtContentToUser); if (bStroke || FillType) { diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp index ec2b69f70b..d829acb004 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp @@ -269,7 +269,7 @@ FX_DWORD _DecodeAllScanlines(ICodec_ScanlineDecoder* pDecoder, uint8_t*& dest_bu if (pLine == NULL) { break; } - FXSYS_memcpy32(dest_buf + row * pitch, pLine, pitch); + FXSYS_memcpy(dest_buf + row * pitch, pLine, pitch); } FX_DWORD srcoff = pDecoder->GetSrcOffset(); delete pDecoder; @@ -374,7 +374,7 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc, CPDF_Dicti OrigSize = m_Size - m_Pos; } pData = FX_Alloc(uint8_t, OrigSize); - FXSYS_memcpy32(pData, m_pBuf + m_Pos, OrigSize); + FXSYS_memcpy(pData, m_pBuf + m_Pos, OrigSize); dwStreamSize = OrigSize; m_Pos += OrigSize; } else { @@ -422,7 +422,7 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc, CPDF_Dicti } m_Pos = dwSavePos; pData = FX_Alloc(uint8_t, dwStreamSize); - FXSYS_memcpy32(pData, m_pBuf + m_Pos, dwStreamSize); + FXSYS_memcpy(pData, m_pBuf + m_Pos, dwStreamSize); m_Pos += dwStreamSize; } } @@ -1052,7 +1052,7 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause) m_pData = FX_Alloc(uint8_t, m_Size); FX_DWORD pos = 0; for (i = 0; i < m_nStreams; i ++) { - FXSYS_memcpy32(m_pData + pos, m_pStreamArray[i]->GetData(), m_pStreamArray[i]->GetSize()); + FXSYS_memcpy(m_pData + pos, m_pStreamArray[i]->GetData(), m_pStreamArray[i]->GetSize()); pos += m_pStreamArray[i]->GetSize() + 1; m_pData[pos - 1] = ' '; delete m_pStreamArray[i]; diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp index d23d75a25d..2aa66d725a 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp @@ -217,7 +217,7 @@ void CPDF_MeshStream::GetColor(FX_FLOAT& r, FX_FLOAT& g, FX_FLOAT& b) static const int kMaxResults = 8; FX_FLOAT result[kMaxResults]; int nResults; - FXSYS_memset32(result, 0, sizeof(result)); + FXSYS_memset(result, 0, sizeof(result)); for (FX_DWORD i = 0; i < m_nFuncs; i ++) { if (m_pFuncs[i] && m_pFuncs[i]->CountOutputs() <= kMaxResults) { m_pFuncs[i]->Call(color_value, 1, result, nResults); -- cgit v1.2.3