code cleanup: warning and style

This commit is contained in:
Campbell Barton
2012-09-17 22:34:42 +00:00
parent aff591c6e1
commit f6251a1f32
7 changed files with 49 additions and 41 deletions

View File

@@ -355,9 +355,11 @@ static GHOST_TKey convertKey(int rawCode, unichar recvChar, UInt16 keyAction)
/* alphanumerical or punctuation key that is remappable in int'l keyboards */ /* alphanumerical or punctuation key that is remappable in int'l keyboards */
if ((recvChar >= 'A') && (recvChar <= 'Z')) { if ((recvChar >= 'A') && (recvChar <= 'Z')) {
return (GHOST_TKey) (recvChar - 'A' + GHOST_kKeyA); 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); return (GHOST_TKey) (recvChar - 'a' + GHOST_kKeyA);
} else { }
else {
#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 #if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4
KeyboardLayoutRef keyLayout; KeyboardLayoutRef keyLayout;
UCKeyboardLayout *uchrData; UCKeyboardLayout *uchrData;
@@ -870,8 +872,8 @@ bool GHOST_SystemCocoa::processEvents(bool waitForEvent)
// SetMouseCoalescingEnabled(false, NULL); // SetMouseCoalescingEnabled(false, NULL);
//TODO : implement timer ?? //TODO : implement timer ??
#if 0
/*do { do {
GHOST_TimerManager* timerMgr = getTimerManager(); GHOST_TimerManager* timerMgr = getTimerManager();
if (waitForEvent) { if (waitForEvent) {
@@ -880,7 +882,8 @@ bool GHOST_SystemCocoa::processEvents(bool waitForEvent)
if (next == GHOST_kFireTimeNever) { if (next == GHOST_kFireTimeNever) {
timeOut = kEventDurationForever; timeOut = kEventDurationForever;
} else { }
else {
timeOut = (double)(next - getMilliSeconds())/1000.0; timeOut = (double)(next - getMilliSeconds())/1000.0;
if (timeOut < 0.0) if (timeOut < 0.0)
timeOut = 0.0; timeOut = 0.0;
@@ -892,7 +895,7 @@ bool GHOST_SystemCocoa::processEvents(bool waitForEvent)
if (timerMgr->fireTimers(getMilliSeconds())) { if (timerMgr->fireTimers(getMilliSeconds())) {
anyProcessed = true; anyProcessed = true;
} }
*/ #endif
do { do {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
@@ -963,7 +966,9 @@ bool GHOST_SystemCocoa::processEvents(bool waitForEvent)
[NSApp sendEvent:event]; [NSApp sendEvent:event];
[pool drain]; [pool drain];
} while (event!= nil); } 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(); if (m_needDelayedApplicationBecomeActiveEventProcessing) handleApplicationBecomeActiveEvent();
@@ -1290,7 +1295,8 @@ GHOST_TUns8 GHOST_SystemCocoa::handleQuitRequest()
{ {
pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventQuit, NULL) ); pushEvent( new GHOST_Event(getMilliSeconds(), GHOST_kEventQuit, NULL) );
return GHOST_kExitNow; return GHOST_kExitNow;
} else { }
else {
//Give back focus to the blender window if user selected cancel quit //Give back focus to the blender window if user selected cancel quit
NSArray *windowsList = [NSApp orderedWindows]; NSArray *windowsList = [NSApp orderedWindows];
if ([windowsList count]) { if ([windowsList count]) {
@@ -1405,7 +1411,8 @@ GHOST_TSuccess GHOST_SystemCocoa::handleTabletEvent(void *eventPtr, short eventT
ct.Active = GHOST_kTabletModeNone; ct.Active = GHOST_kTabletModeNone;
break; break;
} }
} else { }
else {
// pointer is leaving - return to mouse // pointer is leaving - return to mouse
ct.Active = GHOST_kTabletModeNone; ct.Active = GHOST_kTabletModeNone;
} }
@@ -1694,7 +1701,8 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr)
if ([event type] == NSKeyDown) { if ([event type] == NSKeyDown) {
pushEvent( new GHOST_EventKey([event timestamp]*1000, GHOST_kEventKeyDown, window, keyCode, ascii, utf8_buf) ); 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); //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') ); 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); //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) { if(temp_buff) {
return temp_buff; return temp_buff;
} else { }
else {
return NULL; return NULL;
} }
} }

