Skip to content

Commit

Permalink
[Fix] Add missing newline to key config parser error reporting.
Browse files Browse the repository at this point in the history
[Fix] File sizes in the instrument browser and comments tab were displayed incorrectly if a file size < 1KB ended in 0s.

git-svn-id: https://source.openmpt.org/svn/openmpt/trunk/OpenMPT@20363 56274372-70c3-4bfc-bfc3-4c3a0b034d27
  • Loading branch information
sagamusix committed Mar 15, 2024
1 parent aae91a6 commit 2fe6c9f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mptrack/CommandSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2225,7 +2225,7 @@ bool CCommandSet::LoadFile(std::istream &iStrm, const mpt::ustring &filenameDesc
keymapVersion = Version::Parse(mpt::ToUnicode(mpt::Charset::ASCII, tokens[1]));
if(keymapVersion > Version::Current())
{
errText += MPT_CFORMAT("Keymap was saved with OpenMPT {}, but you are running OpenMPT {}.")(keymapVersion, Version::Current());
errText += MPT_CFORMAT("Keymap was saved with OpenMPT {}, but you are running OpenMPT {}.\n")(keymapVersion, Version::Current());
}
continue;
}
Expand Down
5 changes: 4 additions & 1 deletion mptrack/Mptrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2109,7 +2109,10 @@ CString FormatFileSize(uint64 fileSize)
// Variable-length formatting may decide on a whim to switch to scientific formatting, so used a fixed width and trim manually...
CString s = mpt::cfmt::fix(size, 2);
if(i == 0)
s.TrimRight(_T("0."));
{
if(int pos = s.ReverseFind(_T('.')); pos >= 0)
s.Delete(pos, s.GetLength() - pos);
}
return s + Unit[i];
}
size /= 1024.0;
Expand Down

0 comments on commit 2fe6c9f

Please sign in to comment.