1
0
Fork 0
Commit Graph

288 Commits

Author SHA1 Message Date
peterbell10 13144a08e4
Enable some more clang-tidy linter checks (#4738)
* Avoid inefficient AString -> c_str() -> AString round trip

* Avoid redundant string init expressions

* Avoid unnecessary return, continue, etc.

* Add .clang-format to help with clang-tidy fix-its

* Avoid unnecessary passing by value

* Avoid unnecessary local copying

* Avoid copying in range-for loops

* Avoid over-complicated boolean expressions

* Some violations missed by my local clang-tidy

* Allow unnecessary continue statements

* Add brackets

* Another expression missed locally

* Move BindingsProcessor call into clang-tidy.sh and add space

* Fix pushd not found error

* Different grouping of CheckBlockInteractionRate
2020-05-14 22:15:35 +00:00
Mat e053f72db8
Android build cleanup (#4734)
* Android build cleanup

* Remove unnecessary workaround

* Remove more unnecessities

* Bump cmake version
2020-05-10 16:18:28 +00:00
peterbell10 84289a2ba9
Cleanup some workarounds and warnings (#4735)
* Cleanup thread_local usage in FastRandom

* Use constexpr to avoid clang warning

* Fix more Wglobal-constructor warnings

* Make MSVC happy?
2020-05-10 16:16:49 +00:00
peterbell10 154df6b09d
Cleanup unneeded globals (#4736) 2020-05-10 16:16:38 +00:00
Mat c710f6a4ea
Remove old Android leftovers (#4722) 2020-05-07 22:14:00 +03:00
peterbell10 57952505e5
Update fmt to 6.2.0 (#4718)
* Update fmt to 6.2.0
2020-05-05 22:52:14 +01:00
Mattes D 9ee47e5999 Using Super. 2020-04-16 20:07:48 +00:00
Mattes D 42cc736bfd
ServerHandle: Fix closing failed servers. (#4653)
If the cServerHandle failed to listen, closing it would then crash Cuberite.
2020-04-15 14:13:40 +02:00
Mat 318d31dc39
Use a reasonable listen backlog value (#4597) 2020-04-02 16:05:07 +02:00
Mat 7d4934534e
Stabilise MoveToWorld (#4004)
* Stabilise MoveToWorld

* Fix comments and deprecate ScheduleMoveToWorld

* Enhanced thread safety for m_WorldChangeInfo

* Return unique_ptr from cAtomicUniquePtr::exchange

* cWorld now calls entity cEntity::OnAddToWorld and cEntity::OnRemoveFromWorld.

Allows broadcasting entities added to the world from the world's tick thread.
This also factors out some common code from cEntity::DoMoveToWorld and cEntity::Initialize.

As a consequence, cEntity::Destroy(false) (i.e. Destroying the entity without broadcasting) is impossible.
This isn't used anywhere in Cuberite so it's now deprecated.

* Update entity position after removing it from the world.
Fixes broadcasts being sent to the wrong chunk.

* Fix style

* cEntity: Update LastSentPosition when sending spawn packet

* Add Wno-deprecated-declarations to the lua bindings

* Kill uses of ScheduleMoveToWorld
2020-03-05 12:52:34 +02:00
Alexander Harkness bf10b56638 Fix android builds (#4432)
* Terminate android build script early if any step fails

* Remove deprecated android types

* Use android NDK cmake support rather than cmake android NDK support as that support is better supported

* Android uses GNU strerror_r?

* Fix compilation

* Rebase

* Fix final issues

* Drop submodule changes

* Revert change

* Parentheses

* Lower api levels

* Don't use GNU strerror_r for Android

Co-authored-by: Mat <mail@mathias.is>
2020-01-02 03:54:40 +02:00
Mattes D f021e2fe22 Updated LibEvent to release 2.1.11-stable. (#4383)
This finally restores my ability to compile on Windows and Linux from the same source folder (on a network drive).

LibEvent broke this long ago by writing a config file into the source folder, rather than build folder. Now it's finally fixed.
2019-09-04 22:34:54 +01:00
peterbell10 ee84197014
Force all headers other than "Globals.h" to be included with relative paths (#4269)
Closes #4236

CMake now creates a header file in the build directory under the path "include/Globals.h" which just includes "src/Globals.h" with an absolute path. Then instead of adding "src/" to the include directories, it adds "include/".

#include "Globals.h" still works by including the build generated file and any other src-relative path will not work.
2018-08-29 01:51:25 +01:00
Nate 801d5d7170 Fix: Create players folder recursively (#4283)
Problem: On a new server the players folder was not created on windows.

Root Cause:
`GetUUIDFolderName` was returning a folder structure for players with `/` while CreateFolderRecursively was checking for `\\` for win32. 

The fix is to recognise both forward and backward slashes as file separators on windows.

Fixes #4284
2018-08-12 23:47:38 +01:00
peterbell10 950aeffff8
CheckBasicStyle: Check number of empty lines between functions (#4267)
Add check for number of empty lines between functions and fix the corresponding failures
2018-07-26 22:24:36 +01:00
peterbell10 7b431bed51
cIsThread: Reset m_ShouldTerminate after the thread has stopped (#4258)
This allows threads to be restarted after stopping.

Fixes #4257
2018-07-22 22:35:58 +01:00
peterbell10 a4dbb5c582
Prefer static_cast to reinterpret_cast (#4223)
* Change reinterpret_cast -> static_cast wherever possible
* Remove more unnecessary `const_cast`s.

reinterpret_casts should be avoided for the same reason as c-style casts - they don't do any type-checking. reinterpret_cast was mainly being used for down-casting in inheritance hierarchies but static_cast works just as well while also making sure that there is actually an inheritance relationship there.
2018-05-02 08:50:36 +01:00
peterbell10 1ea36298d2
Fix cUrlClient leak (#4125)
Fixes #4040
* The TCP connection is now shutdown after OnBodyFinished
* Any open connections are closed when cNetworkSingleton::Terminate() is called.
* Removed ownership cycles in cUrlClientRequest
* Added a check to the test to ensure there are no leaks.
2018-02-20 17:08:46 +00:00
peterbell10 757231cc6e
Add the fmt library (#4065)
* Replaces AppendVPrintf with fmt::sprintf
* fmt::ArgList now used as a type safe alternative to varargs.
* Removed SIZE_T_FMT compatibility macros. fmt::sprintf is fully portable and supports %zu.
* Adds FLOG functions to log with fmt's native formatting style.
2018-01-03 17:41:16 +00:00
Mattes D 01322cb1b0 NetworkLookup: Added "virtual" keyword to overridden dtor. (#4100) 2017-12-21 13:31:20 +00:00
bibo38 532731e6f4 Fixed Clang 5.0 compile errors (#4085)
* Fixed Clang 5.0 compile errors

* Fixed wrong comment

* Only disable warnings in Clang 5 or higher

* Added a CMake condition for the Clang 5 no-zero-as-null-pointer-constant warning

* Now using the use_nullptr branch of the Cuberite specific SQLiteCpp fork
2017-12-21 11:36:58 +00:00
Lukas Pioch c5f590d460 Removed UTF-8 BOM (#4033) 2017-09-19 10:34:08 +02:00
peterbell10 84941bcc9f Update mbedtls to 2.5.1 (#3964)
* Renaming changes:
  * macro prefix "POLARSSL" -> "MBEDTLS"
  * functions now prefixed with "mbedtls_"
  * rename PolarSSL++ -> mbedTLS++
  * rename polarssl submodule

* Use mbedtls' AES-CFB8 implementation.

* Add cSslConfig to wrap mbedtls_ssl_config

* Update cTCPLink and cBlockingSslClientSocket to use cSslConfig

* Use cSslConfig in cHTTPServer

* Use cSslConfig for cMojangAPI::SecureRequest

* CI Fixes

* Set -fomit-frame-pointer on the right target
2017-08-30 15:00:06 +01:00
mathiascode 02775e52c4 Minor changes (#3909) 2017-08-24 11:19:40 +02:00
Lukas Pioch 07f25253a2 Removed unneeded includes (#3902) 2017-08-06 20:57:44 +01:00
peterbell10 759618b035 Remove double includes part 2 (#3890) 2017-08-03 15:34:19 +02:00
peterbell10 5a5297974b Remove alignment macros 2017-07-21 14:41:51 +01:00
peterbell10 a56cfd1f42 Remove smart pointer macros 2017-07-21 14:41:51 +01:00
Mattes D ea6660721b NetworkSingleton: Fixed a throw warning in VS2017. (#3792)
Also fixed the misleading name.
2017-06-22 21:10:41 +02:00
Mattes D 7ac3b0fa0b Removed the LeakFinder for Windows. (#3777) 2017-06-19 11:05:19 +02:00
Mattes D bb020bbe78 NetworkSingleton: Fixed an object leak upon termination. 2017-06-17 07:14:20 +02:00
peterbell10 705132011a Change error no data to no name 2017-06-16 14:06:27 +02:00
peterbell10 035ecdc9e2 Replace evdns with getaddrinfo and getnameinfo (#3766) 2017-06-15 11:03:49 +02:00
Lukas Pioch e35ac1bfb9 Clang 5.0 fixes
- Added override keyword
- Removed inherited member variables
2017-05-21 12:19:06 +02:00
Lukas Pioch 4b1bc1cc5c Removed unnecessary check for lower and upper folder 2017-03-16 17:50:19 +01:00
Mattes D 7cc3fb098d DeadlockDetect now lists some tracked CS's stats. 2017-01-18 09:03:05 +01:00
Mattes D 8dd1e56515 TCPLink: call networking callbacks with LibEvent unlocked. (#3515) 2017-01-03 21:20:01 +01:00
mathiascode efc7fed05b Updated links and docs (#3488) 2016-12-19 17:08:19 +01:00
Tiger Wang 8c6d0b51c7 Use CMake's Android generators to crosscompile 2016-12-12 14:32:32 +00:00
Mattes D 5ca371bb9a cUrlClient: Exported to Lua API. 2016-08-23 13:20:43 +02:00
Mattes D 641cb063bc cTCPLink supports TLS out of the box. 2016-08-22 23:44:36 +02:00
Mattes D dd5567a90c IPLookup: Fixed a soft memory leak when looking up invalid IPs. 2016-08-13 21:16:21 +02:00
Mattes D 876496c953 Removed "." and ".." from cFile:GetFolderContents(). (#3301) 2016-08-07 12:50:19 +02:00
Mattes D 8eaa8613da CMake: Remove needless minimum version specifications. 2016-07-18 22:11:42 +02:00
Mattes D 1462e4f70e Self tests (#3242)
* SelfTests: Added a cEvent stress-test.

* cNetwork: Fixed startup event hang.

The original code used to hang with a ~ 1:50000 chance, because on Linux the cEvent was destroyed before its "Set()" returned.
2016-06-26 14:51:12 +01:00
Mattes D 8610083a8e cNetwork: Fixed possible hang when terminating immediately after init. 2016-06-18 13:12:12 +02:00
Mattes D 36eefbf0f2 SelfTests: Removed the unneeded cSelfTests class. 2016-06-18 13:12:10 +02:00
Mattes D 3184433756 Moved NetworkInterfaceEnum test to a separate test project. 2016-06-18 13:12:06 +02:00
LogicParrot ca6ef58b1e Bulk clearing of whitespace 2016-02-05 23:50:18 +02:00
Mattes D 80e1eb37dd Renamed leftover strings to Cuberite / Server, as needed.
Also upgraded the user setting file for MSVC to 2013.
2016-01-01 21:05:09 +01:00