Commit Graph

239 Commits

Author SHA1 Message Date
Luke Street 1b8b7f6819 DNAYaml: Correctly initialize yaml events 2020-06-10 00:13:49 -04:00
Phillip Stephens aa94bdadc4
Downgrade aggressive fatal to error 2020-04-15 06:35:32 -07:00
Luke Street 7ed8784b50 Compression: Support gzip in decompressZlib 2020-04-14 20:58:07 -04:00
Jack Andersen 30fe237210 Update fmtlib 2020-04-11 12:46:42 -10:00
Luke S dcc85e38ea
Fix build error in MemoryReader.cpp 2019-12-10 16:41:05 -05:00
Phillip Stephens eb41d349dc
Fix stand alone compiling, minor code updates 2019-12-08 13:32:50 -08:00
Lioncash e7f7867f32 DNAYaml: Make use of if constexpr within NodeToVec()
Only the constexpr isDouble variable is tested within the conditional,
so we can make use of if constexpr here.
2019-10-19 07:13:51 -04:00
Lioncash 120b3d1281 DNAYaml: Collapse SFINAE functions into single function
We can leverage if constexpr here to determine which branch of code to
instantiate, eliminating the need for the use of SFINAE.
2019-10-19 07:10:50 -04:00
Jack Andersen ee012692ba Fix memory-related problems triggered by emplace_back + copy elision 2019-10-12 18:50:46 -10:00
Jack Andersen 42581c922a Merge branch 'master' of ssh://git.axiodl.com:6431/libAthena/athena 2019-09-30 21:16:11 -10:00
Jack Andersen c7b6744509 Numerous code style improvements 2019-09-30 21:10:47 -10:00
Lioncash b7974ffd01 CMakeLists: Define -DNOMINMAX and -DWIN32_LEAN_AND_MEAN on Windows
Avoids needing to explicitly define these in code and also allow
external targets to be unaffected by this.
2019-09-07 12:18:45 -04:00
Lioncash 3b1348a26a FileWriterWin32: Handle large files within writeUBytes
Handles the case where a given size exceeds the maximum value that can
be contained within a DWORD.

Given a DWORD is 32-bit in size and an atUint64 is 64-bits in size, this
avoids errors on valid sizes, even if they're extremely unlikely to ever
occur.
2019-09-07 08:35:05 -04:00
Lioncash 462146b644 FileWriterWin32: Prevent implicit sign conversion within position() 2019-09-07 08:35:01 -04:00
Phillip Stephens e63ea83f51
Merge pull request #60 from lioncash/crc
Checksums: Correct null check within crc16()
2019-09-06 23:22:43 -07:00
Lioncash 34ae45bbd1 Checksums: Correct null check within crc16
This should be checking if the input is null rather than not null before
early exiting, otherwise the data itself will never have the checksum
calculated.
2019-09-06 04:46:27 -04:00
Phillip Stephens 8b0a010e78
Merge pull request #59 from lioncash/cast
Compression/LZ77: Remove unnecessary pointer casts
2019-09-06 01:16:28 -07:00
Lioncash 200f8f311a Compression/LZ77: Remove unnecessary pointer casts
There's no need to cast here in a few of these areas, so we can remove
them.

This also resolves quite a few -Wcast-qual warnings,
2019-09-06 04:13:58 -04:00
Lioncash de45f0896f MemoryWriter: Use a std::unique_ptr within resize()
Same behavior, but keeps the memory managed throughout its whole
lifetime.
2019-09-06 03:32:16 -04:00
Lioncash 57ad780321 MemoryWriter: Remove unnecessary type cast within MemoryWriter constructor and setData()
The input type is already the same type as the class member, so the cast
is unnecessary.

