mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-15 08:16:08 +00:00
refactor(src/common): remove unused imports (#19506)
* refactor(src/common): remove unused imports * fix: build * chore: fix build * chore: size_t -> std::size_t * chore: fix fuckup from previous commit * chore: fix build * chore: fix build * chore: fix build * chore: fix build with std::size_t * chore: fix build * chore: fix build * chore: fix build * chore: fix build * chore: fix build * chore: fix build * chore: fix build * chore: fix build * chore: fix build * chore: fix build * chore: fix build * chore: fix build
This commit is contained in:
@@ -42,12 +42,12 @@ char* GetPlainName(char* FileName)
|
||||
return FileName;
|
||||
}
|
||||
|
||||
void fixnamen(char* name, size_t len)
|
||||
void fixnamen(char* name, std::size_t len)
|
||||
{
|
||||
if (len < 3)
|
||||
return;
|
||||
|
||||
for (size_t i = 0; i < len - 3; i++)
|
||||
for (std::size_t i = 0; i < len - 3; i++)
|
||||
{
|
||||
if (i > 0 && name[i] >= 'A' && name[i] <= 'Z' && isalpha(name[i - 1]))
|
||||
name[i] |= 0x20;
|
||||
@@ -56,16 +56,16 @@ void fixnamen(char* name, size_t len)
|
||||
}
|
||||
|
||||
//extension in lowercase
|
||||
for (size_t i = len - 3; i < len; i++)
|
||||
for (std::size_t i = len - 3; i < len; i++)
|
||||
name[i] |= 0x20;
|
||||
}
|
||||
|
||||
void fixname2(char* name, size_t len)
|
||||
void fixname2(char* name, std::size_t len)
|
||||
{
|
||||
if (len < 3)
|
||||
return;
|
||||
|
||||
for (size_t i = 0; i < len - 3; i++)
|
||||
for (std::size_t i = 0; i < len - 3; i++)
|
||||
if (name[i] == ' ')
|
||||
name[i] = '_';
|
||||
}
|
||||
@@ -105,7 +105,7 @@ bool ADTFile::init(uint32 map_num, uint32 tileX, uint32 tileY)
|
||||
flipcc(fourcc);
|
||||
fourcc[4] = 0;
|
||||
|
||||
size_t nextpos = _file.getPos() + size;
|
||||
std::size_t nextpos = _file.getPos() + size;
|
||||
|
||||
if (!strcmp(fourcc, "MCIN"))
|
||||
{
|
||||
|
||||
@@ -75,8 +75,8 @@ public:
|
||||
const char* GetPlainName(const char* FileName);
|
||||
char* GetPlainName(char* FileName);
|
||||
char* GetExtension(char* FileName);
|
||||
void fixnamen(char* name, size_t len);
|
||||
void fixname2(char* name, size_t len);
|
||||
//void fixMapNamen(char *name, size_t len);
|
||||
void fixnamen(char* name, std::size_t len);
|
||||
void fixname2(char* name, std::size_t len);
|
||||
//void fixMapNamen(char *name, std::size_t len);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -76,7 +76,7 @@ DBCFile::~DBCFile()
|
||||
delete [] data;
|
||||
}
|
||||
|
||||
DBCFile::Record DBCFile::getRecord(size_t id)
|
||||
DBCFile::Record DBCFile::getRecord(std::std::size_t id)
|
||||
{
|
||||
assert(data);
|
||||
return Record(*this, data + id * recordSize);
|
||||
|
||||
@@ -64,30 +64,30 @@ public:
|
||||
offset = r.offset;
|
||||
return *this;
|
||||
}
|
||||
[[nodiscard]] float getFloat(size_t field) const
|
||||
[[nodiscard]] float getFloat(std::size_t field) const
|
||||
{
|
||||
assert(field < file.fieldCount);
|
||||
return *reinterpret_cast<float*>(offset + field * 4);
|
||||
}
|
||||
[[nodiscard]] unsigned int getUInt(size_t field) const
|
||||
[[nodiscard]] unsigned int getUInt(std::size_t field) const
|
||||
{
|
||||
assert(field < file.fieldCount);
|
||||
return *reinterpret_cast<unsigned int*>(offset + (field * 4));
|
||||
}
|
||||
[[nodiscard]] int getInt(size_t field) const
|
||||
[[nodiscard]] int getInt(std::size_t field) const
|
||||
{
|
||||
assert(field < file.fieldCount);
|
||||
return *reinterpret_cast<int*>(offset + field * 4);
|
||||
}
|
||||
[[nodiscard]] unsigned char getByte(size_t ofs) const
|
||||
[[nodiscard]] unsigned char getByte(std::size_t ofs) const
|
||||
{
|
||||
assert(ofs < file.recordSize);
|
||||
return *reinterpret_cast<unsigned char*>(offset + ofs);
|
||||
}
|
||||
[[nodiscard]] const char* getString(size_t field) const
|
||||
[[nodiscard]] const char* getString(std::size_t field) const
|
||||
{
|
||||
assert(field < file.fieldCount);
|
||||
size_t stringOffset = getUInt(field);
|
||||
std::size_t stringOffset = getUInt(field);
|
||||
assert(stringOffset < file.stringSize);
|
||||
//char * tmp = (char*)file.stringTable + stringOffset;
|
||||
//unsigned char * tmp2 = file.stringTable + stringOffset;
|
||||
@@ -134,21 +134,21 @@ public:
|
||||
};
|
||||
|
||||
// Get record by id
|
||||
Record getRecord(size_t id);
|
||||
Record getRecord(std::size_t id);
|
||||
/// Get begin iterator over records
|
||||
Iterator begin();
|
||||
/// Get begin iterator over records
|
||||
Iterator end();
|
||||
/// Trivial
|
||||
[[nodiscard]] size_t getRecordCount() const { return recordCount;}
|
||||
[[nodiscard]] size_t getFieldCount() const { return fieldCount; }
|
||||
[[nodiscard]] std::size_t getRecordCount() const { return recordCount;}
|
||||
[[nodiscard]] std::size_t getFieldCount() const { return fieldCount; }
|
||||
|
||||
private:
|
||||
std::string filename;
|
||||
size_t recordSize;
|
||||
size_t recordCount;
|
||||
size_t fieldCount;
|
||||
size_t stringSize;
|
||||
std::size_t recordSize;
|
||||
std::size_t recordCount;
|
||||
std::size_t fieldCount;
|
||||
std::size_t stringSize;
|
||||
unsigned char* data;
|
||||
unsigned char* stringTable;
|
||||
};
|
||||
|
||||
@@ -99,12 +99,12 @@ MPQFile::MPQFile(const char* filename):
|
||||
buffer = nullptr;
|
||||
}
|
||||
|
||||
size_t MPQFile::read(void* dest, size_t bytes)
|
||||
std::size_t MPQFile::read(void* dest, std::size_t bytes)
|
||||
{
|
||||
if (eof) return 0;
|
||||
|
||||
size_t rpos = pointer + bytes;
|
||||
if (rpos > size_t(size))
|
||||
std::size_t rpos = pointer + bytes;
|
||||
if (rpos > std::size_t(size))
|
||||
{
|
||||
bytes = size - pointer;
|
||||
eof = true;
|
||||
|
||||
@@ -86,9 +86,9 @@ class MPQFile
|
||||
public:
|
||||
MPQFile(const char* filename); // filenames are not case sensitive
|
||||
~MPQFile() { close(); }
|
||||
size_t read(void* dest, size_t bytes);
|
||||
size_t getSize() { return size; }
|
||||
size_t getPos() { return pointer; }
|
||||
std::size_t read(void* dest, std::size_t bytes);
|
||||
std::size_t getSize() { return size; }
|
||||
std::size_t getPos() { return pointer; }
|
||||
char* getBuffer() { return buffer; }
|
||||
char* getPointer() { return buffer + pointer; }
|
||||
bool isEof() { return eof; }
|
||||
|
||||
@@ -485,7 +485,7 @@ int main(int argc, char** argv)
|
||||
map_ids[x].id = dbc->getRecord(x).getUInt(0);
|
||||
|
||||
char const* map_name = dbc->getRecord(x).getString(1);
|
||||
size_t max_map_name_length = sizeof(map_ids[x].name);
|
||||
std::size_t max_map_name_length = sizeof(map_ids[x].name);
|
||||
if (strlen(map_name) >= max_map_name_length)
|
||||
{
|
||||
delete dbc;
|
||||
|
||||
@@ -63,7 +63,7 @@ bool WDTFile::init(uint32 mapId)
|
||||
flipcc(fourcc);
|
||||
fourcc[4] = 0;
|
||||
|
||||
size_t nextpos = _file.getPos() + size;
|
||||
std::size_t nextpos = _file.getPos() + size;
|
||||
|
||||
if (!strcmp(fourcc, "MAIN"))
|
||||
{
|
||||
|
||||
@@ -56,7 +56,7 @@ bool WMORoot::open()
|
||||
flipcc(fourcc);
|
||||
fourcc[4] = 0;
|
||||
|
||||
size_t nextpos = f.getPos() + size;
|
||||
std::size_t nextpos = f.getPos() + size;
|
||||
|
||||
if (!strcmp(fourcc, "MOHD")) // header
|
||||
{
|
||||
@@ -185,7 +185,7 @@ bool WMOGroup::open(WMORoot* rootWMO)
|
||||
size = 68;
|
||||
}
|
||||
fourcc[4] = 0;
|
||||
size_t nextpos = f.getPos() + size;
|
||||
std::size_t nextpos = f.getPos() + size;
|
||||
LiquEx_size = 0;
|
||||
liquflags = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user