Commit Graph

59 Commits

Author SHA1 Message Date
NRK
36190eb07d Error check qoi_read() more strictly
fseek is not guaranteed to succeed and can fail, e.g when trying to
seek a pipe. the first fseek() is not error checked since if it failed,
ftell would return 0.

also check for fread errors too before calling qoi_decode().
2023-06-15 16:06:03 +06:00
NRK
00dfdc8b5c Error check qoi_write() more strictly
simply checking the return value of fwrite() wouldn't be enough since
stdio is typically buffered. and so force a flush and check for errors
via ferror().
2023-06-15 14:36:19 +06:00
Dominic Szablewski
a4e7750d68 Add SPDX License Identifier, remove license text; close #168 2022-08-05 23:39:12 +02:00
Dominic Szablewski
e42b0b3022 Load/store RGBA separately instead of using a typecast; close #197
This should fix problems on big-endian machines and with ILP64
2022-04-11 23:19:04 +02:00
Dominic Szablewski
fd6f6463ef Fix documentation for consecutive QOI_OP_INDEX chunks; close #112 2022-01-05 16:57:38 +01:00
Dominic Szablewski
07116e8b89 Clarify colorspace & channels header usage; #152 2022-01-05 16:55:27 +01:00
Dominic Szablewski
6804a745e4 Fix example in QOI_OP_LUMA documentation; close #161 2022-01-05 16:51:38 +01:00
Dominic Szablewski
00e3421744
Merge pull request #134 from jmaselbas/trailing_spaces
Style: Remove trailing whitespaces
2021-12-26 21:12:47 +01:00
Jules Maselbas
da1070a234 Fix missing prototypes warning
Functions qoi_write_32 and qoi_read_32 should either have a prototype
or be declared static. Do the latter, as theses functions are defined
in a header and should only exists in the same compilation unit as the
file including qoi.h and defining QOI_IMPLEMENTATION, ie not exported.

By adding the static keyword in the function declaration the following
command doesn't raise a missing-prototypes warning, anymore:
    cc -Wmissing-prototypes -DQOI_IMPLEMENTATION -c -o qoi.o -xc qoi.h
