Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a few compiler warnings and formatting for DB startup message #272

Merged
merged 1 commit into from
Mar 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/TableData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ static void loadDrops(json& dropData) {

if (rankScores.size() != 5 || rankScores.size() != rankRewards.size()) {
char buff[255];
sprintf(buff, "Race in EP %d doesn't have exactly 5 score/reward pairs", raceEPID);
snprintf(buff, 255, "Race in EP %d doesn't have exactly 5 score/reward pairs", raceEPID);
throw TableException(std::string(buff));
}

Expand Down
6 changes: 3 additions & 3 deletions src/db/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,17 +267,17 @@ void Database::open() {
checkMetaTable();
createTables();

std::cout << "[INFO] Database in operation ";
std::cout << "[INFO] Database in operation";
int accounts = getTableSize("Accounts");
int players = getTableSize("Players");
std::string message = "";
if (accounts > 0) {
message += ": Found " + std::to_string(accounts) + " account(s)";
message += ": Found " + std::to_string(accounts) + " account";
if (accounts > 1)
message += "s";
}
if (players > 0) {
message += " and " + std::to_string(players) + " player(s)";
message += " and " + std::to_string(players) + " player";
if (players > 1)
message += "s";
}
Expand Down
8 changes: 6 additions & 2 deletions vendor/bcrypt/bcrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@
#endif
#include <errno.h>

#ifdef _WIN32 || _WIN64
#if defined(_WIN32) || defined(_WIN64)
// On windows we need to generate random bytes differently.
#if defined(_WIN32) && !defined(_WIN64)
typedef __int32 ssize_t;
#elif defined(_WIN32) && defined(_WIN64)
typedef __int64 ssize_t;
#endif
#define BCRYPT_HASHSIZE 60

#include "bcrypt.h"
Expand Down Expand Up @@ -117,7 +121,7 @@ int bcrypt_gensalt(int factor, char salt[BCRYPT_HASHSIZE])
char *aux;

// Note: Windows does not have /dev/urandom sadly.
#ifdef _WIN32 || _WIN64
#if defined(_WIN32) || defined(_WIN64)
HCRYPTPROV p;
ULONG i;

Expand Down
2 changes: 1 addition & 1 deletion vendor/bcrypt/crypt_blowfish.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
#endif

/* Just to make sure the prototypes match the actual definitions */
#ifdef _WIN32 || _WIN64
#if defined(_WIN32) || defined(_WIN64)
#include "crypt_blowfish.h"
#else
#include "crypt_blowfish.h"
Expand Down
4 changes: 2 additions & 2 deletions vendor/bcrypt/wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#define __SKIP_GNU
#endif

#ifdef _WIN32 | _WIN64
#if defined(_WIN32) || defined(_WIN64)
#include "ow-crypt.h"

#include "crypt_blowfish.h"
Expand Down Expand Up @@ -251,7 +251,7 @@ char *__crypt_gensalt_ra(const char *prefix, unsigned long count,
input, size, output, sizeof(output));

if (retval) {
#ifdef _WIN32 | _WIN64
#if defined(_WIN32) || defined(_WIN64)
retval = _strdup(retval);
#else
retval = strdup(retval);
Expand Down
Loading