fix warnings

pull/411/head
Li Linfeng 2019-09-21 14:11:41 +08:00
parent 67e0d9b0c6
commit 552175e2de
12 changed files with 24 additions and 75 deletions

View File

@ -21,7 +21,7 @@
@class ScriptsController;
@class ConfigSelectionWindowController;
@interface CelestiaController : NSWindowController
@interface CelestiaController : NSWindowController <NSWindowDelegate>
{
CelestiaSettings* settings;
CelestiaAppCore* appCore;

View File

@ -640,7 +640,7 @@ NSString* fatalErrorMessage;
// Close the original window (does not release it)
[origWindow close];
glView = fullScreenView;
[glView takeValue: self forKey: @"controller"];
[glView setValue: self forKey: @"controller"];
[fullScreenWindow makeFirstResponder: glView];
// Make sure the view looks ready before unfading from black
[glView update];

View File

@ -12,7 +12,6 @@
#import "CelestiaUniversalCoord_PrivateAPI.h"
#import "NSString_ObjCPlusPlus.h"
#import "Astro.h"
#import "Observer.h"
#import "CelestiaAppCore.h"
#import "CelestiaSimulation.h"
#import "CelestiaSimulation_PrivateAPI.h"

View File

@ -7,7 +7,7 @@
//
#import "CelestiaFavorite.h"
#import "myTree.h"
#import "MyTree.h"
@interface CelestiaFavorites : MyTree

View File

@ -479,7 +479,7 @@
}
return NO;
}
- (unsigned int) draggingEntered: (id <NSDraggingInfo>) sender
- (NSDragOperation) draggingEntered: (id <NSDraggingInfo>) sender
{
NSPasteboard *pb = [sender draggingPasteboard];
NSString *type = [pb availableTypeFromArray:

View File

@ -19,7 +19,7 @@
-(void) setControl: (id) _control;
-(id) valueForTag: (int) tag;
-(void) takeValue: (id) value forTag: (int) tag;
-(void) setValue: (id) value forTag: (int) tag;
// User Defaults

View File

@ -29,14 +29,14 @@ class MacOSXWatcher : public CelestiaWatcher
void notifyChange(CelestiaCore* core, int i)
{
if ( 0 == i & (
if ( 0 == (i & (
CelestiaCore::LabelFlagsChanged
| CelestiaCore::RenderFlagsChanged
| CelestiaCore::VerbosityLevelChanged
| CelestiaCore::TimeZoneChanged
| CelestiaCore::AmbientLightChanged
| CelestiaCore::FaintestChanged
)) { return; }
))) { return; }
[control validateItems];
};
};
@ -274,7 +274,7 @@ static NSMutableDictionary* tagMap;
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
[self setValue: [defaultsDictionary objectForKey: key] forKey: key];
#else
[self takeValue: [defaultsDictionary objectForKey: key] forKey: key];
[self setValue: [defaultsDictionary objectForKey: key] forKey: key];
#endif
}
}
@ -316,20 +316,15 @@ static NSMutableDictionary* tagMap;
return [self valueForKey: [tagDict objectForKey: [NSNumber numberWithInt: tag] ] ];
}
-(void) takeValue: (id) value forTag: (int) tag
-(void) setValue: (id) value forTag: (int) tag
{
id key = [tagDict objectForKey: [NSNumber numberWithInt: tag] ];
if (key!= nil)
{
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
[self setValue: value forKey: key ];
#else
[self takeValue: value forKey: key ];
#endif
}
}
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
- (id)valueForUndefinedKey: (NSString *) key
{
#ifdef DEBUG
@ -352,31 +347,6 @@ static NSMutableDictionary* tagMap;
#endif
}
#else
-(id)handleQueryWithUnboundKey: (NSString*) key
{
#ifdef DEBUG
if ( key ) NSLog(@"unbound key query for %@", key);
#endif
return nil;
}
-(void)handleTakeValue: (id) value forUnboundKey: (NSString*) key
{
#ifdef DEBUG
NSLog(@"unbound key set for %@", key);
#endif
}
-(void)unableToSetNilForKey: (NSString*) key
{
#ifdef DEBUG
NSLog(@"nil key for %@", key);
#endif
}
#endif
// Time Settings
-(double) time { return appCore->getSimulation()->getTime(); }
@ -658,7 +628,7 @@ FEATUREMETHODS(Other)
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
[control setValue: [NSNumber numberWithBool: (value != 0)] forKey: @"isFullScreen"];
#else
[control takeValue: [NSNumber numberWithBool: (value != 0)] forKey: @"isFullScreen"];
[control setValue: [NSNumber numberWithBool: (value != 0)] forKey: @"isFullScreen"];
#endif
}
@ -675,7 +645,7 @@ FEATUREMETHODS(Other)
if ( surfaces && [surfaces count] > 0 )
{
NSString *displayedSurfStr = [NSString stringWithStdString: displayedSurfName];
unsigned index = [surfaces indexOfObject: displayedSurfStr];
NSUInteger index = [surfaces indexOfObject: displayedSurfStr];
if (index != NSNotFound)
return index+1;
}
@ -731,11 +701,11 @@ FEATUREMETHODS(Other)
switch ( tag/100)
{
case 4: case 5: case 7: case 8: case 10: // 400, 500, 700, 800, 1000
[self takeValue: [NSNumber numberWithInt: (1-[[self valueForTag: tag] intValue])] forTag: tag ];
[self setValue: [NSNumber numberWithInt: (1-[[self valueForTag: tag] intValue])] forTag: tag ];
break;
case 6: // 600
value = [NSNumber numberWithInt: tag%10 ];
[self takeValue: value forTag: (tag/10)*10 ];
[self setValue: value forTag: (tag/10)*10 ];
[self selectPopUpButtonItem: item withIndex: tag%10];
//[self setPopUpButtonWithTag: ((tag/10)*10) toIndex: [value intValue]];
if ([[tagDict objectForKey:[NSNumber numberWithInt:((tag/10)*10)]] isEqualToString: @"renderPath"])
@ -748,7 +718,7 @@ FEATUREMETHODS(Other)
}
break;
case 9: // 900
[self takeValue: [NSNumber numberWithFloat: [item floatValue]] forTag: tag];
[self setValue: [NSNumber numberWithFloat: [item floatValue]] forTag: tag];
break;
}
}

