diff options
author | Lei Zhang <thestig@chromium.org> | 2017-12-15 15:51:52 -0800 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-01-09 19:20:58 +0000 |
commit | a88e30519ec0cca46c7fc36a14556eb8c1eae0c6 (patch) | |
tree | 66c6e4dc294965655b92a49190fe1e4a753a853a /fpdfsdk/fpdfview.cpp | |
parent | ef55c79650768a731c22038acd36b2a741706ed6 (diff) | |
download | pdfium-a88e30519ec0cca46c7fc36a14556eb8c1eae0c6.tar.xz |
Fix some nits in FPDF_BStr_Set().
Change-Id: I298c7013541cc4ee77bef2f1e7d07984ecfa1705
Reviewed-on: https://pdfium-review.googlesource.com/21490
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdfview.cpp')
-rw-r--r-- | fpdfsdk/fpdfview.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp index ad669614bb..aad29462cc 100644 --- a/fpdfsdk/fpdfview.cpp +++ b/fpdfsdk/fpdfview.cpp @@ -1407,19 +1407,14 @@ FPDF_EXPORT FPDF_RESULT FPDF_CALLCONV FPDF_BStr_Init(FPDF_BSTR* str) { FPDF_EXPORT FPDF_RESULT FPDF_CALLCONV FPDF_BStr_Set(FPDF_BSTR* str, FPDF_LPCSTR bstr, int length) { - if (!str) - return -1; - if (!bstr || !length) + if (!str || !bstr || !length) return -1; + if (length == -1) length = strlen(bstr); if (length == 0) { - if (str->str) { - FX_Free(str->str); - str->str = nullptr; - } - str->len = 0; + FPDF_BStr_Clear(str); return 0; } |