Commit Graph

689 Commits

Author SHA1 Message Date
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
Phillip Stephens 30158859f7
Merge pull request #61 from lioncash/size
FileWriterWin32: Handle large files within writeUBytes
2019-09-07 07:06:33 -07:00
Phillip Stephens 1e2f5d4ec0
Merge pull request #62 from lioncash/cmake
CMakeLists: Append sources to athena-core directly
2019-09-07 07:06:02 -07:00
Lioncash 4460ecedd2 CMakeLists: Append sources to athena-core directly
Avoids using an intermediary variable for the same behavior.
2019-09-07 08:53:05 -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
Phillip Stephens 9aad64e740
Merge pull request #58 from lioncash/leak
MemoryWriter: Prevent potential leak within save()
2019-09-06 01:01:27 -07: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 781937da88
Merge pull request #57 from lioncash/init
MemoryWriter: Initialize member variables to deterministic values
2019-09-05 01:09:14 -07:00
Lioncash 016e14c460 MemoryWriter: Initialize member variables to deterministic values
Makes the variable initialization behavior deterministic in the case of
the default constructor. This also eliminates the possibility of an
uninitialized read from occurring within the destructor entirely; even
in the face of future changes.
2019-09-05 01:12:07 -04:00
Phillip Stephens f099ee0b1b
Merge pull request #56 from lioncash/string
atdna/main: Avoid unnecessary string churn
2019-09-04 19:32:23 -07:00
Lioncash 0dcf0cec03 main: Avoid unnecessary string churn
Reduces the amount of overall allocation churn due to string
concatenation by avoiding redundant string temporaries.
2019-09-04 16:12:25 -04:00
Lioncash 607f99fa1a main: Amend variable shadowing warnings 2019-09-04 15:23:44 -04:00
Lioncash 8dc86ea991 main: Amend inclusion order 2019-09-04 15:20:55 -04:00
Jack Andersen 132c7def65 Merge branch 'master' of ssh://git.axiodl.com:6431/libAthena/athena 2019-08-31 10:36:20 -10:00
Jack Andersen d4f7132047 More permissive atdna warnings 2019-08-31 10:35:50 -10:00
Phillip Stephens 276db8ea56
DNA fixes 2019-08-26 18:00:30 -07:00
Phillip Stephens 3f9177be15
Merge pull request #54 from lioncash/override
DNA: Add missing override specifiers
2019-08-26 17:44:21 -07:00
Phillip Stephens b383eedaee
Merge pull request #53 from lioncash/explicit
General: Make constructors explicit where applicable
2019-08-26 17:43:59 -07:00
Phillip Stephens 8368014a65
Merge pull request #55 from lioncash/goto
DNAYaml: Remove use of goto in finish()
2019-08-26 17:43:46 -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 fd61e12081 DNA: Add missing override specifiers
Adds three missing override specifiers
2019-08-26 20:15:47 -04:00
Lioncash 881db18f7d General: Make constructors explicit where applicable
Makes non-conversion constructors explicit to make their construction
obvious.
2019-08-26 20:13:00 -04:00
Phillip Stephens 23b9b92f9f
Merge pull request #52 from lioncash/macro
General: Remove unused macros
2019-08-26 16:49:15 -07:00
Lioncash 641305635e General: Remove unused macros
These aren't used anywhere, so they can be removed.
2019-08-26 19:26:16 -04:00
Phillip Stephens e8d6c2abe7
Merge pull request #51 from lioncash/include
General: Include headers that are necessary
2019-08-26 15:59:54 -07: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 d1d1850cb7
Merge pull request #50 from lioncash/type
Types: Tidy up header
2019-08-24 00:48:08 -07:00
Lioncash 0622ada766 Types: Qualify std types with std::
Same behavior, but more proper from a type header point of view.
2019-08-24 02:33:43 -04:00
Lioncash f669191fcb Types: Remove unnecessary macros
These appear to be unused, and, with C++17, can be superseded with
[[maybe_unused]] and [[deprecated]] attributes
2019-08-24 02:31:10 -04:00
Lioncash 8471a7e189 Types: Simplify typedefs
These can just be regular structure declarations. This also has the
benefit of allowing forward declaring the types.
2019-08-24 02:29:37 -04:00
Phillip Stephens 5da7e7bac3
Merge pull request #49 from lioncash/doc
General: Silence -Wdocumentation warnings
2019-08-16 18:18:23 -07:00
Phillip Stephens 1fc1c9eab3
Merge pull request #48 from lioncash/lz
LZBase/LZLookupTable: Minor cleanup
2019-08-16 18:18:14 -07:00
Lioncash 5140e9e7eb General: Silence -Wdocumentation warnings
Resolves trivial Doxygen reference warnings uncovered with
-Wdocumentation
2019-08-16 00:40:29 -04:00
Lioncash c524a9caa2 LZLookupTable: Remove unused <deque> include
This header and the matching cpp file make no use of std::deque, so this
can be removed.
2019-08-15 23:54:04 -04:00
Lioncash a3a6e3b42a LZLookupTable: Reuse setLookAheadWindow within constructor
Provides the same behavior without duplicating code.
2019-08-15 23:48:49 -04:00
Lioncash 70aeed342f LZLookupTable: Convert typedef into a using alias 2019-08-15 23:47:06 -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 48ae0d32fe LZBase: Remove unused <string> include 2019-08-15 23:35:16 -04:00
Lioncash 50936ab1a9 LZBase: Default virtual destructor 2019-08-15 23:35:12 -04:00
Phillip Stephens 8506e3236c
Merge pull request #47 from lioncash/ostream
Global: Change <iostream> include into <ostream>
2019-08-15 20:34:04 -07: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