summaryrefslogtreecommitdiff
path: root/ff2jpg.c
AgeCommit message (Collapse)Author
2018-04-11Add warn() and die()Laslo Hunhold
To fully centralize this matter these well-tested functions are added to the util.c, and implemented as we know it from many other suckless projects.
2018-04-11Add efread() and efwrite()Laslo Hunhold
Given we have a util.c anyway it does not make any sense to duplicate code here. This way, error handling and output is in one place and one does not have to change things in multiple different files. This also reduces code duplication by a lot. It also solves an older bug where the error reporting was not on point: $ echo "farb" | ff2png ff2png: fread: Success (It also lacked a newline) Now it properly reports $ echo "farb" | ff2png ff2png: fread: Unexpected end of file I also fixed some other minor details, for instance that all error messages should begin with a capital letter.
2017-04-14Improve readability of alpha-blending sectionsLaslo Hunhold
2017-04-14Update usage of ff2jpg(1) and ff2ppm(1)Laslo Hunhold
so they align with the manpages.
2017-04-14Make comment in ff2jpg(1) more consistentLaslo Hunhold
2017-04-13Use fshut() to properly flush the output streamLaslo Hunhold
For small images, it could happen that the output stream would not be flushed before exit(), resulting in a lack of error-reporting on a full device. Using fflush(), a function I first introduced in sbase, we do the flushing before returning manually and report errors if they occurred.
2017-04-12Refactor jpg-conversion-utilitiesLaslo Hunhold
First of all, there was lots of libjpeg-specific cruft that just didn't have any right to exist (METHODDEF(), strange typedefs, use of the internal memory pool for no reason). This is gone now. Additionally, we make use of the save and proven utility functions and in general the code should be more well-separated now. What is left to do is clear up the part where we mix the colors with the mask.
2017-03-30Add util.{c|h} to deduplicate codeLaslo Hunhold
2016-05-19Improve fread error handling in ff2*Alexander Krotov
In case of unexpected end of file errno is not set, and strerror(errno) returns "Success". Caller should distinguish between error and EOF by calling ferror(3) as described in fread(3).
2016-04-10Remove dimension checksFRIGN
This may come as a surprise, but I'd like the libraries to handle these cases. Maybe some day libpng supports 0x0 images, so why impose artificial limits here? Same with ppm. For me, an ideal data converter loses as little information as possible. In mixed cases (dimensions 0xn, where n > 0) we could print a warning, but here, 2 principles come at play: - GIGO (garbage in, garbage out) - no information loss if possible Given the code later on won't try to access the malloc(0) region, we are also all safe.
2016-04-03add ff2jpg tool, convert farbfeld images to RGB JPEGHiltjo Posthuma