code cleanup: warning and style
authorCampbell Barton <ideasman42@gmail.com>
Mon, 17 Sep 2012 22:34:42 +0000 (22:34 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 17 Sep 2012 22:34:42 +0000 (22:34 +0000)
intern/ghost/intern/GHOST_SystemCocoa.mm
intern/ghost/intern/GHOST_WindowCocoa.mm
intern/ghost/test/multitest/EventToBuf.c
intern/memutil/MEM_CacheLimiter.h
source/blender/editors/space_file/file_ops.c
source/blender/editors/space_file/fsmenu.c
source/blender/windowmanager/intern/wm_playanim.c

index 7bc40287dc3ccca2ba359242b668929a0e4068c8..76ebdcc07e0b08a2a2b64c59587d84b790d53846 100644 (file)
@@ -355,16 +355,18 @@ static GHOST_TKey convertKey(int rawCode, unichar recvChar, UInt16 keyAction)
                        /* alphanumerical or punctuation key that is remappable in int'l keyboards */
                        if ((recvChar >= 'A') && (recvChar <= 'Z')) {
                                return (GHOST_TKey) (recvChar - 'A' + GHOST_kKeyA);
-                       } else if ((recvChar >= 'a') && (recvChar <= 'z')) {
+                       }
+                       else if ((recvChar >= 'a') && (recvChar <= 'z')) {
                                return (GHOST_TKey) (recvChar - 'a' + GHOST_kKeyA);
-                       } else {
+                       }
+                       else {
 #if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
                                KeyboardLayoutRef keyLayout;
                                UCKeyboardLayout *uchrData;
                                
                                KLGetCurrentKeyboardLayout(&keyLayout);
                                KLGetKeyboardLayoutProperty(keyLayout, kKLuchrData, (const void **)
-                                                                                       &uchrData);
+                                                           &uchrData);
                                /*get actual character value of the "remappable" keys in int'l keyboards,
                                 if keyboard layout is not correctly reported (e.g. some non Apple keyboards in Tiger),
                                 then fallback on using the received charactersIgnoringModifiers */
@@ -870,29 +872,30 @@ bool GHOST_SystemCocoa::processEvents(bool waitForEvent)
        
        //      SetMouseCoalescingEnabled(false, NULL);
        //TODO : implement timer ??
-       
-       /*do {
+#if 0
+       do {
                GHOST_TimerManager* timerMgr = getTimerManager();
                
                if (waitForEvent) {
-               GHOST_TUns64 next = timerMgr->nextFireTime();
-               double timeOut;
-
-               if (next == GHOST_kFireTimeNever) {
-               timeOut = kEventDurationForever;
-               } else {
-               timeOut = (double)(next - getMilliSeconds())/1000.0;
-               if (timeOut < 0.0)
-               timeOut = 0.0;
-               }
+                       GHOST_TUns64 next = timerMgr->nextFireTime();
+                       double timeOut;
 
-               ::ReceiveNextEvent(0, NULL, timeOut, false, &event);
+                       if (next == GHOST_kFireTimeNever) {
+                               timeOut = kEventDurationForever;
+                       }
+                       else {
+                               timeOut = (double)(next - getMilliSeconds())/1000.0;
+                               if (timeOut < 0.0)
+                                       timeOut = 0.0;
+                       }
+
+                       ::ReceiveNextEvent(0, NULL, timeOut, false, &event);
                }
 
                if (timerMgr->fireTimers(getMilliSeconds())) {
-               anyProcessed = true;
+                       anyProcessed = true;
                }
-               */
+#endif
                
                do {
                        NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@@ -963,7 +966,9 @@ bool GHOST_SystemCocoa::processEvents(bool waitForEvent)
                        [NSApp sendEvent:event];
                        [pool drain];
                } while (event!= nil);          
-       //} while (waitForEvent && !anyProcessed); Needed only for timer implementation
+#if 0
+       } while (waitForEvent && !anyProcessed); // Needed only for timer implementation
+#endif
        
        if (m_needDelayedApplicationBecomeActiveEventProcessing) handleApplicationBecomeActiveEvent();
        
@@ -1285,12 +1290,13 @@ GHOST_TUns8 GHOST_SystemCocoa::handleQuitRequest()
        if (m_windowManager->getAnyModifiedState())
        {
                int shouldQuit = NSRunAlertPanel(@"Exit Blender", @"Some changes have not been saved.\nDo you really want to quit ?",
-                                                                                @"Cancel", @"Quit Anyway", nil);
+                                                @"Cancel", @"Quit Anyway", nil);
                if (shouldQuit == NSAlertAlternateReturn)
                {
                        pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventQuit, NULL) );
                        return GHOST_kExitNow;
-               } else {
+               }
+               else {
                        //Give back focus to the blender window if user selected cancel quit
                        NSArray *windowsList = [NSApp orderedWindows];
                        if ([windowsList count]) {
@@ -1405,7 +1411,8 @@ GHOST_TSuccess GHOST_SystemCocoa::handleTabletEvent(void *eventPtr, short eventT
                                                ct.Active = GHOST_kTabletModeNone;
                                                break;
                                }
-                       } else {
+                       }
+                       else {
                                // pointer is leaving - return to mouse
                                ct.Active = GHOST_kTabletModeNone;
                        }
@@ -1694,7 +1701,8 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr)
                        if ([event type] == NSKeyDown) {
                                pushEvent( new GHOST_EventKey([event timestamp]*1000, GHOST_kEventKeyDown, window, keyCode, ascii, utf8_buf) );
                                //printf("Key down rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c utf8=%s\n",[event keyCode],[charsIgnoringModifiers length]>0?[charsIgnoringModifiers characterAtIndex:0]:' ',keyCode,ascii,ascii, utf8_buf);
-                       } else {
+                       }
+                       else {
                                pushEvent( new GHOST_EventKey([event timestamp]*1000, GHOST_kEventKeyUp, window, keyCode, 0, '\0') );
                                //printf("Key up rawCode=0x%x charsIgnoringModifiers=%c keyCode=%u ascii=%i %c utf8=%s\n",[event keyCode],[charsIgnoringModifiers length]>0?[charsIgnoringModifiers characterAtIndex:0]:' ',keyCode,ascii,ascii, utf8_buf);
                        }
@@ -1780,7 +1788,8 @@ GHOST_TUns8* GHOST_SystemCocoa::getClipboard(bool selection) const
 
        if(temp_buff) {
                return temp_buff;
-       } else {
+       }
+       else {
                return NULL;
        }
 }
index 31589003131b3e0dba0f7e1a1b8cab1f35fd45c1..dc05fe42a70011a8f7869f9d545e49bfe80b55e7 100644 (file)
@@ -670,7 +670,8 @@ void GHOST_WindowCocoa::setTitle(const STR_String& title)
                        [m_window setRepresentedFilename:@""];
                }
 
-       } else {
+       }
+       else {
                [m_window setTitle:windowTitle];
                [m_window setRepresentedFilename:@""];
        }
@@ -1288,7 +1289,8 @@ void GHOST_WindowCocoa::loadCursor(bool visible, GHOST_TStandardCursor cursor) c
 
        if (cursor == GHOST_kStandardCursorCustom && m_customCursor) {
                tmpCursor = m_customCursor;
-       } else {
+       }
+       else {
                switch (cursor) {
                        case GHOST_kStandardCursorDestroy:
                                tmpCursor = [NSCursor disappearingItemCursor];
index 0eb37a58be280cf7aa347d1acd063047ed5d4768..aba80784a7258fad5959d804de818358ddc1cd50 100644 (file)
@@ -208,7 +208,8 @@ void event_to_buf(GHOST_EventHandle evt, char buf[128])
                char *s= GHOST_GetTitle(win);
                pos += sprintf(pos, " - win: %s", s);
                free(s);
-       } else {
+       }
+       else {
                pos+= sprintf(pos, " - sys evt");
        }
        switch (type) {
index 801ee154d401c9395264a26c71f2a0cfe0193103..1f1088ea1189e8e727379a91277f1bbd9ac2fde7 100644 (file)
@@ -179,9 +179,10 @@ public:
                        return;
                }
 
-               if(getDataSize) {
+               if (getDataSize) {
                        mem_in_use = total_size();
-               } else {
+               }
+               else {
                        mem_in_use = MEM_get_memory_in_use();
                }
 
@@ -196,16 +197,18 @@ public:
 
                        priority_queue.pop();
 
-                       if(getDataSize) {
+                       if (getDataSize) {
                                cur_size = getDataSize(elem->get()->get_data());
-                       } else {
+                       }
+                       else {
                                cur_size = mem_in_use;
                        }
 
                        if (elem->destroy_if_possible()) {
                                if (getDataSize) {
                                        mem_in_use -= cur_size;
-                               } else {
+                               }
+                               else {
                                        mem_in_use -= cur_size - MEM_get_memory_in_use();
                                }
                        }
index 6c718751cfedcfe40d55a70fb9fe573f8bf1601e..94967b264ed3d83949c2562ff8d5d543cb49dbd2 100644 (file)
@@ -515,7 +515,7 @@ void FILE_OT_delete_bookmark(wmOperatorType *ot)
        RNA_def_int(ot->srna, "index", -1, -1, 20000, "Index", "", -1, 20000);
 }
 
-static int reset_recent_exec(bContext *C, wmOperator *op)
+static int reset_recent_exec(bContext *C, wmOperator *UNUSED(op))
 {
        ScrArea *sa = CTX_wm_area(C);
        char name[FILE_MAX];
index f7701e79016662ab9c90366beb59f56c8cee7cf7..66cda3082ea879ef9028b71e8b28ebe8b3c5678e 100644 (file)
@@ -206,7 +206,8 @@ void fsmenu_insert_entry(struct FSMenu *fsmenu, FSMenuCategory category, const c
                if (flag & FS_INSERT_FIRST) {
                        fsm_iter->next = fsm_head;
                        fsmenu_set_category(fsmenu, category, fsm_iter);
-               } else {
+               }
+               else {
                        fsm_iter->next = fsm_prev->next;
                        fsm_prev->next = fsm_iter;
                }
index bff40faf1d1cbc87de73f98858a37107712cc801..35cc1545c408988c67ad34a9257591cfa8017f01 100644 (file)
@@ -713,14 +713,6 @@ static void playanim_window_open(const char *title, int posx, int posy, int size
                                               inital_state,
                                               GHOST_kDrawingContextTypeOpenGL,
                                               FALSE /* no stereo */, FALSE);
-
-       //if (ghostwin) {
-       //if (win) {
-       // GHOST_SetWindowUserData(ghostwin, win);
-       //} else {
-       //      GHOST_DisposeWindow(g_WS.ghost_system, ghostwin);
-       //}
-       //}
 }