Rename E_{ERROR,WARNING,...} to GD_{ERROR,WARNING,...} and install the header

master
Ondřej Surý 2013-04-16 13:00:36 +02:00
parent 32b1307c62
commit e5d9ea1826
8 changed files with 30 additions and 30 deletions

View File

@ -18,7 +18,7 @@ check_PROGRAMS = fontsizetest fontwheeltest gdtest gddemo gd2time gdtestft testa
EXTRA_DIST = bdftogd demoin.png entities.html entities.tcl CMakeLists.txt
include_HEADERS = gd.h gdfx.h gd_io.h gdcache.h gdfontg.h gdfontl.h gdfontmb.h gdfonts.h gdfontt.h entities.h gd_color_map.h
include_HEADERS = gd.h gdfx.h gd_io.h gdcache.h gdfontg.h gdfontl.h gdfontmb.h gdfonts.h gdfontt.h entities.h gd_color_map.h gd_errors.h
lib_LTLIBRARIES = libgd.la

View File

@ -75,19 +75,19 @@ void gd_stderr_error(int priority, const char *format, ...)
va_start(args, format);
switch (priority) {
case E_ERROR:
case GD_ERROR:
fputs("GD Error: ", stderr);
break;
case E_WARNING:
case GD_WARNING:
fputs("GD Warning: ", stderr);
break;
case E_NOTICE:
case GD_NOTICE:
fputs("GD Notice: ", stderr);
break;
case E_INFO:
case GD_INFO:
fputs("GD Info: ", stderr);
break;
case E_DEBUG:
case GD_DEBUG:
fputs("GD Debug: ", stderr);
break;
}
@ -104,7 +104,7 @@ void gd_error(const char *format, ...)
va_list args;
va_start(args, format);
gd_error_ex(E_WARNING, format, args);
gd_error_ex(GD_WARNING, format, args);
va_end(args);
}
void gd_error_ex(int priority, const char *format, ...)

View File

@ -14,11 +14,11 @@ LOG_INFO informational message
LOG_DEBUG debug-level message
*/
#define E_ERROR LOG_ERR
#define E_WARNING LOG_WARNING
#define E_NOTICE LOG_NOTICE
#define E_INFO LOG_INFO
#define E_DEBUG LOG_DEBUG
#define GD_ERROR LOG_ERR
#define GD_WARNING LOG_WARNING
#define GD_NOTICE LOG_NOTICE
#define GD_INFO LOG_INFO
#define GD_DEBUG LOG_DEBUG
void gd_error(const char *format, ...);
void gd_error_ex(int priority, const char *format, ...);

View File

@ -484,7 +484,7 @@ BGD_DECLARE(gdImagePtr) gdImageCreateFromJpegCtx(gdIOCtx *infile)
goto error;
}
#if BITS_IN_JSAMPLE == 12
gd_error_ex(E_ERROR,
gd_error_ex(GD_ERROR,
"gd-jpeg: error: jpeg library was compiled for 12-bit\n"
"precision. This is mostly useless, because JPEGs on the web are\n"
"8-bit and such versions of the jpeg library won't read or write\n"

View File

@ -467,7 +467,7 @@ int verbose;
for (i=0; i<rad; i++)
nnq->radpower[i] = alpha*(((rad*rad - i*i)*radbias)/(rad*rad));
if (verbose) gd_error_ex(E_NOTICE, "beginning 1D learning: initial radius=%d\n", rad);
if (verbose) gd_error_ex(GD_NOTICE, "beginning 1D learning: initial radius=%d\n", rad);
if ((nnq->lengthcount%prime1) != 0) step = 4*prime1;
else {
@ -502,7 +502,7 @@ int verbose;
nnq->radpower[j] = alpha*(((rad*rad - j*j)*radbias)/(rad*rad));
}
}
if (verbose) gd_error_ex(E_NOTICE, "finished 1D learning: final alpha=%f !\n",((float)alpha)/initalpha);
if (verbose) gd_error_ex(GD_NOTICE, "finished 1D learning: final alpha=%f !\n",((float)alpha)/initalpha);
}
BGD_DECLARE(gdImagePtr) gdImageNeuQuant(gdImagePtr im, const int max_color, int sample_factor)

