Bug 158023 - [PATCH] C++ xor operator is ^
Summary: [PATCH] C++ xor operator is ^
Status: RESOLVED FIXED
Alias: None
Product: kdelibs
Classification: Frameworks and Libraries
Component: kdeui (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-18 22:41 UTC by David Benjamin
Modified: 2008-02-18 22:59 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Benjamin 2008-02-18 22:41:26 UTC
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();
                        }
                }
        }
Comment 1 Urs Wolfer 2008-02-18 22:59:46 UTC
SVN commit 776857 by uwolfer:

Nice catch.
Thanks to David Benjamin for the small patch.
BUG:158023

 M  +1 -5      kglobalaccel_x11.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=776857