summaryrefslogtreecommitdiff
path: root/core/fxcrt/fx_extension.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-04-07 16:58:00 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-04-10 16:33:54 +0000
commitec8ff7d258ef25f7e3193572aeef220ff86784f0 (patch)
tree1c72cae7e3b43908840c9a6881b239850933680b /core/fxcrt/fx_extension.cpp
parent84b596d64aab8f8c6dd6145e9c210b145fc5631a (diff)
downloadpdfium-ec8ff7d258ef25f7e3193572aeef220ff86784f0.tar.xz
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 <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fxcrt/fx_extension.cpp')
-rw-r--r--core/fxcrt/fx_extension.cpp14
1 files changed, 7 insertions, 7 deletions
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<const uint8_t*>(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