Skip to content

Commit

Permalink
fix using namespace stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
jakoch committed Jun 20, 2024
1 parent f6c812b commit ccf0a75
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
9 changes: 7 additions & 2 deletions src/DateTimeUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@ std::string getYear()
std::string getDateTime(time_t const & time, char const * time_format)
{
std::stringstream ss;
ss << std::put_time(localtime_r(&time), time_format);
ss << std::put_time(std::localtime(&time), time_format);
return ss.str();
}

std::string format_duration_get_minutes(int msecs)
{
using std::chrono;
using std::chrono::milliseconds;
using std::chrono::seconds;
using std::chrono::minutes;
using std::chrono::hours;
using std::chrono::duration_cast;

auto ms = milliseconds(msecs);
auto secs = duration_cast<seconds>(ms);
ms -= duration_cast<milliseconds>(secs);
Expand Down
6 changes: 3 additions & 3 deletions src/commands/cmd.upload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ static inline void uploadShareCode(std::string& sharecode, ShareCodeCache* match

std::string jsonResponse;

fmt::print(" Uploading ShareCode: {}\n", formatTerminalYellow(sharecode));
fmt::print(" Uploading ShareCode: {}\n", WinCliColors::formatTerminalYellow(sharecode));

if (codeUpload->uploadShareCode(sharecode, jsonResponse) == 0) {
int upload_status = codeUpload->processJsonResponse(jsonResponse);
Expand All @@ -33,7 +33,7 @@ static inline void uploadShareCode(std::string& sharecode, ShareCodeCache* match
void uploadReplayShareCodes(DataObject& data, bool& verbose)
{
if (!data.has_matches_played) {
printRed(" No replay sharecodes to upload.\n");
WinCliColors::printRed(" No replay sharecodes to upload.\n");
return;
}

Expand All @@ -50,7 +50,7 @@ void uploadReplayShareCodes(DataObject& data, bool& verbose)

void uploadSingleShareCode(std::string& sharecode, bool& verbose)
{
printTerminalYellow("\n Uploading Single Replay ShareCode to https://csgostats.gg/: \n\n");
WinCliColors::printTerminalYellow("\n Uploading Single Replay ShareCode to https://csgostats.gg/: \n\n");

ShareCodeCache* matchCache = new ShareCodeCache(verbose);
ShareCodeUpload* codeUpload = new ShareCodeUpload(verbose);
Expand Down
8 changes: 4 additions & 4 deletions src/csgostats/ShareCodeUpload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ int ShareCodeUpload::uploadShareCode(std::string shareCode, std::string& respons

// prepare user-agent identifier
char ua_ident[100];
snprintf(ua_ident, "User-Agent: Mozilla/5.0 (compatible; %s)", CSGO_CLI_USERAGENT_ID);
printf(ua_ident, "User-Agent: Mozilla/5.0 (compatible; %s)", CSGO_CLI_USERAGENT_ID);

// 4. set headers
struct curl_slist* headers = NULL;
Expand Down Expand Up @@ -197,7 +197,7 @@ int ShareCodeUpload::processJsonResponse(std::string& jsonResponse)
std::string const msg = data["msg"].get<std::string>();

auto const result = fmt::format(" Result: {} -> {}. \n", status, msg);
printRed(result);
WinCliColors::printRed(result);

return 3;
}
Expand All @@ -220,7 +220,7 @@ int ShareCodeUpload::processJsonResponse(std::string& jsonResponse)
std::string const url = data["url"].get<std::string>();

auto const result = fmt::format(" Result: {} -> {} | {} \n", status, url, newMsg);
printDarkOrange(result);
WinCliColors::printDarkOrange(result);

return 4;
}
Expand All @@ -229,7 +229,7 @@ int ShareCodeUpload::processJsonResponse(std::string& jsonResponse)
std::string const url = data["url"].get<std::string>();

auto const result = fmt::format(" Result: {} -> {} \n", status, url);
printGreen(result);
WinCliColors::printGreen(result);

return 5;
}
Expand Down
2 changes: 0 additions & 2 deletions src/csgostats/ShareCodeUpload.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
#include <sstream>
#include <stdio.h>

using WinCliColors;

class ShareCodeUpload
{
public:
Expand Down
4 changes: 1 addition & 3 deletions src/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
// Includes needed for _setmode() (+io.h)
#include <fcntl.h>

using WinCliColors;

void initSteamAPI(bool& verbose)
{
if (verbose)
Expand Down Expand Up @@ -180,7 +178,7 @@ int main(int argc, char** argv)
printHelp();
return 0;
} else if (option == "-V" || option == "--V" || option == "-version") {
fmt::print("{} version {}\n", formatLightGreen(CSGO_CLI_BINARYNAME), formatYellow(CSGO_CLI_VERSION));
fmt::print("{} version {}\n", WinCliColors::formatLightGreen(CSGO_CLI_BINARYNAME), WinCliColors::formatYellow(CSGO_CLI_VERSION));
return 0;
} else if (option == "-v" || option == "--v" || option == "-verbose") {
paramVerbose = true;
Expand Down

0 comments on commit ccf0a75

Please sign in to comment.