29 Commits
Author SHA1 Message Date
Volodymyr FialkoandBIAGINI Nathan 15d823dab6 Enable build flags and fix compilation warnings (gcc 14.1.0) (#66)
* Fix rpc build with other examples

CPP_COMPILE is an option, a cache variable, thus regular unset() is not
working for it since it tries to unset the scope variable.

This causing cmake to skip compilation of rpc.
Unset CPP_COMPILE from CACHE to make it work as intended.

* Fix compiler flags with build targets

Currently tests, soak and examples are build without extra flags,
because add_compile_options is specified after defining build targets.

From add_compile_options() docs:
Adds options to the compiler command line for targets in the current
directory and below that are added *after* this command is invoked.

* Pass debug callbacks as struct

Fixes:
warning: ISO C forbids conversion of function pointer to object pointer
type

* Move global variables under NBNET_IMPL

Nb net could be included multiple times, to prevent creation of global
variables in each file move them under NBNET_IMPL.

Also use designated initializer to initiate a driver structure to
remove warnings about partial initialization. Designated initializer
would initialize other members to zero.

* Resolve unused variables warnings.

Cast unused function arguments to (void) to suspend warnings.

* Resolve signed vs unsigned warnings

Remove unnecessary lt 0 checks and sync types to remove signed vs
unsigned warnings.

* Resolve string related warnings

Fixes:
nbnet/tests/string_tests.c:18:9: error: ‘strncpy’
output truncated before terminating nul copying 5 bytes from a string of
the same length
[-Werror=stringop-truncation]
   18 |         strncpy(res + pos, b, len_b);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

nbnet/tests/string_tests.c:24:9: error: ‘strncpy’
specified bound depends on the length of the source argument
[-Werror=stringop-truncation]

* Resolve function defined but not used warnings

Mark GameServer_GetClientCount() as inline.

* Attempt to fix warning in ASSERT_VALUE_IN_RANGE

In case when value in unsigned type and min is 0, this commit just
obfuscates types, maybe there's better solution.

Fixes:
warning: comparison of unsigned expression in ‘>= 0’ is always true
[-Wtype-limits]

* Ensure that read len is less than word size

In release mode(-DCMAKE_BUILD_TYPE=Release) tests returning following
error:
nbnet/tests/../nbnet.h:2272:9: error: ‘memcpy’ forming offset [4, 7] is
out of the bound s [0, 4] of object ‘word’ with type ‘Word’ {aka
‘unsigned int’} [-Werror=array-bounds=]
 2272 |         memcpy(bytes, &word, length); |
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

Add check to verify that length is less than Word size.

* add -Wno-unknown-pragmas flag

* fix examples compilation on windows

* fix examples compilation on windows

* fix examples compilation on windows

* fix unit tests compilation on windows

* fix soak test compilation on windows

* fix unit tests compilation on windows

* fix unit tests compilation on windows

---------

Co-authored-by: BIAGINI Nathan <nath.biagini@gmail.com>
2024-08-10 12:02:42 +02:00
Nathan 32b1b62781 remove encryption support from core library (#59)
remove encryption support from the core library
2024-07-16 23:34:00 +02:00
BIAGINI Nathan 23b9fc8627 fix driver registering in echo example 2024-06-23 08:48:06 +02:00
BIAGINI Nathan 0e1974d287 update copyright year 2024-02-07 22:28:54 +01:00
Nathan a0d605e27f [WIP] Rework native webrtc driver (ditch facil.io) (#52)
Remove the dependency of the native webrtc driver to facil.io entirely.
2024-02-07 22:03:20 +01:00
Nathan 9e28e97685 nbnet 2.0 (#35)
2.0 release - internal refactoring, public API rework, and introduction of a new CI based on GitHub actions
2023-09-24 19:43:08 +02:00
BIAGINI Nathan 8113cddb3b fix examples 2023-05-27 18:38:13 +02:00
Mark Deneen 5cd9bfcc53 Allow echo example to be built with C++ 2023-05-21 09:02:15 -04:00
BIAGINI Nathan a59c4303ec update copyrights year 2023-02-18 11:28:18 +01:00
BIAGINI Nathan 993b6c9c7c fix examples 2023-02-05 10:28:39 +01:00
BIAGINI Nathan 9bd6a55a6e update examples & soak test 2021-11-30 14:41:27 +01:00
BIAGINI Nathan a42fc0e933 update examples & soak test 2021-11-30 10:11:06 +01:00
laurenloco bbe339f0b2 Fix echo example documentation
Missing `-lm` on `gcc` compile command, both on server and client files.
2021-10-08 20:34:24 -03:00
BIAGINI Nathan d43a30fef3 update examples 2021-09-05 12:21:03 +02:00
Nathan BIAGINI 1740c4120b update examples 2021-08-29 18:40:53 +02:00
Nathan BIAGINI ceb1426228 update examples 2021-08-29 18:23:16 +02:00
Nathan BIAGINI ac9b5db620 update examples 2021-05-22 23:10:20 +02:00
Nathan BIAGINI abbe541386 update echo example to support encryption 2021-01-29 18:04:58 +01:00
Nathan BIAGINI 10d34cf923 README; update typo 2021-01-19 19:23:52 +01:00
Nathan BIAGINI 43f8d07bf1 update examples 2021-01-19 19:23:52 +01:00
Nathan BIAGINI 0d02cb03d2 update echo example 2020-10-18 10:13:43 +02:00
Nathan BIAGINI 6695a86d9d update examples 2020-10-12 21:13:10 +02:00
Nathan BIAGINI 2133134ebb update examples 2020-10-10 15:24:44 +02:00
Nathan BIAGINI f68962d742 update echo example to work with the webrtc driver 2020-10-03 22:36:03 +02:00
Nathan BIAGINI f37abea666 licensing 2020-09-20 20:52:21 +02:00
Nathan BIAGINI 96dff64443 rm binaries 2020-09-20 20:52:21 +02:00
Nathan c698403c76 Update README.md 2020-09-20 20:12:15 +02:00
Nathan BIAGINI cda770f224 examples 2020-09-20 20:08:28 +02:00
nathb 3e0f34b605 minor api changes 2020-09-05 17:29:49 +02:00