Commit graph

291 commits

Author SHA1 Message Date
Rémi Verschelde
68735d2a88 Fix compilation warnings in JS and Windows builds
Warnings raised by Emscripten 1.38.0 and MinGW64 5.0.4 / GCC 8.3.0.

JS can now build with `werror=yes warnings=extra`.
MinGW64 still has a few warnings to resolve with `warnings=extra`,
and only one with `warnings=all`.

Part of #29033 and #29801.
2019-06-15 14:40:45 +02:00
hbina085
f78baa5f93 added a const keyword for a methods that return constant literal... 2019-05-21 02:16:30 -04:00
marxin
cdf54d6c5f Ignore a warning in _get_socket_error (-Wlogical-op).
drivers/unix/net_socket_posix.cpp: In member function 'NetSocketPosix::NetError NetSocketPosix::_get_socket_error()':
drivers/unix/net_socket_posix.cpp:197:22: warning: logical 'or' of equal expressions [-Wlogical-op]
  197 |  if (errno == EAGAIN || errno == EWOULDBLOCK)
      |                      ^

and:

modules/mono/utils/string_utils.cpp: In function 'int {anonymous}::sfind(const String&, int)':
modules/mono/utils/string_utils.cpp:68:48: error: logical 'or' of collectively exhaustive tests is always true [-Werror=logical-op]
      found = src[read_pos] == 's' || (c >= '0' || c <= '4');
                                       ~~~~~~~~~^~~~~~~~~~~
2019-05-02 11:11:52 +02:00
Juan Linietsky
cd4449e7ab Add FileAccess::set_unix_permissions for Unix platforms 2019-04-07 15:45:30 -03:00
Juan Linietsky
65f3a953de Remove SIGCHILD handle in OS_Unix, interferes with pclose() 2019-04-07 15:45:00 -03:00
Fabio Alessandrelli
0bcf0314f7 Fix jump over uninitialized value in OS Unix/X11 2019-04-09 15:12:55 +02:00
Pedro J. Estébanez
9c3ddf05cb Revert accidental commits
This reverts commit fb37284c02.
This reverts commit 4db0f51b9a.
2019-03-20 21:43:55 +01:00
Pedro J. Estébanez
fb37284c02 Create class for shared memory blocks [wip] 2019-03-20 20:44:43 +01:00
Rémi Verschelde
372152220b
Merge pull request #26159 from marxin/fix-Wsuggest-attribute=format
Fix -Wsuggest-attribute=format warnings.
2019-02-27 09:23:26 +01:00
marxin
e5f665c718 Fix -Wsign-compare warnings.
I decided to modify code in a defensive way. Ideally functions
like size() or length() should return an unsigned type.
2019-02-27 07:45:57 +01:00
marxin
aff84ec55d Fix -Wsuggest-attribute=format warnings. 2019-02-27 06:56:50 +01:00
Rémi Verschelde
5fc86026ca Fix typos with codespell
Using codespell 1.14.0.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
doubleclick
lod
nd
numer
que
te
unselect
EOF
$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2019-02-13 09:23:29 +01:00
Ignacio Etcheverry
9bd9d21358 Fix OS_Unix::set_environment 2019-02-04 00:44:37 +01:00
Ignacio Etcheverry
41873ffa88 Added set_environment to OS class 2019-02-03 05:38:47 +01:00
Rémi Verschelde
c3b0ee5941 Fix code style issues 2019-01-26 22:35:31 +01:00
Ignacio Etcheverry
6de04cf04c Improve custom thread numbering for POSIX
We lazily assign new IDs to threads that do not have one. This is the case for threads not created by the Godot API.
2019-01-25 00:59:07 +01:00
Juan Linietsky
6fa632b821 Add function to obtain filesystem type from DirAccess.
Change EditorFileSystem to not use directory modification times on FAT32, fixes #20946
2019-01-21 18:06:14 -03:00
Rémi Verschelde
b16c309f82 Update copyright statements to 2019
Happy new year to the wonderful Godot community!
2019-01-01 12:58:10 +01:00
Rémi Verschelde
6770357e47 Android: Better identify thirdparty C/C++ code
- The `cpu-features.{c,h}` code was only used by chance by the webm
  (libvpx) code, so I moved it there. It was actually introduced before
  that and wasn't in use, and libvpx just happened to be able to
  compile thanks to it being bundled.
  It could potentially be compiled on the fly from the Android NDK, but
  since we plan to replace the webm module by a GDNative plugin in the
  near future, I went the bundling route.

- `ifaddrs_android.h` is already provided in the Android NDK as
  `ifaddrs.h`, same as on other Unixes. Yet we cannot use it until we
  up the min API level to 24, where `getifaddrs` is first defined.
  I moved the files to `thirdparty/misc` and synced them with upstream
  WebRTC (only indentation changes and removal of `static` qualifiers).

