Commit Graph

244 Commits (aa971544741a6373b8a34498c51d033556ccb916)

Author SHA1 Message Date
BodgeMaster aa97154474 lib/error: Remove misplaced code fragment
brea
2022-09-30 18:09:23 +02:00
BodgeMaster 9abfd9e5a9 setupenv: Move sourcing the local environment before FOSS-VG environment adjustments 2022-09-30 17:55:17 +02:00
Shwoomple 150ce826ba complete merge 2022-09-30 11:03:05 +05:30
Shwoomple 3449e3b9c4 lib/file: Implement broken file functions 2022-09-30 11:02:46 +05:30
Charlie Root 213d28a9b8 setupenv: Fix syntax errors 2022-09-30 06:13:38 +02:00
Shwoomple c1d7801436 complete merge 2022-09-28 08:22:09 +05:30
Shwoomple 9610f4a4a2 lib/file: implement open function 2022-09-28 08:21:39 +05:30
BodgeMaster 434c976cc5 lib/nbt: Continue implementing in-memory NBT tag data types
This is still all unvalidated work.
For all I know it might cause your computer to burst into flames,
grow an arm and a leg and an eye, and attack you with a sword.
But probably, it will just not work and I will realize that sleepy
past me was a fucking idiot (as always).
2022-09-28 03:43:54 +02:00
BodgeMaster 47fd1f8970 test/nbt_read_write_helpers: Change unnecessarily long string to be just one above the allowed size 2022-09-26 23:53:53 +02:00
BodgeMaster 10b1d9fa0c lib/nbt: Start implementing NBT data types, make NBT::Helper::writeString() return an error instead of aborting the program
The former is finally some progress on getting NBT going,
though at this point it is all unvalidated work.
For all I know it might cause your computer to burst into flames,
grow an arm and a leg and an eye, and attack you with a sword.
But probably, it won’t do that and instead start working after I
have debugged it so much that I wish I could attack my PC with a sword.

