Fixed possible accidental conversion memsize type to strict 32 bit

This commit is contained in:
Herman Semenov committed 2024-04-02 19:03:12 +03:00
1 parent 8aac45fec0
commit 9e126b5f00
5 files changed
+7 -7

No files matched your search

+2 -2
View File
@@ -46,7 +46,7 @@ bool SwitchMemstickFolderTo(Path newMemstickFolder) {
#endif
std::string str = newMemstickFolder.ToString();
if (!File::WriteDataToFile(true, str.c_str(), (unsigned int)str.size(), memStickDirFile)) {
if (!File::WriteDataToFile(true, str.c_str(), str.size(), memStickDirFile)) {
ERROR_LOG(SYSTEM, "Failed to write memstick path '%s' to '%s'", newMemstickFolder.c_str(), memStickDirFile.c_str());
// Not sure what to do if this file can't be written. Disk full?
}
@@ -208,7 +208,7 @@ MoveResult *MoveDirectoryContentsSafe(Path moveSrc, Path moveDest, MoveProgressR
for (size_t i = 0; i < fileSuffixesToMove.size(); i++) {
const auto &fileSuffix = fileSuffixesToMove[i];
progressReporter.SetProgress(StringFromFormat("%s (%s)", fileSuffix.suffix.c_str(), NiceSizeFormat(fileSuffix.fileSize).c_str()),
(int)i, (int)fileSuffixesToMove.size());
i, fileSuffixesToMove.size());
Path from = moveSrc / fileSuffix.suffix;
Path to = moveDest / fileSuffix.suffix;
+2 -2
View File
@@ -354,10 +354,10 @@ void GameInfo::SetupTexture(Draw::DrawContext *thin3d, GameInfoTex &tex) {
using namespace Draw;
// TODO: Use TempImage to semi-load the image in the worker task, then here we
// could just call CreateTextureFromTempImage.
tex.texture = CreateTextureFromFileData(thin3d, (const uint8_t *)tex.data.data(), (int)tex.data.size(), ImageFileType::DETECT, false, GetTitle().c_str());
tex.texture = CreateTextureFromFileData(thin3d, (const uint8_t *)tex.data.data(), tex.data.size(), ImageFileType::DETECT, false, GetTitle().c_str());
tex.timeLoaded = time_now_d();
if (!tex.texture) {
ERROR_LOG(G3D, "Failed creating texture (%s) from %d-byte file", GetTitle().c_str(), (int)tex.data.size());
ERROR_LOG(G3D, "Failed creating texture (%s) from %d-byte file", GetTitle().c_str(), tex.data.size());
}
}
+1 -1
View File
@@ -1509,7 +1509,7 @@ void GameSettingsScreen::CallbackMemstickFolder(bool yes) {
}
File::Delete(Path(testWriteFile));
if (!File::WriteDataToFile(true, pendingMemstickFolder_.c_str(), (unsigned int)pendingMemstickFolder_.size(), memstickDirFile)) {
if (!File::WriteDataToFile(true, pendingMemstickFolder_.c_str(), pendingMemstickFolder_.size(), memstickDirFile)) {
WARN_LOG(SYSTEM, "Failed to write memstick folder to '%s'", memstickDirFile.c_str());
} else {
// Save so the settings, at least, are transferred.
+1 -1
View File
@@ -1533,7 +1533,7 @@ static Path GetSecretPath(const char *nameOfSecret) {
// name should be simple alphanumerics to avoid problems on Windows.
bool NativeSaveSecret(const char *nameOfSecret, const std::string &data) {
Path path = GetSecretPath(nameOfSecret);
if (!File::WriteDataToFile(false, data.data(), (unsigned int)data.size(), path)) {
if (!File::WriteDataToFile(false, data.data(), data.size(), path)) {
WARN_LOG(SYSTEM, "Failed to write secret '%s' to path '%s'", nameOfSecret, path.c_str());
return false;
}
+1 -1
View File
@@ -183,7 +183,7 @@ void HttpImageFileView::Draw(UIContext &dc) {
}
if (!textureData_.empty()) {
texture_ = CreateTextureFromFileData(dc.GetDrawContext(), (const uint8_t *)(textureData_.data()), (int)textureData_.size(), ImageFileType::DETECT, false, "store_icon");
texture_ = CreateTextureFromFileData(dc.GetDrawContext(), (const uint8_t *)(textureData_.data()), textureData_.size(), ImageFileType::DETECT, false, "store_icon");
if (!texture_)
textureFailed_ = true;
textureData_.clear();