Skip to content

Commit

Permalink
Crank up the CFLAGS and fix the errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
noncombatant committed Nov 16, 2018
1 parent 356b930 commit 80d4ef9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CFLAGS = -Wall -Wextra -Werror -O0
CFLAGS = -Weverything -Werror -O0 -ansi -pedantic -std=c11 -Wno-padded
LDFLAGS = -lncurses

robotfindskitten: robotfindskitten.c
Expand Down
16 changes: 6 additions & 10 deletions robotfindskitten.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdnoreturn.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
Expand Down Expand Up @@ -122,7 +123,7 @@ static void InitializeMessages(void) {
GameState.messages = Messages;
GameState.message_count = MessageCount;
for (size_t i = Bogus; i < (GameState.message_count - 1); ++i) {
size_t j = i + (random() % (GameState.message_count - i));
size_t j = i + ((size_t)random() % (GameState.message_count - i));
if (i != j) {
char* temp = GameState.messages[i];
GameState.messages[i] = GameState.messages[j];
Expand Down Expand Up @@ -186,7 +187,7 @@ static TouchTestResult TouchTest(int y, int x, size_t* item_number) {
return 0;
}

static void Finish(int signal) {
static noreturn void Finish(int signal) {
endwin();
exit(signal);
}
Expand Down Expand Up @@ -506,7 +507,6 @@ static void MainLoop(void) {
case Key_QUIT:
case Key_quit:
Finish(EXIT_FAILURE);
break;
case Key_RedrawScreen:
RedrawScreen();
break;
Expand Down Expand Up @@ -545,13 +545,9 @@ static void MainLoop(void) {
case TouchTestResultKitten:
PlayAnimation(approach_from_right);
Finish(EXIT_SUCCESS);
break;
case TouchTestResultNonKitten:
ShowMessage(GameState.messages[item_number]);
break;
default:
ShowMessage("Well, that was unexpected...");
break;
}
}
}
Expand All @@ -563,7 +559,7 @@ int main(int count, char* arguments[]) {
setlocale(LC_ALL, NULL);
#endif

int seed = time(0);
unsigned int seed = (unsigned int)time(0);
size_t item_count = DefaultItemCount;
bool options_present = false;

Expand All @@ -580,12 +576,12 @@ int main(int count, char* arguments[]) {
fprintf(stderr, "Argument must be positive.\n");
exit(EXIT_FAILURE);
}
item_count = i;
item_count = (size_t)i;
options_present = true;
break;
}
case 's':
seed = atoi(optarg);
seed = (unsigned int)atoi(optarg);
options_present = true;
break;
case 'h':
Expand Down

0 comments on commit 80d4ef9

Please sign in to comment.