While we're at it, we can also remove an unnecessary initializer for
m_position, since we initialize this to zero within the class
declaration already.
2019-09-06 03:31:56 -04:00
Lioncash 4e414902be MemoryWriter: Use a std::unique_ptr for FILE handle in save()
Prevents potential leaks from occurring within failure cases (e.g. with
the default exception handler).
2019-09-06 03:23:48 -04:00
Phillip Stephens 276db8ea56
DNA fixes 2019-08-26 18:00:30 -07:00
Lioncash dcf83d7782 DNAYaml: Remove use of goto in finish()
We can just wrap the error code within a lambda and call it in the error
control paths, eliminating the need for goto.
2019-08-26 20:20:23 -04:00
Lioncash 9c50a60c2b General: Include headers that are necessary
Removes unused headers and ensures that all necessary headers are
included. In particular, this removes quite a few <iostream> includes,
which removes quite a few static constructors.
2019-08-26 08:04:23 -04:00
Phillip Stephens 1fc1c9eab3
Merge pull request #48 from lioncash/lz
LZBase/LZLookupTable: Minor cleanup
2019-08-16 18:18:14 -07:00
Lioncash a3a6e3b42a LZLookupTable: Reuse setLookAheadWindow within constructor
Provides the same behavior without duplicating code.
2019-08-15 23:48:49 -04:00
Lioncash f7b8c33ed2 LZLookupTable: Default-initialize class members directly in the class
Same thing without the need to duplicate the variable name.
2019-08-15 23:45:17 -04:00
Lioncash 3092dc79e7 LZLookupTable: Default destructor 2019-08-15 23:41:10 -04:00
Lioncash 663696fe72 LZLookupTable: Make member functions const where applicable
While we're at it, we can convert compare_equal into an operator==
operator!= pair, and make the curPos argument to search() const as well.
2019-08-15 23:39:45 -04:00
Lioncash 50936ab1a9 LZBase: Default virtual destructor 2019-08-15 23:35:12 -04:00
Lioncash be9ac57b9d LZBase: Mark functions as const where applicable
Most of the interface can be const qualified except for the setters.
While we're at it, we can also make the private member functions
internally linked helper functions, given they don't depend on instance
state at all.
2019-08-15 23:28:41 -04:00
Lioncash d36b7bdc3f Global: Change <iostream> include into <ostream>
<iostream> injects a static constructor into every translation unit that
includes the header--even if nothing from the header is used. This can
result in minor initial program slowdown, as all of these constructors
need to run before main() can execute.

Instead, we can use <ostream>, which includes all of the necessary
machinery that we need.
2019-08-15 20:06:17 -04:00
Lioncash 54b1e8f836 General: Use nullptr where applicable
Uses nullptr instead of NULL or the 0 integer literal where applicable.
2019-08-15 16:12:17 -04:00
Phillip Stephens af59ea2d48
Revert "General: Minor general cleanup" 2019-08-15 08:52:45 -07:00
Phillip Stephens 97db908b3d
Merge pull request #43 from lioncash/str
DNAYaml: Replace implementation-specific functions with standardized equivalents
2019-08-15 08:39:32 -07:00
Phillip Stephens 5973db475c
Merge pull request #42 from lioncash/inline
General: Minor general cleanup
2019-08-15 08:39:13 -07:00
Lioncash 407c9cfab5 DNAYaml: Replace implementation-specific functions with standardized equivalents 2019-08-15 11:18:47 -04:00
Lioncash 83818a6272 General: Use nullptr where applicable
Uses nullptr instead of NULL or the 0 integer literal where applicable.
2019-08-15 11:04:09 -04:00
Lioncash c3d19a8aab DNAYaml: Make is_base64() internally linked
This isn't used outside of this translation unit, so it can be made
static.
2019-08-15 08:29:07 -04:00
Lioncash 9fc76a7dea DNAYaml: Use std::string_view instead of std::string for base64 characters
Eliminates a runtime static constructor that needs to execute. Also gets
rid of a heap allocation.
2019-08-15 08:09:41 -04:00
Lioncash ee5b894537 DNAYaml: Get rid of trivial uses of goto
We can just wrap the handling within a lambda function and then execute
it on the error paths.
2019-08-15 08:06:52 -04:00
Lioncash 46a847e885 DNAYaml: Make use of std::make_unique where applicable
Gets rid of a few places of raw new where it can be trivially avoided.
2019-08-15 07:49:55 -04:00
Jack Andersen ffbd1a0bcd Windows build fixes 2019-07-27 15:18:57 -10:00
Jack Andersen 478d75f1cb Massive fmtlib refactor 2019-07-19 18:19:44 -10:00
Jack Andersen 727f057fa7 GCC fixes and better CMake dependency handling 2019-06-11 15:58:44 -10:00
Jack Andersen 0b3fd2b5af Bug fix for Win7 2019-03-23 22:05:17 -10:00
Jack Andersen 2034232d52 Switch to using lzokay library 2018-12-19 17:43:07 -10:00
Jack Andersen 7243c687a8 New code style refactor 2018-12-07 19:18:17 -10:00
Jack Andersen e1b29fda7a SIMD refactor 2018-12-07 15:31:02 -10:00
Phillip Stephens 80c283736e Various NX build fixes 2018-09-23 19:12:29 -07:00