mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
Fix: 9 typos
Signed-off-by: RoboSchmied <github@roboschmie.de>
This commit is contained in:
parent
9214044f80
commit
9c334f54fe
@ -25,7 +25,7 @@ Additionally, if your class is part of one of registered object hierarchies (bas
|
||||
They are simply stored in a binary form, as in memory. Compatibility is ensued through the following means:
|
||||
|
||||
- VCMI uses internally types that have constant, defined size (like int32_t - has 32 bits on all platforms)
|
||||
- serializer stores information about its endianess
|
||||
- serializer stores information about its endianness
|
||||
|
||||
It's not "really" portable, yet it works properly across all platforms we currently support.
|
||||
|
||||
@ -132,7 +132,7 @@ struct DLL_LINKAGE Rumor
|
||||
|
||||
### Common information
|
||||
|
||||
Serializer classes provide iostream-like interface with operator `<<` for serialization and operator `>>` for deserialization. Serializer upon creation will retrieve/store some metadata (version number, endianess), so even if no object is actually serialized, some data will be passed.
|
||||
Serializer classes provide iostream-like interface with operator `<<` for serialization and operator `>>` for deserialization. Serializer upon creation will retrieve/store some metadata (version number, endianness), so even if no object is actually serialized, some data will be passed.
|
||||
|
||||
### Serialization to file
|
||||
|
||||
|
@ -18,7 +18,7 @@ BinaryDeserializer::BinaryDeserializer(IBinaryReader * r): CLoaderBase(r)
|
||||
saving = false;
|
||||
version = Version::NONE;
|
||||
smartPointerSerialization = true;
|
||||
reverseEndianess = false;
|
||||
reverseEndianness = false;
|
||||
|
||||
registerTypes(*this);
|
||||
}
|
||||
|
@ -23,12 +23,12 @@ protected:
|
||||
public:
|
||||
CLoaderBase(IBinaryReader * r): reader(r){};
|
||||
|
||||
inline void read(void * data, unsigned size, bool reverseEndianess)
|
||||
inline void read(void * data, unsigned size, bool reverseEndianness)
|
||||
{
|
||||
auto bytePtr = reinterpret_cast<std::byte*>(data);
|
||||
|
||||
reader->read(bytePtr, size);
|
||||
if(reverseEndianess)
|
||||
if(reverseEndianness)
|
||||
std::reverse(bytePtr, bytePtr + size);
|
||||
};
|
||||
};
|
||||
@ -153,7 +153,7 @@ class DLL_LINKAGE BinaryDeserializer : public CLoaderBase
|
||||
public:
|
||||
using Version = ESerializationVersion;
|
||||
|
||||
bool reverseEndianess; //if source has different endianness than us, we reverse bytes
|
||||
bool reverseEndianness; //if source has different endianness than us, we reverse bytes
|
||||
Version version;
|
||||
|
||||
std::map<ui32, void*> loadedPointers;
|
||||
@ -174,7 +174,7 @@ public:
|
||||
template < class T, typename std::enable_if_t < std::is_fundamental_v<T> && !std::is_same_v<T, bool>, int > = 0 >
|
||||
void load(T &data)
|
||||
{
|
||||
this->read(static_cast<void *>(&data), sizeof(data), reverseEndianess);
|
||||
this->read(static_cast<void *>(&data), sizeof(data), reverseEndianness);
|
||||
}
|
||||
|
||||
template < typename T, typename std::enable_if_t < is_serializeable<BinaryDeserializer, T>::value, int > = 0 >
|
||||
|
@ -29,7 +29,7 @@ int CLoadFile::read(std::byte * data, unsigned size)
|
||||
|
||||
void CLoadFile::openNextFile(const boost::filesystem::path & fname, ESerializationVersion minimalVersion)
|
||||
{
|
||||
assert(!serializer.reverseEndianess);
|
||||
assert(!serializer.reverseEndianness);
|
||||
assert(minimalVersion <= ESerializationVersion::CURRENT);
|
||||
|
||||
try
|
||||
@ -62,7 +62,7 @@ void CLoadFile::openNextFile(const boost::filesystem::path & fname, ESerializati
|
||||
if(serializer.version == ESerializationVersion::CURRENT)
|
||||
{
|
||||
logGlobal->warn("%s seems to have different endianness! Entering reversing mode.", fname.string());
|
||||
serializer.reverseEndianess = true;
|
||||
serializer.reverseEndianness = true;
|
||||
}
|
||||
else
|
||||
THROW_FORMAT("Error: too new file format (%s)!", fName);
|
||||
|
Loading…
Reference in New Issue
Block a user