1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-22 21:50:55 +00:00
nixpkgs/pkgs/development/libraries/urt/urt-3.1b-rle-fixes.patch
Evgeny Egorochkin 5a4bc5b072 URT library: packaged
svn path=/nixpkgs/trunk/; revision=24278
2010-10-14 11:54:06 +00:00

204 lines
5 KiB
Diff

Fixes taken from netpbm
--- lib/rle_global.c
+++ lib/rle_global.c
@@ -76,7 +76,7 @@ rle_hdr rle_dflt_hdr = {
8, /* cmaplen (log2 of length of color map) */
NULL, /* pointer to color map */
NULL, /* pointer to comment strings */
- stdout, /* output file */
+ NULL, /* output file -- must be set dynamically */
{ 7 }, /* RGB channels only */
0L, /* Can't free name and file fields. */
"Urt", /* Default "program name". */
--- lib/rle_hdr.c
+++ lib/rle_hdr.c
@@ -269,6 +273,9 @@
{
rle_hdr *ret_hdr;
+ rle_dflt_hdr.rle_file = stdout;
+ /* The rest of rle_dflt_hdr is set by the loader's data initialization */
+
if ( the_hdr == &rle_dflt_hdr )
return the_hdr;
--- lib/dither.c
+++ lib/dither.c
@@ -38,10 +38,10 @@ void make_square();
#endif
static int magic4x4[4][4] = {
- 0, 14, 3, 13,
- 11, 5, 8, 6,
- 12, 2, 15, 1,
- 7, 9, 4, 10
+{ 0, 14, 3, 13},
+{ 11, 5, 8, 6},
+{ 12, 2, 15, 1},
+{ 7, 9, 4, 10}
};
/* basic dithering macro */
--- lib/rle_open_f.c
+++ lib/rle_open_f.c
@@ -9,7 +9,11 @@
*/
#include "rle_config.h"
+#define _XOPEN_SOURCE /* Make sure fdopen() is in stdio.h */
+
#include <stdio.h>
+#include <unistd.h>
+#include <fcntl.h>
#ifndef NO_OPEN_PIPES
/* Need to have a SIGCLD signal catcher. */
@@ -260,7 +260,6 @@
int pipefd[2];
int i;
char *argv[4];
- extern int errno;
/* Check args. */
if ( *mode != 'r' && *mode != 'w' )
--- lib/rle_getcom.c
+++ lib/rle_getcom.c
@@ -53,11 +53,12 @@
{
for ( ; *n != '\0' && *n != '=' && *n == *v; n++, v++ )
;
- if (*n == '\0' || *n == '=')
+ if (*n == '\0' || *n == '=') {
if ( *v == '\0' )
return v;
else if ( *v == '=' )
return ++v;
+ }
return NULL;
}
--- lib/scanargs.c
+++ lib/scanargs.c
@@ -128,10 +130,10 @@
va_list argl;
{
- register check; /* check counter to be sure all argvs
+ int check; /* check counter to be sure all argvs
are processed */
register CONST_DECL char *cp;
- register cnt;
+ int cnt;
int optarg = 0; /* where optional args start */
int nopt = 0;
char tmpflg, /* temp flag */
@@ -375,11 +377,12 @@
if ( optarg > 0 ) /* end optional args? */
{
/* Eat the arg, too, if necessary */
- if ( list_cnt == 0 )
+ if ( list_cnt == 0 ) {
if ( typchr == 's' )
(void)va_arg( argl, char * );
else
(void)va_arg( argl, ptr );
+ }
break;
}
else
@@ -567,7 +570,7 @@
* Do conversion for n and N types
*/
tmpflg = typchr;
- if (typchr == 'n' || typchr == 'N' )
+ if (typchr == 'n' || typchr == 'N' ) {
if (*argp != '0')
tmpflg = 'd';
else if (*(argp+1) == 'x' ||
@@ -578,6 +581,7 @@
}
else
tmpflg = 'o';
+ }
if (typchr == 'N')
tmpflg = toupper( tmpflg );
--- lib/inv_cmap.c
+++ lib/inv_cmap.c
@@ -42,7 +42,7 @@
static long cbinc, cginc, crinc;
static unsigned long *gdp, *rdp, *cdp;
static unsigned char *grgbp, *rrgbp, *crgbp;
-static gstride, rstride;
+static long gstride, rstride;
static long x, xsqr, colormax;
static int cindex;
#ifdef INSTRUMENT_IT
--- lib/rle_getrow.c
+++ lib/rle_getrow.c
@@ -351,7 +351,7 @@
bzero( (char *)scanline[-1] + the_hdr->xmin,
the_hdr->xmax - the_hdr->xmin + 1 );
for ( nc = 0; nc < the_hdr->ncolors; nc++ )
- if ( RLE_BIT( *the_hdr, nc ) )
+ if ( RLE_BIT( *the_hdr, nc ) ) {
/* Unless bg color given explicitly, use 0. */
if ( the_hdr->background != 2 || the_hdr->bg_color[nc] == 0 )
bzero( (char *)scanline[nc] + the_hdr->xmin,
@@ -360,6 +360,7 @@
bfill( (char *)scanline[nc] + the_hdr->xmin,
the_hdr->xmax - the_hdr->xmin + 1,
the_hdr->bg_color[nc] );
+ }
}
/* If skipping, then just return */
@@ -367,7 +368,7 @@
{
the_hdr->priv.get.vert_skip--;
the_hdr->priv.get.scan_y++;
- if ( the_hdr->priv.get.vert_skip > 0 )
+ if ( the_hdr->priv.get.vert_skip > 0 ) {
if ( the_hdr->priv.get.scan_y >= the_hdr->ymax )
{
int y = the_hdr->priv.get.scan_y;
@@ -377,6 +378,7 @@
}
else
return the_hdr->priv.get.scan_y;
+ }
}
/* If EOF has been encountered, return also */
@@ -457,11 +459,12 @@
else
nc = DATUM(inst);
nc++;
- if ( debug_f )
+ if ( debug_f ) {
if ( RLE_BIT( *the_hdr, channel ) )
fprintf( stderr, "Pixel data %d (to %d):", nc, scan_x+nc );
else
fprintf( stderr, "Pixel data %d (to %d)\n", nc, scan_x+nc);
+ }
if ( RLE_BIT( *the_hdr, channel ) )
{
/* Don't fill past end of scanline! */
--- lib/rle_putcom.c
+++ lib/rle_putcom.c
@@ -53,11 +53,12 @@
{
for ( ; *n != '\0' && *n != '=' && *n == *v; n++, v++ )
;
- if (*n == '\0' || *n == '=')
+ if (*n == '\0' || *n == '=') {
if ( *v == '\0' )
return v;
else if ( *v == '=' )
return ++v;
+ }
return NULL;
}