<AWT Dev> RFR: 8211810 X11 Time stamp data should be unsigned

Ichiroh Takiguchi takiguc at linux.vnet.ibm.com
Thu Oct 25 17:10:35 UTC 2018


Hello Sergey.

Thank you for reviewing.

Since xclient.get_data(3) is long,
So it is necessary to cast the value ​​from "long" to "int", like:
   Integer.toUnsignedLong((int)xclient.get_data(3))
I'm not sure, which is good...

Also same kind of codes are there:
src/java.desktop/unix/classes/sun/awt/X11/MotifDnDDropTargetProtocol.java: 
        long time_stamp = MotifDnDConstants.Swapper.getInt(data + 4, 
eventByteOrder) & 0xffffffffL;
src/java.desktop/unix/classes/sun/awt/X11/MotifDnDDropTargetProtocol.java: 
        long time_stamp = MotifDnDConstants.Swapper.getInt(data + 4, 
eventByteOrder) & 0xffffffffL;
src/java.desktop/unix/classes/sun/awt/X11/XDnDDropTargetProtocol.java:   
          time_stamp = xclient.get_data(3) & 0xFFFFFFFFL;
src/java.desktop/unix/classes/sun/awt/X11/XDnDDropTargetProtocol.java:   
          time_stamp = xclient.get_data(2) & 0xFFFFFFFFL;

It is necessary to cast the values ​​from "long" to "int".

What do you think ?

Ichiroh Takiguchi

On 2018-10-25 08:16, Sergey Bylokhov wrote:
> Hi, Ichiroh.
> 
> I think you can simplify the fix a little bit by using
> Integer.toUnsignedLong(int).
> 
> On 07/10/2018 19:33, Ichiroh Takiguchi wrote:
>> Hello.
>> (Sorry, I put wrong bug id, please ignore previous mail)
>> Could you review the fix ?
>> 
>> Bug:    https://bugs.openjdk.java.net/browse/JDK-8211810
>> Change: https://cr.openjdk.java.net/~itakiguchi/8211810/webrev.00/
>> 
>> Thanks,
>> Ichiroh Takiguchi
>> IBM Japan, Ltd.
>> 
>> On 2018-10-08 11:20, Ichiroh Takiguchi wrote:
>>> Hello.
>>> Could you review the fix ?
>>> 
>>> Bug:    https://bugs.openjdk.java.net/browse/JDK-8211826
>>> Change: https://cr.openjdk.java.net/~itakiguchi/8211826/webrev.00/
>>> 
>>> Thanks,
>>> Ichiroh Takiguchi
>>> IBM Japan, Ltd.
>>> 
>>> On 2018-06-19 22:22, Ichiroh Takiguchi wrote:
>>>> Hello,
>>>> IBM would like to contribute a patch to OpenJDK project.
>>>> 
>>>> Time stamp data on X11 ClientMessage should be 32 bit unsigned int.
>>>> But it's converted to signed long on Java.
>>>> It should be masked as unsigned 32bit data
>>>> 
>>>> I'd like to obtain a sponsor.
>>>> 
>>>> ----------
>>>> ---
>>>> old/src/java.desktop/unix/classes/sun/awt/X11/XDnDDropTargetProtocol.java
>>>>        2018-06-19 22:10:49.313678852 +0900
>>>> +++
>>>> new/src/java.desktop/unix/classes/sun/awt/X11/XDnDDropTargetProtocol.java
>>>>        2018-06-19 22:10:48.670692432 +0900
>>>> @@ -620,7 +620,7 @@
>>>> 
>>>>          /* Time stamp - new in XDnD version 1. */
>>>>          if (sourceProtocolVersion > 0) {
>>>> -            time_stamp = xclient.get_data(3);
>>>> +            time_stamp = xclient.get_data(3) & 
>>>> 0xFFFFFFFFL;
>>>>          }
>>>> 
>>>>          /* User action - new in XDnD version 2. */
>>>> @@ -867,7 +867,7 @@
>>>>           */
>>>>          if (dropAction == DnDConstants.ACTION_MOVE && 
>>>> success) {
>>>> 
>>>> -            long time_stamp = xclient.get_data(2);
>>>> +            long time_stamp = xclient.get_data(2) & 
>>>> 0xFFFFFFFFL;
>>>>              long xdndSelectionAtom =
>>>> XDnDConstants.XDnDSelection.getSelectionAtom().getAtom();
>>>> 
>>>> --- old/src/java.desktop/unix/classes/sun/awt/X11/XMSelection.java
>>>>    2018-06-19 22:10:50.223659632 +0900
>>>> +++ new/src/java.desktop/unix/classes/sun/awt/X11/XMSelection.java
>>>>    2018-06-19 22:10:49.576673297 +0900
>>>> @@ -200,7 +200,7 @@
>>>>              if 
>>>> (log.isLoggable(PlatformLogger.Level.FINE)) {
>>>>                  log.fine("client messags = " + 
>>>> xce);
>>>>              }
>>>> -            long timestamp = xce.get_data(0);
>>>> +            long timestamp = xce.get_data(0) & 
>>>> 0xFFFFFFFFL;
>>>>              long atom = xce.get_data(1);
>>>>              long owner = xce.get_data(2);
>>>>              long data = xce.get_data(3);
>>>> ----------
>>>> 
>>>> Thanks,
>>>> Ichiroh Takiguchi
>>>> IBM Japan, Ltd.
>> 



More information about the awt-dev mailing list