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

Peter Klotz peter.klotz at aon.at
Mon Oct 18 08:33:49 BST 2010


Hello Duncan

On 04/13/2010 04:38 PM, Mike Richmond wrote:
> When building omniORB 4.1.4 with MSVC 8 for Win 64 we get warnings 
> from the omniORB headers:
>
> stringtypes.h(149) : warning C4267: 'argument' : conversion from 
> 'size_t' to 'int', possible loss of data
> callDescriptor.h(333) : warning C4267: 'argument' : conversion from 
> 'size_t' to 'int', possible loss of data
>
> These warnings go away if we change _CORBA_String_helper::alloc() to 
> take a size_t instead of an int, and change omniCallDescriptor()'s 
> op_len_ argument to be a size_t instead of an int.  The latter change 
> also fixes similar warnings in the C++ generated from our IDL.
>
> Can these changes be incorporated?  Thanks.

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));


include/omniORB4/callDescriptor.h:

-      omniCallDescriptor(lcfn, op_, oplen, 0, 0, 0, upcall),
+      omniCallDescriptor(lcfn, op_, (int)oplen, 0, 0, 0, upcall),


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?

Regards, Peter.



More information about the omniORB-list mailing list