Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Issue 1473753004: Merge to master: Take Jun's UTF16LE patches. (Closed)

Created:
5 years ago by Tom Sepez
Modified:
5 years ago
Reviewers:
Lei Zhang, jun_fang
CC:
pdfium-reviews_googlegroups.com, Lei Zhang, Oliver Chang
Base URL:
https://pdfium.googlesource.com/pdfium.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Merge to master: Take Jun's UTF16LE patches. (cherry picked from commit 8d89e65897d8b6cf7899e7a82d9d381c3ad327cb) (cherry picked from commit c70b19aad245fb1ed39bf8c264d991555f4c5a58) BUG=pdfium:275 TBR=jun_fang@foxitsoftware.com Committed: https://pdfium.googlesource.com/pdfium/+/c3e4ae5fe5067723b58a2029a95c6411c92bed15

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+43 lines, -48 lines) Patch
M core/src/fxcrt/fx_basic_wstring.cpp View 1 chunk +6 lines, -8 lines 0 comments Download
M core/src/fxcrt/fx_basic_wstring_unittest.cpp View 1 chunk +6 lines, -6 lines 0 comments Download
M fpdfsdk/src/fpdfdoc_embeddertest.cpp View 2 chunks +2 lines, -2 lines 0 comments Download
M fpdfsdk/src/fpdftext_embeddertest.cpp View 4 chunks +19 lines, -22 lines 0 comments Download
M fpdfsdk/src/fpdfview_embeddertest.cpp View 5 chunks +10 lines, -10 lines 0 comments Download

Messages

Total messages: 10 (2 generated)
Tom Sepez
TBR, trivial conflicts.
5 years ago (2015-11-25 23:37:45 UTC) #1
Tom Sepez
Committed patchset #1 (id:1) manually as c3e4ae5fe5067723b58a2029a95c6411c92bed15 (presubmit successful).
5 years ago (2015-11-25 23:38:00 UTC) #3
Oliver Chang
On 2015/11/25 at 23:38:00, tsepez wrote: > Committed patchset #1 (id:1) manually as c3e4ae5fe5067723b58a2029a95c6411c92bed15 (presubmit ...
5 years ago (2015-12-08 00:21:49 UTC) #4
Oliver Chang
On 2015/12/08 at 00:21:49, Oliver Chang wrote: > On 2015/11/25 at 23:38:00, tsepez wrote: > ...
5 years ago (2015-12-08 00:35:23 UTC) #5
Oliver Chang
On 2015/12/08 at 00:35:23, Oliver Chang wrote: > On 2015/12/08 at 00:21:49, Oliver Chang wrote: ...
5 years ago (2015-12-08 00:36:20 UTC) #6
Lei Zhang
Looks like we have some changes that affects the public API? We should update the ...
5 years ago (2015-12-08 01:19:03 UTC) #8
jun_fang
On 2015/12/08 01:19:03, Lei Zhang wrote: > Looks like we have some changes that affects ...
5 years ago (2015-12-08 02:58:04 UTC) #9
jun_fang
5 years ago (2015-12-08 03:00:26 UTC) #10
Message was sent while issue was closed.
On 2015/12/08 02:58:04, jun_fang wrote:
> On 2015/12/08 01:19:03, Lei Zhang wrote:
> > Looks like we have some changes that affects the public API? We should
update
> > the API docs, and fix the affected sites in Chromium's pdf/ in the CL that
> does
> > the DEPS roll? We should also mention this on various pdfium mailing lists.
> 
> Hi Lei,
> 
> You are right. FPDFBookmark_GetTitle returns the number of bytes after 
> my UTF16LE patches. Before these patches, it returned including trailing
zeros.
> We should go through all places where UTF16LE_Encode is called.
> 
> // Function: FPDFBookmark_GetTitle
> //          Get title of a bookmark.
> // Parameters:
> //          bookmark    -   Handle to the bookmark.
> //          buffer      -   Buffer for the title. Can be NULL.
> //          buflen      -   The length of the buffer in bytes. Can be 0.
> // Return value:
> //          Number of bytes the title consumes, including trailing zeros.

In Pdfium_engine.cc, FPDFBookmark_GetTitle's return is treated as buffer size.
After my patches, it should be the number of bytes without trailing zeros.

pp::VarDictionary TraverseBookmarks(FPDF_DOCUMENT doc,
                                    FPDF_BOOKMARK bookmark,
                                    unsigned int depth) {
  pp::VarDictionary dict;
  base::string16 title;
  unsigned long buffer_size = FPDFBookmark_GetTitle(bookmark, NULL, 0);
  if (buffer_size > 0) {
    PDFiumAPIStringBufferSizeInBytesAdapter<base::string16> api_string_adapter(
        &title, buffer_size, true);
    api_string_adapter.Close(FPDFBookmark_GetTitle(
        bookmark, api_string_adapter.GetData(), buffer_size));
  }
  dict.Set(pp::Var("title"), pp::Var(base::UTF16ToUTF8(title)));

Powered by Google App Engine
This is Rietveld 408576698