Remove implicit conversion operator from RString to const char* (macOS)
Tested via CI (don't have a Mac).
This commit is contained in:
@@ -414,7 +414,7 @@ static void ChangeToDirOfExecutable( const RString &argv0 )
|
||||
* through a symlink. Assume this is the case and change to the dir of the symlink. */
|
||||
if( Basename(RageFileManagerUtil::sDirOfExecutable) == "MacOS" )
|
||||
CollapsePath( RageFileManagerUtil::sDirOfExecutable += "/../../../" );
|
||||
if( chdir( RageFileManagerUtil::sDirOfExecutable ) )
|
||||
if( chdir( RageFileManagerUtil::sDirOfExecutable.c_str() ) )
|
||||
#endif
|
||||
{
|
||||
LOG->Warn("Can't set current working directory to %s", RageFileManagerUtil::sDirOfExecutable.c_str());
|
||||
|
||||
@@ -99,7 +99,7 @@ static bool ConvertFromCP( RString &sText, int iCodePage )
|
||||
if( encoding == kCFStringEncodingInvalidId )
|
||||
return false;
|
||||
|
||||
CFStringRef old = CFStringCreateWithCString( kCFAllocatorDefault, sText, encoding );
|
||||
CFStringRef old = CFStringCreateWithCString( kCFAllocatorDefault, sText.c_str(), encoding );
|
||||
|
||||
if( old == nullptr )
|
||||
return false;
|
||||
|
||||
@@ -46,7 +46,7 @@ void DialogDriver_MacOSX::OK( RString sMessage, RString sID )
|
||||
{
|
||||
CFBundleRef bundle = CFBundleGetMainBundle();
|
||||
CFStringRef sDSA = LSTRING( bundle, "Don't show again" );
|
||||
CFOptionFlags result = ShowAlert( kCFUserNotificationNoteAlertLevel, sMessage, CFSTR("OK"), sDSA );
|
||||
CFOptionFlags result = ShowAlert( kCFUserNotificationNoteAlertLevel, sMessage.c_str(), CFSTR("OK"), sDSA );
|
||||
|
||||
CFRelease( sDSA );
|
||||
if( result == kCFUserNotificationAlternateResponse )
|
||||
@@ -55,7 +55,7 @@ void DialogDriver_MacOSX::OK( RString sMessage, RString sID )
|
||||
|
||||
void DialogDriver_MacOSX::Error( RString sError, RString sID )
|
||||
{
|
||||
ShowAlert( kCFUserNotificationStopAlertLevel, sError, CFSTR("OK") );
|
||||
ShowAlert( kCFUserNotificationStopAlertLevel, sError.c_str(), CFSTR("OK") );
|
||||
}
|
||||
|
||||
Dialog::Result DialogDriver_MacOSX::OKCancel( RString sMessage, RString sID )
|
||||
@@ -63,7 +63,7 @@ Dialog::Result DialogDriver_MacOSX::OKCancel( RString sMessage, RString sID )
|
||||
CFBundleRef bundle = CFBundleGetMainBundle();
|
||||
CFStringRef sOK = LSTRING( bundle, "OK" );
|
||||
CFStringRef sCancel = LSTRING( bundle, "Cancel" );
|
||||
CFOptionFlags result = ShowAlert( kCFUserNotificationNoteAlertLevel, sMessage, sOK, sCancel );
|
||||
CFOptionFlags result = ShowAlert( kCFUserNotificationNoteAlertLevel, sMessage.c_str(), sOK, sCancel );
|
||||
|
||||
CFRelease( sOK );
|
||||
CFRelease( sCancel );
|
||||
@@ -85,7 +85,7 @@ Dialog::Result DialogDriver_MacOSX::AbortRetryIgnore( RString sMessage, RString
|
||||
CFStringRef sIgnore = LSTRING( bundle, "Ignore" );
|
||||
CFStringRef sRetry = LSTRING( bundle, "Retry" );
|
||||
CFStringRef sAbort = LSTRING( bundle, "Abort" );
|
||||
CFOptionFlags result = ShowAlert( kCFUserNotificationNoteAlertLevel, sMessage, sIgnore, sRetry, sAbort );
|
||||
CFOptionFlags result = ShowAlert( kCFUserNotificationNoteAlertLevel, sMessage.c_str(), sIgnore, sRetry, sAbort );
|
||||
|
||||
CFRelease( sIgnore );
|
||||
CFRelease( sRetry );
|
||||
@@ -110,7 +110,7 @@ Dialog::Result DialogDriver_MacOSX::AbortRetry( RString sMessage, RString sID )
|
||||
CFBundleRef bundle = CFBundleGetMainBundle();
|
||||
CFStringRef sRetry = LSTRING( bundle, "Retry" );
|
||||
CFStringRef sAbort = LSTRING( bundle, "Abort" );
|
||||
CFOptionFlags result = ShowAlert( kCFUserNotificationNoteAlertLevel, sMessage, sRetry, sAbort );
|
||||
CFOptionFlags result = ShowAlert( kCFUserNotificationNoteAlertLevel, sMessage.c_str(), sRetry, sAbort );
|
||||
|
||||
CFRelease( sRetry );
|
||||
CFRelease( sAbort );
|
||||
@@ -131,7 +131,7 @@ Dialog::Result DialogDriver_MacOSX::YesNo( RString sMessage, RString sID )
|
||||
CFBundleRef bundle = CFBundleGetMainBundle();
|
||||
CFStringRef sYes = LSTRING( bundle, "Yes" );
|
||||
CFStringRef sNo = LSTRING( bundle, "No" );
|
||||
CFOptionFlags result = ShowAlert( kCFUserNotificationNoteAlertLevel, sMessage, sYes, sNo );
|
||||
CFOptionFlags result = ShowAlert( kCFUserNotificationNoteAlertLevel, sMessage.c_str(), sYes, sNo );
|
||||
|
||||
CFRelease( sYes );
|
||||
CFRelease( sNo );
|
||||
|
||||
@@ -325,7 +325,7 @@ void *LowLevelWindow_MacOSX::GetProcAddress( RString s )
|
||||
{
|
||||
// http://developer.apple.com/qa/qa2001/qa1188.html
|
||||
// Both functions mentioned in there are deprecated in 10.4.
|
||||
const RString& symbolName( '_' + s );
|
||||
const RString& symbolName( '_' + s.c_str() );
|
||||
const uint32_t count = _dyld_image_count();
|
||||
NSSymbol symbol = nil;
|
||||
const uint32_t options = NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR;
|
||||
|
||||
@@ -160,7 +160,7 @@ void MemoryCardDriverThreaded_MacOSX::GetUSBStorageDevices( std::vector<UsbStora
|
||||
// Now that we have the disk name, look up the IOServices associated with it.
|
||||
CFMutableDictionaryRef dict;
|
||||
|
||||
if( !(dict = IOBSDNameMatching(kIOMasterPortDefault, 0, sDisk)) )
|
||||
if( !(dict = IOBSDNameMatching(kIOMasterPortDefault, 0, sDisk.c_str())) )
|
||||
continue;
|
||||
|
||||
// Look for certain properties: Leaf, Ejectable, Writable.
|
||||
@@ -229,7 +229,7 @@ void MemoryCardDriverThreaded_MacOSX::GetUSBStorageDevices( std::vector<UsbStora
|
||||
|
||||
bool MemoryCardDriverThreaded_MacOSX::TestWrite( UsbStorageDevice *pDevice )
|
||||
{
|
||||
if( access(pDevice->sOsMountDir, W_OK) )
|
||||
if( access(pDevice->sOsMountDir.c_str(), W_OK) )
|
||||
{
|
||||
pDevice->SetError( "TestFailed" );
|
||||
return false;
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#ifndef DARWIN_CRASH_H
|
||||
#define DARWIN_CRASH_H
|
||||
#include <string>
|
||||
|
||||
namespace CrashHandler
|
||||
{
|
||||
RString GetLogsDirectory();
|
||||
void InformUserOfCrash( const RString& sPath );
|
||||
std::string GetLogsDirectory();
|
||||
void InformUserOfCrash( const std::string& sPath );
|
||||
bool IsDebuggerPresent();
|
||||
void DebugBreak();
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "arch/ArchHooks/ArchHooks.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
|
||||
#include <CoreServices/CoreServices.h>
|
||||
#include <os/log.h>
|
||||
@@ -15,20 +16,21 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
RString CrashHandler::GetLogsDirectory()
|
||||
std::string CrashHandler::GetLogsDirectory()
|
||||
{
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
NSURL *url = [fileManager URLForDirectory:NSLibraryDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:NO error:nil];
|
||||
if (url == nil)
|
||||
return "/tmp";
|
||||
|
||||
return RString([url fileSystemRepresentation]) + "/Logs/" PRODUCT_ID;
|
||||
RString path= RString([url fileSystemRepresentation]) + "/Logs/" PRODUCT_ID;
|
||||
return std::string(path.c_str());
|
||||
}
|
||||
|
||||
// XXX Can we use LocalizedString here instead?
|
||||
#define LSTRING(b,x) CFBundleCopyLocalizedString( (b), CFSTR(x), nullptr, CFSTR("Localizable") )
|
||||
|
||||
void CrashHandler::InformUserOfCrash( const RString& sPath )
|
||||
void CrashHandler::InformUserOfCrash( const std::string& sPath )
|
||||
{
|
||||
CFBundleRef bundle = CFBundleGetMainBundle();
|
||||
CFStringRef sAlternate = LSTRING( bundle, "Quit " PRODUCT_FAMILY );
|
||||
|
||||
@@ -59,7 +59,7 @@ bool GetThreadBacktraceContext( uint64_t iID, BacktraceContext *ctx )
|
||||
#endif
|
||||
}
|
||||
|
||||
RString SetThreadPrecedence( float prec )
|
||||
const char* SetThreadPrecedence( float prec )
|
||||
{
|
||||
// Real values are between 0 and 63.
|
||||
DEBUG_ASSERT( 0.0f <= prec && prec <= 1.0f );
|
||||
@@ -69,7 +69,7 @@ RString SetThreadPrecedence( float prec )
|
||||
|
||||
if( ret != KERN_SUCCESS )
|
||||
return mach_error_string( ret );
|
||||
return RString();
|
||||
return "";
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -23,7 +23,7 @@ uint64_t GetCurrentThreadId();
|
||||
* Valid values for the thread are from 0.0f to 1.0f.
|
||||
* 0.5f is the default.
|
||||
* @param prec the precedence to set. */
|
||||
RString SetThreadPrecedence( float prec );
|
||||
const char* SetThreadPrecedence( float prec );
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <IOKit/hid/IOHIDLib.h>
|
||||
@@ -72,7 +73,7 @@ private:
|
||||
IOHIDDeviceInterface **m_Interface;
|
||||
IOHIDQueueInterface **m_Queue;
|
||||
bool m_bRunning;
|
||||
RString m_sDescription;
|
||||
std::string m_sDescription;
|
||||
|
||||
static void AddLogicalDevice( const void *value, void *context );
|
||||
static void AddElement( const void *value, void *context );
|
||||
@@ -112,7 +113,7 @@ public:
|
||||
|
||||
bool Open( io_object_t device );
|
||||
void StartQueue( CFRunLoopRef loopRef, IOHIDCallbackFunction callback, void *target );
|
||||
inline const RString& GetDescription() const { return m_sDescription; }
|
||||
inline const std::string& GetDescription() const { return m_sDescription; }
|
||||
|
||||
/* Add button presses (or releases) to vPresses for the given cookie. More
|
||||
* than one DeviceInput can be added at a time. For example, Two axes
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#ifndef SPECIAL_DIRS_H
|
||||
#define SPECIAL_DIRS_H
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace SpecialDirs
|
||||
{
|
||||
RString GetDesktopDir();
|
||||
std::string GetDesktopDir();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,16 +2,18 @@
|
||||
#include "SpecialDirs.h"
|
||||
#include "ProductInfo.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
RString SpecialDirs::GetDesktopDir()
|
||||
std::string SpecialDirs::GetDesktopDir()
|
||||
{
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
NSURL *url = [fileManager URLForDirectory:NSDesktopDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:NO error:nil];
|
||||
if (url == nil)
|
||||
return "/tmp";
|
||||
|
||||
return RString([url fileSystemRepresentation]) + "/" PRODUCT_ID;
|
||||
return std::string([url fileSystemRepresentation]) + "/" PRODUCT_ID;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user