[Bug 158023] New: [PATCH] C++ xor operator is ^

David Benjamin dnas.dnas at gmail.com
Mon Feb 18 22:41:27 CET 2008


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=158023         
           Summary: [PATCH] C++ xor operator is ^
           Product: kdelibs
           Version: unspecified
          Platform: Compiled Sources
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: kdeui
        AssignedTo: kdelibs-bugs kde org
        ReportedBy: dnas.dnas gmail com


Version:            (using Devel)
Installed from:    Compiled sources
OS:                Linux

Sorry if this isn't the best place to mention this. (Should such things be dealt with on a mailing list instead? I wasn't sure which was more appropriate for super-minor stuff.)

I was poking around the kdelibs code and noticed an amusing TODO.
// TODO: what's the xor operator in c++?

And a patch, if it's really necessary. (I expect, for something like this, it's not worth the email-spam of filing a bug + attaching the patch.)

--- kdeui/shortcuts/kglobalaccel_x11.cpp        (revision 774182)
+++ kdeui/shortcuts/kglobalaccel_x11.cpp        (working copy)
 @ -208,7 +208,6  @ bool KGlobalAccelImpl::x11KeyPress( cons
        //  e.g., KP_4 => Shift+KP_Left, and Shift+KP_4 => KP_Left.
        if( pEvent->xkey.state & KKeyServer::modXNumLock() ) {
                uint sym = XKeycodeToKeysym( QX11Info::display(), keyCodeX, 0 );
-               // TODO: what's the xor operator in c++?
                // If this is a keypad key,
                if( sym >= XK_KP_Space && sym <= XK_KP_9 ) {
                        switch( sym ) {
 @ -220,10 +219,7  @ bool KGlobalAccelImpl::x11KeyPress( cons
                                case XK_KP_Divide:
                                        break;
                                default:
-                                       if( keyModX & KKeyServer::modXShift() )
-                                               keyModX &= ~KKeyServer::modXShift();
-                                       else
-                                               keyModX |= KKeyServer::modXShift();
+                                       keyModX ^= KKeyServer::modXShift();
                        }
                }
        }


More information about the Kdelibs-bugs mailing list