diff options
| author | Franklin Wei <git@fwei.tk> | 2015-05-24 14:14:03 -0400 |
|---|---|---|
| committer | Franklin Wei <git@fwei.tk> | 2015-05-24 14:14:03 -0400 |
| commit | 058c0f9bce6401112f37463cd8d9f10df5c7d004 (patch) | |
| tree | 8f192f6adeaf8bffc2b240ac69b35bb57ee1e828 | |
| parent | 619550ed4aa3e242334153dcc2f003209fff986d (diff) | |
| download | market-sim-058c0f9bce6401112f37463cd8d9f10df5c7d004.zip market-sim-058c0f9bce6401112f37463cd8d9f10df5c7d004.tar.gz market-sim-058c0f9bce6401112f37463cd8d9f10df5c7d004.tar.bz2 market-sim-058c0f9bce6401112f37463cd8d9f10df5c7d004.tar.xz | |
make error messages more uniform
| -rw-r--r-- | src/load.c | 6 | ||||
| -rw-r--r-- | src/util.c | 4 |
2 files changed, 5 insertions, 5 deletions
@@ -6,7 +6,7 @@ static uint32_t cksum; #define ADD_CKSUM(x) (cksum += (x*x) + 1) -#define FAIL() fail("Failed to read from file.") +#define FAIL() fail("Failed to load save: Unexpected end-of-file") uint64_t read_be64(FILE *f) { @@ -122,7 +122,7 @@ void load_portfolio(struct player_t *player, const char *filename) char *sym = malloc(symlen + 1); if(ck_read(sym, symlen + 1, 1, f) != 1) { - fail("Save is corrupted (symbol too short)."); + fail("Failed to load save: Unexpected end-of-file"); } stock->symbol = sym; @@ -166,7 +166,7 @@ void load_portfolio(struct player_t *player, const char *filename) if(ck != cksum) { - fail("Bad checksum, file is corrupt.\nCalculated: %d File: %d", ck, cksum); + fail("Failed to load save: Bad checksum", ck, cksum); } int junk = fgetc(f); @@ -75,7 +75,7 @@ bool get_stock_info(char *symbol, struct money_t *price, char **name_ret) if(res != CURLE_OK || buf.data[0] != '"') { - fail("Failed to query information for '%s'.\n", symbol); + fail("Failed to query information for '%s'.", symbol); } /* null-terminate buffer */ @@ -121,7 +121,7 @@ static void detect_endianness(void) endianness = LITTLE; else { - fail("failed to detect system endianness"); + fail("Failed to detect system endianness."); } } |