summaryrefslogtreecommitdiffstats
path: root/core/variant
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | | binder_common: Fix uninitialized marshallingSai Nane2024-08-091-2/+2
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | C# uses `long`s to access many native values. With `PtrToArg<m_enum>` and `PtrToArg<bitfield<m_enum>>` this isn't a problem, as C++ code converts through a `*(int64_t*)` cast in assignment, so all 64-bits are initialized. However, with `PtrToArg<char32_t>`, value assignment happens through an `*(int *)` cast, leaving 32 bits uninitialized where `int` is 32 bits. On platforms where `int` is 16 bits, there are presumably 48 bits uninitialized, though there are very few platforms where this is still the case. The easiest way to see the practical effects of this is by looking at `EventInputKey.Unicode`: ```csharp public override void _Input(InputEvent @event) { if (@event is InputEventKey keyEvent) { if (keyEvent.IsPressed() && !keyEvent.Echo) { var raw = keyEvent.Unicode; var value = raw & 0xffffffff; GD.Print($"Key pressed: raw: {raw}; masked: {(char) value} ({value})"); } } } ``` Pressing 'a' emits the following line: ``` Key pressed: raw: -3617008645356650399; masked: a (97) ``` Examining execution flow in gdb shows this conversion going through the following line: ``` PtrToArg<char32_t>::encode (p_ptr=0x7ffcd5bb4b18, p_val=97 U'a') at ./core/variant/binder_common.h:221 221 *(int *)p_ptr = p_val; ``` Here, `p_val` is still 97, which is the value `InputEventKey.Unicode` is expected to have. After assignment, `p *(int64_t *)0x7ffcd5bb4b18` displays `-3617008645356650399`, with only the lower 32 bits being properly assigned, and is the value we see from C#. With this patch applied, the above testing `_Input` now prints: ``` Key pressed: raw: 97; masked: a (97) ``` Thank you to blujay1269 for asking about an unexpected value they saw in `EventInputKey.Unicode`, which prompted this investigation.
* | | | Merge pull request #94679 from rune-scape/remove-unused-initialize_refRémi Verschelde2024-08-283-12/+0
|\ \ \ \ | | | | | | | | | | | | | | | Remove unused `initialize_ref`
| * | | | Remove unused `initialize_ref`rune-scape2024-07-033-12/+0
| | |_|/ | |/| |
* | | | Add `String.is_valid_unicode_identifier()`Haoyu Qiu2024-08-271-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Adds `is_valid_unicode_identifier()` - Adds `is_valid_ascii_identifier()` - Deprecates `is_valid_identifier()` - Renames `validate_identifier()` to `validate_ascii_identifier()`
* | | | Simplify and fix Rect2/AABB get_support functionAaron Franke2024-08-191-1/+2
| |/ / |/| |
* | | [Core] Fix `Variant::construct` of `Object`A Thousand Ships2024-07-251-1/+7
| | | | | | | | | | | | Variant type was not updated correctly causing leaks in ref-counted
* | | Core: Improve vformat error reporting on sprintf failureRémi Verschelde2024-07-042-5/+5
|/ / | | | | | | And fix a few occurrences of formatting errors that led me to this.
* | Revert "Make freed object different than null in comparison operators"Rémi Verschelde2024-07-012-17/+17
| | | | | | | | | | | | | | | | | | | | This reverts commit 150b50cfcde95f74419ade2811d963224e96fc98. As discussed with the GDScript team, this has some implications which aren't fully consensual yet, and which we want to revisit. For now we revert to the 4.2 behavior for the 4.3 release, to avoid breaking user expectations.
* | Merge pull request #89197 from AThousandShips/arr_typed_fixRémi Verschelde2024-06-261-6/+16
|\ \ | | | | | | | | | [Core] Fix sharing of typed arrays from constructor
| * | [Core] Fix sharing of typed arrays from constructorA Thousand Ships2024-05-071-6/+16
| | |
* | | [TextServer, GDExtension] Fix building text servers as GDExtension, expose ↵bruvzg2024-06-121-0/+1
| | | | | | | | | | | | new/changed low-level methods to GDExtension API.
* | | [Windows] Fix 32-bit MinGW LTO build.bruvzg2024-06-041-2/+14
| | |
* | | fix callable not clearing freed pointerrune-scape2024-06-021-0/+2
| | |
* | | Core: Readd Variant class initializer, fix commentThaddeus Crews2024-05-141-3/+5
| | |
* | | Use Core/Scene stringnames consistentlykobewi2024-05-137-6/+1
| | |
* | | Add shorthand for using singleton string nameskobewi2024-05-112-4/+4
| | |
* | | [Core] Add case-insensitive `String::containsn`A Thousand Ships2024-05-081-0/+1
| | |
* | | Merge pull request #91104 from RandomShaper/simple_type_cppRémi Verschelde2024-05-082-9/+9
|\ \ \ | | | | | | | | | | | | Redefine `GetSimpleTypeT<>` in terms of `<type_traits>`
| * | | Redefine GetSimpleTypeT<> in terms of <type_traits>Pedro J. Estébanez2024-04-242-9/+9
| | | |
* | | | Add const char * overloads to String classWilson E. Alvarez2024-05-071-13/+13
| |/ / |/| | | | | | | | Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
* | | Add PackedVector4Array Variant typeK. S. Ernest (iFire) Lee2024-05-0315-3/+237
| | | | | | | | | | | | | | | Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
* | | Expose `Vector*` component-wise and scalar `min/max` to scriptingA Thousand Ships2024-05-021-0/+24
| | |
* | | [Core] Add scalar versions of `Vector*` `min/max/clamp/snap(ped)`A Thousand Ships2024-05-021-0/+12
| | | | | | | | | | | | Convenience for a number of cases operating on single values
* | | [GDScript] Correctly report invalid read-only accessA Thousand Ships2024-05-012-0/+12
| | |
* | | Merge pull request #91376 from clayjohn/DOCS-reflect-vec3Rémi Verschelde2024-05-011-1/+1
|\ \ \ | | | | | | | | | | | | Update the description and parameter name for Vector3 reflect to correct how the plane is constructed
| * | | Update the description and parameter name for Vector3 reflect to correct how ↵clayjohn2024-04-301-1/+1
| | | | | | | | | | | | | | | | the plane is constructed
* | | | Merge pull request #89647 from AThousandShips/read_only_dictRémi Verschelde2024-05-011-4/+10
|\ \ \ \ | | | | | | | | | | | | | | | [Core] Fix property access on read-only `Dictionary`
| * | | | [Core] Fix property access on read-only `Dictionary`A Thousand Ships2024-04-221-4/+10
| | |/ / | |/| |
* | | | Merge pull request #90394 from dsnopek/object-ptrcall-null-unlikelyRémi Verschelde2024-04-301-8/+2
|\ \ \ \ | |_|/ / |/| | | | | | | Use `likely()` in `PtrToArg<T *>` when checking for null `Object *`s
| * | | Use `likely()` in `PtrToArg<T *>` when checking for null `Object *`sDavid Snopek2024-04-081-8/+2
| | | |
* | | | Make varray() variadickobewi2024-04-262-50/+17
| | | |
* | | | Merge pull request #90540 from Repiteo/core/type-info-use-type-traitsRémi Verschelde2024-04-241-35/+2
|\ \ \ \ | | | | | | | | | | | | | | | Core: Use `<type_traits>` where applicable
| * | | | Core: Use `<type_traits>` where applicableThaddeus Crews2024-04-111-35/+2
| | | | |
* | | | | Merge pull request #90889 from timothyqiu/compatRémi Verschelde2024-04-232-10/+19
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | Use compatible text resource format when possible
| * | | | | Use compatible text resource format when possibleHaoyu Qiu2024-04-232-10/+19
| | |_|/ / | |/| | |
* | | | | Merge pull request #90866 from Repiteo/core/variant-initalizer-listsRémi Verschelde2024-04-232-118/+115
|\ \ \ \ \ | |/ / / / |/| | | | | | | | | Core: Utilize initalizer lists in Variant constructors
| * | | | Core: Integrate initalizer lists for VariantThaddeus Crews2024-04-192-118/+115
| | | | |
* | | | | Rename internal is_ascii_char to is_ascii_alphabet_charAaron Franke2024-04-201-2/+2
|/ / / /
* / / / [Core] Fix incorrect comparison for `Array` const iteratorA Thousand Ships2024-04-131-1/+1
|/ / /
* | | Merge pull request #89186 from groud/save_byte_arrays_as_base64_encodedRémi Verschelde2024-04-102-11/+83
|\ \ \ | | | | | | | | | | | | Save PackedByteArrays as base64 encoded
| * | | Save PackedByteArrays as base64 encodedGilles Roudière2024-03-062-11/+83
| | | |
* | | | [Core] Add iteration support to `Array`A Thousand Ships2024-04-104-4/+138
| | | |
* | | | Clarify bounce and reflect docs and update param namesclayjohn2024-04-101-2/+2
| |/ / |/| |
* | | Ignore ERR_FILE_CANT_OPEN error when loading scenekobewi2024-04-051-1/+1
| | |
* | | Update lingering `do/while(0)` definesThaddeus Crews2024-04-041-4/+6
| | |
* | | Core: Use fixed-width integer types in VariantThaddeus Crews2024-04-042-110/+46
| | |
* | | Merge pull request #87831 from Riteo/bitfield-xorRémi Verschelde2024-03-261-0/+1
|\ \ \ | | | | | | | | | | | | Core: Implement a XOR operator for BitField
| * | | Core: Implement a XOR operator for BitFieldRiteo2024-02-011-0/+1
| | | |
* | | | Fix sorting of files/dirs in dialogsA Thousand Ships2024-03-201-0/+2
| | | | | | | | | | | | | | | | Sorts leading `_` before other characters except `.`.
* | | | Merge pull request #89270 from Repiteo/enforce-typename-in-templatesRémi Verschelde2024-03-1419-246/+246
|\ \ \ \ | | | | | | | | | | | | | | | Enforce template syntax `typename` over `class`