Minor fix to compiling with gcc and gcc related warning 0.2a
authorHarishankar <v.harishankar@gmail.com>
Mon, 11 May 2020 09:59:06 +0000 (15:29 +0530)
committerHarishankar <v.harishankar@gmail.com>
Mon, 11 May 2020 09:59:06 +0000 (15:29 +0530)
Fixed bug in the Makefile to compile with gcc where the library
was not getting linked properly with the gcc command line. Also
fixed a gcc compiler warning about typecasting NULL in initalizing
char array by using '\0' (null terminator character) instead of
NULL.

Makefile
wordblah.h

index 6bd7b90..0cbcb1b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,8 @@
 all:  wordblah wordblah_player
 
 wordblah: wordblah.c wordblah.h constantstrings.h
-       clang wordblah.c -lgd -lz -lcrypto -o wordblah
-
+       clang wordblah.c -o wordblah -lgd -lz -lcrypto
+        
 wordblah_player: wordblah_player.c wordblah.h wordblah.gresource.xml wordblah_player.glade constantstrings.h
                glib-compile-resources wordblah.gresource.xml --target wordblah_resource.c --generate-source
-               clang -rdynamic -lz -lgd -lcrypto -o wordblah_player wordblah_player.c -Wall `pkg-config --cflags --libs gtk+-3.0`
+               clang -rdynamic -o wordblah_player wordblah_player.c -Wall `pkg-config --cflags --libs gtk+-3.0` -lgd -lz -lcrypto
index c641abc..13874dc 100644 (file)
@@ -133,7 +133,7 @@ bool verify_solution_password (Puzzle *p, const char* password)
        unsigned int len;
        digest_message ((const unsigned char *)password, strlen(password),
                                                &hashed_sol_password, &len);
-       char hashed_hex_pwd[256] = { (char) NULL };
+       char hashed_hex_pwd[256] = { '\0' };
        encode_binary (hashed_hex_pwd, hashed_sol_password, len);
        
        if (strcmp (p->hashed_solution_password, hashed_hex_pwd) == 0)
@@ -155,7 +155,7 @@ bool verify_master_password (Puzzle *p, const char* password)
        unsigned int len;
        digest_message ((const unsigned char *)password, strlen(password),
                                                &hashed_mas_password, &len);
-       char hashed_hex_pwd[256] = { (char) NULL };
+       char hashed_hex_pwd[256] = { '\0' };
        encode_binary (hashed_hex_pwd, hashed_mas_password, len);
        
        if (strcmp (p->hashed_master_password, hashed_hex_pwd) == 0)