A couple derp fixes

- Allocate enough space for byte sizes
- Pass size to 'bytes' count
- Check lang ini not font path for lang reload
- Use 24 hour with 0 instead of space for filename date
This commit is contained in:
Pk11 2021-11-23 01:44:49 -06:00
parent 52355b98c7
commit 78e9bd9996
4 changed files with 5 additions and 5 deletions

View File

@ -33,7 +33,7 @@ std::string RetTimeForFilename()
const struct tm *Time = localtime(&raw); const struct tm *Time = localtime(&raw);
char tmp[8]; char tmp[8];
strftime(tmp, sizeof(tmp), "%k%M%S", Time); strftime(tmp, sizeof(tmp), "%H%M%S", Time);
return tmp; return tmp;
} }

View File

@ -64,7 +64,7 @@ static float getTbNumber(u64 bytes) {
std::string getDriveBytes(u64 bytes) std::string getDriveBytes(u64 bytes)
{ {
char buffer[12]; char buffer[32];
if (bytes < (1024 * 1024)) if (bytes < (1024 * 1024))
sniprintf(buffer, sizeof(buffer), STR_N_KB.c_str(), (int)bytes >> 10); sniprintf(buffer, sizeof(buffer), STR_N_KB.c_str(), (int)bytes >> 10);

View File

@ -22,12 +22,12 @@ bool clipboardOn = false;
bool clipboardUsed = false; bool clipboardUsed = false;
std::string getBytes(int bytes) { std::string getBytes(int bytes) {
char buffer[11]; char buffer[32];
if (bytes == 1) if (bytes == 1)
sniprintf(buffer, sizeof(buffer), STR_1_BYTE.c_str()); sniprintf(buffer, sizeof(buffer), STR_1_BYTE.c_str());
else if (bytes < 1024) else if (bytes < 1024)
sniprintf(buffer, sizeof(buffer), STR_N_BYTES.c_str()); sniprintf(buffer, sizeof(buffer), STR_N_BYTES.c_str(), bytes);
else if (bytes < (1024 * 1024)) else if (bytes < (1024 * 1024))
sniprintf(buffer, sizeof(buffer), STR_N_KB.c_str(), bytes >> 10); sniprintf(buffer, sizeof(buffer), STR_N_KB.c_str(), bytes >> 10);

View File

@ -108,7 +108,7 @@ std::string getString(CIniFile &ini, const std::string &item, const std::string
*/ */
void langInit(bool reloading) { void langInit(bool reloading) {
// If reloading then don't change if ini not found // If reloading then don't change if ini not found
if(reloading && access(config->fontPath().c_str(), F_OK) != 0) if(reloading && access(config->languageIniPath().c_str(), F_OK) != 0)
return; return;
CIniFile languageini(config->languageIniPath()); CIniFile languageini(config->languageIniPath());