ProfileManager: use Magnum types.

This commit is contained in:
Guillaume Jacquemin 2021-06-20 14:08:17 +02:00
parent 5bdb710356
commit 5dc7fbc06c

View file

@ -117,7 +117,7 @@ auto ProfileManager::deleteProfile(std::size_t index, bool delete_builds) -> boo
} }
if(delete_builds) { if(delete_builds) {
for(std::uint8_t i = 0; i < 32; ++i) { for(UnsignedByte i = 0; i < 32; ++i) {
std::string filename = Utility::formatString("{}Unit{:.2d}{}.sav", std::string filename = Utility::formatString("{}Unit{:.2d}{}.sav",
_profiles.at(index).type() == ProfileType::Demo ? "Demo": "", _profiles.at(index).type() == ProfileType::Demo ? "Demo": "",
i, _profiles.at(index).steamId()); i, _profiles.at(index).steamId());
@ -170,7 +170,7 @@ auto ProfileManager::backupProfile(std::size_t index, bool backup_builds) -> boo
zip_set_archive_comment(zip, comment.c_str(), comment.length()); zip_set_archive_comment(zip, comment.c_str(), comment.length());
if(backup_builds) { if(backup_builds) {
for(std::uint8_t i = 0; i < 32; ++i) { for(UnsignedByte i = 0; i < 32; ++i) {
std::string build_filename = Utility::formatString("{}Unit{:.2d}{}.sav", std::string build_filename = Utility::formatString("{}Unit{:.2d}{}.sav",
_profiles.at(index).type() == ProfileType::Demo ? "Demo": "", _profiles.at(index).type() == ProfileType::Demo ? "Demo": "",
i, _profiles.at(index).steamId()); i, _profiles.at(index).steamId());
@ -267,7 +267,7 @@ void ProfileManager::refreshBackups() {
backup.timestamp.minute = std::stoi(ts.at(4)); backup.timestamp.minute = std::stoi(ts.at(4));
backup.timestamp.second = std::stoi(ts.at(5)); backup.timestamp.second = std::stoi(ts.at(5));
std::int64_t num_entries = zip_get_num_entries(zip, ZIP_FL_UNCHANGED); Long num_entries = zip_get_num_entries(zip, ZIP_FL_UNCHANGED);
if(num_entries == 0) { if(num_entries == 0) {
continue; continue;
@ -275,7 +275,7 @@ void ProfileManager::refreshBackups() {
backup.includedFiles.reserve(num_entries); backup.includedFiles.reserve(num_entries);
for(std::int64_t i = 0; i < num_entries; i++) { for(Long i = 0; i < num_entries; i++) {
backup.includedFiles.emplace_back(zip_get_name(zip, i, ZIP_FL_UNCHANGED)); backup.includedFiles.emplace_back(zip_get_name(zip, i, ZIP_FL_UNCHANGED));
} }
@ -331,7 +331,7 @@ auto ProfileManager::restoreBackup(std::size_t index) -> bool {
Containers::StaticArray<8192, char> buf{ValueInit}; Containers::StaticArray<8192, char> buf{ValueInit};
std::int64_t bytes_read = 0; Long bytes_read = 0;
while((bytes_read = zip_fread(zf, buf.data(), buf.size())) > 0) { while((bytes_read = zip_fread(zf, buf.data(), buf.size())) > 0) {
if(std::fwrite(buf.data(), sizeof(char), bytes_read, out) < static_cast<std::size_t>(bytes_read)) { if(std::fwrite(buf.data(), sizeof(char), bytes_read, out) < static_cast<std::size_t>(bytes_read)) {
_lastError = Utility::formatString(error_format, file, "not enough bytes written."); _lastError = Utility::formatString(error_format, file, "not enough bytes written.");