sizeof int /= size of void*

Stephen Leake <[email protected]>
Newsgroups gmane.comp.version-control.monotone.devel
Message-ID <[email protected]>
In mingw64, pointers are 64 bit, 'int' is 32 bit. So I'm getting an
error in netxx:

../monotone/src/netxx_pipe.cc:365:31: error: cast from 'HANDLE {aka void*}' to 'Netxx::socket_type {aka int}' loses precision [-fpermissive]
   return (Netxx::socket_type) named_pipe;

The context is:

Netxx::socket_type
Netxx::PipeStream::get_socketfd (void) const
{
#ifdef WIN32
  return (Netxx::socket_type) named_pipe;
#else
  return Netxx::socket_type(-1);
#endif
}

'socket_type' is declared in src/netxx/types.h:

    /// type for representing socket file descriptors
    typedef signed int socket_type;

Changing this to:

    /// type for representing socket file descriptors
#ifdef WIN32
    typedef HANDLE socket_type;
#else
    typedef signed int socket_type;
#endif

fixes that error. There are still a couple of others, like:

      if (fd == -1)
        break;


Should I commit these changes in nvm, or use a devel branch?

-- 
-- Stephe
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.