Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

hide or rename any symbols that are likely to conflict with other

libraries or perl
  • Loading branch information...
commit b33c08f8410d40346ed7e445d45f842409842dda 1 parent dff75de
Tony Cook authored
View
87 Imager.xs
@@ -38,13 +38,89 @@ typedef TT_Fonthandle* Imager__Font__TT;
typedef FT2_Fonthandle* Imager__Font__FT2;
#endif
+/* These functions are all shared - then comes platform dependant code */
+static int getstr(void *hv_t,char *key,char **store) {
+ SV** svpp;
+ HV* hv=(HV*)hv_t;
+
+ mm_log((1,"getstr(hv_t 0x%X, key %s, store 0x%X)\n",hv_t,key,store));
+
+ if ( !hv_exists(hv,key,strlen(key)) ) return 0;
+
+ svpp=hv_fetch(hv, key, strlen(key), 0);
+ *store=SvPV(*svpp, PL_na );
+
+ return 1;
+}
+
+static int getint(void *hv_t,char *key,int *store) {
+ SV** svpp;
+ HV* hv=(HV*)hv_t;
+
+ mm_log((1,"getint(hv_t 0x%X, key %s, store 0x%X)\n",hv_t,key,store));
+
+ if ( !hv_exists(hv,key,strlen(key)) ) return 0;
+
+ svpp=hv_fetch(hv, key, strlen(key), 0);
+ *store=(int)SvIV(*svpp);
+ return 1;
+}
+
+static int getdouble(void *hv_t,char* key,double *store) {
+ SV** svpp;
+ HV* hv=(HV*)hv_t;
+
+ mm_log((1,"getdouble(hv_t 0x%X, key %s, store 0x%X)\n",hv_t,key,store));
+
+ if ( !hv_exists(hv,key,strlen(key)) ) return 0;
+ svpp=hv_fetch(hv, key, strlen(key), 0);
+ *store=(float)SvNV(*svpp);
+ return 1;
+}
+
+static int getvoid(void *hv_t,char* key,void **store) {
+ SV** svpp;
+ HV* hv=(HV*)hv_t;
+
+ mm_log((1,"getvoid(hv_t 0x%X, key %s, store 0x%X)\n",hv_t,key,store));
+
+ if ( !hv_exists(hv,key,strlen(key)) ) return 0;
+
+ svpp=hv_fetch(hv, key, strlen(key), 0);
+ *store = INT2PTR(void*, SvIV(*svpp));
+
+ return 1;
+}
+
+static int getobj(void *hv_t,char *key,char *type,void **store) {
+ SV** svpp;
+ HV* hv=(HV*)hv_t;
+
+ mm_log((1,"getobj(hv_t 0x%X, key %s,type %s, store 0x%X)\n",hv_t,key,type,store));
+
+ if ( !hv_exists(hv,key,strlen(key)) ) return 0;
+
+ svpp=hv_fetch(hv, key, strlen(key), 0);
+
+ if (sv_derived_from(*svpp,type)) {
+ IV tmp = SvIV((SV*)SvRV(*svpp));
+ *store = INT2PTR(void*, tmp);
+ } else {
+ mm_log((1,"getobj: key exists in hash but is not of correct type"));
+ return 0;
+ }
+
+ return 1;
+}
+
+UTIL_table_t i_UTIL_table={getstr,getint,getdouble,getvoid,getobj};
void my_SvREFCNT_dec(void *p) {
SvREFCNT_dec((SV*)p);
}
-void
+static void
log_entry(char *string, int level) {
mm_log((level, string));
}
@@ -376,7 +452,7 @@ static ssize_t io_reader(void *p, void *data, size_t size) {
cbd->where = 0;
cbd->used = did_read;
- copy_size = min(size, cbd->used);
+ copy_size = i_min(size, cbd->used);
memcpy(out, cbd->buffer, copy_size);
cbd->where += copy_size;
out += copy_size;
@@ -770,7 +846,8 @@ static void copy_colors_back(HV *hv, i_quantize *quant) {
}
/* loads the segments of a fountain fill into an array */
-i_fountain_seg *load_fount_segs(AV *asegs, int *count) {
+static i_fountain_seg *
+load_fount_segs(AV *asegs, int *count) {
/* Each element of segs must contain:
[ start, middle, end, c0, c1, segtype, colortrans ]
start, middle, end are doubles from 0 to 1
@@ -859,6 +936,10 @@ i_fountain_seg *load_fount_segs(AV *asegs, int *count) {
#define IFILL_DESTROY(fill) i_fill_destroy(fill);
typedef i_fill_t* Imager__FillHandle;
+/* the m_init_log() function was called init_log(), renamed to reduce
+ potential naming conflicts */
+#define init_log m_init_log
+
MODULE = Imager PACKAGE = Imager::Color PREFIX = ICL_
Imager::Color
View
2  draw.c
@@ -513,7 +513,7 @@ i_line_aa(i_img *im,int x1,int y1,int x2,int y2,i_color *val) {
}
}
-double
+static double
perm(int n,int k) {
double r;
int i;
View
93 dynaload.c
@@ -1,5 +1,6 @@
#include "dynaload.h"
-#include "XSUB.h" /* so we can compile on threaded perls */
+/* #include "XSUB.h" so we can compile on threaded perls */
+#include "imagei.h"
static symbol_table_t symbol_table={i_has_format,ICL_set_internal,ICL_info,
i_img_new,i_img_empty,i_img_empty_ch,i_img_exorcise,
@@ -7,86 +8,6 @@ static symbol_table_t symbol_table={i_has_format,ICL_set_internal,ICL_info,
i_box,i_draw,i_arc,i_copyto,i_copyto_trans,i_rubthru};
-/* These functions are all shared - then comes platform dependant code */
-
-
-int getstr(void *hv_t,char *key,char **store) {
- SV** svpp;
- HV* hv=(HV*)hv_t;
-
- mm_log((1,"getstr(hv_t 0x%X, key %s, store 0x%X)\n",hv_t,key,store));
-
- if ( !hv_exists(hv,key,strlen(key)) ) return 0;
-
- svpp=hv_fetch(hv, key, strlen(key), 0);
- *store=SvPV(*svpp, PL_na );
-
- return 1;
-}
-
-int getint(void *hv_t,char *key,int *store) {
- SV** svpp;
- HV* hv=(HV*)hv_t;
-
- mm_log((1,"getint(hv_t 0x%X, key %s, store 0x%X)\n",hv_t,key,store));
-
- if ( !hv_exists(hv,key,strlen(key)) ) return 0;
-
- svpp=hv_fetch(hv, key, strlen(key), 0);
- *store=(int)SvIV(*svpp);
- return 1;
-}
-
-int getdouble(void *hv_t,char* key,double *store) {
- SV** svpp;
- HV* hv=(HV*)hv_t;
-
- mm_log((1,"getdouble(hv_t 0x%X, key %s, store 0x%X)\n",hv_t,key,store));
-
- if ( !hv_exists(hv,key,strlen(key)) ) return 0;
- svpp=hv_fetch(hv, key, strlen(key), 0);
- *store=(float)SvNV(*svpp);
- return 1;
-}
-
-int getvoid(void *hv_t,char* key,void **store) {
- SV** svpp;
- HV* hv=(HV*)hv_t;
-
- mm_log((1,"getvoid(hv_t 0x%X, key %s, store 0x%X)\n",hv_t,key,store));
-
- if ( !hv_exists(hv,key,strlen(key)) ) return 0;
-
- svpp=hv_fetch(hv, key, strlen(key), 0);
- *store=(void*)SvIV(*svpp);
-
- return 1;
-}
-
-int getobj(void *hv_t,char *key,char *type,void **store) {
- SV** svpp;
- HV* hv=(HV*)hv_t;
-
- mm_log((1,"getobj(hv_t 0x%X, key %s,type %s, store 0x%X)\n",hv_t,key,type,store));
-
- if ( !hv_exists(hv,key,strlen(key)) ) return 0;
-
- svpp=hv_fetch(hv, key, strlen(key), 0);
-
- if (sv_derived_from(*svpp,type)) {
- IV tmp = SvIV((SV*)SvRV(*svpp));
- *store = (void*) tmp;
- } else {
- mm_log((1,"getobj: key exists in hash but is not of correct type"));
- return 0;
- }
-
- return 1;
-}
-
-
-UTIL_table_t UTIL_table={getstr,getint,getdouble,getvoid,getobj};
-
/*
Dynamic loading works like this:
dynaload opens the shared object and
@@ -125,13 +46,13 @@ DSO_open(char* file,char** evalstring) {
if ( (shl_findsym(&tt_handle, "symbol_table",TYPE_UNDEFINED,(void*)&plugin_symtab))) return NULL;
if ( (shl_findsym(&tt_handle, "util_table",TYPE_UNDEFINED,&plugin_utiltab))) return NULL;
(*plugin_symtab)=&symbol_table;
- (*plugin_utiltab)=&UTIL_table;
+ (*plugin_utiltab)=&i_UTIL_table;
*/
if ( (shl_findsym(&tt_handle, I_INSTALL_TABLES ,TYPE_UNDEFINED, &f ))) return NULL;
mm_log( (1,"Calling install_tables\n") );
- f(&symbol_table,&UTIL_table);
+ f(&symbol_table,&i_UTIL_table);
mm_log( (1,"Call ok.\n") );
if ( (shl_findsym(&tt_handle, I_FUNCTION_LIST ,TYPE_UNDEFINED,(func_ptr*)&function_list))) return NULL;
@@ -181,7 +102,7 @@ DSO_open(char *file, char **evalstring) {
return NULL;
}
mm_log((1, "Calling install tables\n"));
- f(&symbol_table, &UTIL_table);
+ f(&symbol_table, &i_UTIL_table);
mm_log((1, "Call ok\n"));
if ( (function_list = (func_ptr *)GetProcAddress(d_handle, I_FUNCTION_LIST)) == NULL) {
@@ -351,11 +272,11 @@ DSO_open(char* file,char** evalstring) {
}
mm_log( (1,"Calling install_tables\n") );
- f(&symbol_table,&UTIL_table);
+ f(&symbol_table,&i_UTIL_table);
mm_log( (1,"Call ok.\n") );
/* (*plugin_symtab)=&symbol_table;
- (*plugin_utiltab)=&UTIL_table; */
+ (*plugin_utiltab)=&i_UTIL_table; */
mm_log( (1,"DSO_open: going to dlsym '%s'\n", I_FUNCTION_LIST ));
if ( (function_list=(func_ptr *)dlsym(d_handle, I_FUNCTION_LIST)) == NULL) {
View
3  dynaload.h
@@ -42,11 +42,12 @@ typedef struct {
void *store;
} UTIL_args;
+#if 0
int getobj(void *hv_t,char *key,char *type,void **store);
int getint(void *hv_t,char *key,int *store);
int getdouble(void *hv_t,char *key,double *store);
int getvoid(void *hv_t,char *key,void **store);
-
+#endif
void *DSO_open(char* file,char** evalstring);
int DSO_close(void *);
View
6 error.c
@@ -67,13 +67,13 @@ C). The Perl level won't use all of this.
/* we never actually use the last item - it's the NULL terminator */
#define ERRSTK 20
-i_errmsg error_stack[ERRSTK];
-int error_sp = ERRSTK - 1;
+static i_errmsg error_stack[ERRSTK];
+static int error_sp = ERRSTK - 1;
/* we track the amount of space used each string, so we don't reallocate
space unless we need to.
This also means that a memory tracking library may see the memory
allocated for this as a leak. */
-int error_space[ERRSTK];
+static int error_space[ERRSTK];
static i_error_cb error_cb;
static i_failed_cb failed_cb;
View
5 ext.h
@@ -1,5 +1,8 @@
#include "image.h"
+#ifndef IMAGER_EXT_H
+#define IMAGER_EXT_H
+
/* structures for passing data between Imager-plugin and the Imager-module */
typedef struct {
@@ -16,3 +19,5 @@ typedef struct {
int (*getvoid)(void *hv_t,char* key,void **store);
int (*getobj)(void *hv_t,char* key,char* type,void **store);
} UTIL_table_t;
+
+#endif
View
2  fills.c
@@ -892,7 +892,7 @@ static void combine_valuef(i_fcolor *, i_fcolor *, int, int);
static void combine_color(i_color *, i_color *, int, int);
static void combine_colorf(i_fcolor *, i_fcolor *, int, int);
-struct i_combines {
+static struct i_combines {
i_fill_combine_f combine;
i_fill_combinef_f combinef;
} combines[] =
View
14 filters.c
@@ -960,7 +960,7 @@ i_gradgen(i_img *im, int num, int *xo, int *yo, i_color *ival, int dmeasure) {
fdist[p] = xd*xd + yd*yd; /* euclidean distance */
break;
case 2: /* euclidean squared */
- fdist[p] = max(xd*xd, yd*yd); /* manhattan distance */
+ fdist[p] = i_max(xd*xd, yd*yd); /* manhattan distance */
break;
default:
m_fatal(3,"i_gradgen: Unknown distance measure\n");
@@ -1013,7 +1013,7 @@ i_nearest_color_foo(i_img *im, int num, int *xo, int *yo, i_color *ival, int dme
mindist = xd*xd + yd*yd; /* euclidean distance */
break;
case 2: /* euclidean squared */
- mindist = max(xd*xd, yd*yd); /* manhattan distance */
+ mindist = i_max(xd*xd, yd*yd); /* manhattan distance */
break;
default:
m_fatal(3,"i_nearest_color: Unknown distance measure\n");
@@ -1030,7 +1030,7 @@ i_nearest_color_foo(i_img *im, int num, int *xo, int *yo, i_color *ival, int dme
curdist = xd*xd + yd*yd; /* euclidean distance */
break;
case 2: /* euclidean squared */
- curdist = max(xd*xd, yd*yd); /* manhattan distance */
+ curdist = i_max(xd*xd, yd*yd); /* manhattan distance */
break;
default:
m_fatal(3,"i_nearest_color: Unknown distance measure\n");
@@ -1083,7 +1083,7 @@ i_nearest_color(i_img *im, int num, int *xo, int *yo, i_color *oval, int dmeasur
mindist = xd*xd + yd*yd; /* euclidean distance */
break;
case 2: /* euclidean squared */
- mindist = max(xd*xd, yd*yd); /* manhattan distance */
+ mindist = i_max(xd*xd, yd*yd); /* manhattan distance */
break;
default:
m_fatal(3,"i_nearest_color: Unknown distance measure\n");
@@ -1100,7 +1100,7 @@ i_nearest_color(i_img *im, int num, int *xo, int *yo, i_color *oval, int dmeasur
curdist = xd*xd + yd*yd; /* euclidean distance */
break;
case 2: /* euclidean squared */
- curdist = max(xd*xd, yd*yd); /* manhattan distance */
+ curdist = i_max(xd*xd, yd*yd); /* manhattan distance */
break;
default:
m_fatal(3,"i_nearest_color: Unknown distance measure\n");
@@ -1225,8 +1225,8 @@ i_diff_image(i_img *im1, i_img *im2, int mindiff) {
if (outchans == 1 || outchans == 3)
++outchans;
- xsize = min(im1->xsize, im2->xsize);
- ysize = min(im1->ysize, im2->ysize);
+ xsize = i_min(im1->xsize, im2->xsize);
+ ysize = i_min(im1->ysize, im2->ysize);
out = i_sametype_chans(im1, xsize, ysize, outchans);
View
8 font.c
@@ -70,11 +70,11 @@ i_init_fonts(int t1log) {
mm_log((1,"Initializing fonts\n"));
#ifdef HAVE_LIBT1
- init_t1(t1log);
+ i_init_t1(t1log);
#endif
#ifdef HAVE_LIBTT
- init_tt();
+ i_init_tt();
#endif
#ifdef HAVE_FT2
@@ -101,7 +101,7 @@ Initializes the t1lib font rendering engine.
*/
undef_int
-init_t1(int t1log) {
+i_init_t1(int t1log) {
int init_flags = IGNORE_CONFIGFILE|IGNORE_FONTDATABASE;
mm_log((1,"init_t1()\n"));
@@ -430,7 +430,7 @@ Initializes the freetype font rendering engine
*/
undef_int
-init_tt() {
+i_init_tt() {
TT_Error error;
mm_log((1,"init_tt()\n"));
error = TT_Init_FreeType( &engine );
View
16 freetyp2.c
@@ -400,10 +400,10 @@ void ft2_transform_box(FT2_Fonthandle *handle, int bbox[4]) {
work[6] = matrix[0] * bbox[2] + matrix[1] * bbox[3];
work[7] = matrix[3] * bbox[2] + matrix[4] * bbox[3];
- bbox[0] = floor(min(min(work[0], work[2]),min(work[4], work[6])));
- bbox[1] = floor(min(min(work[1], work[3]),min(work[5], work[7])));
- bbox[2] = ceil(max(max(work[0], work[2]),max(work[4], work[6])));
- bbox[3] = ceil(max(max(work[1], work[3]),max(work[5], work[7])));
+ bbox[0] = floor(i_min(i_min(work[0], work[2]),i_min(work[4], work[6])));
+ bbox[1] = floor(i_min(i_min(work[1], work[3]),i_min(work[5], work[7])));
+ bbox[2] = ceil(i_max(i_max(work[0], work[2]),i_max(work[4], work[6])));
+ bbox[3] = ceil(i_max(i_max(work[1], work[3]),i_max(work[5], work[7])));
}
/*
@@ -415,10 +415,10 @@ bounding box in bbox[] that encloses both.
=cut
*/
static void expand_bounds(int bbox[4], int bbox2[4]) {
- bbox[0] = min(bbox[0], bbox2[0]);
- bbox[1] = min(bbox[1], bbox2[1]);
- bbox[2] = max(bbox[2], bbox2[2]);
- bbox[3] = max(bbox[3], bbox2[3]);
+ bbox[0] = i_min(bbox[0], bbox2[0]);
+ bbox[1] = i_min(bbox[1], bbox2[1]);
+ bbox[2] = i_max(bbox[2], bbox2[2]);
+ bbox[3] = i_max(bbox[3], bbox2[3]);
}
/*
View
2  gaussian.c
@@ -1,6 +1,6 @@
#include "image.h"
-float
+static float
gauss(int x,float std) {
return 1.0/(sqrt(2.0*PI)*std)*exp(-(float)(x)*(float)(x)/(2*std*std));
}
View
8 gif.c
@@ -871,7 +871,7 @@ i_readgif_multi_callback(i_read_callback_t cb, char *userdata, int *count) {
}
result = i_readgif_multi_low(GifFile, count);
- free_gen_read_data(gci);
+ i_free_gen_read_data(gci);
return result;
#else
@@ -1023,7 +1023,7 @@ i_readgif_callback(i_read_callback_t cb, char *userdata, int **colour_table, int
}
result = i_readgif_low(GifFile, colour_table, colours);
- free_gen_read_data(gci);
+ i_free_gen_read_data(gci);
return result;
#else
@@ -1926,12 +1926,12 @@ i_writegif_callback(i_quantize *quant, i_write_callback_t cb, char *userdata,
gif_push_error();
i_push_error(0, "Cannot create GIF file object");
mm_log((1, "Error in EGifOpenFileHandle, unable to write image.\n"));
- free_gen_write_data(gwd, 0);
+ i_free_gen_write_data(gwd, 0);
return 0;
}
result = i_writegif_low(quant, gf, imgs, count);
- return free_gen_write_data(gwd, result);
+ return i_free_gen_write_data(gwd, result);
#else
i_clear_error();
i_push_error(0, "callbacks not supported with giflib3");
View
20 image.c
@@ -38,7 +38,7 @@ Some of these functions are internal.
#define minmax(a,b,i) ( ((a>=i)?a: ( (b<=i)?b:i )) )
/* Hack around an obscure linker bug on solaris - probably due to builtin gcc thingies */
-void fake(void) { ceil(1); }
+static void fake(void) { ceil(1); }
static int i_ppix_d(i_img *im, int x, int y, i_color *val);
static int i_gpix_d(i_img *im, int x, int y, i_color *val);
@@ -1138,8 +1138,8 @@ i_transform(i_img *im, int *opx,int opxl,int *opy,int opyl,double parm[],int par
parm[1]=(double)ny;
/* fprintf(stderr,"(%d,%d) ->",nx,ny); */
- rx=op_run(opx,opxl,parm,parmlen);
- ry=op_run(opy,opyl,parm,parmlen);
+ rx=i_op_run(opx,opxl,parm,parmlen);
+ ry=i_op_run(opy,opyl,parm,parmlen);
/* fprintf(stderr,"(%f,%f)\n",rx,ry); */
i_gpix(im,rx,ry,&val);
i_ppix(new_img,nx,ny,&val);
@@ -1897,7 +1897,7 @@ i_gen_reader(i_gen_read_data *gci, char *buf, int length) {
gci->cpos = 0;
gci->length = did_read;
- copy_size = min(length, gci->length);
+ copy_size = i_min(length, gci->length);
memcpy(buf, gci->buffer, copy_size);
gci->cpos += copy_size;
buf += copy_size;
@@ -1940,13 +1940,13 @@ i_gen_read_data_new(i_read_callback_t cb, char *userdata) {
}
/*
-=item free_gen_read_data(i_gen_read_data *)
+=item i_free_gen_read_data(i_gen_read_data *)
Cleans up.
=cut
*/
-void free_gen_read_data(i_gen_read_data *self) {
+void i_free_gen_read_data(i_gen_read_data *self) {
myfree(self);
}
@@ -1990,7 +1990,7 @@ int size)
Allocates and initializes the data structure used by i_gen_writer.
-This should be released with L<image.c/free_gen_write_data>
+This should be released with L<image.c/i_free_gen_write_data>
=cut
*/
@@ -2000,7 +2000,7 @@ i_gen_write_data *i_gen_write_data_new(i_write_callback_t cb,
i_gen_write_data *self = mymalloc(sizeof(i_gen_write_data));
self->cb = cb;
self->userdata = userdata;
- self->maxlength = min(max_length, sizeof(self->buffer));
+ self->maxlength = i_min(max_length, sizeof(self->buffer));
if (self->maxlength < 0)
self->maxlength = sizeof(self->buffer);
self->filledto = 0;
@@ -2009,7 +2009,7 @@ i_gen_write_data *i_gen_write_data_new(i_write_callback_t cb,
}
/*
-=item free_gen_write_data(i_gen_write_data *info, int flush)
+=item i_free_gen_write_data(i_gen_write_data *info, int flush)
Cleans up the write buffer.
@@ -2023,7 +2023,7 @@ ie. if it fails.
=cut
*/
-int free_gen_write_data(i_gen_write_data *info, int flush)
+int i_free_gen_write_data(i_gen_write_data *info, int flush)
{
int result = !flush ||
info->filledto == 0 ||
View
8 image.h
@@ -243,7 +243,7 @@ undef_int i_init_fonts( int t1log );
#ifdef HAVE_LIBT1
#include <t1lib.h>
-undef_int init_t1( int t1log );
+undef_int i_init_t1( int t1log );
int i_t1_new( char *pfb, char *afm );
int i_t1_destroy( int font_id );
undef_int i_t1_cp( i_img *im, int xb, int yb, int channel, int fontnum, float points, char* str, int len, int align );
@@ -282,7 +282,7 @@ typedef struct TT_Fonthandle_ TT_Fonthandle;
-undef_int init_tt( void );
+undef_int i_init_tt( void );
TT_Fonthandle* i_tt_new(char *fontname);
void i_tt_destroy( TT_Fonthandle *handle );
undef_int i_tt_cp( TT_Fonthandle *handle,i_img *im,int xb,int yb,int channel,float points,char* txt,int len,int smooth);
@@ -357,7 +357,7 @@ typedef struct {
extern int i_gen_reader(i_gen_read_data *info, char *buffer, int need);
extern i_gen_read_data *i_gen_read_data_new(i_read_callback_t cb, char *userdata);
-extern void free_gen_read_data(i_gen_read_data *);
+extern void i_free_gen_read_data(i_gen_read_data *);
/* general writer callback
userdata - the data the user passed into the writer
@@ -377,7 +377,7 @@ typedef struct {
extern int i_gen_writer(i_gen_write_data *info, char const *data, int size);
extern i_gen_write_data *i_gen_write_data_new(i_write_callback_t cb, char *userdata, int maxlength);
-extern int free_gen_write_data(i_gen_write_data *, int flush);
+extern int i_free_gen_write_data(i_gen_write_data *, int flush);
/* transparency handling for quantized output */
typedef enum i_transp_tag {
View
4 imagei.h
@@ -41,4 +41,8 @@ extern int i_setcolors_forward(i_img *im, int index, i_color *colors,
extern void i_get_combine(int combine, i_fill_combine_f *, i_fill_combinef_f *);
+#include "ext.h"
+
+extern UTIL_table_t i_UTIL_table;
+
#endif
View
4 imio.h
@@ -57,7 +57,7 @@ void i_mempool_destroy(i_mempool *mp);
/* XXX Shouldn't these go away? */
-int min(int a,int b);
-int max(int x,int y);
+int i_min(int a,int b);
+int i_max(int x,int y);
#endif
View
4 io.c
@@ -300,12 +300,12 @@ i_mempool_destroy(i_mempool *mp) {
#undef max
int
-min(int a,int b) {
+i_min(int a,int b) {
if (a<b) return a; else return b;
}
int
-max(int a,int b) {
+i_max(int a,int b) {
if (a>b) return a; else return b;
}
View
2  iolayer.c
@@ -676,7 +676,7 @@ bufchain_seek(io_glue *ig, off_t offset, int whence) {
ieb->cpos = ieb->tfill;
while(wrlen > 0) {
- ssize_t rc, wl = min(wrlen, BBSIZ);
+ ssize_t rc, wl = i_min(wrlen, BBSIZ);
mm_log((1, "bufchain_seek: wrlen = %d, wl = %d\n", wrlen, wl));
rc = bufchain_write( ig, TB, wl );
if (rc != wl) m_fatal(0, "bufchain_seek: Unable to extend file\n");
View
2  jpeg.c
@@ -36,7 +36,7 @@ Reads and writes JPEG images
#define JPEG_APP13 0xED /* APP13 marker code */
#define JPGS 16384
-unsigned char fake_eoi[]={(JOCTET) 0xFF,(JOCTET) JPEG_EOI};
+static unsigned char fake_eoi[]={(JOCTET) 0xFF,(JOCTET) JPEG_EOI};
/* Bad design right here */
View
2  log.c
@@ -17,7 +17,7 @@ static char data_buffer[DATABUFF];
*/
void
-init_log(const char* name,int level) {
+m_init_log(const char* name,int level) {
log_level = level;
if (level < 0) {
lg_file = NULL;
View
2  log.h
@@ -11,7 +11,7 @@
*/
void m_lhead ( const char *file, int line );
-void init_log( const char *name, int onoff );
+void m_init_log( const char *name, int onoff );
void m_loog(int level,const char *msg, ... );
void m_fatal ( int exitcode,const char *fmt, ... );
View
2  png.c
@@ -26,7 +26,7 @@
/* this is a way to get number of channels from color space
* Color code to channel number */
-int CC2C[PNG_COLOR_MASK_PALETTE|PNG_COLOR_MASK_COLOR|PNG_COLOR_MASK_ALPHA];
+static int CC2C[PNG_COLOR_MASK_PALETTE|PNG_COLOR_MASK_COLOR|PNG_COLOR_MASK_ALPHA];
#define PNG_BYTES_TO_CHECK 4
View
64 polygon.c
@@ -101,10 +101,10 @@ line_set_new(double *x, double *y, int l) {
lset[i].y1 = IMTRUNC(y[i]);
lset[i].x2 = IMTRUNC(x[(i+1)%l]);
lset[i].y2 = IMTRUNC(y[(i+1)%l]);
- lset[i].miny=min(lset[i].y1,lset[i].y2);
- lset[i].maxy=max(lset[i].y1,lset[i].y2);
- lset[i].minx=min(lset[i].x1,lset[i].x2);
- lset[i].maxx=max(lset[i].x1,lset[i].x2);
+ lset[i].miny=i_min(lset[i].y1,lset[i].y2);
+ lset[i].maxy=i_max(lset[i].y1,lset[i].y2);
+ lset[i].minx=i_min(lset[i].x1,lset[i].x2);
+ lset[i].maxx=i_max(lset[i].x1,lset[i].x2);
}
return lset;
}
@@ -265,7 +265,7 @@ typedef void (*scanline_flusher)(i_img *im, ss_scanline *ss, int y, void *ctx);
/* This function must be modified later to do proper blending */
-void
+static void
scanline_flush(i_img *im, ss_scanline *ss, int y, void *ctx) {
int x, ch, tv;
i_color t;
@@ -368,22 +368,22 @@ render_slice_scanline(ss_scanline *ss, int y, p_line *l, p_line *r) {
/* Find the y bounds of scanline_slice */
- maxy = min( l->maxy, r->maxy );
- miny = max( l->miny, r->miny );
+ maxy = i_min( l->maxy, r->maxy );
+ miny = i_max( l->miny, r->miny );
- maxy = min( maxy, (y+1)*16 );
- miny = max( miny, y*16 );
+ maxy = i_min( maxy, (y+1)*16 );
+ miny = i_max( miny, y*16 );
- lminx = min( p_eval_aty(l, maxy), p_eval_aty(l, miny) );
- lmaxx = max( p_eval_aty(l, maxy), p_eval_aty(l, miny) );
+ lminx = i_min( p_eval_aty(l, maxy), p_eval_aty(l, miny) );
+ lmaxx = i_max( p_eval_aty(l, maxy), p_eval_aty(l, miny) );
- rminx = min( p_eval_aty(r, maxy), p_eval_aty(r, miny) );
- rmaxx = max( p_eval_aty(r, maxy), p_eval_aty(r, miny) );
+ rminx = i_min( p_eval_aty(r, maxy), p_eval_aty(r, miny) );
+ rmaxx = i_max( p_eval_aty(r, maxy), p_eval_aty(r, miny) );
thin = coarse(lmaxx) >= coarse(rminx);
- startpix = max( coarse(lminx), 0 );
- stoppix = min( coarse(rmaxx-1), ss->linelen-1 );
+ startpix = i_max( coarse(lminx), 0 );
+ stoppix = i_min( coarse(rmaxx-1), ss->linelen-1 );
for(cpix=startpix; cpix<=stoppix; cpix++) {
int lt = coarse(lmaxx-1) >= cpix;
@@ -422,24 +422,24 @@ render_slice_scanline_old(ss_scanline *ss, int y, p_line *l, p_line *r) {
/* Find the y bounds of scanline_slice */
- maxy = min( l->maxy, r->maxy );
- miny = max( l->miny, r->miny );
+ maxy = i_min( l->maxy, r->maxy );
+ miny = i_max( l->miny, r->miny );
- maxy = min( maxy, (y+1)*16 );
- miny = max( miny, y*16 );
+ maxy = i_min( maxy, (y+1)*16 );
+ miny = i_max( miny, y*16 );
- lminx = min( p_eval_aty(l, maxy), p_eval_aty(l, miny) );
- lmaxx = max( p_eval_aty(l, maxy), p_eval_aty(l, miny) );
+ lminx = i_min( p_eval_aty(l, maxy), p_eval_aty(l, miny) );
+ lmaxx = i_max( p_eval_aty(l, maxy), p_eval_aty(l, miny) );
- rminx = min( p_eval_aty(r, maxy), p_eval_aty(r, miny) );
- rmaxx = max( p_eval_aty(r, maxy), p_eval_aty(r, miny) );
+ rminx = i_min( p_eval_aty(r, maxy), p_eval_aty(r, miny) );
+ rmaxx = i_max( p_eval_aty(r, maxy), p_eval_aty(r, miny) );
thin = coarse(lmaxx) >= coarse(rminx);
/* First step */
startpix = coarse(lminx); /* includes tricky starting pixel */
- stoppix = min(coarse(lmaxx), coarse(rminx) ); /* last pixel is tricky */
+ stoppix = i_min(coarse(lmaxx), coarse(rminx) ); /* last pixel is tricky */
/* handle start pixel */
@@ -468,7 +468,7 @@ render_slice_scanline_old(ss_scanline *ss, int y, p_line *l, p_line *r) {
printf("%2d: step2a pixel\n", cpix);
ss->line[cpix] +=
pixel_coverage(l, cpix*16, cpix*16+16, miny, maxy)
- +(cpix*16+16-min(cpix*16+16, l->maxx))*(maxy-miny)
+ +(cpix*16+16-i_min(cpix*16+16, l->maxx))*(maxy-miny)
-pixel_coverage(r, cpix*16, cpix*16+16, miny, maxy);
}
} else { /* step 2b */
@@ -481,7 +481,7 @@ render_slice_scanline_old(ss_scanline *ss, int y, p_line *l, p_line *r) {
/* step 3 */
- cpix = max(coarse(rminx), coarse(lmaxx+15));
+ cpix = i_max(coarse(rminx), coarse(lmaxx+15));
stoppix = coarse(rmaxx-15);
printf("step3 from %d to %d\n", cpix, stoppix);
@@ -533,7 +533,7 @@ render_slice_scanline_old(ss_scanline *ss, int y, p_line *l, p_line *r) {
*/
-void
+static void
i_poly_aa_low(i_img *im, int l, double *x, double *y, void *ctx, scanline_flusher flusher) {
int i ,k; /* Index variables */
int clc; /* Lines inside current interval */
@@ -579,8 +579,8 @@ i_poly_aa_low(i_img *im, int l, double *x, double *y, void *ctx, scanline_flushe
/* loop on intervals */
for(i=0; i<l-1; i++) {
- int startscan = max( coarse(pset[i].y), 0);
- int stopscan = min( coarse(pset[i+1].y+15), im->ysize);
+ int startscan = i_max( coarse(pset[i].y), 0);
+ int stopscan = i_min( coarse(pset[i+1].y+15), im->ysize);
pcord cc = (pset[i].y + pset[i+1].y)/2;
if (pset[i].y == pset[i+1].y) {
@@ -615,7 +615,7 @@ i_poly_aa_low(i_img *im, int l, double *x, double *y, void *ctx, scanline_flushe
);
}
for(cscl=startscan; cscl<stopscan; cscl++) {
- tempy = min(cscl*16+16, pset[i+1].y);
+ tempy = i_min(cscl*16+16, pset[i+1].y);
POLY_DEB( printf("evaluating scan line %d \n", cscl) );
for(k=0; k<clc-1; k+=2) {
POLY_DEB( printf("evaluating slice %d\n", k) );
@@ -657,7 +657,7 @@ struct poly_cfill_state {
i_fill_t *fill;
};
-void
+static void
scanline_flush_cfill(i_img *im, ss_scanline *ss, int y, void *ctx) {
int x, ch, tv;
i_color t;
@@ -720,7 +720,7 @@ struct poly_cfill_state_f {
i_fill_t *fill;
};
-void
+static void
scanline_flush_cfill_f(i_img *im, ss_scanline *ss, int y, void *ctx) {
int x, ch, tv;
int pos;
View
15 quant.c
@@ -1525,9 +1525,9 @@ maxdist(int boxnum,cvec *cv) {
bbox(boxnum,&r0,&r1,&g0,&g1,&b0,&b1);
- mr=max(abs(b-b0),abs(b-b1));
- mg=max(abs(g-g0),abs(g-g1));
- mb=max(abs(r-r0),abs(r-r1));
+ mr=i_max(abs(b-b0),abs(b-b1));
+ mg=i_max(abs(g-g0),abs(g-g1));
+ mb=i_max(abs(r-r0),abs(r-r1));
return PWR2(mr)+PWR2(mg)+PWR2(mb);
}
@@ -1547,9 +1547,9 @@ mindist(int boxnum,cvec *cv) {
if (r0<=r && r<=r1 && g0<=g && g<=g1 && b0<=b && b<=b1) return 0;
- mr=min(abs(b-b0),abs(b-b1));
- mg=min(abs(g-g0),abs(g-g1));
- mb=min(abs(r-r0),abs(r-r1));
+ mr=i_min(abs(b-b0),abs(b-b1));
+ mg=i_min(abs(g-g0),abs(g-g1));
+ mb=i_min(abs(r-r0),abs(r-r1));
mr=PWR2(mr);
mg=PWR2(mg);
@@ -1670,7 +1670,8 @@ transparent_errdiff(i_quantize *quant, i_palidx *data, i_img *img,
}
/* builtin ordered dither maps */
-unsigned char orddith_maps[][64] =
+static unsigned char
+orddith_maps[][64] =
{
{ /* random
this is purely random - it's pretty awful
View
22 regmach.c
@@ -19,16 +19,16 @@
*/
/* returns the value (brightness) of color from 0 to 1 */
-double hsv_value(i_color color) {
- return max(max(color.rgb.r, color.rgb.g), color.rgb.b) / 255.0;
+static double hsv_value(i_color color) {
+ return i_max(i_max(color.rgb.r, color.rgb.g), color.rgb.b) / 255.0;
}
/* returns the hue (color) of color from 0 to 360 */
-double hsv_hue(i_color color) {
+static double hsv_hue(i_color color) {
int val;
int temp;
- temp = min(min(color.rgb.r, color.rgb.g), color.rgb.b);
- val = max(color.rgb.r, max(color.rgb.g, color.rgb.b));
+ temp = i_min(i_min(color.rgb.r, color.rgb.g), color.rgb.b);
+ val = i_max(color.rgb.r, i_max(color.rgb.g, color.rgb.b));
if (val == 0 || val==temp) {
return 0;
}
@@ -55,18 +55,18 @@ double hsv_hue(i_color color) {
}
/* return the saturation of color from 0 to 1 */
-double hsv_sat(i_color color) {
- int value = max(max(color.rgb.r, color.rgb.g), color.rgb.b);
+static double hsv_sat(i_color color) {
+ int value = i_max(i_max(color.rgb.r, color.rgb.g), color.rgb.b);
if (value == 0) {
return 0;
}
else {
- int temp = min(max(color.rgb.r, color.rgb.g), color.rgb.b);
+ int temp = i_min(i_max(color.rgb.r, color.rgb.g), color.rgb.b);
return (value - temp) / (double)value;
}
}
-i_color make_hsv(double hue, double sat, double val) {
+static i_color make_hsv(double hue, double sat, double val) {
int i;
i_color c;
for( i=0; i< MAXCHANNELS; i++) c.channel[i]=0;
@@ -123,7 +123,7 @@ i_color make_hsv(double hue, double sat, double val) {
return c;
}
-i_color make_rgb(int r, int g, int b) {
+static i_color make_rgb(int r, int g, int b) {
i_color c;
if (r < 0)
r = 0;
@@ -163,7 +163,7 @@ i_color make_rgb(int r, int g, int b) {
#define n_epsilon(x, y) (abs(x)+abs(y))*0.001
static i_color bcol = {{ 0 }};
-i_color rm_run(struct rm_op codes[], size_t code_count,
+i_color i_rm_run(struct rm_op codes[], size_t code_count,
double n_regs[], size_t n_regs_count,
i_color c_regs[], size_t c_regs_count,
i_img *images[], size_t image_count) {
View
8 regmach.h
@@ -73,10 +73,10 @@ struct rm_op {
rm_word rout; /* output register */
};
-i_color rm_run(struct rm_op codes[], size_t code_count,
- double n_regs[], size_t n_regs_count,
- i_color c_regs[], size_t c_regs_count,
- i_img *images[], size_t image_count);
+i_color i_rm_run(struct rm_op codes[], size_t code_count,
+ double n_regs[], size_t n_regs_count,
+ i_color c_regs[], size_t c_regs_count,
+ i_img *images[], size_t image_count);
/* op_run(fx, sizeof(fx), parms, 2)) */
View
2  stackmach.c
@@ -1,7 +1,7 @@
#include "stackmach.h"
double
-op_run(int codes[], size_t code_size, double parms[], size_t parm_size) {
+i_op_run(int codes[], size_t code_size, double parms[], size_t parm_size) {
double stack[100];
double *sp = stack;
View
2  stackmach.h
@@ -14,7 +14,7 @@ enum ByteCodes {
bcCos
};
-double op_run(int codes[], size_t code_size, double parms[], size_t parm_size);
+double i_op_run(int codes[], size_t code_size, double parms[], size_t parm_size);
/* op_run(fx, sizeof(fx), parms, 2)) */
View
4 tga.c
@@ -395,14 +395,14 @@ tga_source_read(tga_source *s, unsigned char *buf, size_t pixels) {
break;
case Rle:
- ml = min(s->len, pixels-cp);
+ ml = i_min(s->len, pixels-cp);
for(k=0; k<ml; k++) for(j=0; j<s->bytepp; j++)
buf[(cp+k)*s->bytepp+j] = s->cval[j];
cp += ml;
s->len -= ml;
break;
case Raw:
- ml = min(s->len, pixels-cp);
+ ml = i_min(s->len, pixels-cp);
if (s->ig->readcb(s->ig, buf+cp*s->bytepp, ml*s->bytepp) != ml*s->bytepp) return 0;
cp += ml;
s->len -= ml;
View
2  trans2.c
@@ -69,7 +69,7 @@ i_img* i_transform2(int width, int height, int channels,
for (y = 0; y < height; ++y) {
n_regs[0] = x;
n_regs[1] = y;
- val = rm_run(ops, ops_count, n_regs, n_regs_count, c_regs, c_regs_count,
+ val = i_rm_run(ops, ops_count, n_regs, n_regs_count, c_regs, c_regs_count,
in_imgs, in_imgs_count);
i_ppix(new_img, x, y, &val);
}
Please sign in to comment.
Something went wrong with that request. Please try again.