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

Issue 733693003: Getting rid of more (FX_LPCWSTR) casts and fixing two bugs revealed by this. (Closed)

Created:
6 years, 1 month ago by brucedawson
Modified:
6 years ago
Reviewers:
Tom Sepez, Bo Xu
CC:
pdfium-reviews_googlegroups.com
Base URL:
https://pdfium.googlesource.com/pdfium.git@master
Visibility:
Public.

Description

Getting rid of more (FX_LPCWSTR) casts and fixing two bugs revealed by this. Since casts to FX_LPCWSTR have been shown to hide bugs I tried removing more of them, targeting those places where a cast was used to force a conversion from CFX_WideString to FX_LPCWSTR, replacing these casts with calls to the newly added .c_str() function. This revealed two places where the cast was hiding a bug -- where ->c_str() was required instead! This removes ~33 FX_LPCWSTR casts and there are ~31 left, many of which will go away in some future change. Also includes this change: Removing unnecessary casts from wchar_t* to wchar_t*, by various names. Original patch from Bruce Dawson(brucedawson@chromium.org) R=bo_xu@foxitsoftware.com, tsepez@chromium.org Committed: https://pdfium.googlesource.com/pdfium/+/b69da0b96ffdad124efd1b48d51c617bb216a98e

Patch Set 1 #

Patch Set 2 : Merged latest changes including pdfium_test.cc fix. #

Total comments: 4

Patch Set 3 : Rebasing to latest origin/master. #

Total comments: 2

Patch Set 4 : Tweaking comments for implicit and explicit string conversions. #

Total comments: 2

Patch Set 5 : Tweaking comment based on Tom's feedback. #

Patch Set 6 : Updated to latest code -- fewer diffs now. #

Patch Set 7 : Simplified GetAttrValue to just assign *pValue and to share code. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+47 lines, -45 lines) Patch
M core/include/fxcrt/fx_string.h View 1 2 3 4 5 3 chunks +11 lines, -4 lines 0 comments Download
M core/src/fpdfapi/fpdf_font/fpdf_font.cpp View 1 chunk +1 line, -1 line 0 comments Download
M core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp View 2 chunks +3 lines, -3 lines 0 comments Download
M core/src/fpdfdoc/doc_form.cpp View 1 chunk +1 line, -1 line 0 comments Download
M core/src/fxcrt/fx_basic_bstring.cpp View 1 chunk +1 line, -1 line 0 comments Download
M core/src/fxcrt/fx_basic_buffer.cpp View 1 chunk +1 line, -1 line 0 comments Download
M core/src/fxcrt/fx_extension.cpp View 1 chunk +1 line, -1 line 0 comments Download
M core/src/fxcrt/fx_xml_parser.cpp View 1 2 3 4 5 6 1 chunk +2 lines, -7 lines 0 comments Download
M core/src/fxcrt/fxcrt_platforms.cpp View 1 chunk +1 line, -1 line 0 comments Download
M fpdfsdk/include/javascript/JS_Define.h View 1 2 3 4 5 4 chunks +5 lines, -5 lines 0 comments Download
M fpdfsdk/src/fsdk_baseform.cpp View 5 chunks +6 lines, -6 lines 0 comments Download
M fpdfsdk/src/javascript/Document.cpp View 2 chunks +2 lines, -2 lines 0 comments Download
M fpdfsdk/src/javascript/Field.cpp View 1 2 3 4 5 5 chunks +5 lines, -5 lines 0 comments Download
M fpdfsdk/src/javascript/PublicMethods.cpp View 5 chunks +5 lines, -5 lines 0 comments Download
M fpdfsdk/src/javascript/app.cpp View 1 chunk +1 line, -1 line 0 comments Download
M fpdfsdk/src/javascript/global.cpp View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 19 (1 generated)
Tom Sepez
Can you rebase this once your prior CL lands? It looks to be doing the ...
6 years, 1 month ago (2014-11-17 18:25:23 UTC) #2
brucedawson
On 2014/11/17 18:25:23, Tom Sepez wrote: > Can you rebase this once your prior CL ...
6 years, 1 month ago (2014-11-17 18:30:39 UTC) #3
Tom Sepez
https://codereview.chromium.org/733693003/diff/20001/core/include/fxcrt/fx_string.h File core/include/fxcrt/fx_string.h (right): https://codereview.chromium.org/733693003/diff/20001/core/include/fxcrt/fx_string.h#newcode649 core/include/fxcrt/fx_string.h:649: // Implicit conversion -- potentially risky Can we remove ...
6 years, 1 month ago (2014-11-17 18:31:38 UTC) #4
Tom Sepez
lgtm
6 years, 1 month ago (2014-11-17 18:33:01 UTC) #5
Tom Sepez
I think its better as two changes. The first one is essentially cleanup and is ...
6 years, 1 month ago (2014-11-17 18:34:38 UTC) #6
brucedawson
I commented on the comments. https://codereview.chromium.org/733693003/diff/20001/core/include/fxcrt/fx_string.h File core/include/fxcrt/fx_string.h (right): https://codereview.chromium.org/733693003/diff/20001/core/include/fxcrt/fx_string.h#newcode649 core/include/fxcrt/fx_string.h:649: // Implicit conversion -- ...
6 years, 1 month ago (2014-11-17 18:41:55 UTC) #7
Tom Sepez
https://codereview.chromium.org/733693003/diff/40001/core/src/fxcrt/fx_xml_parser.cpp File core/src/fxcrt/fx_xml_parser.cpp (right): https://codereview.chromium.org/733693003/diff/40001/core/src/fxcrt/fx_xml_parser.cpp#newcode673 core/src/fxcrt/fx_xml_parser.cpp:673: const CFX_WideString* pValue = m_AttrMap.Lookup(bsSpace, bsName); nit: some reason ...
6 years, 1 month ago (2014-11-17 18:43:15 UTC) #8
brucedawson
https://codereview.chromium.org/733693003/diff/40001/core/src/fxcrt/fx_xml_parser.cpp File core/src/fxcrt/fx_xml_parser.cpp (right): https://codereview.chromium.org/733693003/diff/40001/core/src/fxcrt/fx_xml_parser.cpp#newcode673 core/src/fxcrt/fx_xml_parser.cpp:673: const CFX_WideString* pValue = m_AttrMap.Lookup(bsSpace, bsName); On 2014/11/17 18:43:15, ...
6 years, 1 month ago (2014-11-17 18:52:02 UTC) #9
brucedawson
> Good also (I think) replace the assignment to attribute with: > > attribute = ...
6 years, 1 month ago (2014-11-17 19:06:13 UTC) #10
Tom Sepez
Still LGTM. https://codereview.chromium.org/733693003/diff/60001/core/include/fxcrt/fx_string.h File core/include/fxcrt/fx_string.h (right): https://codereview.chromium.org/733693003/diff/60001/core/include/fxcrt/fx_string.h#newcode643 core/include/fxcrt/fx_string.h:643: // Explicit conversion to raw string nit: ...
6 years, 1 month ago (2014-11-17 19:14:02 UTC) #11
brucedawson
Comment updated per Tom's suggestion. https://codereview.chromium.org/733693003/diff/60001/core/include/fxcrt/fx_string.h File core/include/fxcrt/fx_string.h (right): https://codereview.chromium.org/733693003/diff/60001/core/include/fxcrt/fx_string.h#newcode643 core/include/fxcrt/fx_string.h:643: // Explicit conversion to ...
6 years, 1 month ago (2014-11-17 19:34:14 UTC) #12
Bo Xu
On 2014/11/17 19:06:13, brucedawson wrote: > > Good also (I think) replace the assignment to ...
6 years, 1 month ago (2014-11-17 20:22:51 UTC) #13
brucedawson
On 2014/11/17 20:22:51, Bo Xu wrote: > On 2014/11/17 19:06:13, brucedawson wrote: > > > ...
6 years, 1 month ago (2014-11-17 23:41:27 UTC) #14
Bo Xu
On 2014/11/17 23:41:27, brucedawson wrote: > On 2014/11/17 20:22:51, Bo Xu wrote: > > On ...
6 years ago (2014-11-25 23:58:27 UTC) #15
brucedawson
I updated fx_xml_parser.cpp to simplify the code. The first version of GetAttrValue calls into the ...
6 years ago (2014-11-26 23:51:48 UTC) #16
brucedawson
On 2014/11/26 23:51:48, brucedawson wrote: > I updated fx_xml_parser.cpp to simplify the code. The first ...
6 years ago (2014-12-06 01:11:14 UTC) #17
Bo Xu
On 2014/12/06 01:11:14, brucedawson wrote: > On 2014/11/26 23:51:48, brucedawson wrote: > > I updated ...
6 years ago (2014-12-08 19:32:26 UTC) #18
brucedawson
6 years ago (2014-12-08 21:10:07 UTC) #19
Message was sent while issue was closed.
Committed patchset #7 (id:120001) manually as
b69da0b96ffdad124efd1b48d51c617bb216a98e (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698