Fix for bug 2875:

Fix a final eth_fopen -> ws_fopen
When configuring with --without-zlib these functions need to have some parameters tagged _U_

svn path=/trunk/; revision=26212
This commit is contained in:
Jaap Keuter 2008-09-15 21:50:50 +00:00
parent 740a53095c
commit b95f7e92ae
4 changed files with 41 additions and 19 deletions

View File

@ -1185,6 +1185,7 @@ ssl_create_flow(void)
return flow;
}
#ifdef HAVE_LIBZ
/* memory allocations functions for zlib intialization */
static void* ssl_zalloc(void* opaque _U_, unsigned int no, unsigned int size)
{
@ -1194,6 +1195,7 @@ static void ssl_zfree(void* opaque _U_, void* address)
{
g_free(address);
}
#endif
static SslDecompress*
ssl_create_decompressor(gint compression)
@ -1713,16 +1715,13 @@ dtls_check_mac(SslDecoder*decoder, gint ct,int ver, guint8* data,
}
#endif
#ifdef HAVE_LIBZ
int
ssl_decompress_record(SslDecompress* decomp, const guchar* in, guint inl, StringInfo* out_str, guint* outl)
{
#ifdef HAVE_LIBZ
gint err;
#endif
switch (decomp->compression) {
#ifdef HAVE_LIBZ
case 1: /* DEFLATE */
err = Z_OK;
if (out_str->data_len < 16384) { /* maximal plain length */
@ -1740,13 +1739,20 @@ ssl_decompress_record(SslDecompress* decomp, const guchar* in, guint inl, String
}
*outl = out_str->data_len - decomp->istream.avail_out;
break;
#endif /* HAVE_LIBZ */
default:
ssl_debug_printf("ssl_decompress_record: unsupported compression method %d\n", decomp->compression);
return -1;
}
return 0;
}
#else
int
ssl_decompress_record(SslDecompress* decomp _U_, const guchar* in _U_, guint inl _U_, StringInfo* out_str _U_, guint* outl _U_)
{
ssl_debug_printf("ssl_decompress_record: unsupported compression method %d\n", decomp->compression);
return -1;
}
#endif
int
ssl_decrypt_record(SslDecryptSession*ssl,SslDecoder* decoder, gint ct,

View File

@ -1503,10 +1503,15 @@ vnc_hextile_encoding(tvbuff_t *tvb, packet_info *pinfo, gint *offset,
return 0; /* bytes_needed */
}
#ifdef HAVE_LIBZ
static guint
vnc_zrle_encoding(tvbuff_t *tvb, packet_info *pinfo, gint *offset,
proto_tree *tree, guint16 width, guint16 height)
#else
static guint
vnc_zrle_encoding(tvbuff_t *tvb, packet_info *pinfo _U_, gint *offset,
proto_tree *tree, guint16 width _U_, guint16 height _U_)
#endif
{
guint32 data_len;
#ifdef HAVE_LIBZ

View File

@ -688,18 +688,21 @@ gboolean wtap_dump_can_write_encap(int filetype, int encap)
return TRUE;
}
#ifdef HAVE_LIBZ
gboolean wtap_dump_can_compress(int filetype)
{
#ifdef HAVE_LIBZ
if (filetype < 0 || filetype >= wtap_num_file_types
|| dump_open_table[filetype].can_compress == FALSE)
return FALSE;
return TRUE;
#else
return FALSE;
#endif
}
#else
gboolean wtap_dump_can_compress(int filetype _U_)
{
return FALSE;
}
#endif
static gboolean wtap_dump_open_check(int filetype, int encap, gboolean comressed, int *err);
@ -945,30 +948,38 @@ void wtap_set_bytes_dumped(wtap_dumper *wdh, gint64 bytes_dumped)
/* internally open a file for writing (compressed or not) */
#ifdef HAVE_LIBZ
static FILE *wtap_dump_file_open(wtap_dumper *wdh, const char *filename)
{
#ifdef HAVE_LIBZ
if(wdh->compressed) {
return gzopen(filename, "wb");
} else
#endif
{
} else {
return ws_fopen(filename, "wb");
}
}
#else
static FILE *wtap_dump_file_open(wtap_dumper *wdh _U_, const char *filename)
{
return ws_fopen(filename, "wb");
}
#endif
/* internally open a file for writing (compressed or not) */
#ifdef HAVE_LIBZ
static FILE *wtap_dump_file_fdopen(wtap_dumper *wdh, int fd)
{
#ifdef HAVE_LIBZ
if(wdh->compressed) {
return gzdopen(fd, "wb");
} else
#endif
{
} else {
return fdopen(fd, "wb");
}
}
#else
static FILE *wtap_dump_file_fdopen(wtap_dumper *wdh _U_, int fd)
{
return fdopen(fd, "wb");
}
#endif
/* internally writing raw bytes (compressed or not) */
size_t wtap_dump_file_write(wtap_dumper *wdh, const void *buf, unsigned bufsize)

View File

@ -42,7 +42,7 @@ extern FILE_T file_open(const char *path, const char *mode);
#else /* No zLib */
#define file_open(path, mode) eth_fopen(path, mode)
#define file_open(path, mode) ws_fopen(path, mode)
#define filed_open fdopen
/* XX: file_read and file_write defined to return number of *bytes* to be consistent with gzread & gzwrite */
#define file_read(buf, bsize, count, file) ((bsize) * fread((buf), (bsize), (count), (file)))