Commit graph

192 commits

Author SHA1 Message Date
Juan Linietsky
9b0dd4f571 A lot of progress with canvas rendering, still far from working. 2020-02-11 11:53:27 +01:00
Rémi Verschelde
0b4b24883d
Merge pull request #33731 from madmiraal/fix-c4996-warning
Fix Visual Studio throwing C4996 warning in ustring.cpp.
2020-02-11 10:22:36 +01:00
dankan1890
ca0ee767cb Fixed String::humanize_size crash.
Close #35872
2020-02-03 17:59:24 +01:00
Rémi Verschelde
a7f49ac9a1 Update copyright statements to 2020
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.
2020-01-01 11:16:22 +01:00
Haoyu Qiu
e7e095da3f Encodes property names properly in project.godot 2019-12-20 10:42:08 +08:00
Yuri Roubinsky
8674655a45 Fix build warning in ustring.cpp on Windows/MSVC platform 2019-12-18 17:40:51 +03:00
Catchawink
b2a14042d5 Fixed issues with using a relative path in the export window.
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-16 09:50:42 -05:00
Rafał Mikrut
ed1c4bc77d Removed unused variables, add some constants numbers 2019-12-10 05:13:02 +01:00
Rafał Mikrut
99d8626f4a Fix some overflows and unitialized variables 2019-11-20 16:22:16 +01:00
Marcel Admiraal
70b0fad25a Fix Visual Studio throwing C4996 warning in ustring.cpp. 2019-11-19 14:47:12 +00:00
bruvzg
5d6ff7f2a2
Fix MinGW/clang/LLD/UCRT build. 2019-11-08 15:04:35 +02:00
Jamie Pate
bdb7adecfb Fix #24137 Different number of leading zeros on MINGW printf("%lg")
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-07 16:23:35 -08:00
Rafał Mikrut
9ddb3265e1 Fix some crashes, overflows and using variables without values 2019-11-01 16:16:31 +01:00
Hugo Locurcio
3b8004865d
Remove redundant condition in String::_humanize_digits() 2019-10-04 18:07:06 +02:00
Andrii Doroshenko (Xrayez)
a0d00c0e99 Bind the String::humanize_size method
The method signature is also changed to use `uint64_t` instead of `size_t`
for it to be Variant-compatible.
2019-10-04 15:51:13 +03:00
Rémi Verschelde
ef2a7834c9
Merge pull request #31883 from aole/create-string-function-repeat
Create a GDScript String function repeat
2019-09-24 11:50:58 +02:00
Rémi Verschelde
ed18e3f195
Merge pull request #32273 from Calinou/humanize-size-fix-i18n
Fix i18n in `String::humanize_size()`
2019-09-23 15:57:18 +02:00
Hugo Locurcio
a51e8b1ff0
Fix i18n in String::humanize_size()
Calls to `RTR()` must be added to each string so the PO file generator
can pick them up.
2019-09-23 13:54:10 +02:00
qarmin
50be65bf43 Changed some code found by Clang Tidy and Coverity 2019-09-22 18:45:08 +02:00
Hugo Locurcio
9a94fe7d26
Improve the String::humanize_size() method
- 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-05 19:48:46 +02:00
Bhupendra Aole
073f625a91 Create a GDScript String function repeat
Fixes #30610
2019-09-03 13:06:13 -04:00
qarmin
33c62db7af Add forgotten pointer checking 2019-08-24 13:34:14 +02:00
Rémi Verschelde
3a53e792ef
Merge pull request #31513 from qarmin/int_overflow
Prevent int overflow and underflow
2019-08-23 09:05:25 +02:00
qarmin
538405f9c7 Prevent int overflow and underflow 2019-08-22 17:22:35 +02:00
Fabio Alessandrelli
c19871af6d Move CryptoCore to it's own folder.
Crypto classes will be placed in core/crypto.
2019-08-19 16:31:05 +02:00
Chaosus
080c0bb7fe Added count method to String 2019-07-23 18:55:54 +03:00
Fabio Alessandrelli
2f91e250f6 Add NULL-terminator the string passed to strtol.
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-08 17:15:10 +02:00
qarmin
9a77d748c0 Fixes minor issues found by static analyzer 2019-07-07 23:08:51 +02:00
Fabio Alessandrelli
6c512e21a9 Add sha1 functions to string (using new CryptoCore) 2019-07-03 18:42:46 +02:00
Fabio Alessandrelli
564d93ff10 CryptoCore class to access to base crypto utils.
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-02 12:36:27 +02:00
qarmin
3c154eb93b Remove unnecessary code and add some error explanations 2019-07-01 12:59:42 +02:00
qarmin
4e5310cc60 Some code changed with Clang-Tidy 2019-06-26 15:08:25 +02:00
Rémi Verschelde
2b52cd3e5c
Merge pull request #28648 from KoBeWi/substr-1
Make second parameter of substr optional
2019-06-19 12:43:46 +02:00
Rémi Verschelde
f410e7a8a9
Merge pull request #29616 from Calinou/humanize-size-clearer-rounding
Make humanized size rounding clearer by padding decimals with zeroes
2019-06-12 16:25:10 +02:00
Rémi Verschelde
704f2c5d85
Merge pull request #29615 from Calinou/fix-editor-monitor-large-sizes
Fix display of large sizes in the editor monitors
2019-06-12 15:21:37 +02:00
Rémi Verschelde
971b5160c6
Merge pull request #29306 from qarmin/small_code_fixes
Small fixes to unrechable code, possibly overflows, using NULL pointers
2019-06-12 12:49:21 +02:00
Hugo Locurcio
463d0988dd
Make humanized size rounding clearer by padding decimals with zeroes
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-08 22:17:57 +02:00
Hugo Locurcio
746bfc3662
Fix display of large sizes in the editor monitors
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-08 22:05:57 +02:00
qarmin
8245db869f Small fixes to unrechable code, possibly overflows, using NULL pointers 2019-06-03 21:52:50 +02:00
Rémi Verschelde
af2c742f53 Fix and expose String::strip_escapes(), use it in LineEdit paste
Supersedes #27736.
2019-05-31 15:49:14 +02:00
Tomasz Chabora
0b8a785539 Make second parameter of substr optional 2019-05-03 19:46:56 +02:00
jude-lafitteIII
d3cc9c0bf1 Support for binary literals in GDScript. Added an error that shows if a point is written in a hex literal. Added highlighting for binary literals in GDScript 2019-04-25 13:44:27 +01:00
Ibrahn Sahir
9d0b3b300c fixed an access after free in OS_X11::set_context.
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-22 13:34:17 +01:00
Juan Linietsky
a20235aeb0 Add ability to edit editor feature profiles
Allows enabling/disabling parts of the editor and storing/loading profiles for that.
2019-04-08 19:18:51 -03:00
Hein-Pieter van Braam
4f49d09272 Don't crash when parse_utf8 receives a NULL pointer
This can happen when chaining calls to various string methods when the
string is empty.
2019-02-22 19:28:19 +01:00
marxin
c11e7ffd0e Fix warnings seen with -Wignored-qualifiers. 2019-02-21 20:24:29 +01:00
marxin
8d51618949 Add -Wshadow=local to warnings and fix reported issues.
Fixes #25316.
2019-02-20 19:44:12 +01:00
lupoDharkael
597aac382b Fix wrong bounds check in String::right 2019-02-20 16:47:25 +01:00
Ibrahn Sahir
cbb396c006 Repair String lstrip and rstrip.
Background: lstrip and rstrip were broken by changes to String in:
0e29f7974b
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-07 17:34:44 +00:00
Hein-Pieter van Braam
5e6c6f3bb7
Merge pull request #21708 from hpvb/fix-21242v2
String[size()] should return a default constructed CharType
2019-01-04 20:57:22 +01:00