View File

@@ -670,7 +670,8 @@ void GHOST_WindowCocoa::setTitle(const STR_String& title)
[m_window setRepresentedFilename:@""]; [m_window setRepresentedFilename:@""];
} }
} else { }
else {
[m_window setTitle:windowTitle]; [m_window setTitle:windowTitle];
[m_window setRepresentedFilename:@""]; [m_window setRepresentedFilename:@""];
} }
@@ -1288,7 +1289,8 @@ void GHOST_WindowCocoa::loadCursor(bool visible, GHOST_TStandardCursor cursor) c
if (cursor == GHOST_kStandardCursorCustom && m_customCursor) { if (cursor == GHOST_kStandardCursorCustom && m_customCursor) {
tmpCursor = m_customCursor; tmpCursor = m_customCursor;
} else { }
else {
switch (cursor) { switch (cursor) {
case GHOST_kStandardCursorDestroy: case GHOST_kStandardCursorDestroy:
tmpCursor = [NSCursor disappearingItemCursor]; tmpCursor = [NSCursor disappearingItemCursor];

View File

@@ -208,7 +208,8 @@ void event_to_buf(GHOST_EventHandle evt, char buf[128])
char *s= GHOST_GetTitle(win); char *s= GHOST_GetTitle(win);
pos += sprintf(pos, " - win: %s", s); pos += sprintf(pos, " - win: %s", s);
free(s); free(s);
} else { }
else {
pos+= sprintf(pos, " - sys evt"); pos+= sprintf(pos, " - sys evt");
} }
switch (type) { switch (type) {

View File

@@ -179,9 +179,10 @@ public:
return; return;
} }
if(getDataSize) { if (getDataSize) {
mem_in_use = total_size(); mem_in_use = total_size();
} else { }
else {
mem_in_use = MEM_get_memory_in_use(); mem_in_use = MEM_get_memory_in_use();
} }
@@ -196,16 +197,18 @@ public:
priority_queue.pop(); priority_queue.pop();
if(getDataSize) { if (getDataSize) {
cur_size = getDataSize(elem->get()->get_data()); cur_size = getDataSize(elem->get()->get_data());
} else { }
else {
cur_size = mem_in_use; cur_size = mem_in_use;
} }
if (elem->destroy_if_possible()) { if (elem->destroy_if_possible()) {
if (getDataSize) { if (getDataSize) {
mem_in_use -= cur_size; mem_in_use -= cur_size;
} else { }
else {
mem_in_use -= cur_size - MEM_get_memory_in_use(); mem_in_use -= cur_size - MEM_get_memory_in_use();
} }
} }

View File

@@ -515,7 +515,7 @@ void FILE_OT_delete_bookmark(wmOperatorType *ot)
RNA_def_int(ot->srna, "index", -1, -1, 20000, "Index", "", -1, 20000); 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); ScrArea *sa = CTX_wm_area(C);
char name[FILE_MAX]; char name[FILE_MAX];

View File

@@ -206,7 +206,8 @@ void fsmenu_insert_entry(struct FSMenu *fsmenu, FSMenuCategory category, const c
if (flag & FS_INSERT_FIRST) { if (flag & FS_INSERT_FIRST) {
fsm_iter->next = fsm_head; fsm_iter->next = fsm_head;
fsmenu_set_category(fsmenu, category, fsm_iter); fsmenu_set_category(fsmenu, category, fsm_iter);
} else { }
else {
fsm_iter->next = fsm_prev->next; fsm_iter->next = fsm_prev->next;
fsm_prev->next = fsm_iter; fsm_prev->next = fsm_iter;
} }

View File

@@ -713,14 +713,6 @@ static void playanim_window_open(const char *title, int posx, int posy, int size
inital_state, inital_state,
GHOST_kDrawingContextTypeOpenGL, GHOST_kDrawingContextTypeOpenGL,
FALSE /* no stereo */, FALSE); FALSE /* no stereo */, FALSE);
//if (ghostwin) {
//if (win) {
// GHOST_SetWindowUserData(ghostwin, win);
//} else {
// GHOST_DisposeWindow(g_WS.ghost_system, ghostwin);
//}
//}
} }