Commit Graph

1779 Commits

Author SHA1 Message Date
Rémi Verschelde 040254ef7c Fix potential divisions by 0 reported by MSVC
The `TextEdit` one was indeed a potential bug.
The `PCKPacker` one seems to be a false positive, it's already in a
`for` loop that depends on `files.size()`.

(cherry picked from commit ca4e4506db)
2020-03-25 10:27:48 +01:00
Fabio Alessandrelli 41fe1bd887 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.

(cherry picked from commit 2f91e250f6)
2019-08-21 11:03:53 +02:00
Hein-Pieter van Braam-Stewart 0b4dec63a9 Object::script may not be a valid Ref<Script>
It appears that Object::script may be a valid ScriptInstance but not be
castable to Ref<Script>. There were only 5 places in the code that made
this assumption. This commit fixes that.

(cherry picked from commit 20b0046945)
2019-07-03 17:02:13 +02:00
Rémi Verschelde d127f92bd5 Image: Fix decompressing ETC2
Thanks to @Rriik for finding the bug and its cause.

Fixes #25595.

(cherry picked from commit 1772d6fa23)
2019-07-03 16:11:46 +02:00
Rémi Verschelde 2ff2b727b6 Prevent upscaled SVG from exceeding Image bounds
Also expose Image MAX_WIDTH and MAX_HEIGHT.

Fixes #24455.

(cherry picked from commit cc0842f9a6)
2019-07-03 16:05:39 +02:00
Pedro J. Estébanez fc38c87030 Fix blitting from negative position
(cherry picked from commit 6dc9a1b475)
2019-07-03 15:40:42 +02:00
Aaron Franke 58c87e5d26 Fix many errors found by PVS-Studio
Fix errors 2, 3, 4, 6, 8, 9, 11, 12, 13, 14, and 15.

(cherry picked from commit cb01268562)
2019-07-03 15:39:12 +02:00
Poommetee Ketson 0f5538e44d Fix formatting -0.0 by %+f displays +-0.0
(cherry picked from commit aa311320d9)
2019-07-03 14:53:16 +02:00
exts a7d070d2d5 fixes #22828 - res://user had incorrect substr value
(cherry picked from commit 18b6f5a6c9)
2019-07-03 14:39:25 +02:00
elasota 7ac73098fc Fix FileAccessCompressed::get_8 returning 0 for the last byte of a file
(cherry picked from commit 88c74aa017)
2019-07-03 14:22:06 +02:00
Fabio Alessandrelli 681c22375b Fix DNS resolution when cache is invalid.
Fix StreamPeerTCP.connect_to_host return value.

(cherry picked from commit 97757cd1d1)
2019-07-03 14:05:19 +02:00
Hein-Pieter van Braam 73fa1470b3 Remove faces in in QuickHull::build() that we don't need anymore
We delete the faces for consideration in this loop but we can still
sometimes find an edge that connects to this face. We now interate over
all edges and disconnect edges connecting to this face.

This fixes #16560 and fixes #17569

(cherry picked from commit 33669a8bca)
2019-07-03 13:58:27 +02:00
Rémi Verschelde 005d1c8901 Fix loading PO files with missing newline after last msgstr
Fixes #20375.

(cherry picked from commit 12d69ef53e)
2019-07-03 13:35:41 +02:00
Marcelo Fernandez 0572b52ba1 Fix upper/lower case convertion for characters >= 0x80
(cherry picked from commit ecb071b221)
2019-07-03 13:35:41 +02:00
karroffel f302888a47 fix nameclash with MSVC
(cherry picked from commit 43ae1c712f)
2019-07-03 13:23:41 +02:00
matthew1006 c68a465f47 Fixed OS.has_feature not using custom feature tags.
(cherry picked from commit 25e64ffa20)
2019-07-03 13:21:56 +02:00
matthew1006 dae30964a2 Fixed project settings overrides not using custom feature tags.
(cherry picked from commit 1844704c20)
2019-07-03 12:41:27 +02:00
Fabian 82e54db588 Fix for not picking up locale of some .po translation files
(cherry picked from commit 1065f06eef)
2019-07-03 12:33:25 +02:00
nemerle 13a90fdd89 Fix PoolAllocator::resize for too large p_new_size
The code had a subtle signed/unsigned bug -
```cpp
if( signed - unsigned < 0)
// signed - unsigned is unsigned in c++, so
if( unsigned < 0)
// and thus the if block will never be executed
```

Thus all the following code would be ran, including unnecessary retries
of compacting the pool.

