Skip to content

Commit

Permalink
Terminate error messages with newlines
Browse files Browse the repository at this point in the history
  • Loading branch information
rayrobdod committed Apr 14, 2024
1 parent 8982709 commit ae1c47b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Output dimension will be exactly `-s` instead of rounding `-s` to some multiple of swash count
* Succeed even when swatch width is larger than 259 pixels
* Improved compression
* Terminate error messages with newlines

## [v2023.03.07] 2023-03-07
Initial release
2 changes: 1 addition & 1 deletion src/main/c/bitstream.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void bitstream_extend(struct Bitstream *const this, const size_t min_capacity) {
if (this->bufferc < min_capacity) {
this->bufferv = realloc(this->bufferv, min_capacity);
if (! (this->bufferv)) {
fprintf(stderr, "memory allocation failure");
fprintf(stderr, "memory allocation failure\n");
exit(1);
}
for (size_t i = this->bufferc; i < min_capacity; i++) {
Expand Down
8 changes: 4 additions & 4 deletions src/main/c/deflate.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,18 @@ struct BitStrShort encode_fixed_huffman_code(uint16_t value) {
bitstr_reverse(&retval);
return retval;
} else {
fprintf(stderr, "Value error: encode_fixed_huffman_codes value exceeded 285");
fprintf(stderr, "Value error: encode_fixed_huffman_codes value exceeded 285\n");
exit(1);
}
}

struct BitStrShort encode_length(uint16_t value) {
if (value < 3) {
fprintf(stderr, "Value error: encode_length value less than 3");
fprintf(stderr, "Value error: encode_length value less than 3\n");
exit(1);
}
if (value > 258) {
fprintf(stderr, "Value error: encode_length value greater than 258");
fprintf(stderr, "Value error: encode_length value greater than 258\n");
exit(1);
}

Expand All @@ -73,7 +73,7 @@ struct BitStrShort encode_length(uint16_t value) {

struct BitStrShort encode_offset(uint16_t value) {
if (value > 32768) {
fprintf(stderr, "Value error: encode_offset value greater than 32768");
fprintf(stderr, "Value error: encode_offset value greater than 32768\n");
exit(1);
}
uint16_t code = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/main/c/jasc-pal-thumbnailer.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void parse_input(struct Palette *const retval, const char *const filename) {
if (filename) {
f = fopen(filename, "rb");
if (!f) {
fprintf(stderr, "Could not open file %s", filename);
fprintf(stderr, "Could not open file %s\n", filename);
exit(1);
}
} else {
Expand Down Expand Up @@ -151,7 +151,7 @@ void write_output(const struct Palette *const palette, const char *const filenam
if (filename) {
f = fopen(filename, "wb");
if (!f) {
fprintf(stderr, "Could not open file %s", filename);
fprintf(stderr, "Could not open file %s\n", filename);
exit(1);
}
} else {
Expand Down

0 comments on commit ae1c47b

Please sign in to comment.