Commit Graph

126 Commits (93fdcb7b65aebf8d9dfad40f09cfd9adeb1600f6)

Author SHA1 Message Date
BodgeMaster cdc23e7468 lib/nbt: Implement parser 2022-10-15 23:05:26 +02:00
BodgeMaster 8b62ec9c88 lib/nbt: Get rid of that ugly #define return hack
Instead of doing #define return, the boolean returnValue is set and
a goto statement is used to get to the code that does what the macro
used to do.
2022-10-15 18:55:58 +02:00
BodgeMaster 996154fbbc lib/nbt: Return the correct error code from soem functions for i32 arrays. 2022-10-14 22:33:32 +02:00
BodgeMaster 374466f26c lib/nbt: Fix not actually returning from Compound::setElementPointerAt in the do nothing case 2022-10-14 20:01:47 +02:00
BodgeMaster 3b56a52085 lib/nbt: Fix a memory leak 2022-10-14 19:22:05 +02:00
BodgeMaster 7be73f86d4 lib/nbt: Prevent addition of additional end tags to compounds 2022-10-14 18:33:05 +02:00
BodgeMaster 71834e1018 lib/nbt: Build an end tag object into compound tag objects to prevent creation of endless compounds 2022-10-14 18:08:49 +02:00
BodgeMaster ccce564219 lib/error: Add NOT_ALLOWED 2022-10-14 17:39:00 +02:00
BodgeMaster 53279c6905 lib/error: Clean up comments 2022-10-14 17:30:35 +02:00
BodgeMaster d5ce50a4a9 lib/nbt: Fix a potential memory leak 2022-10-09 10:18:20 +02:00
BodgeMaster f0092b78d3 lib/nbt: Make list serielizer return an error when serializing a list with no contained type set 2022-10-08 23:35:21 +02:00
BodgeMaster 833c09e2da lib/nbt: Fix a bug caused by having two return statements swapped 2022-10-08 12:54:05 +02:00
BodgeMaster 17792ec5bf lib/cli: Implement the "Additional Info" feature 2022-10-08 08:27:48 +02:00
BodgeMaster 936def1a65 lib/nbt: move a comment (yes, very important commit) 2022-10-06 11:09:58 +02:00
BodgeMaster 3cc1222de9 lib/nbt: Fix a bug in NBT::Helper::writeString()
Writing a string to a byte vector would result in it being replaced
with one holding only the string.
2022-10-06 10:21:59 +02:00
BodgeMaster 4cb1206839 lib/file: Fix isOpen not being set properly when closing and reopening; add destructor 2022-10-05 05:02:58 +02:00
BodgeMaster 39c5940200 lib/file: Fix a potential memory leak created by yours truly 2022-10-05 04:50:41 +02:00
BodgeMaster f3e03710f6 lib/file: Ensure a file is actually open before attempting to read 2022-10-05 04:07:46 +02:00
BodgeMaster 72fc923839 lib/nbt: remove now useless comment 2022-10-05 04:02:32 +02:00
BodgeMaster 5059bd0193 lib/file: change File::eof to a function
This is just way easier to implement and less messy.
2022-10-05 04:01:18 +02:00
BodgeMaster 8bb633f118 lib/error and lib/file: reassign code 9 to FILE_NOT_OPEN
These are not exceptions so we don’t need multiple variants of
generic error in case someone wants to catch it somewhere
up the call stack.

It’s okay to use UNKNOWN for generic errors where we don’t know
exactly what happened.
2022-10-05 03:48:05 +02:00
BodgeMaster ec44ac9531 lib/file: Check if there are enough bytes left to read 2022-10-05 03:46:42 +02:00
BodgeMaster 341b4c187e lib/file: Fix (potential) memory leaks 2022-10-05 03:30:01 +02:00
BodgeMaster 79650e390e lib/nbt: Implement the rest of the functions outline in the header
This concludes the implementation of the in-memory NBT representation.
This is still all untested code so it might just blow up in your face.
The next step will be writing tests (and probably a lot of cursing and
debugging)...
2022-10-05 01:12:38 +02:00
BodgeMaster 2d2b67373c lib/nbt: Yesterday’s progress of implementing more of the functions in the header 2022-10-04 02:39:58 +02:00
BodgeMaster 4c4366f7e6 lib/nbt: Partially update documentation to current terminology.
Would probably be better if it were moved to doc/ and completely rewritten.
2022-10-02 07:48:03 +02:00
BodgeMaster 4ef1d2c44f lib/nbt: Split serializer into two components
One for serializing full tags and one for serializing tags without
their header.

The former is what used to be `toRawData` - though a bunch of
duplicated code has been removed by just moving it to the Generic
type class instead of having an implementation on the sub-classes.

The latter is useful for serializing lists.

The previous warning that all of this is untested still applies.
2022-10-02 07:47:12 +02:00
Shwoomple 5920d1d004 commit merge 2022-10-02 08:42:33 +05:30
Shwoomple 056c1e6b11 lib/file.cpp: fix read fubctions. 2022-10-02 08:38:39 +05:30
BodgeMaster 8b1491c311 lib/nbt: Add missing class prefix to function names 2022-10-01 04:57:45 +02:00
BodgeMaster fc2caf3bc0 lib/nbt: Implement more member functions for tag types 2022-10-01 04:51:53 +02:00
BodgeMaster 89baeebc65 lib/file: Switch to using pointers for passing File objects around 2022-09-30 20:10:28 +02:00
Shwoomple c204aa7d76 lib/file.cpp:Fix exception warnings 2022-09-30 22:41:55 +05:30
BodgeMaster 09503d3dc7 lib/file: Remove accidentally included C header 2022-09-30 18:31:49 +02:00
BodgeMaster aa97154474 lib/error: Remove misplaced code fragment
brea
2022-09-30 18:09:23 +02:00
Shwoomple 3449e3b9c4 lib/file: Implement broken file functions 2022-09-30 11:02:46 +05:30
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 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
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 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
BodgeMaster 629c999336 lib/nbt: Return correct error code from read functions (fixes #17) 2022-08-27 22:35:10 +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 a1fc0ce4b4 lib/nbt: Fix a possible buffer overflow in readString() 2022-08-15 12:02:58 +02:00