summaryrefslogtreecommitdiff
path: root/core/ustring.cpp
AgeCommit message (Collapse)Author
2020-05-14Style: Enforce braces around if blocks and loopsRémi Verschelde
Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14Style: Enforce separation line between function definitionsRémi Verschelde
I couldn't find a tool that enforces it, so I went the manual route: ``` find -name "thirdparty" -prune \ -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \ -o -name "*.glsl" > files perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files) misc/scripts/fix_style.sh -c ``` This adds a newline after all `}` on the first column, unless they are followed by `#` (typically `#endif`). This leads to having lots of places with two lines between function/class definitions, but clang-format then fixes it as we enforce max one line of separation. This doesn't fix potential occurrences of function definitions which are indented (e.g. for a helper class defined in a .cpp), but it's better than nothing. Also can't be made to run easily on CI/hooks so we'll have to be careful with new code. Part of #33027.
2020-05-14Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocksRémi Verschelde
Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
2020-05-14Port member initialization from constructor to declaration (C++11)Rémi Verschelde
Using `clang-tidy`'s `modernize-use-default-member-init` check and manual review of the changes, and some extra manual changes that `clang-tidy` failed to do. Also went manually through all of `core` to find occurrences that `clang-tidy` couldn't handle, especially all initializations done in a constructor without using initializer lists.
2020-05-10New lightmapperJuan Linietsky
-Added LocalVector (needed it) -Added stb_rect_pack (It's pretty cool, we could probably use it for other stuff too) -Fixes and changes all around the place -Added library for 128 bits fixed point (required for Delaunay3D)
2020-05-10Style: clang-format: Disable AllowShortCaseLabelsOnASingleLineRémi Verschelde
Part of #33027.
2020-05-10Style: clang-format: Disable AllowShortIfStatementsOnASingleLineRémi Verschelde
Part of #33027, also discussed in #29848. Enforcing the use of brackets even on single line statements would be preferred, but `clang-format` doesn't have this functionality yet.
2020-04-04Improve the shader error console outputHugo Locurcio
This makes the line gutter look more like an actual line gutter, which makes it less confusing.
2020-04-02Replace NULL with nullptrlupoDharkael
2020-03-20i18n: Add support for translating the class referenceRémi Verschelde
- Parse `.po` files from `doc/translations/*.po` like already done with `editor/translations/*.po`. - Add logic to register a doc translation mapping in `TranslationServer` and `EditorSettings`. - Add `DTR()` to lookup the doc translation mapping (similar to `TTR()`). Strings are automatically dedented and stripped of whitespace to ensure that they would match the translation catalog. - Use `DTR()` to translate relevant strings in `EditorHelp`, `EditorInspector`, `CreateDialog`, `ConnectionsDialog`. - Small simplification to `TranslationLoaderPO`, the path argument was not really meaningful.
2020-03-16Tweak the invalid Unicode error message to be more descriptiveHugo Locurcio
This closes #28503.
2020-02-23Replace FALLTHROUGH macro by C++17 [[fallthrough]]Rémi Verschelde
This attribute is now part of the standard we target so we no longer need compiler-specific hacks. Also enables -Wimplicit-fallthrough for Clang now that we can properly support it. It's already on by default for GCC's -Wextra. Fixes new warnings raised by Clang's -Wimplicit-fallthrough.
2020-02-11A lot of progress with canvas rendering, still far from working.Juan Linietsky
2020-02-11Merge pull request #33731 from madmiraal/fix-c4996-warningRémi Verschelde
Fix Visual Studio throwing C4996 warning in ustring.cpp.
2020-02-03Fixed String::humanize_size crash.dankan1890
Close #35872
2020-01-01Update copyright statements to 2020Rémi Verschelde
Happy new year to the wonderful Godot community! We're starting a new decade with a well-established, non-profit, free and open source game engine, and tons of further improvements in the pipeline from hundreds of contributors. Godot will keep getting better, and we're looking forward to all the games that the community will keep developing and releasing with it.
2019-12-20Encodes property names properly in project.godotHaoyu Qiu
2019-12-18Fix build warning in ustring.cpp on Windows/MSVC platformYuri Roubinsky
2019-12-16Fixed issues with using a relative path in the export window.Catchawink
Before this fix, opening relative export paths inside of an EditorFileDialog was not possible. This was fixed by modifying String::path_to_file() to save relative paths in EditorExportPreset::set_export_path() more appropriately and changing EditorFileDialog::set_current_dir() to open relative paths.
2019-12-10Removed unused variables, add some constants numbersRafał Mikrut
2019-11-20Fix some overflows and unitialized variablesRafał Mikrut
2019-11-19Fix Visual Studio throwing C4996 warning in ustring.cpp.Marcel Admiraal
2019-11-08Fix MinGW/clang/LLD/UCRT build.bruvzg
2019-11-07Fix #24137 Different number of leading zeros on MINGW printf("%lg")Jamie Pate
Use _set_output_format() on MINGW platform to force _snprintf_s() to conform to the C99 standard and match the other platforms. Fixes #24137
2019-11-01Fix some crashes, overflows and using variables without valuesRafał Mikrut
2019-10-04Remove redundant condition in `String::_humanize_digits()`Hugo Locurcio
2019-10-04Bind the `String::humanize_size` methodAndrii Doroshenko (Xrayez)
The method signature is also changed to use `uint64_t` instead of `size_t` for it to be Variant-compatible.
2019-09-24Merge pull request #31883 from aole/create-string-function-repeatRémi Verschelde
Create a GDScript String function repeat
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-09-03Create a GDScript String function repeatBhupendra Aole
Fixes #30610
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.