Commit graph

128 commits

Author SHA1 Message Date
Rémi Verschelde
7718b90d92
Merge pull request #20443 from AlexHolly/add-string-format-no-index
Added String.format "no index" support
2018-08-14 16:13:34 +02:00
Rémi Verschelde
9a6e4d10b4
Merge pull request #20772 from dragmz/string_copy_oob_read_fix
Fix out of buffer read when copying from a non-null-terminated string
2018-08-14 15:47:34 +02:00
Ibrahn Sahir
62f0dd9d57 removed some surplus null appends that got typoed in 0e29f7974b
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-07 03:30:14 +01:00
Marcin Zawiejski
f3b2689aa6 fix out of buffer read when copying non-null terminated strings 2018-08-06 23:51:07 +02:00
Hein-Pieter van Braam
0e29f7974b Reduce unnecessary COW on Vector by make writing explicit
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-26 00:54:16 +02:00
Alexander Holland
2290cc6227 Added String.format "no index" support 2018-07-25 13:23:44 +02:00
Alexander Holland
84db7056b7 Fix format ignores case in placeholder 2018-07-25 12:14:48 +02:00
Ibrahn Sahir
e0df1221bf removed redundant strlen calculation from String::substr 2018-07-24 16:08:45 +01:00
Marcelo Fernandez
ecb071b221 Fix upper/lower case convertion for characters >= 0x80 2018-07-22 14:10:28 -03:00
Ibrahn Sahir
8ff52c5923 reworked ustring.rsplit to fix behaviour.
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-07-17 20:44:17 +01:00
Max Hilbrunner
acf6c326fb
Merge pull request #14715 from Krakean/string_add_rsplit2
Added rsplit() method to String class
2018-05-23 17:19:35 +02:00
Juan Linietsky
cb1fc5734b
Merge pull request #17316 from ShyRed/significantdigits
Adjust decimal precision
2018-05-07 20:25:06 -03:00
Paul Joannon
a35c8bbdc7 fix API string path 2018-04-30 09:38:18 +02:00
George Marques
ca25f1e6ea
Merge pull request #18176 from nikibobi/string-trim
Add string trim_prefix, trim_suffix, lstrip and rstrip methods
2018-04-22 12:29:44 -03:00
Rémi Verschelde
9a75975042 Fix some Coverity warnings in String API
- 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-18 22:20:39 +02:00
bosak
79ecdee496
add string trim_prefix trim_suffix lstrip and rstrip methods 2018-04-17 14:15:43 +03:00
Pedro J. Estébanez
00e98458ba Revert "Unify http- and percent- encode/decode"
This reverts commit b76ee30917.
2018-04-12 21:12:34 +02:00
Pedro J. Estébanez
1fc85b87bd Fix buggy percent-encoding
Fixes #17875.
2018-04-05 21:49:44 +02:00
Pedro J. Estébanez
b76ee30917 Unify http- and percent- encode/decode
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-27 19:18:30 +02:00
ShyRed
051b4d6f19 Adjust decimal precision
Increase the number of significant digits when converting from double to string.
2018-03-06 20:40:29 +01:00
Ignacio Etcheverry
f37090ccf4 Mono: Better versioning and gracefully unloading of Godot API assemblies 2018-02-25 20:56:27 +01:00
Ariel Manzur
e2b50e1abb improves portability with some compilers 2018-01-18 19:16:34 -03:00
Rémi Verschelde
9f479f096c Fix typos in code and docs with codespell
Using v1.11.0 from https://github.com/lucasdemarchi/codespell
2018-01-18 22:01:42 +01:00
Juan Linietsky
03475ba197 Filled tutorial field in most relevent classes.
Added tutorial display in doc.
2018-01-15 18:41:13 -03:00
bruvzg
d0868a8f40
Fix String::itos/String::num_int64(INT64_MIN) output. 2018-01-13 22:06:08 +02:00
Rémi Verschelde
e4213e66b2 Add missing copyright headers and fix formatting
Using `misc/scripts/fix_headers.py` on all Godot files.
Some missing header guards were added, and the header inclusion order
was fixed in the Bullet module.
2018-01-05 01:22:23 +01:00
Rémi Verschelde
b50a9114b1 Update copyright statements to 2018
Happy new year to the wonderful Godot community!
2018-01-01 14:40:47 +01:00
Noshyaar
a6328011d8
Merge pull request #14973 from poke1024/docs-word-selection
Double-click word selection for RichTextLabel (i.e. docs)
2018-01-01 18:51:35 +07:00
Bernhard Liebl
b80bc553dd Double-click word selection for RichTextLabel (i.e. docs) 2017-12-28 17:44:22 +01:00
Juan Linietsky
a663dbfdd8
Merge pull request #14744 from poke1024/stringname-compare
Avoid string allocations in AlphCompare
2017-12-27 15:44:45 -03:00
Bernhard Liebl
b47ce5e5d6 Avoid string allocations in AlphCompare 2017-12-17 12:16:08 +01:00
Rémi Verschelde
6b7bed98f4
Merge pull request #14576 from poke1024/strings
Some performance tweaking of string handling
2017-12-16 13:10:30 +01:00
Dmitry Koteroff
6fe415ca7f Added rsplit() for String class
Docs updated
2017-12-15 22:23:58 +03:00
Dmitry Koteroff
5302fd125b Added third argument for String.split() function (see issue #14349)
Remove negative limit, leave only positive and make it reflect behaviour like in Python
Also limit renamed to maxsplit to match Python one.
Also docs updated.

Fix indent
2017-12-15 21:51:13 +03:00
poke1024
040d4dba6b Some performance tweaking of string handling 2017-12-15 17:25:57 +01:00
Unknown
fd1b94e307 Improve slang, especially in user-visible parts 2017-12-05 15:41:38 +01:00
Juan Linietsky
bc2e8d99e5 Made Vector::ptrw explicit for writing, compiler was sometimes using the wrong function,
leading to unnecesary copy on writes and reduced performance.
2017-11-25 00:09:40 -03:00
Ruslan Mustakov
8f0f327f02 Allow configuring iOS export
- EditorExportPlugin's _export_begin accepts all the arguments related
   to the current export (is_debug, path, flags).

 - EditorExportPlugin API is extended with methods allowing to configure
   iOS export: add_ios_framework, add_ios_plist_content,
   add_ios_linker_flags, add_ios_bundle_file.

 - iOS export template now contains Godot as a static library so that
   it can be linked with third-party Frameworks and GDNative static
   libraries.

 - Adds method to DirAccess for recursive copying of a directory.

 - Fixes iOS export to work with Xcode 9 (released recently).
2017-11-21 01:16:49 +07:00
Will Nations
238d488a04 Fixed a bug where capitalize didn't work with camelCase names 2017-11-14 14:32:37 -06:00
Zher Huei Lee
0804dd5336 Added String::dedent() to remove text indentation
This functions similarly to Python's textwrap.dedent()

It's also been applied to doc_data.cpp to remove extra whitespace while
parsing the XML.
2017-11-01 07:20:20 +08:00
Unknown
7683ff3e42 Fix get_node() and $ autocompletion when using single quotes 2017-10-30 21:58:32 +01:00
Ross Hadden
1a97d6455d Fixed a bunch of typos, including an error code. 2017-09-21 23:58:29 -04:00
Hein-Pieter van Braam
9c63ab99f0 Fix use of unitialized variables
The second in my quest to make Godot 3.x compile with -Werror on GCC7
2017-09-02 01:59:26 +02:00
Hein-Pieter van Braam
f9467ec1ea Fix signed and unsigned comparisons
The first in my quest to make Godot 3.x compile with -Werror on GCC7
2017-09-01 08:13:12 +02:00
Rémi Verschelde
7ad14e7a3e Dead code tells no tales 2017-08-27 22:13:45 +02:00
Rémi Verschelde
bd282ff43f Use HTTPS URL for Godot's website in the headers 2017-08-27 14:16:55 +02:00
TwistedTwigleg
00f6c85928 Synchronize parameter names in definition and declaration
Fixes #10244.
2017-08-16 17:22:23 +02:00
geequlim
4b2a44054a Fix crash with String copy from with NULL string parameter 2017-06-25 21:57:06 +08:00
dumitru-stama
82d8da2a48 Fixed a string class bug 2017-06-19 20:08:31 -07:00
Poommetee Ketson
ff03d846eb NaturalSort: strings start with . treated differently 2017-05-29 09:59:02 +07:00