summaryrefslogtreecommitdiff
path: root/core/ustring.cpp
AgeCommit message (Collapse)Author
2019-06-12Merge pull request #29616 from Calinou/humanize-size-clearer-roundingRémi Verschelde
Make humanized size rounding clearer by padding decimals with zeroes
2019-06-12Merge pull request #29615 from Calinou/fix-editor-monitor-large-sizesRémi Verschelde
Fix display of large sizes in the editor monitors
2019-06-12Merge pull request #29306 from qarmin/small_code_fixesRémi Verschelde
Small fixes to unrechable code, possibly overflows, using NULL pointers
2019-06-08Make humanized size rounding clearer by padding decimals with zeroesHugo Locurcio
For example, "5 MB" will now be displayed as "5.00 MB" to make the rounding precision clear, regardless of the value being rounded. This closes #29611.
2019-06-08Fix display of large sizes in the editor monitorsHugo Locurcio
Unlike the old custom method, the `String::humanize_size()` method works well with file sizes above 2 GB. This also tweaks the suffixes for spacing consistency and uses the correct acronym for exabytes (EB). This closes #29610.
2019-06-03Small fixes to unrechable code, possibly overflows, using NULL pointersqarmin
2019-05-31Fix and expose String::strip_escapes(), use it in LineEdit pasteRémi Verschelde
Supersedes #27736.
2019-04-25Support for binary literals in GDScript. Added an error that shows if a ↵jude-lafitteIII
point is written in a hex literal. Added highlighting for binary literals in GDScript
2019-04-22fixed an access after free in OS_X11::set_context.Ibrahn Sahir
Added constructor and assignment operator for CharString from const char* to simplify memory management when working with utf8/ascii strings for APIs taking char*. Reworked OS_X11::set_context to use CharString and avoid some manual memory management.
2019-04-08Add ability to edit editor feature profilesJuan Linietsky
Allows enabling/disabling parts of the editor and storing/loading profiles for that.
2019-02-22Don't crash when parse_utf8 receives a NULL pointerHein-Pieter van Braam
This can happen when chaining calls to various string methods when the string is empty.
2019-02-21Fix warnings seen with -Wignored-qualifiers.marxin
2019-02-20Add -Wshadow=local to warnings and fix reported issues.marxin
Fixes #25316.
2019-02-20Fix wrong bounds check in String::rightlupoDharkael
2019-01-07Repair String lstrip and rstrip.Ibrahn Sahir
Background: lstrip and rstrip were broken by changes to String in: 0e29f7974b59e4440cf02e1388fb9d8ab2b5c5fd which removed it's access to Vector::find(CharType). Moved Vector's find up into CowData so it can be shared by Vector and String. Added String::find_char using CowData::find. Implemented rstrip and lstrip using find_char. Added a few tests for String rstrip and lstrip.
2019-01-04Merge pull request #21708 from hpvb/fix-21242v2Hein-Pieter van Braam
String[size()] should return a default constructed CharType
2019-01-04String[size()] should return a default constructed CharTypeHein-Pieter van Braam
As per the C++ standard 21.3.4.1 for std::string: Returns: If pos < size(), returns data()[pos]. Otherwise, if pos == size(), the const version returns charT(). Otherwise, the behavior is undefined. Since the behavior is undefined Godot now does the same thing for const and non-const versions of operator[]. This fixes #21242 and fixes #22221.
2019-01-04Merge pull request #24585 from Xrayez/fix-crash-hex-numberRémi Verschelde
Fix crash when checking empty string for valid hex number
2019-01-01Update copyright statements to 2019Rémi Verschelde
Happy new year to the wonderful Godot community!
2018-12-24Fix crash when checking empty string for valid hex numberAndrii Doroshenko (Xrayez)
2018-12-16Reduce String CoWHein-Pieter van Braam
By introducing an intermediate proxy class for the array subscript operator for String and CharString we can control better when CowData will actually CoW. This should improve performance of String usage for most cases.
2018-11-09Fix formatting -0.0 by %+f displays +-0.0Poommetee Ketson
2018-11-01Merge pull request #23159 from DavidSichma/string-escapeJuan Linietsky
Fix: String::format Variant to String conversion
2018-10-25Fix: String::format Variant to String conversionDavid Sichma
Previosly String::format used variant.get_construct_string() to convert the passed Variants to Strings. This however did not match the expected printing behavior of some datatypes: Strings for example turned out escaped. This fix replaces the call to get_construct_string() with a simple conversion. This makes String::format consistent with "%s" % "sth" and formated Variants turn out like printed as expected.
2018-10-19Fixing warnings generated by MSVCDualtagh Murray
Fixes #22684.
2018-10-11Make visualscript search better.K. S. Ernest (iFire) Lee
* There were spaces unequally inside the function definitions. * camelcase_to_underscore() should also work for numbers inside of the camel case. * Removed the builtin concept * Capitalize descriptions from methods too. * Match the visual script functions by removing the empty arguments "( )" * Add some test cases
2018-10-07fixes #22828 - res://user had incorrect substr valueexts
2018-10-03Fix some more warnings reported by CIRémi Verschelde
Fixes the following Clang 7 warnings: ``` core/io/marshalls.cpp:872:10: warning: unused variable 'f' [-Wunused-variable] core/ustring.cpp:1831:2: warning: 'register' storage class specifier is deprecated and incompatible with C++17 [-Wdeprecated-register] core/ustring.cpp:1832:2: warning: 'register' storage class specifier is deprecated and incompatible with C++17 [-Wdeprecated-register] drivers/gles3/rasterizer_gles3.cpp:82:24: warning: unused function '_gl_debug_print' [-Wunused-function,34] main/main.cpp:118:13: warning: unused variable 'auto_build_solutions' [-Wunused-variable] modules/csg/csg_gizmos.cpp:225:46: warning: 'current' may be used uninitialized in this function [-Wmaybe-uninitialized] ```
2018-09-12Make core/ includes absolute, remove subfolders from include pathRémi Verschelde
This allows more consistency in the manner we include core headers, where previously there would be a mix of absolute, relative and include path-dependent includes.
2018-08-24Make some debug prints verbose-only, remove othersRémi Verschelde
2018-08-14Merge pull request #20443 from AlexHolly/add-string-format-no-indexRémi Verschelde
Added String.format "no index" support
2018-08-14Merge pull request #20772 from dragmz/string_copy_oob_read_fixRémi Verschelde
Fix out of buffer read when copying from a non-null-terminated string
2018-08-07removed some surplus null appends that got typoed in ↵Ibrahn Sahir
0e29f7974b59e4440cf02e1388fb9d8ab2b5c5fd A couple of null appends got typoed to append a '0' character instead. Removed them here since String already takes care of the null terminator for us.
2018-08-06fix out of buffer read when copying non-null terminated stringsMarcin Zawiejski
2018-07-26Reduce unnecessary COW on Vector by make writing explicitHein-Pieter van Braam
This commit makes operator[] on Vector const and adds a write proxy to it. From now on writes to Vectors need to happen through the .write proxy. So for instance: Vector<int> vec; vec.push_back(10); std::cout << vec[0] << std::endl; vec.write[0] = 20; Failing to use the .write proxy will cause a compilation error. In addition COWable datatypes can now embed a CowData pointer to their data. This means that String, CharString, and VMap no longer use or derive from Vector. _ALWAYS_INLINE_ and _FORCE_INLINE_ are now equivalent for debug and non-debug builds. This is a lot faster for Vector in the editor and while running tests. The reason why this difference used to exist is because force-inlined methods used to give a bad debugging experience. After extensive testing with modern compilers this is no longer the case.
2018-07-25Added String.format "no index" supportAlexander Holland
2018-07-25Fix format ignores case in placeholderAlexander Holland
2018-07-24removed redundant strlen calculation from String::substrIbrahn Sahir
2018-07-22Fix upper/lower case convertion for characters >= 0x80Marcelo Fernandez
2018-07-17reworked ustring.rsplit to fix behaviour.Ibrahn Sahir
Previous problems include failure to remove the splitter from the last element found and a possible infinite loop dealing with multi-character splitter strings.
2018-05-23Merge pull request #14715 from Krakean/string_add_rsplit2Max Hilbrunner
Added rsplit() method to String class
2018-05-07Merge pull request #17316 from ShyRed/significantdigitsJuan Linietsky
Adjust decimal precision
2018-04-30fix API string pathPaul Joannon
2018-04-22Merge pull request #18176 from nikibobi/string-trimGeorge Marques
Add string trim_prefix, trim_suffix, lstrip and rstrip methods
2018-04-18Fix some Coverity warnings in String APIRémi Verschelde
- StringName::StringName(const StringName &p_name) Non-static class member _data is not initialized in this constructor nor in any functions that it calls. - StringName::_Data() Non-static class member idx is not initialized in this constructor nor in any functions that it calls. - String::num_uint64(...) This less-than-zero comparison of an unsigned value is never true. n % base < 0UL. - String::hex_to_int(...) and String::hex_to_int64(...) Execution cannot reach this statement (deadcode)
2018-04-17add string trim_prefix trim_suffix lstrip and rstrip methodsbosak
2018-04-12Revert "Unify http- and percent- encode/decode"Pedro J. Estébanez
This reverts commit b76ee30917c63211ac9e94a21bebbddf518d169f.
2018-04-05Fix buggy percent-encodingPedro J. Estébanez
Fixes #17875.
2018-03-27Unify http- and percent- encode/decodePedro J. Estébanez
There was a percent-prefixed version, which was exposed, and a http-prefixed version which was not (only to GDNative). This commit keeps the percent-prefixed versions, but with the http-prefixed implementations.
2018-03-06Adjust decimal precisionShyRed
Increase the number of significant digits when converting from double to string.