summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjcid <devnull@localhost>2008-09-28 21:01:17 +0200
committerjcid <devnull@localhost>2008-09-28 21:01:17 +0200
commita5148a6be8e38918df3f919505305e73b2f59f2c (patch)
tree73a645254e306b4bd9796098a59ef9e1d8b6cea7 /src
parent943d83abb4a2b16e4b53eae51da95e15c7d33955 (diff)
- Switched from DEBUG_MSG to MSG.
Diffstat (limited to 'src')
-rw-r--r--src/IO/IO.c8
-rw-r--r--src/IO/dpi.c32
-rw-r--r--src/IO/http.c13
-rw-r--r--src/colors.c6
-rw-r--r--src/cookies.c20
-rw-r--r--src/dns.c22
-rw-r--r--src/gif.c29
-rw-r--r--src/jpeg.c25
-rw-r--r--src/png.c40
9 files changed, 82 insertions, 113 deletions
diff --git a/src/IO/IO.c b/src/IO/IO.c
index adf4dbb4..a0e18226 100644
--- a/src/IO/IO.c
+++ b/src/IO/IO.c
@@ -27,10 +27,6 @@
#include "IO.h"
#include "iowatch.hh"
-#define DEBUG_LEVEL 5
-//#define DEBUG_LEVEL 1
-#include "../debug.h"
-
/*
* Symbolic defines for shutdown() function
* (Not defined in the same header file, for all distros --Jcid)
@@ -174,7 +170,7 @@ static bool_t IO_read(IOData_t *io)
bool_t ret = FALSE;
int io_key = io->Key;
- DEBUG_MSG(3, " IO_read\n");
+ _MSG(" IO_read\n");
/* this is a new read-buffer */
dStr_truncate(io->Buf, 0);
@@ -226,7 +222,7 @@ static bool_t IO_write(IOData_t *io)
ssize_t St;
bool_t ret = FALSE;
- DEBUG_MSG(3, " IO_write\n");
+ _MSG(" IO_write\n");
io->Status = 0;
while (1) {
diff --git a/src/IO/dpi.c b/src/IO/dpi.c
index 33e5f730..54072a5f 100644
--- a/src/IO/dpi.c
+++ b/src/IO/dpi.c
@@ -40,10 +40,6 @@
#include "Url.h"
#include "../../dpip/dpip.h"
-/* #define DEBUG_LEVEL 2 */
-#define DEBUG_LEVEL 4
-#include "../debug.h"
-
/* This one is tricky, some sources state it should include the byte
* for the terminating NULL, and others say it shouldn't. */
# define D_SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \
@@ -309,7 +305,7 @@ static int Dpi_start_dpid(void)
if (execl(path1, "dpid", NULL) == -1) {
dFree(path1);
if (execlp("dpid", "dpid", NULL) == -1) {
- DEBUG_MSG(4, "Dpi_start_dpid (child): %s\n", dStrerror(errno));
+ MSG("Dpi_start_dpid (child): %s\n", dStrerror(errno));
do
n = write(st_pipe[1], "ERROR", 5);
while (n == -1 && errno == EINTR);
@@ -319,7 +315,7 @@ static int Dpi_start_dpid(void)
}
} else if (pid < 0) {
/* The fork failed. Report failure. */
- DEBUG_MSG(4, "Dpi_start_dpid: %s\n", dStrerror(errno));
+ MSG("Dpi_start_dpid: %s\n", dStrerror(errno));
/* close the unused pipe */
Dpi_close_fd(st_pipe[0]);
Dpi_close_fd(st_pipe[1]);
@@ -330,11 +326,11 @@ static int Dpi_start_dpid(void)
do
n = read(st_pipe[0], buf, 16);
while (n == -1 && errno == EINTR);
- DEBUG_MSG(2, "Dpi_start_dpid: n = %d\n", n);
+ _MSG("Dpi_start_dpid: n = %d\n", n);
if (n != 5) {
ret = 0;
} else {
- DEBUG_MSG(4, "Dpi_start_dpid: %s\n", dStrerror(errno));
+ MSG("Dpi_start_dpid: %s\n", dStrerror(errno));
}
}
@@ -358,7 +354,7 @@ static int Dpi_check_uds(char *uds_name)
if ((SockFD = socket(AF_LOCAL, SOCK_STREAM, 0)) == -1 ||
connect(SockFD, (void*)&pun, D_SUN_LEN(&pun)) == -1) {
- DEBUG_MSG(4, "Dpi_check_uds: %s %s\n", dStrerror(errno), uds_name);
+ MSG("Dpi_check_uds: %s %s\n", dStrerror(errno), uds_name);
} else {
Dpi_close_fd(SockFD);
ret = 0;
@@ -448,8 +444,8 @@ static int Dpi_check_dpid(int num_tries)
}
dFree(dpid_uds_name);
- DEBUG_MSG(2, "Dpi_check_dpid:: %s\n",
- (ret == 0) ? "OK" : (ret == 1 ? "EAGAIN" : "ERROR"));
+ _MSG("Dpi_check_dpid:: %s\n",
+ (ret == 0) ? "OK" : (ret == 1 ? "EAGAIN" : "ERROR"));
return ret;
}
@@ -485,7 +481,7 @@ static char *Dpi_get_server_uds_name(const char *server_name)
int st;
dReturn_val_if_fail (server_name != NULL, NULL);
- DEBUG_MSG(2, "Dpi_get_server_uds_name:: server_name = [%s]\n", server_name);
+ _MSG("Dpi_get_server_uds_name:: server_name = [%s]\n", server_name);
dpid_uds_dir = Dpi_get_dpid_uds_dir();
if (dpid_uds_dir) {
@@ -505,7 +501,7 @@ static char *Dpi_get_server_uds_name(const char *server_name)
perror("connect");
/* ask dpid to check the server plugin and send its UDS name back */
request = a_Dpip_build_cmd("cmd=%s msg=%s", "check_server", server_name);
- DEBUG_MSG(2, "[%s]\n", request);
+ _MSG("[%s]\n", request);
do
st = write(sock, request, strlen(request));
while (st < 0 && errno == EINTR);
@@ -532,7 +528,7 @@ static char *Dpi_get_server_uds_name(const char *server_name)
strncat(rply, buf, (size_t)rdlen);
}
Dpi_close_fd(sock);
- DEBUG_MSG(2, "rply = [%s]\n", rply);
+ _MSG("rply = [%s]\n", rply);
/* Parse reply */
if (rdlen == 0 && rply) {
@@ -545,7 +541,7 @@ static char *Dpi_get_server_uds_name(const char *server_name)
}
dFree(dpid_uds_dir);
dFree(dpid_uds_name);
- DEBUG_MSG(2, "Dpi_get_server_uds_name:: %s\n", server_uds_name);
+ _MSG("Dpi_get_server_uds_name:: %s\n", server_uds_name);
return server_uds_name;
}
@@ -563,7 +559,7 @@ static int Dpi_connect_socket(const char *server_name, int retry)
/* Query dpid for the UDS name for this server */
server_uds_name = Dpi_get_server_uds_name(server_name);
- DEBUG_MSG(2, "server_uds_name = [%s]\n", server_uds_name);
+ _MSG("server_uds_name = [%s]\n", server_uds_name);
if (access(server_uds_name, F_OK) != 0) {
MSG("server socket was NOT found\n");
@@ -726,11 +722,11 @@ void a_Dpi_bye_dpid()
sa.sun_family = AF_LOCAL;
if ((new_socket = socket(AF_LOCAL, SOCK_STREAM, 0)) == -1) {
- DEBUG_MSG(4, "a_Dpi_bye_dpid: %s\n", dStrerror(errno));
+ MSG("a_Dpi_bye_dpid: %s\n", dStrerror(errno));
}
strncpy(sa.sun_path, srs_name, sizeof (sa.sun_path));
if (connect(new_socket, (struct sockaddr *) &sa, addr_len) == -1) {
- DEBUG_MSG(4, "a_Dpi_bye_dpid: %s\n", dStrerror(errno));
+ MSG("a_Dpi_bye_dpid: %s\n", dStrerror(errno));
MSG("%s\n", sa.sun_path);
}
DpiBye_cmd = a_Dpip_build_cmd("cmd=%s", "DpiBye");
diff --git a/src/IO/http.c b/src/IO/http.c
index 33236b52..03bb4522 100644
--- a/src/IO/http.c
+++ b/src/IO/http.c
@@ -47,11 +47,6 @@ D_STMT_START { \
#define _MSG_BW(web, root, ...)
-#define DEBUG_LEVEL 5
-#include "../debug.h"
-
-
-
/* 'Url' and 'web' are just references (no need to deallocate them here). */
typedef struct {
int SockFD;
@@ -333,7 +328,7 @@ static int Http_connect_socket(ChainLink *Info)
if ((S->SockFD = socket(dh->af, SOCK_STREAM, IPPROTO_TCP)) < 0) {
S->Err = errno;
- DEBUG_MSG(5, "Http_connect_socket ERROR: %s\n", dStrerror(errno));
+ MSG("Http_connect_socket ERROR: %s\n", dStrerror(errno));
return -1;
}
/* set NONBLOCKING and close on exec. */
@@ -352,7 +347,7 @@ static int Http_connect_socket(ChainLink *Info)
sin->sin_port = S->port ? htons(S->port) : htons(DILLO_URL_HTTP_PORT);
memcpy(&sin->sin_addr, dh->data, (size_t)dh->alen);
if (a_Web_valid(S->web) && (S->web->flags & WEB_RootUrl))
- DEBUG_MSG(5, "Connecting to %s\n", inet_ntoa(sin->sin_addr));
+ MSG("Connecting to %s\n", inet_ntoa(sin->sin_addr));
break;
}
#ifdef ENABLE_IPV6
@@ -366,7 +361,7 @@ static int Http_connect_socket(ChainLink *Info)
memcpy(&sin6->sin6_addr, dh->data, dh->alen);
inet_ntop(dh->af, dh->data, buf, sizeof(buf));
if (a_Web_valid(S->web) && (S->web->flags & WEB_RootUrl))
- DEBUG_MSG(5, "Connecting to %s\n", buf);
+ MSG("Connecting to %s\n", buf);
break;
}
#endif
@@ -377,7 +372,7 @@ static int Http_connect_socket(ChainLink *Info)
if (status == -1 && errno != EINPROGRESS) {
S->Err = errno;
Http_socket_close(S);
- DEBUG_MSG(5, "Http_connect_socket ERROR: %s\n", dStrerror(S->Err));
+ MSG("Http_connect_socket ERROR: %s\n", dStrerror(S->Err));
return -1;
} else {
Http_send_query(S->Info, S);
diff --git a/src/colors.c b/src/colors.c
index ddbc3b28..9a4c8c8e 100644
--- a/src/colors.c
+++ b/src/colors.c
@@ -14,8 +14,6 @@
#include <ctype.h>
#include "colors.h"
-#define DEBUG_LEVEL 5
-#include "debug.h"
#include "msg.h"
/*
@@ -277,8 +275,8 @@ int32_t a_Color_parse (const char *subtag, int32_t default_color, int *err)
}
}
- DEBUG_MSG(3, "subtag: %s\n", subtag);
- DEBUG_MSG(3, "color : %X\n", ret_color);
+ _MSG("subtag: %s\n", subtag);
+ _MSG("color : %X\n", ret_color);
*err = st;
return ret_color;
diff --git a/src/cookies.c b/src/cookies.c
index 2f1aa500..1b336b83 100644
--- a/src/cookies.c
+++ b/src/cookies.c
@@ -15,10 +15,6 @@
* http://www.ietf.org/rfc/rfc2965.txt
*/
-#define DEBUG_LEVEL 10
-#include "debug.h"
-
-
#ifdef DISABLE_COOKIES
/*
@@ -26,7 +22,7 @@
*/
void a_Cookies_init(void)
{
- DEBUG_MSG(10, "Cookies: absolutely disabled at compilation time.\n");
+ MSG("Cookies: absolutely disabled at compilation time.\n");
}
#else
@@ -94,10 +90,10 @@ static FILE *Cookies_fopen(const char *filename, char *init_str)
write(fd, init_str, strlen(init_str));
close(fd);
- DEBUG_MSG(10, "Cookies: Created file: %s\n", filename);
+ MSG("Cookies: Created file: %s\n", filename);
F_in = fopen(filename, "r");
} else {
- DEBUG_MSG(10, "Cookies: Could not create file: %s!\n", filename);
+ MSG("Cookies: Could not create file: %s!\n", filename);
}
}
@@ -120,11 +116,11 @@ void a_Cookies_init(void)
/* Read and parse the cookie control file (cookiesrc) */
if (Cookie_control_init() != 0) {
- DEBUG_MSG(10, "Disabling cookies.\n");
+ MSG("Disabling cookies.\n");
return;
}
- DEBUG_MSG(10, "Enabling cookies as from cookiesrc...\n");
+ MSG("Enabling cookies as from cookiesrc...\n");
disabled = FALSE;
}
@@ -150,7 +146,7 @@ void a_Cookies_set(Dlist *cookie_strings, const DilloUrl *set_url)
action = Cookies_control_check(set_url);
if (action == COOKIE_DENY) {
- DEBUG_MSG(5, "Cookies: denied SET for %s\n", URL_HOST_(set_url));
+ _MSG("Cookies: denied SET for %s\n", URL_HOST_(set_url));
return;
}
@@ -161,7 +157,7 @@ void a_Cookies_set(Dlist *cookie_strings, const DilloUrl *set_url)
"set_cookie", cookie_string, URL_HOST_(set_url),
path ? path : "/", numstr);
- DEBUG_MSG(5, "Cookies.c: a_Cookies_set \n\t \"%s\" \n",cmd );
+ _MSG("Cookies.c: a_Cookies_set \n\t \"%s\" \n",cmd );
/* This call is commented because it doesn't guarantee the order
* in which cookies are set and got. (It may deadlock too) */
//a_Capi_dpi_send_cmd(NULL, NULL, cmd, "cookies", 1);
@@ -187,7 +183,7 @@ char *a_Cookies_get_query(const DilloUrl *request_url)
action = Cookies_control_check(request_url);
if (action == COOKIE_DENY) {
- DEBUG_MSG(5, "Cookies: denied GET for %s\n", URL_HOST_(request_url));
+ _MSG("Cookies: denied GET for %s\n", URL_HOST_(request_url));
return dStrdup("");
}
path = URL_PATH_(request_url);
diff --git a/src/dns.c b/src/dns.c
index 73ada0ad..21bebe9e 100644
--- a/src/dns.c
+++ b/src/dns.c
@@ -31,10 +31,6 @@
#include "list.h"
#include "timeout.hh"
-#define DEBUG_LEVEL 5
-#include "debug.h"
-
-
/*
* Uncomment the following line for debugging or gprof profiling.
*/
@@ -127,8 +123,8 @@ static void Dns_queue_remove(int index)
{
int i;
- DEBUG_MSG(2, "Dns_queue_remove: deleting client [%d] [queue_size=%d]\n",
- index, dns_queue_size);
+ _MSG("Dns_queue_remove: deleting client [%d] [queue_size=%d]\n",
+ index, dns_queue_size);
if (index < dns_queue_size) {
dFree(dns_queue[index].hostname);
@@ -161,7 +157,7 @@ static void Dns_cache_add(char *hostname, Dlist *addr_list)
dns_cache[dns_cache_size].hostname = dStrdup(hostname);
dns_cache[dns_cache_size].addr_list = addr_list;
++dns_cache_size;
- DEBUG_MSG(1, "Cache objects: %d\n", dns_cache_size);
+ _MSG("Cache objects: %d\n", dns_cache_size);
}
@@ -173,9 +169,9 @@ void a_Dns_init(void)
int i;
#ifdef D_DNS_THREADED
- DEBUG_MSG(5, "dillo_dns_init: Here we go! (threaded)\n");
+ MSG("dillo_dns_init: Here we go! (threaded)\n");
#else
- DEBUG_MSG(5, "dillo_dns_init: Here we go! (not threaded)\n");
+ MSG("dillo_dns_init: Here we go! (not threaded)\n");
#endif
dns_queue_size = 0;
@@ -278,8 +274,8 @@ static void *Dns_server(void *data)
Dlist *hosts = dList_new(2);
- DEBUG_MSG(3, "Dns_server: starting...\n ch: %d host: %s\n",
- channel, dns_server[channel].hostname);
+ _MSG("Dns_server: starting...\n ch: %d host: %s\n",
+ channel, dns_server[channel].hostname);
error = getaddrinfo(dns_server[channel].hostname, NULL, &hints, &res0);
@@ -310,8 +306,8 @@ static void *Dns_server(void *data)
}
/* tell our findings */
- DEBUG_MSG(5, "Dns_server [%d]: %s is %p\n", channel,
- dns_server[channel].hostname, hosts);
+ MSG("Dns_server [%d]: %s is %p\n", channel,
+ dns_server[channel].hostname, hosts);
dns_server[channel].addr_list = hosts;
dns_server[channel].ip_ready = TRUE;
diff --git a/src/gif.c b/src/gif.c
index 7d2920a6..b16a9e64 100644
--- a/src/gif.c
+++ b/src/gif.c
@@ -72,9 +72,6 @@
#include "dicache.h"
#include "prefs.h"
-#define DEBUG_LEVEL 6
-#include "debug.h"
-
#define INTERLACE 0x40
#define LOCALCOLORMAP 0x80
@@ -245,7 +242,7 @@ static void Gif_write(DilloGif *gif, void *Buf, uint_t BufSize)
buf = ((uchar_t *) Buf) + gif->Start_Ofs;
bufsize = BufSize - gif->Start_Ofs;
- DEBUG_MSG(5, "Gif_write: %u bytes\n", BufSize);
+ _MSG("Gif_write: %u bytes\n", BufSize);
/* Process the bytes in the input buffer. */
bytes_consumed = Gif_process_bytes(gif, buf, bufsize, Buf);
@@ -254,7 +251,7 @@ static void Gif_write(DilloGif *gif, void *Buf, uint_t BufSize)
return;
gif->Start_Ofs += bytes_consumed;
- DEBUG_MSG(5, "exit Gif_write, bufsize=%ld\n", (long)bufsize);
+ _MSG("exit Gif_write, bufsize=%ld\n", (long)bufsize);
}
/*
@@ -264,7 +261,7 @@ static void Gif_close(DilloGif *gif, CacheClient_t *Client)
{
int i;
- DEBUG_MSG(5, "destroy gif %p\n", gif);
+ _MSG("destroy gif %p\n", gif);
a_Dicache_close(gif->url, gif->version, Client);
@@ -545,7 +542,7 @@ static void Gif_sequence(DilloGif *gif, uint_t code)
for (; o_size > 0 && o_index > 0; o_size--) {
uint_t code_and_byte = gif->code_and_byte[code];
- DEBUG_MSG(5, "%d ", gif->code_and_byte[code] & 255);
+ _MSG("%d ", gif->code_and_byte[code] & 255);
obuf[--o_index] = code_and_byte & 255;
code = code_and_byte >> 8;
@@ -565,16 +562,16 @@ static void Gif_sequence(DilloGif *gif, uint_t code)
}
/* Ok, now we write the first byte of the sequence. */
/* We are sure that the code is literal. */
- DEBUG_MSG(5, "%d", code);
+ _MSG("%d", code);
obuf[--o_index] = code;
gif->code_and_byte[gif->last_code] |= code;
/* Fix up the output if the original code was last_code. */
if (orig_code == gif->last_code) {
*last_byte_ptr = code;
- DEBUG_MSG(5, " fixed (%d)!", code);
+ _MSG(" fixed (%d)!", code);
}
- DEBUG_MSG(5, "\n");
+ _MSG("\n");
/* Output any full lines. */
if (gif->line_index >= gif->Width) {
@@ -621,7 +618,7 @@ static int Gif_process_code(DilloGif *gif, uint_t code, uint_t clear_code)
*/
if (code < clear_code) {
/* a literal code. */
- DEBUG_MSG(5, "literal\n");
+ _MSG("literal\n");
Gif_literal(gif, code);
return 1;
} else if (code >= clear_code + 2) {
@@ -632,11 +629,11 @@ static int Gif_process_code(DilloGif *gif, uint_t code, uint_t clear_code)
return 1;
} else if (code == clear_code) {
/* clear code. Resets the whole table */
- DEBUG_MSG(5, "clear\n");
+ _MSG("clear\n");
return 0;
} else {
/* end code. */
- DEBUG_MSG(5, "end\n");
+ _MSG("end\n");
return 2;
}
}
@@ -694,7 +691,7 @@ static int Gif_decode(DilloGif *gif, const uchar_t *buf, size_t bsize)
* at the start of the window */
code = (window >> (32 - bits_in_window)) & code_mask;
- DEBUG_MSG(5, "code = %d, ", code);
+ _MSG("code = %d, ", code);
bits_in_window -= code_size;
switch (Gif_process_code(gif, code, clear_code)) {
@@ -1042,8 +1039,8 @@ static size_t Gif_process_bytes(DilloGif *gif, const uchar_t *ibuf,
break;
}
- DEBUG_MSG(5, "Gif_process_bytes: final state %d, %ld bytes consumed\n",
- gif->state, (long)(bufsize - tmp_bufsize));
+ _MSG("Gif_process_bytes: final state %d, %ld bytes consumed\n",
+ gif->state, (long)(bufsize - tmp_bufsize));
return bufsize - tmp_bufsize;
}
diff --git a/src/jpeg.c b/src/jpeg.c
index 6251ab47..05e4f2d4 100644
--- a/src/jpeg.c
+++ b/src/jpeg.c
@@ -36,9 +36,7 @@
#include "cache.h"
#include "dicache.h"
#include "capi.h" /* get cache entry status */
-
-#define DEBUG_LEVEL 6
-#include "debug.h"
+#include "msg.h"
typedef enum {
DILLO_JPEG_INIT,
@@ -154,11 +152,11 @@ static boolean fill_input_buffer(j_decompress_ptr cinfo)
{
DilloJpeg *jpeg = ((my_source_mgr *) cinfo->src)->jpeg;
- DEBUG_MSG(5, "fill_input_buffer\n");
+ _MSG("fill_input_buffer\n");
#if 0
if (!cinfo->src->bytes_in_buffer) {
- DEBUG_MSG(5, "fill_input_buffer: %ld bytes in buffer\n",
- (long)cinfo->src->bytes_in_buffer);
+ _MSG("fill_input_buffer: %ld bytes in buffer\n",
+ (long)cinfo->src->bytes_in_buffer);
jpeg->Start_Ofs = (ulong_t) jpeg->cinfo.src->next_input_byte -
(ulong_t) jpeg->Data;
@@ -185,10 +183,9 @@ static void skip_input_data(j_decompress_ptr cinfo, long num_bytes)
return;
jpeg = ((my_source_mgr *) cinfo->src)->jpeg;
- DEBUG_MSG(5, "skip_input_data: Start_Ofs = %lu, num_bytes = %ld,"
- " %ld bytes in buffer\n",
- (ulong_t)jpeg->Start_Ofs, num_bytes,
- (long)cinfo->src->bytes_in_buffer);
+ _MSG("skip_input_data: Start_Ofs = %lu, num_bytes = %ld,"
+ " %ld bytes in buffer\n",
+ (ulong_t)jpeg->Start_Ofs, num_bytes,(long)cinfo->src->bytes_in_buffer);
cinfo->src->next_input_byte += num_bytes;
if (num_bytes < (long)cinfo->src->bytes_in_buffer) {
@@ -257,8 +254,8 @@ static void Jpeg_write(DilloJpeg *jpeg, void *Buf, uint_t BufSize)
JSAMPLE *array[1];
int num_read;
- DEBUG_MSG(5, "Jpeg_write: (%p) Bytes in buff: %ld Ofs: %lu\n", jpeg,
- (long) BufSize, (ulong_t)jpeg->Start_Ofs);
+ _MSG("Jpeg_write: (%p) Bytes in buff: %ld Ofs: %lu\n", jpeg,
+ (long) BufSize, (ulong_t)jpeg->Start_Ofs);
/* See if we are supposed to skip ahead. */
if (BufSize <= jpeg->Start_Ofs)
@@ -286,8 +283,8 @@ static void Jpeg_write(DilloJpeg *jpeg, void *Buf, uint_t BufSize)
else if (jpeg->cinfo.num_components == 3)
type = DILLO_IMG_TYPE_RGB;
else
- DEBUG_MSG(5, "jpeg: can't handle %d component images\n",
- jpeg->cinfo.num_components);
+ _MSG("jpeg: can't handle %d component images\n",
+ jpeg->cinfo.num_components);
/*
* If a multiple-scan image is not completely in cache,
diff --git a/src/png.c b/src/png.c
index 4b401889..cd7d4e03 100644
--- a/src/png.c
+++ b/src/png.c
@@ -31,17 +31,16 @@
#include "dicache.h"
#include "prefs.h"
-#define DEBUG_LEVEL 6
-#include "debug.h"
-
enum prog_state {
IS_finished, IS_init, IS_nextdata
};
+#if 0
static char *prog_state_name[] =
{
"IS_finished", "IS_init", "IS_nextdata"
};
+#endif
/*
* This holds the data that must be saved between calls to this module.
@@ -120,7 +119,7 @@ void Png_error_handling(png_structp png_ptr, png_const_charp msg)
{
DilloPng *png;
- DEBUG_MSG(6, "Png_error_handling: %s\n", msg);
+ MSG("Png_error_handling: %s\n", msg);
png = png_get_error_ptr(png_ptr);
png->error = 1;
@@ -139,7 +138,7 @@ Png_datainfo_callback(png_structp png_ptr, png_infop info_ptr)
uint_t i;
double gamma;
- DEBUG_MSG(5, "Png_datainfo_callback:\n");
+ _MSG("Png_datainfo_callback:\n");
png = png_get_progressive_ptr(png_ptr);
dReturn_if_fail (png != NULL);
@@ -147,9 +146,9 @@ Png_datainfo_callback(png_structp png_ptr, png_infop info_ptr)
png_get_IHDR(png_ptr, info_ptr, &png->width, &png->height,
&bit_depth, &color_type, &interlace_type, NULL, NULL);
- DEBUG_MSG(5, "Png_datainfo_callback: png->width = %ld\n"
- "Png_datainfo_callback: png->height = %ld\n",
- png->width, png->height);
+ _MSG("Png_datainfo_callback: png->width = %ld\n"
+ "Png_datainfo_callback: png->height = %ld\n",
+ png->width, png->height);
/* we need RGB/RGBA in the end */
if (color_type == PNG_COLOR_TYPE_PALETTE && bit_depth <= 8) {
@@ -196,10 +195,10 @@ Png_datainfo_callback(png_structp png_ptr, png_infop info_ptr)
png->channels = png_get_channels(png_ptr, info_ptr);
/* init Dillo specifics */
- DEBUG_MSG(5, "Png_datainfo_callback: rowbytes = %d\n"
- "Png_datainfo_callback: width = %ld\n"
- "Png_datainfo_callback: height = %ld\n",
- png->rowbytes, png->width, png->height);
+ _MSG("Png_datainfo_callback: rowbytes = %d\n"
+ "Png_datainfo_callback: width = %ld\n"
+ "Png_datainfo_callback: height = %ld\n",
+ png->rowbytes, png->width, png->height);
png->image_data = (uchar_t *) dMalloc(png->rowbytes * png->height);
png->row_pointers = (uchar_t **) dMalloc(png->height * sizeof(uchar_t *));
@@ -225,7 +224,7 @@ static void
if (!new_row) /* work to do? */
return;
- DEBUG_MSG(5, "Png_datarow_callback: row_num = %ld\n", row_num);
+ _MSG("Png_datarow_callback: row_num = %ld\n", row_num);
png = png_get_progressive_ptr(png_ptr);
@@ -292,7 +291,7 @@ static void
{
DilloPng *png;
- DEBUG_MSG(5, "Png_dataend_callback:\n");
+ _MSG("Png_dataend_callback:\n");
png = png_get_progressive_ptr(png_ptr);
png->state = IS_finished;
@@ -343,7 +342,7 @@ static void Png_callback(int Op, CacheClient_t *Client)
/* Let's make some sound if we have been called with no data */
dReturn_if_fail ( Client->Buf != NULL && Client->BufSize > 0 );
- DEBUG_MSG(5, "Png_callback BufSize = %d\n", Client->BufSize);
+ _MSG("Png_callback BufSize = %d\n", Client->BufSize);
/* Keep local copies so we don't have to pass multiple args to
* a number of functions. */
@@ -352,7 +351,7 @@ static void Png_callback(int Op, CacheClient_t *Client)
/* start/resume the FSM here */
while (png->state != IS_finished && DATASIZE) {
- DEBUG_MSG(5, "State = %s\n", prog_state_name[png->state]);
+ _MSG("State = %s\n", prog_state_name[png->state]);
switch (png->state) {
case IS_init:
@@ -448,11 +447,10 @@ void *a_Png_image(const char *Type, void *Ptr, CA_Callback_t *Call,
DilloWeb *web = Ptr;
DICacheEntry *DicEntry;
- DEBUG_MSG(5, "a_Png_image: Type = %s\n"
- "a_Png_image: libpng - Compiled %s; using %s.\n"
- "a_Png_image: zlib - Compiled %s; using %s.\n",
- Type, PNG_LIBPNG_VER_STRING, png_libpng_ver,
- ZLIB_VERSION, zlib_version);
+ _MSG("a_Png_image: Type = %s\n"
+ "a_Png_image: libpng - Compiled %s; using %s.\n"
+ "a_Png_image: zlib - Compiled %s; using %s.\n",
+ Type, PNG_LIBPNG_VER_STRING, png_libpng_ver,ZLIB_VERSION,zlib_version);
if (!web->Image)
web->Image = a_Image_new(0, 0, NULL, prefs.bg_color);