Commit Graph

46 Commits (7d9d377575ff6aac58561c670c8716314386700a)

Author SHA1 Message Date
Petr Mikheev 32f3a16db3 Change FormId::toString to be consistent with RefId. Remove FormIdRefId. 1 year ago
Petr Mikheev 5d54ca6fdb Refactor components/esm4 1 year ago
Evil Eye c59032fd66 Make RefId::deserializeText return an empty RefId if no pre-existing StringRefId can be found 1 year ago
elsid a6dbd819a1
Fix writing IndexRefId to ESM3
Use correct enum value.
2 years ago
elsid 78b3f7288a
Support UTF-8 by StringRefId::toDebugString 2 years ago
florent.teppe fc3d113d29 fix tests 2 years ago
florent.teppe 3bbf60373a Keep things coherent between references and and cell table 2 years ago
elsid 7db14b3392
Add more tests for printing RefId and clarify some constants 2 years ago
elsid c97df7d770
Check FormIdRefId value in constructor 2 years ago
Petr Mikheev f09a689a4f Merge ESM::RefNum and ESM4::FormId 2 years ago
elsid bd10becb65
Use lexicographical comparison in ESM3ExteriorCellRefId::operator< 2 years ago
elsid 794050df63
Fix and add tests for ESM3ExteriorCellRefId serialization and text representation 2 years ago
florent.teppe 0d17e20490 Implements serialize/deserialize
fixes test compilation.
2 years ago
psi29a 0a791528bc Merge branch 'fix_index_ref_id_hash' into 'master'
Shift record type value for IndexRefId hash

See merge request OpenMW/openmw!2885
2 years ago
elsid 171a25645a
Make sure there are tests for all RefId types 2 years ago
elsid 258aec223a
Shift record type value for IndexRefId hash 2 years ago
elsid b7fdca0fe6
Use serialized ESM::RefId for Lua records 2 years ago
elsid cd4027ffd6
Do not use ESM::RefId::getRefIdString for spell id 2 years ago
elsid e6cf516e12
Support index RefId as pair of record type and std::uint32_t 2 years ago
elsid 86293af084
Support generated RefId as std::uint64_t 2 years ago
elsid 069d4255b9
Make ESM::RefId to be fixed size cheap to copy
Use std::variant. Store refId strings in unordered_set and use pointer to an
item there. Inserts to unordered_set do not invalidate pointers to values so the
pointer is always valid. Elements are not removed. Assume there is finite number
of string refIds.
2 years ago
elsid cd6a5b5a0e
Support asymmetric comparison between ESM::RefId and std::string_view 2 years ago
elsid 6f329f3d40
Add tests for ESM::RefId 2 years ago
elsid 12d36fb1d7
Add missing include 2 years ago
elsid 2e64155c0f
Use signed type for left record and files size in ESM3 reader context
Otherwise reading some of the records like ESM::CellRef without a subrecord
after could lead to underflow of ESM_Context::leftRec which makes
ESM::ESMReader::hasMoreSubs to return true and load hangs for a while trying to
read the same subrecord many times.

Fix ESM::Variant tests since it's now required to have a record for any ESM
data. Add 16 (size of record header) to all expected data sizes.
2 years ago
elsid 2bbed8cc06
Fix gcc warning: array subscript 5 is outside array bounds of ‘const char [5]’
In function ‘bool ESM::operator==(const FixedString<capacity>&, const T* const&) [with long unsigned int capacity = 5; T = char; <template-parameter-1-3> = void]’,
    inlined from ‘testing::AssertionResult testing::internal::CmpHelperEQ(const char*, const char*, const T1&, const T2&) [with T1 = ESM::FixedString<5>; T2 = const char*]’ at /home/elsid/dev/googletest/build/gcc/release/install/include/gtest/gtest.h:1358:11,
    inlined from ‘static testing::AssertionResult testing::internal::EqHelper::Compare(const char*, const char*, const T1&, const T2&) [with T1 = ESM::FixedString<5>; T2 = const char*; typename std::enable_if<((! std::is_integral<_Tp>::value) || (! std::is_pointer<_Dp>::value))>::type* <anonymous> = 0]’ at /home/elsid/dev/googletest/build/gcc/release/install/include/gtest/gtest.h:1377:64,
    inlined from ‘virtual void {anonymous}::EsmFixedString_equality_operator_for_not_convertible_to_uint32_with_const_char_pointer_Test::TestBody()’ at apps/openmw_test_suite/esm/test_fixed_string.cpp:165:9:
components/esm/esmcommon.hpp:134:19: warning: array subscript 5 is outside array bounds of ‘const char [5]’ [-Warray-bounds]
  134 |         return rhs[capacity] == '\0';
      |                ~~~^
apps/openmw_test_suite/esm/test_fixed_string.cpp: In member function ‘virtual void {anonymous}::EsmFixedString_equality_operator_for_not_convertible_to_uint32_with_const_char_pointer_Test::TestBody()’:
apps/openmw_test_suite/esm/test_fixed_string.cpp:164:20: note: at offset 5 into object ‘other’ of size 5
  164 |         const char other[5] = { 'a', 'b', 'c', 'd', '\0' };
      |                    ^~~~~
2 years ago
elsid c80ba92ab7
Add more tests for ESM::FixedString 2 years ago
elsid 7c60905266
Put ESM::FixedString tests into unnamed namespace 2 years ago
elsid 843753da14
Remove unused includes 2 years ago
clang-format-bot ddb0522bbf
Apply clang-format to code base 2 years ago
elsid da0a1ac9ba
Do compile time checks in compile time instead of tests 2 years ago
elsid c42c0dcbc9
Replace deprecated std::is_pod
apps/openmw_test_suite/esm/test_fixed_string.cpp:99:23: warning: ‘template<class _Tp> struct std::is_pod’ is deprecated: use is_standard_layout && is_trivial instead [-Wdeprecated-declarations]
   99 |      ASSERT_TRUE(std::is_pod<ESM::NAME>::value);
      |                       ^~~~~~
2 years ago
elsid b09570692e
Use ifstream for ESMReader
ESMReader reads the whole file, there is no need in the ConstrainedFileStream.
3 years ago
elsid 4447ab0ed7
Remove ESM:: namespace qualifier in components/esm3/ and tests 3 years ago
elsid 3305b400dc
Use ESM::NAME instead of const char* and std::string as argument type 3 years ago
elsid 45db56b382
Rework fixed string
* Avoid inheritance.
* Define equality operators out of the class definition.
* Replace toString with toStringView where it doesn't make sense to create a string.
3 years ago
elsid bf692a4bfa
Add more tests for fixed string 3 years ago
Bret Curtis d1fb854521 move most of the files from esm to esm3, keep common code in esm; this is make space for a future with esm4
esm typo

esm typo
3 years ago
elsid 8e1c92d9af
Use std::variant for ESM::Variant implementation 4 years ago
elsid 7f577f5f08
Do not compare hash in tests
Different std libraries have different implementation that produce different
results for the same values.
4 years ago
elsid dae3f022ba
Add tests for ESM::Variant 4 years ago
Andrei Kortunov 822764d0fa Rework fixed strings handling 4 years ago
Azdul 7940317e42 Make sure that proper operator function is used for char[N] argument 6 years ago
Capostrophic 84a871cac7 Actually enable is_pod test 7 years ago
Capostrophic 85b7aa4f09
Uncomment is_pod test in fixed string tests 7 years ago
Roman Proskuryakov 5ae1864062 Add unit tests for ESM::FIXED_STRING 9 years ago