From 2e2e6e642494dca10b6d101088b8c5237d05f036 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 8 Sep 2010 12:52:18 +0200 Subject: Don't assing 'const Foo*' to a 'Foo*' Reviewed-by: Olivier Goffart --- src/gui/dialogs/qfontdialog_mac.mm | 4 ++-- src/gui/kernel/qcocoamenuloader_mac.mm | 8 ++++---- src/gui/kernel/qcocoaview_mac.mm | 2 +- src/gui/kernel/qt_cocoa_helpers_mac.mm | 8 ++++---- src/gui/kernel/qwidget_mac.mm | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/gui/dialogs/qfontdialog_mac.mm b/src/gui/dialogs/qfontdialog_mac.mm index 9c63dfa..6fb363b 100644 --- a/src/gui/dialogs/qfontdialog_mac.mm +++ b/src/gui/dialogs/qfontdialog_mac.mm @@ -496,7 +496,7 @@ void QFontDialogPrivate::setFont(void *delegate, const QFont &font) QMacCocoaAutoReleasePool pool; QFontEngine *fe = font.d->engineForScript(QUnicodeTables::Common); NSFontManager *mgr = [NSFontManager sharedFontManager]; - NSFont *nsFont = 0; + const NSFont *nsFont = 0; #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 if (qstrcmp(fe->name(), "CoreText") == 0) { @@ -522,7 +522,7 @@ void QFontDialogPrivate::setFont(void *delegate, const QFont &font) size:fontInfo.pointSize()]; } - [mgr setSelectedFont:nsFont isMultiple:NO]; + [mgr setSelectedFont:const_cast(nsFont) isMultiple:NO]; [static_cast(delegate) setQtFont:font]; } diff --git a/src/gui/kernel/qcocoamenuloader_mac.mm b/src/gui/kernel/qcocoamenuloader_mac.mm index 8d38f45..6ee4277 100644 --- a/src/gui/kernel/qcocoamenuloader_mac.mm +++ b/src/gui/kernel/qcocoamenuloader_mac.mm @@ -70,13 +70,13 @@ QT_USE_NAMESPACE showAllItem = [[appMenu itemWithTitle:@"Show All"] retain]; // Get the names in the nib to match the app name set by Qt. - NSString *appName = reinterpret_cast(QCFString::toCFStringRef(qAppName())); + const NSString *appName = reinterpret_cast(QCFString::toCFStringRef(qAppName())); [quitItem setTitle:[[quitItem title] stringByReplacingOccurrencesOfString:@"NewApplication" - withString:appName]]; + withString:const_cast(appName)]]; [hideItem setTitle:[[hideItem title] stringByReplacingOccurrencesOfString:@"NewApplication" - withString:appName]]; + withString:const_cast(appName)]]; [aboutItem setTitle:[[aboutItem title] stringByReplacingOccurrencesOfString:@"NewApplication" - withString:appName]]; + withString:const_cast(appName)]]; [appName release]; // Disable the items that don't do anything. If someone associates a QAction with them // They should get synced back in. diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 2016d40..49f7d7f 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -1417,7 +1417,7 @@ static int qCocoaViewCount = 0; if (!selectedText.isEmpty()) { QCFString string(selectedText.mid(theRange.location, theRange.length)); const NSString *tmpString = reinterpret_cast((CFStringRef)string); - return [[[NSAttributedString alloc] initWithString:tmpString] autorelease]; + return [[[NSAttributedString alloc] initWithString:const_cast(tmpString)] autorelease]; } else { return nil; } diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index cce9daa..5a522f9 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -1365,11 +1365,11 @@ QString qt_mac_get_pasteboardString(OSPasteboardRef paste) QMacCocoaAutoReleasePool pool; NSPasteboard *pb = nil; CFStringRef pbname; - if (PasteboardCopyName (paste, &pbname)) { - pb = [NSPasteboard generalPasteboard]; + if (PasteboardCopyName(paste, &pbname) == noErr) { + pb = [NSPasteboard pasteboardWithName:const_cast(reinterpret_cast(pbname))]; + CFRelease(pbname); } else { - pb = [NSPasteboard pasteboardWithName:reinterpret_cast(pbname)]; - CFRelease (pbname); + pb = [NSPasteboard generalPasteboard]; } if (pb) { NSString *text = [pb stringForType:NSStringPboardType]; diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 5e41efa..017541c 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -3176,7 +3176,7 @@ void QWidgetPrivate::setWindowIcon_sys(bool forceReset) if (iconButton == nil) { QCFString string(q->windowTitle()); const NSString *tmpString = reinterpret_cast((CFStringRef)string); - [qt_mac_window_for(q) setRepresentedURL:[NSURL fileURLWithPath:tmpString]]; + [qt_mac_window_for(q) setRepresentedURL:[NSURL fileURLWithPath:const_cast(tmpString)]]; iconButton = [qt_mac_window_for(q) standardWindowButton:NSWindowDocumentIconButton]; } if (icon.isNull()) { -- cgit v0.12