Also removes dropped thirdparty files from COPYRIGHT.txt after changes
in #24105 and #24145.
2018-12-20 13:07:54 +01:00
volzhs
84d060c768 Added OS.get_system_time_msecs() 2018-12-20 18:50:50 +09:00
Wilson E. Alvarez
08f22f1cf0
Moved member variables to initializer list 2018-12-11 18:33:01 -05:00
Juan Linietsky
f2ae14f309 Attempt to avoid breaking people's workflows on the change from 8ba0d513fa 2018-11-27 18:13:36 -03:00
Juan Linietsky
8ba0d513fa Added missing path verification on Unix, closes #20762 2018-11-22 23:21:03 -03:00
Fabio Alessandrelli
1ef9e9ef6a Properly accept wildcard when binding IPv4 socket.
Also never return null for is_ipv4 to avoid crashes due to engine bug.
(better to get an error and a broken socket then seeing your game crash)
2018-11-18 14:54:40 +01:00
Rémi Verschelde
7771fe5d4a
Merge pull request #23388 from eska014/html5-stubexec
Add proper stubs for OS_JavaScript::execute(), get_process_id(), kill()
2018-10-29 23:40:17 +01:00
Leon Krause
5c2c47a174 Add proper stubs for OS_JavaScript::execute(), get_process_id(), kill()
Avoids linker warnings and errors about undefined references.
2018-10-29 21:41:59 +01:00
Marcelo Fernandez
fe93bb03fe Server platform works on OS X too 2018-10-29 12:54:51 -03:00
Fabio Alessandrelli
12124d2d44 Safer getcwd in DirAccess
Fix [-Wunused-result]
2018-10-07 14:50:14 +02:00
Fabio Alessandrelli
5393e7310d Avoid possible overflow in OS_Unix readlink
Also fix [-Wunused-result]
2018-10-07 12:56:07 +02:00
Leon Krause
5f45476dc1 Fix warnings in HTML5 build outside platform files 2018-10-06 00:08:17 +02:00
Rémi Verschelde
97b9697ea2 Fix some OSX and iOS Clang warnings
Fixes the following XCode 9.4.1 warnings:
```
core/os/memory.cpp:175:13: warning: unused variable 's' [-Wunused-variable]
drivers/coremidi/core_midi.cpp:68:14: warning: comparison between NULL and non-pointer ('MIDIEndpointRef' (aka 'unsigned int') and NULL) [-Wnull-arithmetic]
drivers/gles2/rasterizer_gles2.cpp:77:24: warning: unused function '_gl_debug_print' [-Wunused-function,34]
drivers/unix/thread_posix.cpp:106:12: warning: unused variable 'running_thread' [-Wunused-variable,34]
modules/gdnative/nativescript/nativescript.h:371:16: warning: in-class initialization of non-static data member is a C++11 extension [-Wc++11-extensions]
platform/iphone/gl_view.mm:56:14: warning: unused variable 'video_previous_volume' [-Wunused-variable,34]
platform/iphone/gl_view.mm:251:12: warning: unused function 'get_first_id' [-Wunused-function,34]
platform/iphone/main.m:45:15: warning: unused variable 'app' [-Wunused-variable,34]
platform/osx/os_osx.mm:79:15: warning: unused function 'convertRectToBacking' [-Wunused-function]
```
2018-10-04 11:50:16 +02:00
Rémi Verschelde
d952126caf Fix warnings in Android platform
Fixes the following Clang 7 warnings:
```
platform/android/os_android.h:240:16: warning: 'OS_Android::native_video_play' hides overloaded virtual function [-Woverloaded-virtual]
platform/android/os_android.h:241:15: warning: 'OS_Android::native_video_is_playing' hides overloaded virtual function [-Woverloaded-virtual]

platform/android/audio_driver_opensl.cpp:104:3: warning: suggest braces around initialization of subobject [-Wmissing-braces]

platform/android/audio_driver_opensl.cpp:129:10: warning: unused variable 'numOutputs' [-Wunused-variable]
platform/android/audio_driver_opensl.cpp:130:11: warning: unused variable 'deviceID' [-Wunused-variable]
platform/android/java_glue.cpp:795:10: warning: unused variable 'clsio' [-Wunused-variable]
platform/android/java_glue.cpp:890:12: warning: unused variable 'gob' [-Wunused-variable]
platform/android/java_glue.cpp:592:13: warning: unused variable 'resized' [-Wunused-variable]
platform/android/java_glue.cpp:593:13: warning: unused variable 'resized_reload' [-Wunused-variable]

modules/mobile_vr/mobile_vr_interface.cpp:401:8: warning: unused variable 'aspect_ratio' [-Wunused-variable]

drivers/unix/dir_access_unix.cpp:394:2: warning: THIS IS BROKEN [-W#warnings]
```
2018-10-03 15:17:00 +02:00
Marcelo Fernandez
d0a5ac577f Fix OS X get_ticks_usec return value after #22424 2018-09-30 13:06:46 -03:00
Fabio Alessandrelli
460e3376a4 Use monotonic clock for get_ticks_usec
Static _clock_start and _clock_setup function.
Use clock_gettime on Unix, mach_absolute_time on Mac.
2018-09-29 21:54:48 +02:00
Rémi Verschelde
3a2ca68af3 SCons: Build thirdparty code in own env, disable warnings
Also remove unnecessary `Export('env')` in other SCsubs,
Export should only be used when exporting *new* objects.
2018-09-28 14:07:39 +02:00
Fabio Alessandrelli
9d9a14e289 Remove socket_helper.h after NetSocket refactor 2018-09-28 02:03:23 +02:00
Rémi Verschelde
bca2d3ad40 Fix invalid comparison warnings: [-Wbool-compare] and [-Wenum-compare]
Fixes the following GCC 5 warnings and actual bugs:
```
drivers/unix/net_socket_posix.cpp:562:28: warning: comparison between 'enum IP::Type' and 'enum NetSocket::Type' [-Wenum-compare]
modules/gdscript/gdscript_function.cpp:792:26: warning: comparison of constant '17' with boolean expression is always true [-Wbool-compare]
modules/gdscript/gdscript_function.cpp:792:26: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
modules/gdscript/gdscript_parser.cpp:5082:58: warning: comparison of constant '6' with boolean expression is always false [-Wbool-compare]
modules/gdscript/gdscript_parser.cpp:5082:58: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
modules/mbedtls/stream_peer_mbed_tls.cpp:286:45: warning: comparison between 'enum StreamPeerTCP::Status' and 'enum StreamPeerSSL::Status' [-Wenum-compare]
modules/mbedtls/stream_peer_mbed_tls.cpp:313:45: warning: comparison between 'enum StreamPeerTCP::Status' and 'enum StreamPeerSSL::Status' [-Wenum-compare]
```
2018-09-27 16:25:24 +02:00
Fabio Alessandrelli
c37442ef00 Fix Winsock UDP ECONNRESET/ENETRESET bug
Since Windows 2000:
Calling recv/recvfrom when an ICMP reply was received from a previous
send/sendto, may result in a WSAECONNRESET error.

