Revision: 6535
http://playerstage.svn.sourceforge.net/playerstage/?rev=6535&view=rev
Author: gbiggs
Date: 2008-06-10 20:25:29 -0700 (Tue, 10 Jun 2008)
Log Message:
-----------
Fixed zlib inclusion/exclusion
Modified Paths:
--------------
code/player/trunk/client_libs/libplayerc/CMakeLists.txt
code/player/trunk/client_libs/libplayerc/dev_map.c
code/player/trunk/client_libs/libplayerc/dev_vectormap.c
code/player/trunk/cmake/internal/SearchForStuff.cmake
code/player/trunk/libplayertcp/CMakeLists.txt
code/player/trunk/libplayertcp/playertcp.cc
code/player/trunk/libplayertcp/playerudp.cc
code/player/trunk/server/drivers/shell/CMakeLists.txt
code/player/trunk/server/drivers/shell/readlog.cc
Modified: code/player/trunk/client_libs/libplayerc/CMakeLists.txt
===================================================================
--- code/player/trunk/client_libs/libplayerc/CMakeLists.txt 2008-06-11
03:05:55 UTC (rev 6534)
+++ code/player/trunk/client_libs/libplayerc/CMakeLists.txt 2008-06-11
03:25:29 UTC (rev 6535)
@@ -58,8 +58,13 @@
TARGET_LINK_LIBRARIES (playerc playerjpeg)
PLAYERC_ADD_LINK_LIB (jpeg)
ENDIF (HAVE_JPEG)
+IF (HAVE_Z)
+ TARGET_LINK_LIBRARIES (playerc z)
+ PLAYERC_ADD_LINK_LIB (z)
+ENDIF (HAVE_Z)
IF (HAVE_GEOS)
TARGET_LINK_LIBRARIES (playerc ${GEOS_LIBS})
+ PLAYERC_ADD_LINK_LIB (${GEOS_LIBS})
ENDIF (HAVE_GEOS)
PLAYER_INSTALL_HEADERS (playerc playerc.h)
Modified: code/player/trunk/client_libs/libplayerc/dev_map.c
===================================================================
--- code/player/trunk/client_libs/libplayerc/dev_map.c 2008-06-11 03:05:55 UTC
(rev 6534)
+++ code/player/trunk/client_libs/libplayerc/dev_map.c 2008-06-11 03:25:29 UTC
(rev 6535)
@@ -1,4 +1,4 @@
-/*
+/*
* libplayerc : a Player client library
* Copyright (C) Andrew Howard 2002-2003
*
@@ -20,8 +20,8 @@
/*
* Player - One Hell of a Robot Server
* Copyright (C) Andrew Howard 2003
- *
*
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -45,7 +45,7 @@
#include <config.h>
-#if HAVE_ZLIB_H
+#if HAVE_Z
#include <zlib.h>
#endif
@@ -67,7 +67,7 @@
memset(device, 0, sizeof(playerc_map_t));
playerc_device_init(&device->info, client, PLAYER_MAP_CODE, index,
(playerc_putmsg_fn_t) NULL);
-
+
return device;
}
@@ -103,16 +103,16 @@
int sx,sy;
int si,sj;
char* cell;
-#if HAVE_ZLIB_H
+#if HAVE_Z
uLongf unzipped_data_len;
char* unzipped_data;
#endif
// first, get the map info
- if(playerc_client_request(device->info.client,
- &device->info,
- PLAYER_MAP_REQ_GET_INFO,
+ if(playerc_client_request(device->info.client,
+ &device->info,
+ PLAYER_MAP_REQ_GET_INFO,
NULL, (void**)&info_req) < 0)
{
PLAYERC_ERR("failed to get map info");
@@ -126,7 +126,7 @@
device->origin[1] = info_req->origin.py;
player_map_info_t_free(info_req);
info_req=NULL;
-
+
// Allocate space for the whole map
device->cells = (char*)realloc(device->cells, sizeof(char) *
device->width * device->height);
@@ -134,7 +134,7 @@
// now, get the map, in tiles
-#if HAVE_ZLIB_H
+#if HAVE_Z
// Allocate a buffer into which we'll decompress the map data
unzipped_data_len = device->width*device->height;
unzipped_data = (char*)malloc(unzipped_data_len);
@@ -161,14 +161,14 @@
(void*)data_req, (void**)&data_resp) < 0)
{
PLAYERC_ERR("failed to get map data");
-#if HAVE_ZLIB_H
+#if HAVE_Z
free(unzipped_data);
#endif
free(data_req);
return(-1);
}
-#if HAVE_ZLIB_H
+#if HAVE_Z
unzipped_data_len = device->width*device->height;
if(uncompress((Bytef*)unzipped_data, &unzipped_data_len,
(uint8_t*)data_resp->data, data_resp->data_count) != Z_OK)
@@ -187,7 +187,7 @@
for(i=0;i<si;i++)
{
cell = device->cells + PLAYERC_MAP_INDEX(device,oi+i,oj+j);
-#if HAVE_ZLIB_H
+#if HAVE_Z
*cell = unzipped_data[j*si + i];
#else
*cell = data_resp->data[j*si + i];
@@ -204,7 +204,7 @@
}
free(data_req);
-#if HAVE_ZLIB_H
+#if HAVE_Z
free(unzipped_data);
#endif
player_map_data_t_free(data_resp);
@@ -212,14 +212,14 @@
return(0);
}
-int
+int
playerc_map_get_vector(playerc_map_t* device)
{
player_map_data_vector_t* vmap;
- if(playerc_client_request(device->info.client,
- &device->info,
- PLAYER_MAP_REQ_GET_VECTOR,
+ if(playerc_client_request(device->info.client,
+ &device->info,
+ PLAYER_MAP_REQ_GET_VECTOR,
NULL, (void**)&vmap) < 0)
{
PLAYERC_ERR("failed to get map vector data");
Modified: code/player/trunk/client_libs/libplayerc/dev_vectormap.c
===================================================================
--- code/player/trunk/client_libs/libplayerc/dev_vectormap.c 2008-06-11
03:05:55 UTC (rev 6534)
+++ code/player/trunk/client_libs/libplayerc/dev_vectormap.c 2008-06-11
03:25:29 UTC (rev 6535)
@@ -1,4 +1,4 @@
-/*
+/*
* libplayerc : a Player client library
* Copyright (C) Andrew Howard 2002-2003
*
@@ -20,8 +20,8 @@
/*
* Player - One Hell of a Robot Server
* Copyright (C) Andrew Howard 2003
- *
*
+ *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -45,7 +45,7 @@
#include <config.h>
-/*#if HAVE_ZLIB_H
+/*#if HAVE_Z
#include <zlib.h>
#endif*/
Modified: code/player/trunk/cmake/internal/SearchForStuff.cmake
===================================================================
--- code/player/trunk/cmake/internal/SearchForStuff.cmake 2008-06-11
03:05:55 UTC (rev 6534)
+++ code/player/trunk/cmake/internal/SearchForStuff.cmake 2008-06-11
03:25:29 UTC (rev 6535)
@@ -7,29 +7,33 @@
CHECK_FUNCTION_EXISTS (cfmakeraw HAVE_CFMAKERAW)
CHECK_FUNCTION_EXISTS (dirname HAVE_DIRNAME)
CHECK_FUNCTION_EXISTS (getaddrinfo HAVE_GETADDRINFO)
-CHECK_INCLUDE_FILES ("stdio.h;jpeglib.h" HAVE_JPEGLIB_H)
CHECK_LIBRARY_EXISTS (GL glBegin "" HAVE_LIBGL)
CHECK_LIBRARY_EXISTS (GLU main "" HAVE_LIBGLU)
CHECK_LIBRARY_EXISTS (glut main "" HAVE_LIBGLUT)
-CHECK_LIBRARY_EXISTS (jpeg jpeg_read_header "" HAVE_LIBJPEG)
CHECK_LIBRARY_EXISTS (ltdl lt_dlopenext "" HAVE_LIBLTDL)
-CHECK_LIBRARY_EXISTS (z compress2 "" HAVE_LIBZ)
CHECK_INCLUDE_FILES (linux/joystick.h HAVE_LINUX_JOYSTICK_H)
CHECK_FUNCTION_EXISTS (poll HAVE_POLL)
CHECK_FUNCTION_EXISTS (round HAVE_ROUND)
CHECK_INCLUDE_FILES (stdint.h HAVE_STDINT_H)
CHECK_INCLUDE_FILES (strings.h HAVE_STRINGS_H)
-CHECK_INCLUDE_FILES (zlib.h HAVE_ZLIB_H)
CHECK_FUNCTION_EXISTS (compressBound NEED_COMPRESSBOUND)
CHECK_INCLUDE_FILES (dns_sd.h HAVE_DNS_SD)
IF (HAVE_DNS_SD)
CHECK_LIBRARY_EXISTS (dns_sd DNSServiceRefDeallocate "" HAVE_DNS_SD)
ENDIF (HAVE_DNS_SD)
+CHECK_LIBRARY_EXISTS (jpeg jpeg_read_header "" HAVE_LIBJPEG)
+CHECK_INCLUDE_FILES ("stdio.h;jpeglib.h" HAVE_JPEGLIB_H)
IF (HAVE_LIBJPEG AND HAVE_JPEGLIB_H)
SET (HAVE_JPEG TRUE)
ENDIF (HAVE_LIBJPEG AND HAVE_JPEGLIB_H)
+CHECK_LIBRARY_EXISTS (z compress2 "" HAVE_LIBZ)
+CHECK_INCLUDE_FILES (zlib.h HAVE_ZLIB_H)
+IF (HAVE_LIBZ AND HAVE_ZLIB_H)
+ SET (HAVE_Z TRUE)
+ENDIF (HAVE_LIBZ AND HAVE_ZLIB_H)
+
# Endianess check
INCLUDE (TestBigEndian)
TEST_BIG_ENDIAN (WORDS_BIGENDIAN)
Modified: code/player/trunk/libplayertcp/CMakeLists.txt
===================================================================
--- code/player/trunk/libplayertcp/CMakeLists.txt 2008-06-11 03:05:55 UTC
(rev 6534)
+++ code/player/trunk/libplayertcp/CMakeLists.txt 2008-06-11 03:25:29 UTC
(rev 6535)
@@ -9,8 +9,10 @@
SET (playertcpSrcs socket_util.c playertcp.cc remote_driver.cc)
PLAYER_ADD_LIBRARY (playertcp ${playertcpSrcs})
TARGET_LINK_LIBRARIES (playertcp replace playercore playererror
playerutils playerxdr)
- TARGET_LINK_LIBRARIES (playertcp z)
- PLAYER_ADD_LINK_LIB (z)
+ IF (HAVE_Z)
+ TARGET_LINK_LIBRARIES (playertcp z)
+ PLAYER_ADD_LINK_LIB (z)
+ ENDIF (HAVE_Z)
PLAYER_MAKE_PKGCONFIG ("playertcp" "Player TCP messaging library - part of
the Player Project" "playererror playercore" "" "" "")
PLAYER_INSTALL_HEADERS (playertcp playertcp.h)
Modified: code/player/trunk/libplayertcp/playertcp.cc
===================================================================
--- code/player/trunk/libplayertcp/playertcp.cc 2008-06-11 03:05:55 UTC (rev
6534)
+++ code/player/trunk/libplayertcp/playertcp.cc 2008-06-11 03:25:29 UTC (rev
6535)
@@ -51,7 +51,7 @@
#include <netinet/tcp.h>
#endif
-#if HAVE_ZLIB_H
+#if HAVE_Z
#include <zlib.h>
#endif
@@ -555,7 +555,7 @@
player_msghdr_t hdr;
void* payload;
int encode_msglen;
-#if HAVE_ZLIB_H
+#if HAVE_Z
player_map_data_t* zipped_data=NULL;
#endif
@@ -639,7 +639,7 @@
(hdr.type == PLAYER_MSGTYPE_RESP_ACK) &&
(hdr.subtype == PLAYER_MAP_REQ_GET_DATA))
{
-#if HAVE_ZLIB_H
+#if HAVE_Z
player_map_data_t* raw_data = (player_map_data_t*)payload;
zipped_data =
(player_map_data_t*)calloc(1,sizeof(player_map_data_t));
assert(zipped_data);
@@ -681,7 +681,7 @@
{
PLAYER_WARN4("encoding failed on message from %s:%u with type
%s:%u",
interf_to_str(hdr.addr.interf), hdr.addr.index,
msgtype_to_str(hdr.type), hdr.subtype);
-#if HAVE_ZLIB_H
+#if HAVE_Z
if(zipped_data)
{
free(zipped_data->data);
@@ -706,7 +706,7 @@
PLAYERXDR_ENCODE)) < 0)
{
PLAYER_ERROR("failed to encode msg header");
-#if HAVE_ZLIB_H
+#if HAVE_Z
if(zipped_data)
{
free(zipped_data->data);
@@ -722,7 +722,7 @@
client->writebufferlen = PLAYERXDR_MSGHDR_SIZE + hdr.size;
}
delete msg;
-#if HAVE_ZLIB_H
+#if HAVE_Z
if(zipped_data)
{
free(zipped_data->data);
@@ -744,8 +744,8 @@
int ret = pthread_mutex_trylock(&clients_mutex);
assert (ret == EBUSY);
}
-
-
+
+
if(!have_lock)
Lock();
@@ -966,7 +966,7 @@
(hdr.type == PLAYER_MSGTYPE_RESP_ACK) &&
(hdr.subtype == PLAYER_MAP_REQ_GET_DATA))
{
-#if HAVE_ZLIB_H
+#if HAVE_Z
player_map_data_t* zipped_data =
(player_map_data_t*)this->decode_readbuffer;
player_map_data_t* raw_data =
@@ -1326,13 +1326,13 @@
}
-void
+void
PlayerTCP::Lock()
{
pthread_mutex_lock(&clients_mutex);
}
-void
+void
PlayerTCP::Unlock()
{
pthread_mutex_unlock(&clients_mutex);
Modified: code/player/trunk/libplayertcp/playerudp.cc
===================================================================
--- code/player/trunk/libplayertcp/playerudp.cc 2008-06-11 03:05:55 UTC (rev
6534)
+++ code/player/trunk/libplayertcp/playerudp.cc 2008-06-11 03:25:29 UTC (rev
6535)
@@ -46,7 +46,7 @@
#include <unistd.h>
#include <fcntl.h>
-#if HAVE_ZLIB_H
+#if HAVE_Z
#include <zlib.h>
#endif
@@ -508,7 +508,7 @@
void* payload;
int encode_msglen;
socklen_t addrlen = sizeof(struct sockaddr_in);
-#if HAVE_ZLIB_H
+#if HAVE_Z
player_map_data_t* zipped_data=NULL;
#endif
@@ -596,7 +596,7 @@
(hdr.type == PLAYER_MSGTYPE_RESP_ACK) &&
(hdr.subtype == PLAYER_MAP_REQ_GET_DATA))
{
-#if HAVE_ZLIB_H
+#if HAVE_Z
player_map_data_t* raw_data = (player_map_data_t*)payload;
zipped_data =
(player_map_data_t*)calloc(1,sizeof(player_map_data_t));
assert(zipped_data);
@@ -634,7 +634,7 @@
{
PLAYER_WARN4("encoding failed on message from %s:%u with type %s:%u",
interf_to_str(hdr.addr.interf), hdr.addr.index,
msgtype_to_str(hdr.type), hdr.subtype);
-#if HAVE_ZLIB_H
+#if HAVE_Z
if(zipped_data)
{
free(zipped_data->data);
@@ -656,7 +656,7 @@
PLAYERXDR_ENCODE)) < 0)
{
PLAYER_ERROR("failed to encode msg header");
-#if HAVE_ZLIB_H
+#if HAVE_Z
if(zipped_data)
{
free(zipped_data->data);
@@ -672,7 +672,7 @@
client->writebufferlen = PLAYERXDR_MSGHDR_SIZE + hdr.size;
}
delete msg;
-#if HAVE_ZLIB_H
+#if HAVE_Z
if(zipped_data)
{
free(zipped_data->data);
@@ -807,7 +807,7 @@
// update the message size and send it off
hdr.size = decode_msglen;
void * msg_data = hdr.size? this->decode_readbuffer: NULL;
-
+
if(hdr.addr.interf == PLAYER_PLAYER_CODE)
{
Message* msg = new Message(hdr, msg_data, client->queue);
@@ -828,7 +828,7 @@
(hdr.type == PLAYER_MSGTYPE_RESP_ACK) &&
(hdr.subtype == PLAYER_MAP_REQ_GET_DATA))
{
-#if HAVE_ZLIB_H
+#if HAVE_Z
player_map_data_t* zipped_data =
(player_map_data_t*)this->decode_readbuffer;
player_map_data_t* raw_data =
Modified: code/player/trunk/server/drivers/shell/CMakeLists.txt
===================================================================
--- code/player/trunk/server/drivers/shell/CMakeLists.txt 2008-06-11
03:05:55 UTC (rev 6534)
+++ code/player/trunk/server/drivers/shell/CMakeLists.txt 2008-06-11
03:25:29 UTC (rev 6535)
@@ -8,7 +8,11 @@
PLAYERDRIVER_ADD_DRIVER (writelog build_writelog SOURCES writelog.cc encode.cc)
PLAYERDRIVER_OPTION (readlog build_readlog ON)
-PLAYERDRIVER_ADD_DRIVER (readlog build_readlog SOURCES encode.cc
readlog_time.cc readlog.cc)
+IF (HAVE_Z)
+ SET (readlogLinkFlags -lz)
+ENDIF (HAVE_Z)
+PLAYERDRIVER_ADD_DRIVER (readlog build_readlog SOURCES encode.cc
readlog_time.cc readlog.cc
+ LINKFLAGS ${readlogLinkFlags})
PLAYERDRIVER_OPTION (passthrough build_passthrough ON)
PLAYERDRIVER_ADD_DRIVER (passthrough build_passthrough SOURCES passthrough.cc)
Modified: code/player/trunk/server/drivers/shell/readlog.cc
===================================================================
--- code/player/trunk/server/drivers/shell/readlog.cc 2008-06-11 03:05:55 UTC
(rev 6534)
+++ code/player/trunk/server/drivers/shell/readlog.cc 2008-06-11 03:25:29 UTC
(rev 6535)
@@ -140,7 +140,7 @@
#include <math.h>
#include <unistd.h>
-#if HAVE_ZLIB_H
+#if HAVE_Z
#include <zlib.h>
#endif
@@ -353,7 +353,7 @@
// File to read data from
private: const char *filename;
private: FILE *file;
-#if HAVE_ZLIB_H
+#if HAVE_Z
private: gzFile gzfile;
#endif
@@ -483,7 +483,7 @@
// Initialize other stuff
this->format = strdup("unknown");
this->file = NULL;
-#if HAVE_ZLIB_H
+#if HAVE_Z
this->gzfile = NULL;
#endif
@@ -528,7 +528,7 @@
if (strlen(this->filename) >= 3 && \
strcasecmp(this->filename + strlen(this->filename) - 3, ".gz") == 0)
{
-#if HAVE_ZLIB_H
+#if HAVE_Z
this->gzfile = gzopen(this->filename, "r");
#else
PLAYER_ERROR("no support for reading compressed log files");
@@ -572,7 +572,7 @@
free(this->line);
// Close the file
-#if HAVE_ZLIB_H
+#if HAVE_Z
if (this->gzfile)
{
gzclose(this->gzfile);
@@ -633,7 +633,7 @@
if(!reading_configs && this->rewind_requested)
{
// back up to the beginning of the file
-#if HAVE_ZLIB_H
+#if HAVE_Z
if (this->gzfile)
ret = gzseek(this->file,0,SEEK_SET);
else
@@ -679,7 +679,7 @@
{
// Read a line from the file; note that gzgets is really slow
// compared to fgets (on uncompressed files), so use the latter.
-#if HAVE_ZLIB_H
+#if HAVE_Z
if (this->gzfile)
ret = (gzgets(this->file, this->line, this->line_size) == NULL);
else
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit