bug-commoncpp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

VC++


From: Todd Fisher
Subject: VC++
Date: Fri, 28 Sep 2001 15:53:37 -0400
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.4) Gecko/20010913

Below is a list of code snap shots of the segments of code that I had to modify to get this to compile with VC++ Also just a note on style portablity tabs always make it difficult to read code.

Todd

// Socket.h
#ifdef _WIN32
#if __BYTE_ORDER == __BIG_ENDIAN /// VC++ does not allow anything to be assigned a value other then 0
   enum ENDIANTYPE{
     MCAST_VALID_MASK = 0xF0000000,
     MCAST_VALID_VALUE = 0xE0000000
   };
 #else
   enum ENDIANTYPE{
     MCAST_VALID_MASK = 0x000000F0,
     MCAST_VALID_VALUE = 0x000000E0
   };
 #endif
#endif

#ifndef _WIN32
 #if __BYTE_ORDER == __BIG_ENDIAN
     static const uint32 MCAST_VALID_MASK = 0xF0000000;
     static const uint32 MCAST_VALID_VALUE = 0xE0000000;
 #else
     static const uint32 MCAST_VALID_MASK = 0x000000F0;
     static const uint32 MCAST_VALID_VALUE = 0x000000E0;
 #endif
#endif


// inaddr.cpp
bool InetAddress::setIPAddress(const char *host)
{
   if(!host)
       return false;

#if defined(WIN32)
   unsigned long n_addr;
n_addr = inet_addr(host);
   if ( validator )
(*validator)( *((struct in_addr *)&n_addr ) ); // (*validator) was expecting a struct in_addr this would be the correct casting however // just reading the code i'm not so sure this would then be correct.
   if(n_addr == INADDR_NONE)
       return false;
   *this = n_addr;
#else
   struct in_addr l_addr;
int ok = inet_aton(host, &l_addr);
   if ( validator )
       (*validator)(l_addr);
   if ( !ok )
       return false;
   *this = l_addr;
#endif
   return true;
}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]