From ec8ff7d258ef25f7e3193572aeef220ff86784f0 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Fri, 7 Apr 2017 16:58:00 -0700 Subject: Fix bytestring passing conventions, part 2. Change pass by reference to const reference or pointer. Change-Id: Ic007f14e6569679a846980a96cc627eac4ecd5d6 Reviewed-on: https://pdfium-review.googlesource.com/3953 Commit-Queue: Tom Sepez Reviewed-by: Lei Zhang --- core/fxcrt/fx_extension.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'core/fxcrt/fx_extension.cpp') diff --git a/core/fxcrt/fx_extension.cpp b/core/fxcrt/fx_extension.cpp index f13922e2da..acdce048e0 100644 --- a/core/fxcrt/fx_extension.cpp +++ b/core/fxcrt/fx_extension.cpp @@ -638,24 +638,24 @@ void FX_Random_GenerateCrypto(uint32_t* pBuffer, int32_t iCount) { #ifdef PDF_ENABLE_XFA static const char gs_FX_pHexChars[] = "0123456789ABCDEF"; + void FX_GUID_CreateV4(FX_GUID* pGUID) { FX_Random_GenerateMT((uint32_t*)pGUID, 4); uint8_t& b = ((uint8_t*)pGUID)[6]; b = (b & 0x0F) | 0x40; } -void FX_GUID_ToString(const FX_GUID* pGUID, - CFX_ByteString& bsStr, - bool bSeparator) { + +CFX_ByteString FX_GUID_ToString(const FX_GUID* pGUID, bool bSeparator) { + CFX_ByteString bsStr; char* pBuf = bsStr.GetBuffer(40); - uint8_t b; for (int32_t i = 0; i < 16; i++) { - b = ((const uint8_t*)pGUID)[i]; + uint8_t b = reinterpret_cast(pGUID)[i]; *pBuf++ = gs_FX_pHexChars[b >> 4]; *pBuf++ = gs_FX_pHexChars[b & 0x0F]; - if (bSeparator && (i == 3 || i == 5 || i == 7 || i == 9)) { + if (bSeparator && (i == 3 || i == 5 || i == 7 || i == 9)) *pBuf++ = L'-'; } - } bsStr.ReleaseBuffer(bSeparator ? 36 : 32); + return bsStr; } #endif // PDF_ENABLE_XFA -- cgit v1.2.3