summaryrefslogtreecommitdiff
path: root/core/ustring.cpp
AgeCommit message (Collapse)Author
2019-09-23Merge pull request #32273 from Calinou/humanize-size-fix-i18nRémi Verschelde
Fix i18n in `String::humanize_size()`
2019-09-23Fix i18n in `String::humanize_size()`Hugo Locurcio
Calls to `RTR()` must be added to each string so the PO file generator can pick them up.
2019-09-22Changed some code found by Clang Tidy and Coverityqarmin
2019-09-05Improve the `String::humanize_size()` methodHugo Locurcio
- Use "B" insted of "Bytes" to be more compact - Use suffixes that denote a binary prefix - Make suffixes localizable This removes the need for the custom `EditorNetworkProfiler:_format_bandwidth()` method.
2019-08-24Add forgotten pointer checkingqarmin
2019-08-23Merge pull request #31513 from qarmin/int_overflowRémi Verschelde
Prevent int overflow and underflow
2019-08-22Prevent int overflow and underflowqarmin
2019-08-19Move CryptoCore to it's own folder.Fabio Alessandrelli
Crypto classes will be placed in core/crypto.
2019-07-23Added count method to StringChaosus
2019-07-08Add NULL-terminator the string passed to strtol.Fabio Alessandrelli
This is actually expected by the function although it was apparently working in GCC without the terminator, it breaks (at least some) clang versions.
2019-07-07Fixes minor issues found by static analyzerqarmin
2019-07-03Add sha1 functions to string (using new CryptoCore)Fabio Alessandrelli
2019-07-02CryptoCore class to access to base crypto utils.Fabio Alessandrelli
Godot core needs MD5/SHA256/AES/Base64 which used to be provided by separate libraries. Since we bundle mbedtls in most cases, and we can easily only include the needed sources if we so desire, let's use it. To simplify library changes in the future, and better isolate header dependencies all functions have been wrapped around inside a class in `core/math/crypto_base.h`. If the mbedtls module is disabled, we only bundle the needed source files independently of the `builtin_mbedtls` option. If the module is enabled, the `builtin_mbedtls` option works as usual. Also remove some unused headers from StreamPeerMbedTLS which were causing build issues.
2019-07-01Remove unnecessary code and add some error explanationsqarmin
2019-06-26Some code changed with Clang-Tidyqarmin
2019-06-19Merge pull request #28648 from KoBeWi/substr-1Rémi Verschelde
Make second parameter of substr optional
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-05-03Make second parameter of substr optionalTomasz Chabora
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.