summaryrefslogtreecommitdiff
path: root/src/utils/stringutils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/stringutils.cpp')
-rw-r--r--src/utils/stringutils.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index 8daaf3be2..446d9d234 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -1,11 +1,11 @@
/*
- * The ManaPlus Client
+ * The ManaVerse Client
* Copyright (C) 2007-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
* Copyright (C) 2011-2020 The ManaPlus Developers
- * Copyright (C) 2020-2023 The ManaVerse Developers
+ * Copyright (C) 2020-2025 The ManaVerse Developers
*
- * This file is part of The ManaPlus Client.
+ * This file is part of The ManaVerse Client.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -38,9 +38,9 @@
#include <algorithm>
#include <sstream>
-#ifdef WIN32
+#ifdef _WIN32
#include <sys/time.h>
-#endif // WIN32
+#endif // _WIN32
#include "debug.h"
@@ -947,8 +947,14 @@ std::string timeToStr(const uint32_t time)
char buf[101];
const time_t tempTime = time;
tm *const timeInfo = localtime(&tempTime);
- if (strftime(&buf[0], 100, "%Y-%m-%d_%H-%M-%S", timeInfo) != 0U)
+ PRAGMA8(GCC diagnostic push)
+ PRAGMA8(GCC diagnostic ignored "-Wformat-y2k")
+ // %c is locale-defined format. gcc8 complains:
+ // '%c' yields only last 2 digits of year in some locales.
+ // However, mails *currently, on ML* expire in way less than a year.
+ if (strftime(&buf[0], 100, "%c", timeInfo) != 0U)
return std::string(buf);
+ PRAGMA8(GCC diagnostic pop)
return "unknown";
}
@@ -1021,7 +1027,7 @@ std::string escapeString(std::string str)
void sanitizePath(std::string &path)
{
-#ifdef WIN32
+#ifdef _WIN32
const char sepStr = '\\';
const std::string sep2Str = "\\\\";
const std::string sepWrongStr = "/";
@@ -1037,7 +1043,7 @@ void sanitizePath(std::string &path)
std::string pathJoin(std::string str1,
const std::string &str2)
{
-#ifdef WIN32
+#ifdef _WIN32
const char sep = '\\';
std::string sepStr = "\\";
#else
@@ -1076,7 +1082,7 @@ std::string pathJoin(std::string str1,
const std::string &str2,
const std::string &str3)
{
-#ifdef WIN32
+#ifdef _WIN32
const char sep = '\\';
std::string sepStr = "\\";
#else