Revert "General: Minor general cleanup"

This commit is contained in:
2019-08-15 08:52:45 -07:00
committed by GitHub
parent 4af15d46c9
commit af59ea2d48
24 changed files with 302 additions and 284 deletions

View File

@@ -106,7 +106,7 @@ atUint32 LZType11::compress(const atUint8* src, atUint8** dst, atUint32 srcLengt
}
delete[] compressedBytes;
compressedBytes = nullptr;
compressedBytes = NULL;
// Add zeros until the file is a multiple of 4
while ((outbuff.position() % 4) != 0)

View File

@@ -10,7 +10,7 @@
namespace athena::io::Compression {
atInt32 decompressZlib(const atUint8* src, atUint32 srcLen, atUint8* dst, atUint32 dstLen) {
z_stream strm = {};
z_stream strm = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
strm.total_in = strm.avail_in = srcLen;
strm.total_out = strm.avail_out = dstLen;
strm.next_in = (Bytef*)src;
@@ -45,7 +45,7 @@ atInt32 decompressZlib(const atUint8* src, atUint32 srcLen, atUint8* dst, atUint
}
atInt32 compressZlib(const atUint8* src, atUint32 srcLen, atUint8* dst, atUint32 dstLen) {
z_stream strm = {};
z_stream strm = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
strm.total_in = strm.avail_in = srcLen;
strm.total_out = strm.avail_out = dstLen;
strm.next_in = (Bytef*)src;

View File

@@ -45,7 +45,7 @@ bool Dir::cd(std::string_view path) {
bool Dir::rm(std::string_view path) { return !(remove((m_path + "/" + path.data()).c_str()) < 0); }
bool Dir::touch() {
std::srand(std::time(nullptr));
srand(time(NULL));
atUint64 tmp = utility::rand64();
std::string tmpFile = fmt::format(fmt("{:016X}.tmp"), tmp);
bool ret = FileInfo(m_path + "/" + tmpFile).touch();

View File

@@ -104,7 +104,7 @@ bool FileInfo::touch() const {
(void)athena::io::FileWriter(m_path);
return true;
}
if (utimes(m_path.c_str(), nullptr) < 0) {
if (utimes(m_path.c_str(), NULL) < 0) {
return false;
}
#elif defined(_WIN32)
@@ -114,7 +114,7 @@ bool FileInfo::touch() const {
wchar_t date[80], time[80];
#if !WINDOWS_STORE
fh = CreateFileA(m_path.c_str(), GENERIC_READ | FILE_WRITE_ATTRIBUTES, 0, nullptr, CREATE_NEW, 0, nullptr);
fh = CreateFileA(m_path.c_str(), GENERIC_READ | FILE_WRITE_ATTRIBUTES, 0, NULL, CREATE_NEW, 0, NULL);
if (fh == INVALID_HANDLE_VALUE)
return false;
@@ -122,14 +122,14 @@ bool FileInfo::touch() const {
/*
* Use GetFileTime() to get the file modification time.
*/
if (GetFileTime(fh, nullptr, nullptr, &modtime) == 0) {
if (GetFileTime(fh, NULL, NULL, &modtime) == 0) {
CloseHandle(fh);
return false;
}
FileTimeToSystemTime(&modtime, &st);
if (GetDateFormatW(LOCALE_USER_DEFAULT, DATE_LONGDATE, &st, nullptr, date, sizeof date / sizeof date[0]) == 0 ||
GetTimeFormatW(LOCALE_USER_DEFAULT, 0, &st, nullptr, time, sizeof time / sizeof time[0]) == 0) {
if (GetDateFormatW(LOCALE_USER_DEFAULT, DATE_LONGDATE, &st, NULL, date, sizeof date / sizeof date[0]) == 0 ||
GetTimeFormatW(LOCALE_USER_DEFAULT, 0, &st, NULL, time, sizeof time / sizeof time[0]) == 0) {
CloseHandle(fh);
return false;
}
@@ -139,13 +139,13 @@ bool FileInfo::touch() const {
* to the current time.
*/
GetSystemTime(&st);
if (GetDateFormatW(LOCALE_USER_DEFAULT, DATE_LONGDATE, &st, nullptr, date, sizeof date / sizeof date[0]) == 0 ||
GetTimeFormatW(LOCALE_USER_DEFAULT, 0, &st, nullptr, time, sizeof time / sizeof time[0]) == 0) {
if (GetDateFormatW(LOCALE_USER_DEFAULT, DATE_LONGDATE, &st, NULL, date, sizeof date / sizeof date[0]) == 0 ||
GetTimeFormatW(LOCALE_USER_DEFAULT, 0, &st, NULL, time, sizeof time / sizeof time[0]) == 0) {
CloseHandle(fh);
return false;
}
SystemTimeToFileTime(&st, &modtime);
if (SetFileTime(fh, nullptr, nullptr, &modtime) == 0) {
if (SetFileTime(fh, NULL, NULL, &modtime) == 0) {
CloseHandle(fh);
return false;
}

View File

@@ -45,8 +45,8 @@ void IPAddress::resolve(const std::string& address) {
addrinfo hints;
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_INET;
addrinfo* result = nullptr;
if (getaddrinfo(address.c_str(), nullptr, &hints, &result) == 0) {
addrinfo* result = NULL;
if (getaddrinfo(address.c_str(), NULL, &hints, &result) == 0) {
if (result) {
addr = reinterpret_cast<sockaddr_in*>(result->ai_addr)->sin_addr;
freeaddrinfo(result);

View File

@@ -100,7 +100,7 @@ int countChar(std::string_view str, const char chr, int* lastOccur) {
for (char c : str) {
if (c == chr) {
if (lastOccur != nullptr)
if (lastOccur != NULL)
*lastOccur = index;
ret++;