(cherry picked from commit 2bbe6144ff)
2019-07-03 12:33:24 +02:00
Poommetee Ketson 3daca13f72 Fix error explanation in core_bind Thread::_start_func
(cherry picked from commit 2caaa7c97d)
2019-07-03 10:59:11 +02:00
Rémi Verschelde 0eab0d9343 Update copyright statements to 2019
Happy new year to the wonderful Godot community!
2019-01-03 11:41:35 +01:00
Juan Linietsky a93e28291f Ensure one shot signals are not disconnected while edited, closes #7776
(cherry picked from commit ac52eb444f)
2018-11-28 10:27:41 +01:00
Rémi Verschelde 80e66a6214 Improve return value of OS.execute in blocking/non-blocking variants
Initialized the PID to -2, which will be the value returns in blocking-
mode where the PID is not available. (-1 was already taken to signify an
execution failure).

OS::execute will now properly return a non-OK error code when it fails
to execute the target file.

The documentation was rewritten to be very clear about the differences
between blocking and non-blocking mode.

Fixes #19056.

(cherry picked from commit f392650be2)
2018-11-01 11:39:20 +01:00
Fabio Alessandrelli 5262d1bbcc Fix marshalls size checks.
Yesterday, when playing around with my network code, I realized there is
a security issue in decode_variant, at least when decoding PoolArrays.
Basically, the size of the PoolArray is encoded in a uint32_t, when
decoding it, that value is cast to int when comparing if the packet is
actually that size causing numbers with MSB=1 to be interpreted as
negative thus always passing the check. That same value though, is used
as uint32_t again to resize the output vector.  For this reason, sending
a malformed packet with declared type PoolByteArray and size of 2^31(+x)
causes the engine to try to allocate 2+GB of pool memory, causing the
engine to crash.
2018-07-28 21:21:19 +02:00
Ignacio Etcheverry e7110984f3 Add Dictionary::erase_checked(key) method
Same as erase, but it returns a boolean value indicating whether the pair was erased or not.
This method should be removed during the next compatibility breakage, and 'Dictionary::erase(key)' should be changed to return a boolean.

(cherry picked from commit 2f69e36cef)
2018-07-28 16:06:30 +02:00
Hein-Pieter van Braam b64850e732 Make _ALWAYS_INLINE_ and _FORCE_INLINE_ equivalent
_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-27 17:14:22 +02:00
Rémi Verschelde c709dff1a2 Style: Format code with clang-format 6.0.1
(cherry picked from commit 7c9f7452f4)

Travis: Update style checks to clang-format 6.0.1

(cherry picked from commit 003ac67df1)
2018-07-18 16:37:23 +02:00
Pedro J. Estébanez 59a00c3cdd Fix debugger focus stealing
At least on Windows, the authorization must be given every time, not only at startup.

(cherry picked from commit 2fcbf9dd81)
2018-07-08 15:39:15 +02:00
GagaPete 139185e543 Fix CORS problems due to added headers on JS target
Before this change, missing User-Agent and Accept headers were automatically
added on all platforms. Setting the User-Agent header forces the browser to
do a CORS preflight (see 1) which fails if the HTTP endpoint is not
configured appropriate. It's not neccesary to set either header as the
browser sets them and so this commit disables that functionality on the JS
target.

1: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#Simple_requests
(cherry picked from commit 8a4dccc4ce)
2018-07-08 15:39:15 +02:00
Rhody Lugo 2f3e4c1a7a add NoCache wrapper to Command
(cherry picked from commit 920224a535)
2018-06-22 14:42:14 +02:00
bruvzg 518a691231 Mono: Allow loading `mscorlib` from resources.
(cherry picked from commit b3ddf12fb1)
2018-06-13 11:57:40 +00:00
Hugo Locurcio 403f7dc35f Change ".." punctuation for "..." in editor strings (#16507)
(cherry picked from commit 1c419531a0)
2018-06-05 21:42:33 +02:00
Alexander Alekseev 8231b3cef8 Vector3::round, Vector2::round & Vector2::ceil methods were added.
Now both structs (Vector2 & Vector3) have round, floor & ceil methods.
(see #18603)

(cherry picked from commit 26963473a9)
2018-06-01 18:08:29 +02:00
Paul Joannon 1d3be8c453 fix API string path
(cherry picked from commit a35c8bbdc7)
2018-05-13 23:03:48 +02:00
Ibrahn Sahir 5f632391ca fix for segfault when using CallBasic in visual script on release build
(cherry picked from commit 95dfa5b96d)
2018-05-13 22:11:08 +02:00
RaphaelHunter 0b9f61c9a6 add condition check in Imgae::create(...)
(cherry picked from commit 63e258cc8f)
2018-05-13 21:59:22 +02:00
Hein-Pieter van Braam 5917063192
Merge pull request #18082 from RandomShaper/improve-gui-touch-3.0
Implement universal translation of touch to mouse (3.0)
2018-05-13 21:30:37 +02:00
Hein-Pieter van Braam bcb38393a5
Merge pull request #18157 from RandomShaper/improve-uri-utils-3.0
Improve/fix URI utils (3.0)
2018-05-13 21:11:42 +02:00
Max Hilbrunner 0551c5c2cd PCKPacker:pck_start(): Update version
(cherry picked from commit a3aa5ad0d0)
2018-05-01 22:04:08 +02:00
Pedro J. Estébanez e10a2e5999 Implement universal translation of touch to mouse
Now generating mouse events from touch is optional (on by default) and it's performed by `InputDefault` instead of having each OS abstraction doing it. (*)

The translation algorithm waits for a touch index to be pressed and tracks it translating its events to mouse events until it is raised, while ignoring other pointers.

Furthermore, to avoid an stuck "touch mouse", since not all platforms may report touches raised when the window is unfocused, it checks if touches are still down by the time it's focused again and if so it resets the state of the emulated mouse.

*: In the case of Windows, since it already provides touch-to-mouse translation by itself, "echo" mouse events are filtered out to have it working like the rest.

On X11 a little hack has been needed to avoid a case of a spurious mouse motion event that is generated during touch interaction.

Plus: Improve/fix tracking of current mouse position.
2018-04-30 19:04:35 +02:00
Hein-Pieter van Braam 3ee4d6af2e Hand-merge API hash fixes #18514
This hasn't made it into master yet but is important for mono support.
If this turns out to be the wrong call we'll revert and merge whatever
next version of this becomes available.
2018-04-29 20:44:48 +02:00
Marcelo Fernandez e7837828f6 Improved error checking at EditorExportPlatformPC::export_project
(cherry picked from commit 0876502f72)
2018-04-29 15:12:21 +02:00
Marcelo Fernandez 272fb05270 Added File.get_path and File.get_path_absolute functions
(cherry picked from commit a4e64c5454)
2018-04-29 15:09:29 +02:00
George Marques 3acd6fb728 Fix names of Variant operators
(cherry picked from commit fefee533ae)
2018-04-28 22:56:33 +02:00
Bojidar Marinov 44f4c8e745 Fix crash resulting from bad month check in core_bind.cpp
Also, make it clear that day is 0-based. This might cause very slight differcies in existing games.
Fixes #18221

(cherry picked from commit 4b9cf93338)
2018-04-28 22:53:02 +02:00
Crazy-P e5a17617e6 Resolves Inccorect Quaternion Conversion
Fixes https://github.com/godotengine/godot/issues/18025

(cherry picked from commit ae7a9df292)
2018-04-28 20:29:40 +02:00
Pedro J. Estébanez c07d588e80 Fix listing files inside directory in pack file
When adding a directory path to the inventory of the pack, an empty file name was being added to the file list. That made `Directory.get_ntext()` signal end-of-list too early so that files in a subdirectory were missed.

Fixes #15801.
Helps with #16798.

(cherry picked from commit 536611704a)
2018-04-28 17:35:48 +02:00
robfram 141e389c3f Fix non working action names containing whitespaces
Now the action name is quoted if it contains spaces. Also, quotation
mark (") is added to the forbidden character list for action names, as
it was also a bug.

Fix #17322

(cherry picked from commit ea94a82596)
2018-04-28 17:04:20 +02:00
Andreas Haas 6472d8c7d4 Mono: Avoid invalid class names.
Disallow reserved keywords as class names and prefix base class with the Godot
namespace if it's the same as the class name.

Fixes #12483

(cherry picked from commit 700d07cf7c)
2018-04-15 00:48:11 +02:00
Ruslan Mustakov 99cf2ffb19 iPhone X support and iOS-related fixes
Starting from April 2018 Apple no longer accepts apps that do not
support iPhone X. For games this mainly means respecting the safe area,
unobstructed by notch and virtual home button. UI controls must be
placed within the safe area so that users can interact with them.

This commit:

- Adds OS::get_window_safe_area method that returns unobscured area of
  the window, where interactive controls should be rendered.

- Reorganizes how launch screens are exported - the previous way was
  incorrect and modern iPhones did not pick up the correct screens and
  because of that used a non-native resolution to render the game.

- Adds launch screen options for iPhone X.

- Makes launch screens optional in the export template. If not
  specified, a white screen will be used.

- Adds App Store icon (1024x1024) export option as it now has to be
  bundled with the app instead of being provided in iTunes Connect.

- Fixes crash when launching games in iOS Simulator. It happened because
  controllerWasConnected callback came before the engine was
  initialized. Now in such case the controllers will be queued up and
  registered after initialization is done.

- Fixes issue with the virtual keyboard where for some reason
  autocorrection panel would intersect with the keyboard itself and not
  allow you to use the top row of the keyboard. This is fixed by
  disabling autocorrection altogether.

Closes #17358. Fixes #17428. Fixes #17331.

(cherry picked from commit 1d9a3a9b1c)
2018-04-14 20:17:47 +02:00