Skip to content

Commit fa8c1e7

Browse files
authored
Fix a few compiler warnings and formatting for DB startup message (#272)
Note that the warning in TableData.cpp only seems to occur on clang (deprecated-declarations) Database account/player count message: Before: [INFO] Database in operation : Found 1 account(s) and 2 player(s)s After: [INFO] Database in operation: Found 1 account and 2 players
1 parent aeac57e commit fa8c1e7

File tree

5 files changed

+13
-9
lines changed

5 files changed

+13
-9
lines changed

src/TableData.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ static void loadDrops(json& dropData) {
610610

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

src/db/init.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,17 +267,17 @@ void Database::open() {
267267
checkMetaTable();
268268
createTables();
269269

270-
std::cout << "[INFO] Database in operation ";
270+
std::cout << "[INFO] Database in operation";
271271
int accounts = getTableSize("Accounts");
272272
int players = getTableSize("Players");
273273
std::string message = "";
274274
if (accounts > 0) {
275-
message += ": Found " + std::to_string(accounts) + " account(s)";
275+
message += ": Found " + std::to_string(accounts) + " account";
276276
if (accounts > 1)
277277
message += "s";
278278
}
279279
if (players > 0) {
280-
message += " and " + std::to_string(players) + " player(s)";
280+
message += " and " + std::to_string(players) + " player";
281281
if (players > 1)
282282
message += "s";
283283
}

vendor/bcrypt/bcrypt.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,13 @@
2222
#endif
2323
#include <errno.h>
2424

25-
#ifdef _WIN32 || _WIN64
25+
#if defined(_WIN32) || defined(_WIN64)
2626
// On windows we need to generate random bytes differently.
27+
#if defined(_WIN32) && !defined(_WIN64)
28+
typedef __int32 ssize_t;
29+
#elif defined(_WIN32) && defined(_WIN64)
2730
typedef __int64 ssize_t;
31+
#endif
2832
#define BCRYPT_HASHSIZE 60
2933

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

119123
// Note: Windows does not have /dev/urandom sadly.
120-
#ifdef _WIN32 || _WIN64
124+
#if defined(_WIN32) || defined(_WIN64)
121125
HCRYPTPROV p;
122126
ULONG i;
123127

vendor/bcrypt/crypt_blowfish.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
#endif
5252

5353
/* Just to make sure the prototypes match the actual definitions */
54-
#ifdef _WIN32 || _WIN64
54+
#if defined(_WIN32) || defined(_WIN64)
5555
#include "crypt_blowfish.h"
5656
#else
5757
#include "crypt_blowfish.h"

vendor/bcrypt/wrapper.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
#define __SKIP_GNU
4242
#endif
4343

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

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

253253
if (retval) {
254-
#ifdef _WIN32 | _WIN64
254+
#if defined(_WIN32) || defined(_WIN64)
255255
retval = _strdup(retval);
256256
#else
257257
retval = strdup(retval);

0 commit comments

Comments
 (0)