2021-12-25 16:50:25 +01:00
Jules Maselbas
b060b961e8 Style: Remove trailing whitespaces 2021-12-25 16:44:08 +01:00
Dominic Szablewski
56c2272dbe Clarify pixel ordering; close #120 2021-12-23 11:45:19 +01:00
Dominic Szablewski
52051a310f Documentation: clarify alpha handling for certain chunk types; close #105 2021-12-21 18:05:30 +01:00
Dominic Szablewski
438c1e918f Fix typo in documentation 2021-12-20 16:17:25 +01:00
Dominic Szablewski
f752c1a978 Clarify pixel order and image completeness 2021-12-20 11:56:19 +01:00
Dominic Szablewski
013cfa1ecd Wording 2021-12-20 11:47:04 +01:00
Dominic Szablewski
e276f58931 Remove obsolete padding specification; already specified above; #96 2021-12-20 11:38:09 +01:00
Dominic Szablewski
4bc071df78 Fix bias for run-length in the documentation 2021-12-19 23:14:08 +01:00
Ozkan Sezer
4ca3d3ae42 minor fix for sign-compare warnings. 2021-12-17 01:12:20 +03:00
Dominic Szablewski
3a62cabad2 Change padding bytes to a unique stream-end marker; #89 2021-12-16 20:50:19 +01:00
Dominic Szablewski
bf6951036d Fix check for valid colorspace 2021-12-16 20:13:52 +01:00
Dominic Szablewski
2f255c7aff Enforce a limit of 400 million pixels, 2GB file size 2021-12-16 20:12:27 +01:00
Dominic Szablewski
ae07396158 Avoid UTF-8 in comments... again. 2021-12-14 21:34:33 +01:00
Dominic Szablewski
0112e3d555 Whitespace, cosmetics 2021-12-14 20:54:37 +01:00
Dominic Szablewski
873cba791d Merge branch 'schar' 2021-12-13 17:25:55 +01:00
Dominic Szablewski
3973c549dc Remove single line comments to conform to c89 -pedantic 2021-12-13 17:23:04 +01:00
Dominic Szablewski
5983658ad4 Whitespace, wording 2021-12-13 17:16:22 +01:00
Ozkan Sezer
2aaba8da96 make qoi.h build using c89 compilers.
also add a QOI_ZEROARR macro, wrapping around memset by default.
2021-12-13 15:56:56 +03:00
Xavier-Frédéric Moulet
99fa97792f Revert "Zero-initialize previous pixel color"
This reverts commit 075ab8fe42.
Closes #30
2021-12-13 11:18:41 +01:00
Ozkan Sezer
8c77fad340 change char local vars to signed char
this accomodates toolchains where char type is unsigned by default.
2021-12-11 21:03:37 +03:00
Dominic Szablewski
c2edcd3d7a Cosmetics 2021-12-11 12:54:01 +01:00
Dominic Szablewski
0ad304d761 Be more specific with the documentation of the file format 2021-12-10 21:31:28 +01:00
Dominic Szablewski
075ab8fe42 Zero-initialize previous pixel color 2021-12-10 20:09:52 +01:00
Dominic Szablewski
2103168519 Minor encoding throughput improvement 2021-12-08 15:45:18 +01:00
Dominic Szablewski
6a73cc65c5 Wording, whitespace 2021-12-08 15:45:10 +01:00
Dominic Szablewski
92f7ebd3f8 Fix qoi_desc colorspace check 2021-12-08 15:30:56 +01:00
Dominic Szablewski
6c83cf2e0c Increase padding to 8 zero-bytes 2021-12-08 15:29:46 +01:00
Dominic Szablewski
947941fbd0 Change colorspace header to an enum to avoid confusion 2021-12-08 14:14:51 +01:00
Dominic Szablewski
d6b1ec673a Add alpha channel to QOI_HASH 2021-12-08 11:30:58 +01:00
Dominic Szablewski
eb29269432 Fix typo in documentation 2021-12-08 11:25:24 +01:00
Dominic Szablewski
28954f7a9a Remove QOI_DIFF_16 and QOI_DIFF_24; better tagging of remaining ops; better hash function 2021-12-06 21:23:13 +01:00
Dominic Szablewski
cbb62ea555 Remove QOI_RUN_16, add new QOI_GDIFF_16 op 2021-11-30 22:05:03 +01:00
Dominic Szablewski
94974653c1 Lock output file before writing; close #18 2021-11-28 17:59:51 +01:00
Dominic Szablewski
9dd60534e4 Use local var for channels to speed up encoding 2021-11-28 17:36:47 +01:00
Dominic Szablewski
80356a5aaa Improve documentation, whitespace, wording 2021-11-28 17:36:05 +01:00
Dominic Szablewski
f0a38c19e5
Merge pull request #44 from Samyak2/samyak-typo-fix-1
Fix a typo: "user" -> "use"
2021-11-28 12:32:14 +01:00
Samyak S Sarnayak
8ebd4e7b6d
Fix a typo: "user" -> "use" 2021-11-28 16:18:55 +05:30
Felix "xq" Queißner
ef9ce10bc1 Adds wraparound specification 2021-11-28 01:17:24 +01:00
Felix "xq" Queißner
7053672d3a Starts to improve the documentation. 2021-11-28 01:08:52 +01:00
Dominic Szablewski
be8d23c574
Merge pull request #31 from vec4f/bug/qoi_read/fclose
Close file on allocation failure in `qoi_read()`
2021-11-27 21:04:16 +01:00
Dominic Szablewski
5506399e0d Fix HEADER_SIZE for the new header 2021-11-27 18:41:02 +01:00