[omniORB] Fixes for C4267 warnings when building for Win 64

Duncan Grisby duncan at grisby.org
Mon Oct 18 10:14:56 BST 2010


On Mon, 2010-10-18 at 07:33 +0200, Peter Klotz wrote:

> I just saw, that in SVN the fixes are not implemented as Mike suggested, 
> but the other way round. Not the methods called have been changed but 
> the caller performs the cast.
> 
> include/omniORB4/stringtypes.h:
> 
> -  char* r = alloc(strlen(s));
> +  char* r = alloc((int)strlen(s));

[...]
> This way the code produces no warning but is actually not 64bit 
> compatible since the values are possibly truncated.
> 
> Why wasn't the code changed as originally suggested?

Within the omniORB 4.1.x stream, the libraries need to remain binary
compatible, so code compiled against one 4.1.x version can use another
4.1.x version. It's therefore important not to change the signature of
anything like this.

The changes are "safe", since CORBA strings are limited to 32 bit
lengths anyway. If a string is so long that it overflows the int in this
code, it will fail as soon as it is sent in a CORBA call.

Cheers,

Duncan.

-- 
 -- Duncan Grisby         --
  -- duncan at grisby.org     --
   -- http://www.grisby.org --





More information about the omniORB-list mailing list