summaryrefslogtreecommitdiff
path: root/core/fxcrt/fx_basic_wstring.cpp
AgeCommit message (Collapse)Author
2016-06-14Make code compile with clang_use_chrome_plugin (part II)weili
This change contains files in core directory which were not covered in part I. This is part of the efforts to make PDFium code compilable by Clang chromium style plugins. The changes are mainly the following: -- move inline constructor/destructor of complex class/struct out-of-line; -- add constructor/destructor of complex class/struct if not explicitly defined; -- add explicit out-of-line copy constructor when needed; -- move inline virtual functions out-of-line; -- Properly mark virtual functions with 'override'; -- some minor cleanups; BUG=pdfium:469 Review-Url: https://codereview.chromium.org/2060913003
2016-05-16Fix the code that causes warningsweili
These are the left or newly added code which causes compilation warnings of "signed and unsigned comparison". Need to fix them before I re-enable the warning flag. BUG=pdfium:29 Review-Url: https://codereview.chromium.org/1986533002
2016-05-13Make CFX_WideString(const CFX_WideString&) explicit.tsepez
BUG= Review-Url: https://codereview.chromium.org/1979723003
2016-05-13Templatize CFX_{Byte,Wide}StringCtsepez
Review-Url: https://codereview.chromium.org/1874773002
2016-05-11Add much-needed Find() method for CFX_*StringCtsepez
BUG=pdfium:493 Review-Url: https://codereview.chromium.org/1968233002
2016-04-27Standardize on ASSERT.dsinclair
There are currently three ways to assert in the code (ASSERT, FXSYS_assert and assert). This CL standardizes on ASSERT. The benefit of ASSERT is that it can be overridden if the platform requies and we can pickup the Chromium version if it has already been defined in the build. This does change behaviour. Currently FXSYS_assert is always defined but ASSERT is only defined in debug builds. So, the FXSYS_assert's would fire in Release builds. That will no longer happen. BUG=pdfium:219 Review-Url: https://codereview.chromium.org/1914303003
2016-04-26CFX_ByteString::Reserve(), ReleaseBuffer() fixes.tsepez
Also identical fixes for CFX_WideString. Reserve() on an empty string would not actually reserve a buffer. Currently unused, but there are places where this would really help. ReleaseBuffer() would rarely return memory to the system, since it would short-circuit thinking it could operate in place. Tune the algorithm slightly so that we hold on when the savings is small. Bounds check release buffer args rather than just asserting. Add tests for all of these. Review URL: https://codereview.chromium.org/1916303004
2016-04-21Assert that CFX_ strings are pointer-size.tsepez
The principle has been implicit in the implementation, but make it obvious for future generations. Review URL: https://codereview.chromium.org/1904143002
2016-04-20Inline CFX_WideString::c_str.dsinclair
This was causing issues at one point with the GN build but seems to have been resolved in the meantime. Review URL: https://codereview.chromium.org/1907563002
2016-04-20Standalone GN build.dsinclair
This CL setups up a standalone GN build. You'll need to set gn args similar to: use_goma = true clang_use_chrome_plugins = false pdf_enable_xfa = true pdf_enable_v8 = true pdf_is_standalone = true The third_party/pymock files are needed to make git cl upload work correctly. BUG=pdfium:106 Review URL: https://codereview.chromium.org/1904563002
2016-04-11Make CFX_{Byte,Wide}String::Remove() no-touch if possibletsepez
Don't try to copy the string until we are sure we need to change it. Review URL: https://codereview.chromium.org/1877993002
2016-04-11Avoid copying in TrimRight() and TrimLeft() if possible.tsepez
Make Byte and Wide code identical while at it. Review URL: https://codereview.chromium.org/1877553002
2016-04-08Make CFX_WideString::FromLocal() take a CFX_ByteStringC argtsepez
It doesn't persist the string beyond the duration of the call, hence it should take the *StringC variant. Doing so avoids some allocs by changing to the *StringC ctor in a few places, at the cost of some explicit .ToByteStringC() calls (which are cheap). Review URL: https://codereview.chromium.org/1862953004
2016-04-06Make wide strings use StringData templatetsepez
Shuffled the order of methods in fx_basic_wstring.cpp to match those in fx_basic_bstring.cpp. The way to review this patch is to diff those two files against each other. They are beginning to converge. Re-ordered some parameters in Concat() so that the string comes before its length. It feels wrong otherwise. Review URL: https://codereview.chromium.org/1846793002
2016-04-06Make CFX_WideString::FromUTF8() take a CFX_ByteStringC argument.tsepez
Methods that take string arguments and do not persist them should take *StringC types as argument rather than discrete ptr/len args. Avoids a number of implicit casts from CFX_ByteString to char*. BUG= Review URL: https://codereview.chromium.org/1861183002
2016-04-06Rename CFX_WideStringC::raw_str() to c_str()tsepez
No functional change intended. This difference in naming is standing in the way of consolidating some of the string code between Wide and Byte strings. The Wide code wants to call raw_str() in exactly the same spots that the Byte code calls c_str(). This makes sense, because in both places we get a character type back, and not a uint*_t type. If WideStringC had a raw_str() method, it would have to return uint32_t or similar. R=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1863593004
2016-04-05Rename GetCStr and GetPtr to match CFX_ByteString.dsinclair
This CL updates CFX_ByteStringC to use the more common c_str and raw_str instead of GetCStr and GetPtr. Review URL: https://codereview.chromium.org/1857713003
2016-04-01Remove CFX_{Byte,Wide}String::Equal in favor of "==".tsepez
Makes the code slightly cleaner. Review URL: https://codereview.chromium.org/1846083002
2016-03-31Beef up unit test for CFX_ByteString and CFX_WideString.tsepez
Needed to validate refactoring which was reverted. Review URL: https://codereview.chromium.org/1847193002
2016-03-23Move core/include/fxcrt to core/fxcrt/include.Dan Sinclair
This CL moves the fxcrt code into the core/fxcrt directory. The only exception was fx_bidi.h which was moved into core/fxcrt as it is not used outside of core/. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1825953002 .
2016-03-21Remove FX_WORD in favor of uint16_t.Tom Sepez
It isn't buying us anthing, and it looks strange in a struct when other uint types are already present. R=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1821043003 .
2016-03-21Re-enable several MSVC warningsWei Li
Re-enable the following warnings: 4245: signed/unsigned conversion mismatch; 4310: cast may truncate data; 4389: operator on signed/unsigned mismatch; 4701: use potentially uninitialized local variable; 4706: assignment within conditional expression Clean up the code to avoid those warnings. BUG=pdfium:29 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1801383002 .
2016-03-14Move core/src/ up to core/.Dan Sinclair
This CL moves the core/src/ files up to core/ and fixes up the include guards, includes and build files. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1800523005 .