Sfoglia il codice sorgente

Pass stricter warnings

Stephen Paul Weber 17 anni fa
parent
commit
bbc92bfbe9
2 ha cambiato i file con 5 aggiunte e 3 eliminazioni
  1. 2 0
      Makefile
  2. 3 3
      mnencode.c

+ 2 - 0
Makefile

@@ -1,5 +1,7 @@
 .PHONY: sample_programs clean
 
+CFLAGS=-Wall -Wextra -ansi -pedantic
+
 sample_programs: mnencode mndecode
 
 mnencode: mnencode.o mnemonic.o mn_wordlist.o

+ 3 - 3
mnencode.c

@@ -2,10 +2,10 @@
 #include <string.h>
 #include <stdlib.h>
 #include <errno.h>
+#include <ctype.h>
 #include "mnemonic.h"
 
-int hex2bytes(const char *in, mn_byte *out) {
-	int inlen = strlen(in);
+int hex2bytes(int inlen, const mn_byte *in, mn_byte *out) {
 	char t[3];
 	int i, j = 0, k = 0;
 	if(inlen % 2 != 0) {
@@ -46,7 +46,7 @@ int main(int argc, char **argv) {
 	buflen = fread(cbuf, 1, sizeof cbuf, stdin);
 
 	if(hex_encoded_input) {
-		buflen = hex2bytes(cbuf, xbuf);
+		buflen = hex2bytes(n, cbuf, xbuf);
 		if(buflen < 0) {
 			perror("hex2bytes");
 			return EXIT_FAILURE;