Need reviewer for warning error fix on hprof_init.c

Dmitry Samersoff Dmitry.Samersoff at oracle.com
Sat Sep 15 09:33:16 PDT 2012


Kelly,

Sorry for being later in a party.

Function receiving port number as an argument should use *in_port_t* -
rather than unsigned short - it expands to uint16_t or to uint32_t
depending to OS.

-Dmitry

On 2012-09-15 19:58, Kelly O'Hair wrote:
> 
> On Sep 15, 2012, at 4:10 AM, David Holmes wrote:
> 
>> On 15/09/2012 11:52 AM, Kelly O'Hair wrote:
>>>
>>> 7198327: Fix mac warning error in hprof_init.c
>>>
>>> http://cr.openjdk.java.net/~ohair/openjdk8/repo-jdk/webrev/src/share/demo/jvmti/hprof/hprof_init.c.sdiff.html
>>>
>>> The Mac warns on the if test for the port number being > 65535
>>> made more sense for the port to be a simple int.
>>
>> Seems simpler and more correct to just do:
>>
>>    if (port == 0 || (int)port > 65535) {
> 
> 
> If I can find a way to keep the cast count down, I tend to go that route.
> I also know that compilers really don't pass 16bit quantities around, but 32bit quantities,
> so in my mind, passing an int is simpler and might avoid some implicit casting.
> I spent too many years working on compilers :^(
> 
> Of course I could see that I should have made it an unsigned int.
> 
> 
> So are you against this change?
> 
> -kto
> 
>>
>> David
>>
>>> -kto
>>>
> 


-- 
Dmitry Samersoff
Java Hotspot development team, SPB04
* There will come soft rains ...




More information about the serviceability-dev mailing list