View File

@ -1,7 +1,7 @@
/* FavoritesDrawerController */
#import "CelestiaFavorite.h";
#import "ContextOutlineView.h";
#import "CelestiaFavorite.h"
#import "ContextOutlineView.h"
#import "FavoriteInfoWindowController.h"
#import "NSWindowController_Extensions.h"

View File

@ -88,7 +88,7 @@
[super editWithFrame: textFrame inView: controlView editor:textObj delegate:anObject event: theEvent];
}
- (void)selectWithFrame:(NSRect)aRect inView:(NSView *)controlView editor:(NSText *)textObj delegate:(id)anObject start:(int)selStart length:(int)selLength {
- (void)selectWithFrame:(NSRect)aRect inView:(NSView *)controlView editor:(NSText *)textObj delegate:(id)anObject start:(NSInteger)selStart length:(NSInteger)selLength {
NSRect textFrame, imageFrame;
NSDivideRect (aRect, &imageFrame, &textFrame, 3 + [image size].width, NSMinXEdge);
[super selectWithFrame: textFrame inView: controlView editor:textObj delegate:anObject start:selStart length:selLength];
@ -124,4 +124,4 @@
return cellSize;
}
@end
@end

View File

@ -346,16 +346,14 @@ FUNCS GetGLProcAddress(const GLubyte* procName)
#ifdef TARGET_OS_MAC
#include <dlfcn.h>
#include <mach-o/dyld.h>
#include <stdio.h>
typedef void (*FUNCS) (void);
const struct mach_header *openGLImagePtr = NULL;
static void *openGLImagePtr = NULL;
FUNCS osxGetProcAddress(const GLubyte *procName) {
char myProcName[128];
NSSymbol mySymbol = NULL;
FUNCS myPtr = NULL;
if (openGLImagePtr == NULL) {
openGLImagePtr = NSAddImage("/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL",NSADDIMAGE_OPTION_RETURN_ON_ERROR);
openGLImagePtr = dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL", RTLD_LAZY);
#if 0
unsigned long i;
unsigned long imageCount = _dyld_image_count();
@ -373,29 +371,11 @@ FUNCS osxGetProcAddress(const GLubyte *procName) {
printf("Can't find OpenGL??\n");
return NULL;
}
strcpy(myProcName,"_");
/* sanity check */
if (strlen((char *)procName)>125) return NULL;
strcat(myProcName,(char *)procName);
//printf("%s\n",myProcName);
//if (NSIsSymbolNameDefinedInImage(openGLImagePtr,myProcName) != FALSE) {
mySymbol = NSLookupSymbolInImage(openGLImagePtr, myProcName, NSLOOKUPSYMBOLINIMAGE_OPTION_BIND_NOW | NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR);
if (mySymbol != NULL)
myPtr = (FUNCS)NSAddressOfSymbol(mySymbol);
//printf(" (symbol, address) -> (%08x -> %08x)\n",(unsigned int)mySymbol,(unsigned int)myPtr);
return myPtr;
//}
return (FUNCS)dlsym(openGLImagePtr, (char *)procName);
}
#define GET_GL_PROC_ADDRESS(name) osxGetProcAddress((GLubyte *)name)
#endif /* TARGET_OS_MAC */
void Alert(const char /* *szFormat*/, ...)
{
}
// ARB_multitexture
static void InitExt_ARB_multitexture()
{

View File

@ -153,7 +153,7 @@ void MarkerRepresentation::render(float size) const
#ifndef _MSC_VER
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
#endif
switch (m_symbol)
{

View File

@ -355,7 +355,7 @@ Url::Url(CelestiaCore* core, UrlType type)
#ifndef _MSC_VER
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough="
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
#endif
switch (type) {
case Absolute: // Intentional Fall-Through