Windows warning fixes

This commit is contained in:
Robert Osfield 2011-06-16 15:57:40 +00:00
parent 93d1fedd0b
commit 38a807ae6e
4 changed files with 17 additions and 8 deletions

View File

@ -123,11 +123,11 @@ void Receiver::sync( void )
} }
#if defined(__linux) || defined(__FreeBSD__) || defined( __APPLE__ ) #if defined(__linux) || defined(__FreeBSD__) || defined( __APPLE__ )
socklen_t socklen_t size;
#else #else
int int size;
#endif #endif
size = sizeof( struct sockaddr_in ); size = sizeof( struct sockaddr_in );
fd_set fdset; fd_set fdset;
FD_ZERO( &fdset ); FD_ZERO( &fdset );
@ -144,7 +144,7 @@ void Receiver::sync( void )
int err = WSAGetLastError (); int err = WSAGetLastError ();
if (err!=0) fprintf( stderr, "Receiver::sync() - error %d\n",err ); if (err!=0) fprintf( stderr, "Receiver::sync() - error %d\n",err );
while( select( _so+1, &fdset, 0L, 0L, &tv ) ) while( select( static_cast<int>(_so)+1, &fdset, 0L, 0L, &tv ) )
{ {
if( FD_ISSET( _so, &fdset ) ) if( FD_ISSET( _so, &fdset ) )
{ {

View File

@ -344,7 +344,7 @@ int Thread::start() {
pd->threadStartedBlock.reset(); pd->threadStartedBlock.reset();
pd->tid.set( (void*)_beginthreadex(NULL,pd->stackSize,ThreadPrivateActions::StartThread,static_cast<void *>(this),0,&ID)); pd->tid.set( (void*)_beginthreadex(NULL,static_cast<unsigned>(pd->stackSize),ThreadPrivateActions::StartThread,static_cast<void *>(this),0,&ID));
pd->uniqueId = (int)ID; pd->uniqueId = (int)ID;

View File

@ -5,7 +5,7 @@
namespace esri namespace esri
{ {
int read(int fd, void * buf, size_t nbytes) { return _read(fd, buf, nbytes); } int read(int fd, void * buf, size_t nbytes) { return _read(fd, buf, static_cast<unsigned int>(nbytes)); }
} }
#else #else

View File

@ -128,6 +128,15 @@
#endif #endif
#endif #endif
// workaround for Windows warnings.
#if defined(_MSC_VER)
#define FILENO _fileno
#define GETCWD _getcwd
#else
#define FILENO fileno
#define GETCWD getcwd
#endif
#define ZIP_HANDLE 1 #define ZIP_HANDLE 1
@ -188,7 +197,7 @@ typedef struct tm_unz_s
// some windows<->linux portability things // some windows<->linux portability things
#ifdef ZIP_STD #ifdef ZIP_STD
DWORD GetFilePosU(HANDLE hfout) DWORD GetFilePosU(HANDLE hfout)
{ struct stat st; fstat(fileno(hfout),&st); { struct stat st; fstat(FILENO(hfout),&st);
if ((st.st_mode&S_IFREG)==0) return 0xFFFFFFFF; if ((st.st_mode&S_IFREG)==0) return 0xFFFFFFFF;
return ftell(hfout); return ftell(hfout);
} }
@ -3928,7 +3937,7 @@ ZRESULT TUnzip::Open(void *z,unsigned int len,DWORD flags)
{ if (uf!=0 || currentfile!=-1) return ZR_NOTINITED; { if (uf!=0 || currentfile!=-1) return ZR_NOTINITED;
// //
#ifdef ZIP_STD #ifdef ZIP_STD
char* buf = getcwd(rootdir,MAX_PATH-1); char* buf = GETCWD(rootdir,MAX_PATH-1);
if (buf==0) return ZR_NOFILE; if (buf==0) return ZR_NOFILE;
#else #else
#ifdef GetCurrentDirectory #ifdef GetCurrentDirectory