Since Windows Vista(?)/Windows Server 2008:
Calling recv/recvfrom when an ICMP reply was received from a previous
send/sendto, may also result in a WSAENETRESET error.

Both those features are disabled by this commit using disabling
SIO_UDP_CONNRESET and SIO_UDP_NETRESET on newly created UDP sockets.
2018-09-22 04:09:42 +02:00
Fabio Alessandrelli
479d4fb741 Detect POLLERR revents too in NetSocketPosix.
Usually indicate an RST was received by a TCP socket.
2018-09-22 01:40:58 +02:00
Fabio Alessandrelli
a15db2d2b6 Use select instead of WSAPoll on Windows.
WSAPoll is broken by design.
It was announced as the new way to introduce compatibility to posix
sockets, their implementation was broken, and they decided not to fix it.

You can read the full story here:
https://daniel.haxx.se/blog/2012/10/10/wsapoll-is-broken/
2018-09-22 01:40:58 +02:00
Fabio Alessandrelli
01c3c1a07b Properly initialize Winsock on startup
Also fix typo in _get_last_error which caused Winsock connect to fail.
2018-09-13 16:05:47 +02:00
Rémi Verschelde
1a16dabfb5
Merge pull request #21982 from luzpaz/misc-typos
Misc. typos
2018-09-13 10:59:00 +02:00
luz.paz
08bde5b2de Misc. typos
Found via `codespell -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"`
2018-09-12 21:39:17 -04:00
Fabio Alessandrelli
30327872e0 Unify StreamPeerTCP/TCP_Server with NetSocket API 2018-09-12 15:56:20 +02:00
Fabio Alessandrelli
1b99806b47 Unify PacketPeerUDP using NetSocket 2018-09-12 15:56:16 +02:00
Fabio Alessandrelli
b4e3be7519 New NetSocket interface, BSD/Win implementation
Unified BSD and Winsock sockets into a single implementation of a
generic NetSocket interface.

This is some ground work for few network improvements:
- Reuse as much code as possible between Posix and Windows.
- Provide a single point of implementation for exotic sdks (consoles).
- Provide platform agnostic StreamPeerTCP and PacketPeerUDP in core.
- Implement connect for UDP allowing for DTLS implementation.
2018-09-12 15:46:37 +02:00
Fabio Alessandrelli
7de28be764 ENet wrapper properly detect disconnect on poll
Now PacketPeerUDP.get_available_packet_count() return -1 if the socket
is in error state.
2018-09-12 12:50:53 +02:00
Fabio Alessandrelli
d3108985e0 Properly reset socket blocking state on close 2018-09-12 12:50:53 +02:00
Rémi Verschelde
277b24dfb7 Make core/ includes absolute, remove subfolders from include path
This allows more consistency in the manner we include core headers,
where previously there would be a mix of absolute, relative and
include path-dependent includes.
2018-09-12 09:52:22 +02:00
Rémi Verschelde
72996df656
Revert "Try closing gracefully before terminating process" 2018-08-27 17:32:43 +02:00