I have a similar (all in one) patch that I can post on Monday.

James,
One thing I noticed in your patch was that you still cast the SOCKET type 
to int in several places.  This will appear to work most of the time on 
Win64, but the upper 32 bits are used in some situations.  Discarding the 
upper 32-bits will cause problems in those situations.

The patch doesn't address the non-blocking server (which is fine, my patch 
won't either).  It also doesn't address some HANDLE->int casts in the 
PipeServer that show up when you enable Visual Studio's /WP64 warning flag 
(again, neither will mine).


From:   "James K. Lowden" <[email protected]>
To:     [email protected]
Date:   09/15/2012 03:02 PM
Subject:        Build thrift without warning



http://www.schemamania.org/thrift/patch/

The patches at the above URL allow the current trunk of Thrift C++ to
build without warnings in Visual Studio and GNU gcc. 

I introduce THRIFT_SAFE_CAST in Thrift.h, which tests narrowing
conversions for fit.  Would-be overflows throw std::runtime_error. 

Some functions have been modified or overloaded to allow size_t
parameters.  SOCKET is dealt with intelligently. 

IMO every public thrift function should have a form accepting normal
types -- including e.g. short, int, long, and size_t -- and apply casts
as necessary.  In particular size_t is important because std
constainers have size() members that usually return something like
size_t. 

Enjoy! 

--jkl

Reply via email to