The latter is the implementation of a change I prepared in a previous commit
when i added ErrorOrVoid.
2022-09-26 03:11:44 +02:00
Shwoomple e8d41efeef lib/error.hpp: fix merge conflicts 2022-09-19 16:21:25 +05:30
Shwoomple 508b5e67e7 lib/error.hpp: add file errors 2022-09-19 16:19:52 +05:30
BodgeMaster 398321e415 test/nbt*: Replace NBT::helper with NBT::Helper
Yes, I forgot to run the test suite before committing.
This is why we need CI.
2022-09-19 11:47:29 +02:00
BodgeMaster 53878c3e2b lib/nbt: Start implementing the in-memory data structure for NBT 2022-09-15 06:06:47 +02:00
BodgeMaster ad291ee77d lib/nbt: Capitalize NBT::Helper because I feel like it 2022-09-15 02:00:07 +02:00
BodgeMaster 6149418f52 Add a level.dat to test the NBT parser on. 2022-09-15 01:51:51 +02:00
BodgeMaster ac12bcf865 Makefile: Finally get rid of this as we don't need it.
A makefile may be added back when we are preparing distribution but
it’s a long road until then.
2022-09-15 01:06:59 +02:00
BodgeMaster 8b92d24ab9 setupenv: Add dependency check 2022-09-11 10:11:17 +02:00
BodgeMaster aab91a2523 lib/nbt: Fix NBT::validateRawNBTData() and NBT::validateRawListContents closing #52 and #53 2022-09-11 09:14:32 +02:00
BodgeMaster 58b1199e38 lib/javacompat: Fixed JavaCompat::importJavaString() hanging when trying to import long strings
This was caused by an integer overflow due to using a too small data type in a counter variable.
2022-09-11 09:08:08 +02:00
Shwoomple 48f8a7dcf2 tools/hexnet: start implementing console input 2022-08-30 00:52:06 +05:30
BodgeMaster 209d0828b4 tools/hexnet: un-comment problematic sections 2022-08-29 21:06:54 +02:00
BodgeMaster b4d4ce77b2 tools/dumpnbt: better variable name and exit when data is invalid 2022-08-29 21:02:36 +02:00
BodgeMaster ee5048331c tools/dumpnbt: start implementing a preliminary version
for use until the full NBT library is in place...
2022-08-28 13:59:31 +02:00
BodgeMaster 629c999336 lib/nbt: Return correct error code from read functions (fixes #17) 2022-08-27 22:35:10 +02:00
BodgeMaster cdd17045d1 test/nbt_read_write_helpers: add more tests according to issue #43 2022-08-27 20:10:29 +02:00
BodgeMaster bb40f6553e tools/hexnet: comment sections out temporarily to get rid of compile errors
Doesn’t compile on Void x86_32 glibc. This will need to be investigated.
I just wanted to get rid of the errors while working on other issues.

Compile command:
ccache g++ -std=c++20 -Wall -Wextra src/tools/hexnet.cpp -I./include -Lbin/lib -l:cli.so -l:libsockpp.so -o bin/tools/hexnet
2022-08-27 11:50:36 +02:00
BodgeMaster a9759e3bc2 lib/file: Clarify what the functions do, take cursor position into account for cut functions and add missing cut function 2022-08-24 01:38:44 +02:00
BodgeMaster ab1164557d lib/file: Write header
I hope I didn’t forget anything. Not exactly capable of thinking rn.
2022-08-24 01:27:34 +02:00
BodgeMaster 1b8819ffe5 lib/error: Add ErrorOrVoid
This allows for error propagation on functions that would otherwise
not return anything.
2022-08-24 01:21:38 +02:00
BodgeMaster 4934a78aaa lib/error: Move definitions of constructors of ErrorOr<> inside class definition. 2022-08-24 01:19:59 +02:00
BodgeMaster 327ad9a9b5 Copyright Notice: Add authors section 2022-08-23 23:24:29 +02:00
BodgeMaster bddab2e9f8 setupenv: Add tool directories to PATH, be more verbose
No more `bin/tools/hexnet -4t 9000`. Just `hexnet -4t 9000` now.
2022-08-16 13:55:42 +02:00
BodgeMaster 017c8a61f8 scripts/tools/arraydump: New tool added
Never again will you need to manually convert binary data into an array!
This tool does it for you! Get it now for only $99! Limited availability!

To process data from stdin / a pipe, just pass `-` as the file name.
2022-08-16 13:40:50 +02:00
BodgeMaster 5272636cb8 test/nbt_read_write_helpers: fix unit tests for readString() 2022-08-15 13:30:53 +02:00
BodgeMaster 91d16ea451 test/javacompat: add test for mismatched size 2022-08-15 12:24:03 +02:00
BodgeMaster a1fc0ce4b4 lib/nbt: Fix a possible buffer overflow in readString() 2022-08-15 12:02:58 +02:00
Shwoomple ca7b121c4d tools/hexnet: Implement udp partially. 2022-08-15 15:07:33 +05:30
BodgeMaster 25bec4c587 lib/nbt: Validator: Fix bytes not being added up correctly in multiple places 2022-08-15 10:51:50 +02:00
BodgeMaster 589cf1ddaf lib/nbt: NBT validator: Fix wrong function declaration in the header, fix not using the currentPosition variable when accessing data 2022-08-15 09:53:06 +02:00
BodgeMaster 884a5239c6 lib/nbt: fix a bug in NBT::helper::readString() which caused it to asuume that dataSize is the size of the string 2022-08-15 09:51:46 +02:00
BodgeMaster 9190cad80d lib/nbt: finish implementation of validateRawNBTData() and fix a critical macro-induced bug
I did a `#define return` and then tried to `if () return;` everywhere...
2022-08-15 08:50:07 +02:00
BodgeMaster a862590370 lib/nbt: Start implementing the NBT validator
In theory, this is it. It’s just missing the portion that deals with lists
and unit tests. Both will each likely require similar effort to this.
2022-08-15 05:20:05 +02:00
BodgeMaster 3995e97f03 lib/javacompat: Make the endianness error message refer to the correct function 2022-08-15 02:07:00 +02:00
BodgeMaster c9ec524db1 test/nbt_size_helpers: Implement tests for valid input 2022-08-13 17:32:47 +02:00
BodgeMaster 73ae58e522 test/assert: Add line number to assertion failed message 2022-08-13 17:32:47 +02:00
BodgeMaster acc19ae100 lib/nbt: Change behavior of totalTagSize to treat encounters of compounds and lists as errors
I stumbled over this when writing the unit test. Previously, it would return
an error code but explicitly mark it as not being an error. This was intended
behavior but I decided to change it because I didn’t anticipate it when writing
the test.

Technically `ErrorOr<T>` can be used to pass any message alongside `T`,
but practically, it is reasonable to assume that the error code is
`ErrorCodes::SUCCESS` when `isError` is false. Therefore, this feature
should be really only used in the weirdest edge cases - if at all.
Even then, it is most likely still preferable to flag it as an error and
just hand the resulting `T` back using the long constructor
`ErrorOr<T>(bool, uint8_t, T)`.
2022-08-13 17:32:47 +02:00
BodgeMaster 149285c357 lib/nbt: Finish implementing containedDataLength, rename nextTagTotalSize->totalTagSize and nextTagDataLength->containedDataLength 2022-08-13 17:32:47 +02:00
BodgeMaster 0c92bdf8fd test/nbt_size_helpers: begin adding unit tests for lib/nbt's new nextTag size helpers 2022-08-13 17:32:47 +02:00
BodgeMaster 86f1ef596f lib/nbt: Begin implementing nextTagDataLength 2022-08-13 17:32:47 +02:00