diff --git a/main.c b/main.c
index 805ca2c..f836569 100644
--- a/main.c
+++ b/main.c
@@ -22,9 +22,8 @@ inline char *get_filename(const char *c) {
return qout;
}
-inline int print_tblheader(const char *c) {
+inline void print_tblheader(const char *c) {
char *labels;
- int idx = -1;
switch (*c) {
default:
labels = "
\
@@ -35,7 +34,6 @@ inline int print_tblheader(const char *c) {
Best Time | \
Held By | \
";
- idx = 2;
break;
case 'm':
labels = "\
@@ -45,7 +43,6 @@ inline int print_tblheader(const char *c) {
Name | \
Time | \
";
- idx = 2;
break;
case 'p':
labels = "\
@@ -58,7 +55,6 @@ inline int print_tblheader(const char *c) {
break;
}
printf("%s", labels);
- return idx;
}
// input is an integer as a string.
@@ -66,8 +62,8 @@ inline int print_tblheader(const char *c) {
// this means the longest XDF run this can support is
// 21,474,836.47 seconds
// someone would need to idle in-game for 248 days
-void print_time(const char *strcs) {
- const unsigned int num = strtoul(strcs, NULL, 10);
+void print_time(const unsigned char *strcs) {
+ const unsigned int num = strtoul((const char*)strcs, NULL, 10);
unsigned int s = num/100;
const unsigned int cs = num % 100;
const unsigned int min = s/60;
@@ -84,11 +80,11 @@ void qresult(sqlite3_stmt * const sp, const char *c) {
int e;
unsigned int i;
unsigned int cc = sqlite3_column_count(sp);
- const int cvt = print_tblheader(c);
+ print_tblheader(c);
while ((e = sqlite3_step(sp)) == SQLITE_ROW) {
printf("");
for (i = 0; i < cc; i++) {
- if (*c == 'm' && i == 1 || (*c == '\0' && i == 3) || (*c == 'p' && i == 0)) {
+ if ((*c == 'm' && i == 1) || (*c == '\0' && i == 3) || (*c == 'p' && i == 0)) {
printf("%s | ", sqlite3_column_text(sp, i));
} else if ((i == 0 && *c == '\0') || (i == 1 && *c == 'p') ) {
printf("%s | ", sqlite3_column_text(sp, i), sqlite3_column_text(sp, i));
@@ -110,7 +106,6 @@ bool executequery(const char *sql, const char *str) {
const char *p = (str != NULL) ? strchr(str, '=') + 1 : NULL;
const char qc = (str != NULL) ? str[0] : '\0';
sqlite3 *db;
- char *error;
int con = sqlite3_open("db/cts.db", &db);
if (con != SQLITE_OK) {
fprintf(stderr, "Can not open database: %s\n", sqlite3_errmsg(db));
@@ -134,11 +129,11 @@ bool executequery(const char *sql, const char *str) {
// both allocates and frees memory used up by the string..
// containing the data from query files.
void getquery(const char *qs) {
- char *qf, *qp;
+ char *qf = NULL;
char *fname = get_filename(qs);
if (fname != NULL) {
FILE *f = fopen(fname, "r");
- if (f != NULL && qf != NULL) {
+ if (f != NULL) {
// change from fseek/SEEK_END when sql queries are >2 GB in size.
fseek(f, 0, SEEK_END); // go to the end of file
unsigned int size = ftell(f);
@@ -166,13 +161,14 @@ void html(void) {
\