View File

@ -21,11 +21,11 @@
int overflow2(int a, int b)
{
if(a <= 0 || b <= 0) {
gd_error(E_WARNING, "one parameter to a memory allocation multiplication is negative or zero, failing operation gracefully\n");
gd_error(GD_WARNING, "one parameter to a memory allocation multiplication is negative or zero, failing operation gracefully\n");
return 1;
}
if(a > INT_MAX / b) {
gd_error_ex(E_WARNING, "product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully\n");
gd_error_ex(GD_WARNING, "product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully\n");
return 1;
}
return 0;

View File

@ -173,11 +173,11 @@ DetectKanjiCode (unsigned char *str)
#ifdef DEBUG
if (whatcode == ASCII)
gd_error_ex(E_DEBUG, "Kanji code not included.");
gd_error_ex(GD_DEBUG, "Kanji code not included.");
else if (whatcode == EUCORSJIS)
gd_error_ex(E_DEBUG, "Kanji code not detected.");
gd_error_ex(GD_DEBUG, "Kanji code not detected.");
else
gd_error_ex(E_DEBUG, "Kanji code detected at %d byte.", i);
gd_error_ex(GD_DEBUG, "Kanji code detected at %d byte.", i);
#endif
if (whatcode == EUCORSJIS && oldcode != ASCII)
@ -442,43 +442,43 @@ do_check_and_conv (unsigned char *to, unsigned char *from)
switch (DetectKanjiCode (from)) {
case NEW:
gd_error_ex(E_DEBUG, "Kanji code is New JIS.");
gd_error_ex(GD_DEBUG, "Kanji code is New JIS.");
do_convert (&tmp_p, &from, NEWJISSTR);
break;
case OLD:
gd_error_ex(E_DEBUG, "Kanji code is Old JIS.");
gd_error_ex(GD_DEBUG, "Kanji code is Old JIS.");
do_convert (&tmp_p, &from, OLDJISSTR);
break;
case ESCI:
gd_error_ex(E_DEBUG, "This string includes Hankaku-Kana (jisx0201) escape sequence [ESC] + ( + I.");
gd_error_ex(GD_DEBUG, "This string includes Hankaku-Kana (jisx0201) escape sequence [ESC] + ( + I.");
do_convert (&tmp_p, &from, NEWJISSTR);
break;
case NEC:
gd_error_ex(E_DEBUG, "Kanji code is NEC Kanji.");
gd_error_ex(GD_DEBUG, "Kanji code is NEC Kanji.");
gd_error("cannot convert NEC Kanji.");
ustrcpy (tmp, from);
kanji = FALSE;
break;
case EUC:
gd_error_ex(E_DEBUG, "Kanji code is EUC.");
gd_error_ex(GD_DEBUG, "Kanji code is EUC.");
ustrcpy (tmp, from);
break;
case SJIS:
gd_error_ex(E_DEBUG, "Kanji code is SJIS.");
gd_error_ex(GD_DEBUG, "Kanji code is SJIS.");
do_convert (&tmp_p, &from, SJISSTR);
break;
case EUCORSJIS:
gd_error_ex(E_DEBUG, "Kanji code is EUC or SJIS.");
gd_error_ex(GD_DEBUG, "Kanji code is EUC or SJIS.");
ustrcpy (tmp, from);
kanji = FALSE;
break;
case ASCII:
gd_error_ex(E_DEBUG, "This is ASCII string.");
gd_error_ex(GD_DEBUG, "This is ASCII string.");
ustrcpy (tmp, from);
kanji = FALSE;
break;
default:
gd_error_ex(E_DEBUG, "This string includes unknown code.");
gd_error_ex(GD_DEBUG, "This string includes unknown code.");
ustrcpy (tmp, from);
kanji = FALSE;
break;

View File

@ -21,7 +21,7 @@
BGD_DECLARE(gdImagePtr) gdImageCreateFromXpm(char *filename)
{
(void)filename;
gd_error_ex(E_ERROR, "libgd was not built with xpm support\n");
gd_error_ex(GD_ERROR, "libgd was not built with xpm support\n");
return NULL;
}
#else