228 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
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
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
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
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
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
af59ea2d48
Revert "General: Minor general cleanup" 2019-08-15 08:52:45 -07:00
97db908b3d
Merge pull request #43 from lioncash/str
DNAYaml: Replace implementation-specific functions with standardized equivalents
2019-08-15 08:39:32 -07:00
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
80c283736e Various NX build fixes 2018-09-23 19:12:29 -07:00
5306525029 Initial Switch support (Needs testing) 2018-09-20 10:47:48 -07:00
Jack Andersen
488acc8675 Minor MemoryWriter and VectorWriter behavior changes 2018-09-02 14:45:02 -10:00
Jack Andersen
8d57fe01d2 Windows compile fix 2018-08-25 21:57:03 -10:00
Jack Andersen
7f28214e9f Add VectorWriter 2018-08-24 22:38:23 -10:00
Jack Andersen
075747c418 Remove cyclic include 2018-08-09 20:18:42 -10:00
Jack Andersen
61bfac431e Merge branch 'master' of ssh://git.axiodl.com:6431/libAthena/athena 2018-07-15 21:42:29 -10:00
Jack Andersen
24666aebdd More flexible DNA template support 2018-07-15 21:42:14 -10:00
10b36df71f Fix compilation 2018-06-17 18:43:24 -07:00
Jack Andersen
9a7bee95c4 Remove unused FileWriter fields 2018-05-25 12:02:23 -10:00
Jack Andersen
ed83b2f42c Windows build fixes 2018-05-24 20:33:43 -10:00
Jack Andersen
17a0959dbd Fix implicitly-converted vector serialization 2018-02-23 20:14:19 -10:00