diff options
Diffstat (limited to 'converter/other/fiasco/lib')
-rw-r--r-- | converter/other/fiasco/lib/arith.c | 4 | ||||
-rw-r--r-- | converter/other/fiasco/lib/bit-io.c | 6 | ||||
-rw-r--r-- | converter/other/fiasco/lib/dither.c | 32 | ||||
-rw-r--r-- | converter/other/fiasco/lib/error.c | 39 | ||||
-rw-r--r-- | converter/other/fiasco/lib/image.c | 6 | ||||
-rw-r--r-- | converter/other/fiasco/lib/list.c | 6 | ||||
-rw-r--r-- | converter/other/fiasco/lib/macros.h | 11 | ||||
-rw-r--r-- | converter/other/fiasco/lib/misc.c | 33 | ||||
-rw-r--r-- | converter/other/fiasco/lib/misc.h | 4 |
9 files changed, 26 insertions, 115 deletions
diff --git a/converter/other/fiasco/lib/arith.c b/converter/other/fiasco/lib/arith.c index e3745bf7..dc35d1d1 100644 --- a/converter/other/fiasco/lib/arith.c +++ b/converter/other/fiasco/lib/arith.c @@ -90,7 +90,7 @@ encode_symbol (unsigned symbol, arith_t *arith, model_t *model) * The current state of the arithmetic coder is given by 'arith'. * Output bits are appended to the stream 'output'. * - * The model is updated after encoding the symbol (if neccessary the + * The model is updated after encoding the symbol (if necessary the * symbol counts are rescaled). * * Return value: @@ -354,7 +354,7 @@ decode_symbol (arith_t *arith, model_t *model) * Decode the next symbol - the state of the arithmetic decoder * is given in 'arith'. Read refinement bits from the stream 'input' * and use the given probability 'model'. Update the probability model after - * deconding the symbol (if neccessary also rescale the symbol counts). + * deconding the symbol (if necessary also rescale the symbol counts). * * Return value: * decoded symbol diff --git a/converter/other/fiasco/lib/bit-io.c b/converter/other/fiasco/lib/bit-io.c index 364a1c05..1bfef598 100644 --- a/converter/other/fiasco/lib/bit-io.c +++ b/converter/other/fiasco/lib/bit-io.c @@ -20,9 +20,9 @@ #include "config.h" #include <string.h> -#if STDC_HEADERS -# include <stdlib.h> -#endif /* not STDC_HEADERS */ +#include <stdlib.h> + +#include "nstring.h" #include "macros.h" #include "types.h" diff --git a/converter/other/fiasco/lib/dither.c b/converter/other/fiasco/lib/dither.c index a39afa3c..accd9dd6 100644 --- a/converter/other/fiasco/lib/dither.c +++ b/converter/other/fiasco/lib/dither.c @@ -38,14 +38,8 @@ #include "pm_config.h" #include "config.h" -#if HAVE_STRING_H -# include <string.h> -#else /* not HAVE_STRING_H */ -# include <strings.h> -#endif /* not HAVE_STRING_H */ -#if STDC_HEADERS -# include <stdlib.h> -#endif /* not STDC_HEADERS */ +#include <string.h> +#include <stdlib.h> #include "types.h" #include "macros.h" @@ -65,19 +59,22 @@ static int display_16_bit (const struct fiasco_renderer *this, unsigned char *ximage, const fiasco_image_t *fiasco_image); + static int display_24_bit_bgr (const struct fiasco_renderer *this, unsigned char *ximage, const fiasco_image_t *fiasco_image); + static int display_24_bit_rgb (const struct fiasco_renderer *this, unsigned char *ximage, const fiasco_image_t *fiasco_image); + static int display_32_bit (const struct fiasco_renderer *this, unsigned char *ximage, const fiasco_image_t *fiasco_image); + static int free_bits_at_bottom (unsigned long a); -static int -free_bits_at_top (unsigned long a); + static int number_of_bits_set (unsigned long a); @@ -345,21 +342,6 @@ number_of_bits_set (unsigned long a) } static int -free_bits_at_top (unsigned long a) -/* - * How many 0 bits are there at most significant end of longword. - * Low performance, do not call often. - */ -{ - if(!a) /* assume char is 8 bits */ - return sizeof (unsigned long) * 8; - else if (((long) a) < 0l) /* assume twos complement */ - return 0; - else - return 1 + free_bits_at_top ( a << 1); -} - -static int free_bits_at_bottom (unsigned long a) /* * How many 0 bits are there at least significant end of longword. diff --git a/converter/other/fiasco/lib/error.c b/converter/other/fiasco/lib/error.c index b858badf..ee3afe1f 100644 --- a/converter/other/fiasco/lib/error.c +++ b/converter/other/fiasco/lib/error.c @@ -29,18 +29,9 @@ #include <stdio.h> #include <errno.h> -#if STDC_HEADERS -# include <stdarg.h> -# define VA_START(args, lastarg) va_start(args, lastarg) -#else /* not STDC_HEADERS */ -# include <varargs.h> -# define VA_START(args, lastarg) va_start(args) -#endif /* not STDC_HEADERS */ -#if HAVE_STRING_H -# include <string.h> -#else /* not HAVE_STRING_H */ -# include <strings.h> -#endif /* not HAVE_STRING_H */ +#include <stdarg.h> +#define VA_START(args, lastarg) va_start(args, lastarg) +#include <string.h> #if HAVE_SETJMP_H # include <setjmp.h> @@ -117,11 +108,7 @@ set_error (const char *format, ...) Free (error_message); error_message = Calloc (len, sizeof (char)); -#if HAVE_VPRINTF vsprintf (error_message, format, args); -#elif HAVE_DOPRNT - _doprnt (format, args, stderr); -#endif /* HAVE_DOPRNT */ va_end (args); } @@ -178,11 +165,7 @@ error (const char *format, ...) Free (error_message); error_message = Calloc (len, sizeof (char)); -#if HAVE_VPRINTF vsprintf (error_message, format, args); -#elif HAVE_DOPRNT - _doprnt (format, args, stderr); -#endif /* HAVE_DOPRNT */ va_end (args); @@ -236,11 +219,7 @@ warning (const char *format, ...) return; fprintf (stderr, "Warning: "); -#if HAVE_VPRINTF vfprintf (stderr, format, args); -#elif HAVE_DOPRNT - _doprnt (format, args, stderr); -#endif /* HAVE_DOPRNT */ fputc ('\n', stderr); va_end (args); @@ -259,11 +238,7 @@ message (const char *format, ...) if (verboselevel == FIASCO_NO_VERBOSITY) return; -#if HAVE_VPRINTF vfprintf (stderr, format, args); -#elif HAVE_DOPRNT - _doprnt (format, args, stderr); -#endif /* HAVE_DOPRNT */ fputc ('\n', stderr); va_end (args); } @@ -282,11 +257,7 @@ debug_message (const char *format, ...) return; fprintf (stderr, "*** "); -#if HAVE_VPRINTF vfprintf (stderr, format, args); -#elif HAVE_DOPRNT - _doprnt (format, args, stderr); -#endif /* HAVE_DOPRNT */ fputc ('\n', stderr); va_end (args); } @@ -304,11 +275,7 @@ info (const char *format, ...) if (verboselevel == FIASCO_NO_VERBOSITY) return; -#if HAVE_VPRINTF vfprintf (stderr, format, args); -#elif HAVE_DOPRNT - _doprnt (format, args, stderr); -#endif /* HAVE_DOPRNT */ fflush (stderr); va_end (args); } diff --git a/converter/other/fiasco/lib/image.c b/converter/other/fiasco/lib/image.c index 0168734c..fa3b2db5 100644 --- a/converter/other/fiasco/lib/image.c +++ b/converter/other/fiasco/lib/image.c @@ -18,6 +18,8 @@ #include <string.h> +#include "nstring.h" + #include "types.h" #include "macros.h" #include "error.h" @@ -239,7 +241,7 @@ alloc_image (unsigned width, unsigned height, bool_t color, format_e format) image->format = format; image->reference_count = 1; - strcpy (image->id, "IFIASCO"); + STRSCPY(image->id, "IFIASCO"); for (band = first_band (color); band <= last_band (color); band++) if (format == FORMAT_4_2_0 && band != Y) @@ -447,7 +449,7 @@ write_image (const char *image_name, const image_t *image) if (image->format == FORMAT_4_2_0) { - warning ("Writing of images in 4:2:0 format not supported."); + warning ("We cannot write images in 4:2:0 format."); return; } diff --git a/converter/other/fiasco/lib/list.c b/converter/other/fiasco/lib/list.c index 9f516c2e..bb4efae1 100644 --- a/converter/other/fiasco/lib/list.c +++ b/converter/other/fiasco/lib/list.c @@ -16,11 +16,7 @@ #include "config.h" -#if HAVE_STRING_H -# include <string.h> -#else /* not HAVE_STRING_H */ -# include <strings.h> -#endif /* not HAVE_STRING_H */ +#include <string.h> #include "types.h" #include "macros.h" diff --git a/converter/other/fiasco/lib/macros.h b/converter/other/fiasco/lib/macros.h index 877abeea..9968110a 100644 --- a/converter/other/fiasco/lib/macros.h +++ b/converter/other/fiasco/lib/macros.h @@ -28,11 +28,6 @@ # define SEEK_CUR 1 #endif /* not SEEK_CUR */ -#ifdef WIN32 -#undef max -#undef min -#endif /* not WIN32 */ - /***************************************************************************** Various macros @@ -50,12 +45,6 @@ #define address_of_level(l) ((unsigned) (size_of_level (l) - 1)) #define size_of_tree(l) ((unsigned) (address_of_level ((l) + 1))) #define is_odd(n) (abs (n) % 2) -#ifndef max -#define max(a,b) ((a) < (b) ? (b) : (a)) -#endif -#ifndef min -#define min(a,b) ((a) > (b) ? (b) : (a)) -#endif #define _(x) (x) diff --git a/converter/other/fiasco/lib/misc.c b/converter/other/fiasco/lib/misc.c index 12b94e7a..782ed1e9 100644 --- a/converter/other/fiasco/lib/misc.c +++ b/converter/other/fiasco/lib/misc.c @@ -1,5 +1,5 @@ /* - * misc.c: Some usefull functions, that don't fit in one of + * misc.c: Some useful functions, that don't fit in one of * the other files and that are needed by at least * two modules. * @@ -33,15 +33,10 @@ # endif /* not HAVE_SYS_TIME_H */ #endif /* not TIME_WITH_SYS_TIME */ -#if STDC_HEADERS -# include <stdlib.h> -#endif /* not STDC_HEADERS */ +#include <stdlib.h> +#include <string.h> -#if HAVE_STRING_H -# include <string.h> -#else /* not HAVE_STRING_H */ -# include <strings.h> -#endif /* not HAVE_STRING_H */ +#include "pm_c_util.h" #include "types.h" #include "macros.h" @@ -401,22 +396,6 @@ memmove (void *v_dst, const void *v_src, size_t n) } #endif /* not HAVE_MEMMOVE */ -#ifndef HAVE_STRDUP -char * -strdup (const char *s) -/* - * Duplicate given string 's'. - * - * Return value: - * pointer to new string value - */ -{ - assert (s); - - return strcpy (Calloc (strlen (s) + 1, sizeof (char)), s); -} -#endif /* not HAVE_STRDUP */ - /* Note that some systems have a "log2()" in the math library and some have a "log2" macro. So we name ours Log2. But to avoid lots of differences from the original fiasco source code, we define a @@ -452,13 +431,13 @@ variance (const word_t *pixels, unsigned x0, unsigned y0, assert (pixels); for (average = 0, n = 0, y = y0; y < y0 + height; y++) - for (x = x0; x < min (x0 + width, cols); x++, n++) + for (x = x0; x < MIN(x0 + width, cols); x++, n++) average += pixels [y * cols + x] / 16; average /= n; for (variance = 0, y = y0; y < y0 + height; y++) - for (x = x0; x < min (x0 + width, cols); x++) + for (x = x0; x < MIN(x0 + width, cols); x++) variance += square ((pixels [y * cols + x] / 16) - average); return variance; diff --git a/converter/other/fiasco/lib/misc.h b/converter/other/fiasco/lib/misc.h index 29456590..28fd8b5a 100644 --- a/converter/other/fiasco/lib/misc.h +++ b/converter/other/fiasco/lib/misc.h @@ -72,10 +72,6 @@ memmove(void *dest, const void *src, size_t n); double Log2 (double x); -#ifndef HAVE_STRDUP -char * -strdup (const char *s); -#endif #ifndef HAVE_STRCASECMP bool_t strcaseeq (const char *s1, const char *s2); |