Clang Build Fix: Cocoa platform plugin

Fix some assignment from const values to non-const without cast.
Move #import to avoid compile error.
Fix type mismatch.

Change-Id: I93ae5cd07827b92a91093df979992616b26b14af
Reviewed-on: http://codereview.qt-project.org/4536
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
This commit is contained in:
Takumi ASAKI 2011-09-09 12:56:23 +02:00 committed by Morten Johan Sørvig
parent 2cca7e0884
commit 78fd865391
4 changed files with 5 additions and 5 deletions

View File

@ -69,7 +69,7 @@ inline QString qt_mac_NSStringToQString(const NSString *nsstr)
{ return QCFString::toQString(reinterpret_cast<const CFStringRef>(nsstr)); } { return QCFString::toQString(reinterpret_cast<const CFStringRef>(nsstr)); }
inline NSString *qt_mac_QStringToNSString(const QString &qstr) inline NSString *qt_mac_QStringToNSString(const QString &qstr)
{ return [reinterpret_cast<const NSString *>(QCFString::toCFStringRef(qstr)) autorelease]; } { return [const_cast<NSString *>(reinterpret_cast<const NSString *>(QCFString::toCFStringRef(qstr))) autorelease]; }
CGImageRef qt_mac_image_to_cgimage(const QImage &image); CGImageRef qt_mac_image_to_cgimage(const QImage &image);
NSImage *qt_mac_cgimage_to_nsimage(CGImageRef iamge); NSImage *qt_mac_cgimage_to_nsimage(CGImageRef iamge);

View File

@ -53,8 +53,8 @@
// We mean it. // We mean it.
// //
#include <QtCore/private/qcore_mac_p.h>
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#include <QtCore/private/qcore_mac_p.h>
@interface QT_MANGLE_NAMESPACE(QCocoaMenuLoader) : NSResponder @interface QT_MANGLE_NAMESPACE(QCocoaMenuLoader) : NSResponder
{ {

View File

@ -92,7 +92,7 @@ void qt_mac_loadMenuNib(QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *qtMenuLoader)
} }
// Load and instantiate nib file from temp // Load and instantiate nib file from temp
NSURL *nibUrl = [NSURL fileURLWithPath : reinterpret_cast<const NSString *>(QCFString::toCFStringRef(nibDir))]; NSURL *nibUrl = [NSURL fileURLWithPath : const_cast<NSString *>(reinterpret_cast<const NSString *>(QCFString::toCFStringRef(nibDir)))];
[nibUrl autorelease]; [nibUrl autorelease];
NSNib *nib = [[NSNib alloc] initWithContentsOfURL : nibUrl]; NSNib *nib = [[NSNib alloc] initWithContentsOfURL : nibUrl];
[nib autorelease]; [nib autorelease];

View File

@ -133,7 +133,7 @@ void QCocoaWindow::setVisible(bool visible)
void QCocoaWindow::setWindowTitle(const QString &title) void QCocoaWindow::setWindowTitle(const QString &title)
{ {
CFStringRef windowTitle = QCFString::toCFStringRef(title); CFStringRef windowTitle = QCFString::toCFStringRef(title);
[m_nsWindow setTitle: reinterpret_cast<const NSString *>(windowTitle)]; [m_nsWindow setTitle: const_cast<NSString *>(reinterpret_cast<const NSString *>(windowTitle))];
CFRelease(windowTitle); CFRelease(windowTitle);
} }
@ -325,7 +325,7 @@ QNSWindow * QCocoaWindow::createWindow()
// ### crashes // ### crashes
// [panel setFloatingPanel:needFloating]; // [panel setFloatingPanel:needFloating];
// [panel setWorksWhenModal:worksWhenModal]; // [panel setWorksWhenModal:worksWhenModal];
window = panel; window = static_cast<NSWindow *>(panel);
break; break;
} }
default: default: