Remove global "using namespace std;" declarations, use "std::" prefixes on all std elements

Fix whitespace changes
This commit is contained in:
Michael Sundqvist
2022-07-31 22:14:38 +02:00
committed by Martin Natano
parent f0680a29fc
commit 0cba3579de
534 changed files with 3456 additions and 3488 deletions
+1 -1
View File
@@ -105,7 +105,7 @@ bool ArchHooks_Win32::CheckForMultipleInstances(int argc, char* argv[])
SetForegroundWindow( hWnd );
// Send the command line to the existing window.
vector<RString> vsArgs;
std::vector<RString> vsArgs;
for( int i=0; i<argc; i++ )
vsArgs.push_back( argv[i] );
RString sAllArgs = join("|", vsArgs);
+1 -1
View File
@@ -44,7 +44,7 @@ static RString GetMountDir( const RString &sDirOfExecutable )
{
/* All Windows data goes in the directory one level above the executable. */
CHECKPOINT_M( ssprintf( "DOE \"%s\"", sDirOfExecutable.c_str()) );
vector<RString> asParts;
std::vector<RString> asParts;
split( sDirOfExecutable, "/", asParts );
CHECKPOINT_M( ssprintf( "... %i asParts", asParts.size()) );
ASSERT_M( asParts.size() > 1, ssprintf("Strange sDirOfExecutable: %s", sDirOfExecutable.c_str()) );
+3 -3
View File
@@ -15,7 +15,7 @@ static Preference<RString> g_sIgnoredDialogs( "IgnoredDialogs", "" );
DialogDriver *MakeDialogDriver()
{
RString sDrivers = "win32,cocoa,null";
vector<RString> asDriversToTry;
std::vector<RString> asDriversToTry;
split( sDrivers, ",", asDriversToTry, true );
ASSERT( asDriversToTry.size() != 0 );
@@ -83,7 +83,7 @@ void Dialog::Shutdown()
static bool MessageIsIgnored( RString sID )
{
#if !defined(SMPACKAGE)
vector<RString> asList;
std::vector<RString> asList;
split( g_sIgnoredDialogs, ",", asList );
for( unsigned i = 0; i < asList.size(); ++i )
if( !sID.CompareNoCase(asList[i]) )
@@ -109,7 +109,7 @@ void Dialog::IgnoreMessage( RString sID )
if( MessageIsIgnored(sID) )
return;
vector<RString> asList;
std::vector<RString> asList;
split( g_sIgnoredDialogs, ",", asList );
asList.push_back( sID );
g_sIgnoredDialogs.Set( join(",",asList) );
+4 -4
View File
@@ -3,11 +3,11 @@
#include "RageLog.h"
map<istring, CreateDialogDriverFn> *RegisterDialogDriver::g_pRegistrees;
std::map<istring, CreateDialogDriverFn> *RegisterDialogDriver::g_pRegistrees;
RegisterDialogDriver::RegisterDialogDriver( const istring &sName, CreateDialogDriverFn pfn )
{
if( g_pRegistrees == nullptr )
g_pRegistrees = new map<istring, CreateDialogDriverFn>;
g_pRegistrees = new std::map<istring, CreateDialogDriverFn>;
ASSERT( g_pRegistrees->find(sName) == g_pRegistrees->end() );
(*g_pRegistrees)[sName] = pfn;
@@ -18,14 +18,14 @@ REGISTER_DIALOG_DRIVER_CLASS( Null );
DialogDriver *DialogDriver::Create()
{
RString sDrivers = "win32,macosx,null";
vector<RString> asDriversToTry;
std::vector<RString> asDriversToTry;
split( sDrivers, ",", asDriversToTry, true );
ASSERT( asDriversToTry.size() != 0 );
for (RString const &Driver : asDriversToTry)
{
map<istring, CreateDialogDriverFn>::const_iterator iter = RegisterDialogDriver::g_pRegistrees->find( istring(Driver) );
std::map<istring, CreateDialogDriverFn>::const_iterator iter = RegisterDialogDriver::g_pRegistrees->find( istring(Driver) );
if( iter == RegisterDialogDriver::g_pRegistrees->end() )
continue;
+1 -1
View File
@@ -25,7 +25,7 @@ class DialogDriver_Null : public DialogDriver { };
typedef DialogDriver *(*CreateDialogDriverFn)();
struct RegisterDialogDriver
{
static map<istring, CreateDialogDriverFn> *g_pRegistrees;
static std::map<istring, CreateDialogDriverFn> *g_pRegistrees;
RegisterDialogDriver( const istring &sName, CreateDialogDriverFn pfn );
};
#define REGISTER_DIALOG_DRIVER_CLASS( name ) \
+1 -1
View File
@@ -28,7 +28,7 @@ static CFOptionFlags ShowAlert( CFOptionFlags flags, const RString& sMessage, CF
// Flush all input that's accumulated while the dialog box was up.
if( INPUTFILTER )
{
vector<InputEvent> dummy;
std::vector<InputEvent> dummy;
INPUTFILTER->Reset();
INPUTFILTER->GetInputEvents( dummy );
}
+4 -4
View File
@@ -133,7 +133,7 @@ RString InputHandler::GetDeviceSpecificInputString( const DeviceInput &di )
wchar_t c = DeviceButtonToChar( di.button, false );
if( c && c != L' ' ) // Don't show "Key " for space.
return InputDeviceToString( di.device ) + " " + Capitalize( WStringToRString(wstring()+c) );
return InputDeviceToString( di.device ) + " " + Capitalize( WStringToRString(std::wstring()+c) );
}
RString s = DeviceButtonToString( di.button );
@@ -162,7 +162,7 @@ RString InputHandler::GetLocalizedInputString( const DeviceInput &di )
default:
wchar_t c = DeviceButtonToChar( di.button, false );
if( c && c != L' ' ) // Don't show "Key " for space.
return Capitalize( WStringToRString(wstring()+c) );
return Capitalize( WStringToRString(std::wstring()+c) );
return DeviceButtonToString( di.button );
}
@@ -171,10 +171,10 @@ RString InputHandler::GetLocalizedInputString( const DeviceInput &di )
DriverList InputHandler::m_pDriverList;
static LocalizedString INPUT_HANDLERS_EMPTY( "Arch", "Input Handlers cannot be empty." );
void InputHandler::Create( const RString &drivers_, vector<InputHandler *> &Add )
void InputHandler::Create( const RString &drivers_, std::vector<InputHandler *> &Add )
{
const RString drivers = drivers_.empty()? RString(DEFAULT_INPUT_DRIVER_LIST):drivers_;
vector<RString> DriversToTry;
std::vector<RString> DriversToTry;
split( drivers, ",", DriversToTry, true );
if( DriversToTry.empty() )
+2 -2
View File
@@ -22,14 +22,14 @@
class InputHandler: public RageDriver
{
public:
static void Create( const RString &sDrivers, vector<InputHandler *> &apAdd );
static void Create( const RString &sDrivers, std::vector<InputHandler *> &apAdd );
static DriverList m_pDriverList;
InputHandler(): m_LastUpdate(), m_iInputsSinceUpdate(0) {}
virtual ~InputHandler() { }
virtual void Update() { }
virtual bool DevicesChanged() { return false; }
virtual void GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut ) = 0;
virtual void GetDevicesAndDescriptions( std::vector<InputDeviceInfo>& vDevicesOut ) = 0;
// Override to return a pretty string that's specific to the controller type.
virtual RString GetDeviceSpecificInputString( const DeviceInput &di );
@@ -32,8 +32,8 @@
REGISTER_INPUT_HANDLER_CLASS2( DirectInput, DInput );
static vector<DIDevice> Devices;
static vector<XIDevice> XDevices;
static std::vector<DIDevice> Devices;
static std::vector<XIDevice> XDevices;
// Number of joysticks found:
static int g_iNumJoysticks;
@@ -505,8 +505,8 @@ void InputHandler_DInput::UpdatePolled( DIDevice &device, const RageTimer &tm )
if( neg != DeviceButton_Invalid )
{
float l = SCALE( int(val), 0.0f, 100.0f, 0.0f, 1.0f );
ButtonPressed( DeviceInput(dev, neg, max(-l,0), tm) );
ButtonPressed( DeviceInput(dev, pos, max(+l,0), tm) );
ButtonPressed( DeviceInput(dev, neg, std::max(-l, 0.0f), tm) );
ButtonPressed( DeviceInput(dev, pos, std::max(+l, 0.0f), tm) );
}
break;
@@ -752,8 +752,8 @@ void InputHandler_DInput::UpdateBuffered( DIDevice &device, const RageTimer &tm
}
else
{
ButtonPressed( DeviceInput(dev, up, max(-l,0), tm) );
ButtonPressed( DeviceInput(dev, down, max(+l,0), tm) );
ButtonPressed( DeviceInput(dev, up, std::max(-l, 0.0f), tm) );
ButtonPressed( DeviceInput(dev, down, std::max(+l, 0.0f), tm) );
}
}
break;
@@ -777,8 +777,6 @@ const short XINPUT_GAMEPAD_THUMB_MAX = MAXSHORT;
void InputHandler_DInput::UpdateXInput( XIDevice &device, const RageTimer &tm )
{
using std::max;
XINPUT_STATE state;
ZeroMemory(&state, sizeof(XINPUT_STATE));
if (XInputGetState(device.m_dwXInputSlot, &state) == ERROR_SUCCESS)
@@ -791,10 +789,10 @@ void InputHandler_DInput::UpdateXInput( XIDevice &device, const RageTimer &tm )
lx = SCALE(state.Gamepad.sThumbLX + 0.f, XINPUT_GAMEPAD_THUMB_MIN + 0.f, XINPUT_GAMEPAD_THUMB_MAX + 0.f, -1.0f, 1.0f);
ly = SCALE(state.Gamepad.sThumbLY + 0.f, XINPUT_GAMEPAD_THUMB_MIN + 0.f, XINPUT_GAMEPAD_THUMB_MAX + 0.f, -1.0f, 1.0f);
}
ButtonPressed(DeviceInput(device.dev, JOY_LEFT, max(-lx, 0.f), tm));
ButtonPressed(DeviceInput(device.dev, JOY_RIGHT, max(+lx, 0.f), tm));
ButtonPressed(DeviceInput(device.dev, JOY_UP, max(+ly, 0.f), tm));
ButtonPressed(DeviceInput(device.dev, JOY_DOWN, max(-ly, 0.f), tm));
ButtonPressed(DeviceInput(device.dev, JOY_LEFT, std::max(-lx, 0.f), tm));
ButtonPressed(DeviceInput(device.dev, JOY_RIGHT, std::max(+lx, 0.f), tm));
ButtonPressed(DeviceInput(device.dev, JOY_UP, std::max(+ly, 0.f), tm));
ButtonPressed(DeviceInput(device.dev, JOY_DOWN, std::max(-ly, 0.f), tm));
float rx = 0.f;
float ry = 0.f;
@@ -803,10 +801,10 @@ void InputHandler_DInput::UpdateXInput( XIDevice &device, const RageTimer &tm )
rx = SCALE(state.Gamepad.sThumbRX + 0.f, XINPUT_GAMEPAD_THUMB_MIN + 0.f, XINPUT_GAMEPAD_THUMB_MAX + 0.f, -1.0f, 1.0f);
ry = SCALE(state.Gamepad.sThumbRY + 0.f, XINPUT_GAMEPAD_THUMB_MIN + 0.f, XINPUT_GAMEPAD_THUMB_MAX + 0.f, -1.0f, 1.0f);
}
ButtonPressed(DeviceInput(device.dev, JOY_LEFT_2, max(-rx, 0.f), tm));
ButtonPressed(DeviceInput(device.dev, JOY_RIGHT_2, max(+rx, 0.f), tm));
ButtonPressed(DeviceInput(device.dev, JOY_UP_2, max(+ry, 0.f), tm));
ButtonPressed(DeviceInput(device.dev, JOY_DOWN_2, max(-ry, 0.f), tm));
ButtonPressed(DeviceInput(device.dev, JOY_LEFT_2, std::max(-rx, 0.f), tm));
ButtonPressed(DeviceInput(device.dev, JOY_RIGHT_2, std::max(+rx, 0.f), tm));
ButtonPressed(DeviceInput(device.dev, JOY_UP_2, std::max(+ry, 0.f), tm));
ButtonPressed(DeviceInput(device.dev, JOY_DOWN_2, std::max(-ry, 0.f), tm));
// map buttons
ButtonPressed(DeviceInput(device.dev, JOY_BUTTON_1, !!(state.Gamepad.wButtons & XINPUT_GAMEPAD_A), tm));
@@ -944,7 +942,7 @@ void InputHandler_DInput::InputThreadMain()
// Enable priority boosting.
SetThreadPriorityBoost( GetCurrentThread(), FALSE );
vector<DIDevice*> BufferedDevices;
std::vector<DIDevice*> BufferedDevices;
HANDLE Handle = CreateEvent( nullptr, FALSE, FALSE, nullptr );
for( unsigned i = 0; i < Devices.size(); ++i )
{
@@ -1002,7 +1000,7 @@ void InputHandler_DInput::InputThreadMain()
CloseHandle(Handle);
}
void InputHandler_DInput::GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut )
void InputHandler_DInput::GetDevicesAndDescriptions( std::vector<InputDeviceInfo>& vDevicesOut )
{
for( unsigned i=0; i < XDevices.size(); ++i )
vDevicesOut.push_back( InputDeviceInfo(XDevices[i].dev, XDevices[i].m_sName ) );
@@ -11,7 +11,7 @@ class InputHandler_DInput: public InputHandler
public:
InputHandler_DInput();
~InputHandler_DInput();
void GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut );
void GetDevicesAndDescriptions( std::vector<InputDeviceInfo>& vDevicesOut );
wchar_t DeviceButtonToChar( DeviceButton button, bool bUseCurrentKeyModifiers );
void Update();
bool DevicesChanged();
@@ -44,7 +44,7 @@ struct DIDevice
bool buffered;
int buttons, axes, hats;
vector<input_t> Inputs;
std::vector<input_t> Inputs;
InputDevice dev;
DIDevice();
@@ -67,7 +67,7 @@ struct EventDevice
DeviceButton aiAbsMappingLow[ABS_MAX];
};
static vector<EventDevice *> g_apEventDevices;
static std::vector<EventDevice *> g_apEventDevices;
static bool BitIsSet( const uint8_t *pArray, uint32_t iBit )
{
@@ -153,7 +153,7 @@ bool EventDevice::Open( RString sFile, InputDevice dev )
LOG->Warn( "ioctl(EV_MAX): %s", strerror(errno) );
{
vector<RString> setEventTypes;
std::vector<RString> setEventTypes;
if( BitIsSet(iEventTypes, EV_SYN) ) setEventTypes.push_back( "syn" );
if( BitIsSet(iEventTypes, EV_KEY) ) setEventTypes.push_back( "key" );
@@ -347,7 +347,7 @@ void InputHandler_Linux_Event::InputThread()
continue;
FD_SET( iFD, &fdset );
iMaxFD = max( iMaxFD, iFD );
iMaxFD = std::max( iMaxFD, iFD );
}
if( iMaxFD == -1 )
@@ -414,8 +414,8 @@ void InputHandler_Linux_Event::InputThread()
}
else
{
ButtonPressed( DeviceInput(g_apEventDevices[i]->m_Dev, neg, max(-l,0), now) );
ButtonPressed( DeviceInput(g_apEventDevices[i]->m_Dev, pos, max(+l,0), now) );
ButtonPressed( DeviceInput(g_apEventDevices[i]->m_Dev, neg, std::max(-l, 0.0f), now) );
ButtonPressed( DeviceInput(g_apEventDevices[i]->m_Dev, pos, std::max(+l, 0.0f), now) );
}
break;
}
@@ -428,7 +428,7 @@ void InputHandler_Linux_Event::InputThread()
InputHandler::UpdateTimer();
}
void InputHandler_Linux_Event::GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut )
void InputHandler_Linux_Event::GetDevicesAndDescriptions( std::vector<InputDeviceInfo>& vDevicesOut )
{
for( unsigned i = 0; i < g_apEventDevices.size(); ++i )
{
@@ -14,7 +14,7 @@ public:
~InputHandler_Linux_Event();
bool TryDevice(RString devfile);
bool DevicesChanged() { return m_bDevicesChanged; }
void GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut );
void GetDevicesAndDescriptions( std::vector<InputDeviceInfo>& vDevicesOut );
private:
void StartThread();
@@ -119,7 +119,7 @@ void InputHandler_Linux_Joystick::InputThread()
continue;
FD_SET(fds[i], &fdset);
max_fd = max(max_fd, fds[i]);
max_fd = std::max(max_fd, fds[i]);
}
if(max_fd == -1)
@@ -174,8 +174,8 @@ void InputHandler_Linux_Joystick::InputThread()
DeviceButton neg = enum_add2(JOY_LEFT, 2*event.number);
DeviceButton pos = enum_add2(JOY_RIGHT, 2*event.number);
float l = SCALE( int(event.value), 0.0f, 32767, 0.0f, 1.0f );
ButtonPressed( DeviceInput(id, neg, max(-l,0), now) );
ButtonPressed( DeviceInput(id, pos, max(+l,0), now) );
ButtonPressed( DeviceInput(id, neg, std::max(-l, 0.0f), now) );
ButtonPressed( DeviceInput(id, pos, std::max(+l, 0.0f), now) );
break;
}
@@ -193,7 +193,7 @@ void InputHandler_Linux_Joystick::InputThread()
InputHandler::UpdateTimer();
}
void InputHandler_Linux_Joystick::GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut )
void InputHandler_Linux_Joystick::GetDevicesAndDescriptions( std::vector<InputDeviceInfo>& vDevicesOut )
{
// HACK: If IH_Linux_Joystick is constructed before IH_Linux_Event, our thread won't be started
// as part of the constructor. This isn't called until all InputHandlers have been constructed,
@@ -13,7 +13,7 @@ public:
~InputHandler_Linux_Joystick();
bool TryDevice(RString dev);
bool DevicesChanged() { return m_bDevicesChanged; }
void GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut );
void GetDevicesAndDescriptions( std::vector<InputDeviceInfo>& vDevicesOut );
private:
void StartThread();
@@ -132,7 +132,7 @@ void InputHandler_Linux_PIUIO::InputThread()
InputHandler::UpdateTimer();
}
void InputHandler_Linux_PIUIO::GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut )
void InputHandler_Linux_PIUIO::GetDevicesAndDescriptions( std::vector<InputDeviceInfo>& vDevicesOut )
{
vDevicesOut.push_back( InputDeviceInfo(InputDevice(DEVICE_PIUIO), "PIUIO") );
}
@@ -10,7 +10,7 @@ class InputHandler_Linux_PIUIO: public InputHandler
public:
InputHandler_Linux_PIUIO();
~InputHandler_Linux_PIUIO();
void GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut );
void GetDevicesAndDescriptions( std::vector<InputDeviceInfo>& vDevicesOut );
private:
static int InputThread_Start( void *p );
@@ -12,12 +12,12 @@ class HIDDevice;
class InputHandler_MacOSX_HID : public InputHandler
{
private:
vector<HIDDevice *> m_vDevices;
std::vector<HIDDevice *> m_vDevices;
RageThread m_InputThread;
RageSemaphore m_Sem;
CFRunLoopRef m_LoopRef;
CFRunLoopSourceRef m_SourceRef;
vector<io_iterator_t> m_vIters; // We don't really care about these but they need to stick around
std::vector<io_iterator_t> m_vIters; // We don't really care about these but they need to stick around
IONotificationPortRef m_NotifyPort;
RageMutex m_ChangeLock;
bool m_bChanged;
@@ -33,7 +33,7 @@ public:
~InputHandler_MacOSX_HID();
bool DevicesChanged() { LockMut( m_ChangeLock ); return m_bChanged; }
void GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut );
void GetDevicesAndDescriptions( std::vector<InputDeviceInfo>& vDevicesOut );
RString GetDeviceSpecificInputString( const DeviceInput &di );
wchar_t DeviceButtonToChar( DeviceButton button, bool bUseCurrentKeyModifiers );
static void QueueCallback( void *target, int result, void *refcon, void *sender );
@@ -24,7 +24,7 @@ void InputHandler_MacOSX_HID::QueueCallback( void *target, int result, void *ref
IOHIDEventStruct event;
AbsoluteTime zeroTime = { 0, 0 };
HIDDevice *dev = static_cast<HIDDevice*>(refcon);
vector<DeviceInput> vPresses;
std::vector<DeviceInput> vPresses;
while( (result = CALL(queue, getNextEvent, &event, zeroTime, 0)) == kIOReturnSuccess )
{
@@ -271,7 +271,7 @@ InputHandler_MacOSX_HID::InputHandler_MacOSX_HID() : m_Sem( "Input thread starte
}
}
void InputHandler_MacOSX_HID::GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevices )
void InputHandler_MacOSX_HID::GetDevicesAndDescriptions( std::vector<InputDeviceInfo>& vDevices )
{
for (HIDDevice *i : m_vDevices)
i->GetDevicesAndDescriptions( vDevices );
@@ -13,7 +13,7 @@ InputHandler_MonkeyKeyboard::~InputHandler_MonkeyKeyboard()
{
}
void InputHandler_MonkeyKeyboard::GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut )
void InputHandler_MonkeyKeyboard::GetDevicesAndDescriptions( std::vector<InputDeviceInfo>& vDevicesOut )
{
vDevicesOut.push_back( InputDeviceInfo(DEVICE_KEYBOARD, "MonkeyKeyboard") );
}
@@ -11,7 +11,7 @@ public:
void Update();
InputHandler_MonkeyKeyboard();
~InputHandler_MonkeyKeyboard();
void GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut );
void GetDevicesAndDescriptions( std::vector<InputDeviceInfo>& vDevicesOut );
private:
RageTimer m_timerPressButton;
@@ -18,7 +18,7 @@ public:
InputHandler_NSEvent();
~InputHandler_NSEvent();
void GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut );
void GetDevicesAndDescriptions( std::vector<InputDeviceInfo>& vDevicesOut );
};
#endif /* InputHandler_NSEvent_hpp */
@@ -193,7 +193,7 @@ InputHandler_NSEvent::~InputHandler_NSEvent()
{
}
void InputHandler_NSEvent::GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut )
void InputHandler_NSEvent::GetDevicesAndDescriptions( std::vector<InputDeviceInfo>& vDevicesOut )
{
vDevicesOut.push_back(InputDeviceInfo(DEVICE_KEYBOARD, "NSEventKeyboard"));
}
@@ -9,8 +9,6 @@
#include <cstdio>
#include <cstring>
using namespace std;
// In so many words, ceil(n/6).
#define NUMBER_OF_SEXTETS_FOR_BIT_COUNT(n) (((n) + 5) / 6)
@@ -180,7 +178,7 @@ class InputHandler_SextetStream::Impl
}
}
void GetDevicesAndDescriptions(vector<InputDeviceInfo>& vDevicesOut)
void GetDevicesAndDescriptions(std::vector<InputDeviceInfo>& vDevicesOut)
{
vDevicesOut.push_back(InputDeviceInfo(FIRST_DEVICE, "SextetStream"));
}
@@ -292,7 +290,7 @@ class InputHandler_SextetStream::Impl
}
};
void InputHandler_SextetStream::GetDevicesAndDescriptions(vector<InputDeviceInfo>& vDevicesOut)
void InputHandler_SextetStream::GetDevicesAndDescriptions(std::vector<InputDeviceInfo>& vDevicesOut)
{
if(_impl != nullptr) {
_impl->GetDevicesAndDescriptions(vDevicesOut);
@@ -9,7 +9,7 @@ class InputHandler_SextetStream: public InputHandler
public:
InputHandler_SextetStream();
~InputHandler_SextetStream();
void GetDevicesAndDescriptions(vector<InputDeviceInfo>& vDevicesOut);
void GetDevicesAndDescriptions(std::vector<InputDeviceInfo>& vDevicesOut);
public:
class Impl;
@@ -67,7 +67,7 @@ InputHandler_Win32_MIDI::~InputHandler_Win32_MIDI()
}
}
void InputHandler_Win32_MIDI::GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut )
void InputHandler_Win32_MIDI::GetDevicesAndDescriptions( std::vector<InputDeviceInfo>& vDevicesOut )
{
if( m_bFoundDevice )
{
@@ -10,7 +10,7 @@ public:
InputHandler_Win32_MIDI();
~InputHandler_Win32_MIDI();
void GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut );
void GetDevicesAndDescriptions( std::vector<InputDeviceInfo>& vDevicesOut );
void SetDev( DeviceInput key ) { ButtonPressed( key ); }
@@ -39,7 +39,7 @@ InputHandler_Win32_Para::InputHandler_Win32_Para()
SAFE_DELETE( dev );
}
void InputHandler_Win32_Para::GetDevicesAndDescriptions(vector<InputDeviceInfo>& vDevicesOut )
void InputHandler_Win32_Para::GetDevicesAndDescriptions(std::vector<InputDeviceInfo>& vDevicesOut )
{
// The device appears as a HID joystick
}
@@ -9,7 +9,7 @@ class InputHandler_Win32_Para: public InputHandler
{
public:
InputHandler_Win32_Para();
void GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut );
void GetDevicesAndDescriptions( std::vector<InputDeviceInfo>& vDevicesOut );
};
#endif
@@ -100,7 +100,7 @@ RString InputHandler_Win32_Pump::GetDeviceSpecificInputString( const DeviceInput
return InputHandler::GetDeviceSpecificInputString( di );
}
void InputHandler_Win32_Pump::GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut )
void InputHandler_Win32_Pump::GetDevicesAndDescriptions( std::vector<InputDeviceInfo>& vDevicesOut )
{
for(int i = 0; i < NUM_PUMPS; ++i)
{
@@ -125,7 +125,7 @@ void InputHandler_Win32_Pump::InputThreadMain()
/* Enable priority boosting. */
SetThreadPriorityBoost( GetCurrentThread(), FALSE );
vector<WindowsFileIO *> apSources;
std::vector<WindowsFileIO *> apSources;
for( int i = 0; i < NUM_PUMPS; ++i )
{
if( m_pDevice[i].m_IO.IsOpen() )
@@ -12,7 +12,7 @@ public:
InputHandler_Win32_Pump();
~InputHandler_Win32_Pump();
RString GetDeviceSpecificInputString( const DeviceInput &di );
void GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut );
void GetDevicesAndDescriptions( std::vector<InputDeviceInfo>& vDevicesOut );
private:
USBDevice *m_pDevice;
@@ -54,7 +54,7 @@ InputHandler_Win32_RTIO::~InputHandler_Win32_RTIO()
rtio_.Disconnect();
}
void InputHandler_Win32_RTIO::GetDevicesAndDescriptions(vector<InputDeviceInfo>& vDevicesOut)
void InputHandler_Win32_RTIO::GetDevicesAndDescriptions(std::vector<InputDeviceInfo>& vDevicesOut)
{
// We use a joystick device so we can get automatic input mapping
vDevicesOut.push_back(InputDeviceInfo(InputDevice(DEVICE_JOY1), "Raw Thrills I/O"));
@@ -404,7 +404,7 @@ void InputHandler_Win32_RTIO::HandleCounterAck(const std::string &msg)
if (ack_num == 0 && counter_state_ == COUNTER_STATE_RECV_2) {
counter_state_ = COUNTER_STATE_SEND_1;
counter_cycles_pending_ = max(counter_cycles_pending_ - 1, 0);
counter_cycles_pending_ = std::max(counter_cycles_pending_ - 1, 0);
return;
}
@@ -658,8 +658,8 @@ int SerialDevice::Read(char *buffer, int buffer_size)
ResetOverlapped(&read_overlapped_);
DWORD read_size = min(stat.cbInQue, (DWORD)read_buffer_size_);
read_size = min(read_size, (DWORD)buffer_size);
DWORD read_size = std::min(stat.cbInQue, (DWORD)read_buffer_size_);
read_size = std::min(read_size, (DWORD)buffer_size);
DWORD bytes_transferred;
if (!ReadFile(com_handle_, buffer, read_size, &bytes_transferred, &read_overlapped_)) {
@@ -682,7 +682,7 @@ int SerialDevice::Read(char *buffer, int buffer_size)
int SerialDevice::Write(const char *buffer, int buffer_size)
{
DWORD bytes_transferred;
DWORD write_size = min((DWORD)buffer_size, (DWORD)write_buffer_size_);
DWORD write_size = std::min((DWORD) buffer_size, (DWORD) write_buffer_size_);
ResetOverlapped(&write_overlapped_);
@@ -83,7 +83,7 @@ class InputHandler_Win32_RTIO : public InputHandler
public:
InputHandler_Win32_RTIO();
~InputHandler_Win32_RTIO();
void GetDevicesAndDescriptions(vector<InputDeviceInfo>& vDevicesOut);
void GetDevicesAndDescriptions(std::vector<InputDeviceInfo>& vDevicesOut);
RString GetDeviceSpecificInputString(const DeviceInput &di);
static int InputThread_Start(void *this_ptr);
@@ -247,7 +247,7 @@ RString InputHandler_Win32_ddrio::GetDeviceSpecificInputString( const DeviceInpu
return InputHandler::GetDeviceSpecificInputString(di);
}
void InputHandler_Win32_ddrio::GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut )
void InputHandler_Win32_ddrio::GetDevicesAndDescriptions( std::vector<InputDeviceInfo>& vDevicesOut )
{
// We use a joystick device so we can get automatic input mapping
vDevicesOut.push_back(InputDeviceInfo(InputDevice(DDRIO_DEVICEID), "ddrio"));
@@ -66,7 +66,7 @@ public:
~InputHandler_Win32_ddrio();
RString GetDeviceSpecificInputString( const DeviceInput &di );
void GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut );
void GetDevicesAndDescriptions( std::vector<InputDeviceInfo>& vDevicesOut );
private:
RageThread InputThread;
+1 -1
View File
@@ -247,7 +247,7 @@ void InputHandler_X11::Update()
}
void InputHandler_X11::GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut )
void InputHandler_X11::GetDevicesAndDescriptions( std::vector<InputDeviceInfo>& vDevicesOut )
{
if( Dpy && Win )
{
+1 -1
View File
@@ -11,7 +11,7 @@ public:
InputHandler_X11();
~InputHandler_X11();
void Update();
void GetDevicesAndDescriptions( vector<InputDeviceInfo>& vDevicesOut );
void GetDevicesAndDescriptions( std::vector<InputDeviceInfo>& vDevicesOut );
private:
// timestamp is unsigned long to match X11 Time type
void RegisterKeyEvent( unsigned long timestamp, bool keyDown, DeviceButton button );
+2 -3
View File
@@ -2,7 +2,6 @@
#define LINUX_INPUT_MANAGER 1
#include <vector>
using namespace std;
#include "global.h"
class InputHandler_Linux_Joystick;
@@ -21,11 +20,11 @@ public:
private:
bool m_bEventEnabled;
InputHandler_Linux_Event* m_EventDriver;
vector<RString> m_vsPendingEventDevices;
std::vector<RString> m_vsPendingEventDevices;
bool m_bJoystickEnabled;
InputHandler_Linux_Joystick* m_JoystickDriver;
vector<RString> m_vsPendingJoystickDevices;
std::vector<RString> m_vsPendingJoystickDevices;
};
extern LinuxInputManager* LINUXINPUT; // global and accessible from anywhere in our program
+2 -2
View File
@@ -10,11 +10,11 @@
DriverList LightsDriver::m_pDriverList;
void LightsDriver::Create( const RString &sDrivers, vector<LightsDriver *> &Add )
void LightsDriver::Create( const RString &sDrivers, std::vector<LightsDriver *> &Add )
{
LOG->Trace( "Initializing lights drivers: %s", sDrivers.c_str() );
vector<RString> asDriversToTry;
std::vector<RString> asDriversToTry;
split( sDrivers, ",", asDriversToTry, true );
for (RString const &Driver : asDriversToTry)
+1 -1
View File
@@ -9,7 +9,7 @@ struct LightsState;
class LightsDriver: public RageDriver
{
public:
static void Create( const RString &sDriver, vector<LightsDriver *> &apAdd );
static void Create( const RString &sDriver, std::vector<LightsDriver *> &apAdd );
static DriverList m_pDriverList;
LightsDriver() {};
@@ -7,9 +7,6 @@
#include <cstring>
using namespace std;
// Private members/methods are kept out of the header using an opaque pointer `_impl`.
// Google "pimpl idiom" for an explanation of what's going on and why it is (or might be) useful.
+1 -1
View File
@@ -13,7 +13,7 @@ LoadingWindow *LoadingWindow::Create()
#endif
// Don't load nullptr by default.
const RString drivers = "win32,macosx,gtk";
vector<RString> DriversToTry;
std::vector<RString> DriversToTry;
split( drivers, ",", DriversToTry, true );
ASSERT( DriversToTry.size() != 0 );
@@ -134,7 +134,7 @@ void LoadingWindow_MacOSX::SetSplash( const RageSurface *pSplash )
{
RageFile f;
RString data;
vector<RString> vs;
std::vector<RString> vs;
// Try to load a custom splash from the current theme, first.
GetDirListing( THEME->GetPathG( "Common", "splash"), vs, false, true );
@@ -87,7 +87,7 @@ INT_PTR CALLBACK LoadingWindow_Win32::WndProc( HWND hWnd, UINT msg, WPARAM wPara
{
case WM_INITDIALOG:
{
vector<RString> vs;
std::vector<RString> vs;
GetDirListing( "Data/splash*.png", vs, false, true );
if( !vs.empty() )
g_hBitmap = LoadWin32Surface( vs[0], hWnd );
@@ -176,7 +176,7 @@ void LoadingWindow_Win32::Paint()
void LoadingWindow_Win32::SetText( RString sText )
{
vector<RString> asMessageLines;
std::vector<RString> asMessageLines;
split( sText, "\n", asMessageLines, false );
while( asMessageLines.size() < 3 )
asMessageLines.push_back( "" );
+4 -4
View File
@@ -59,18 +59,18 @@ bool MemoryCardDriver::NeedUpdate( bool bMount )
return USBStorageDevicesChanged();
}
bool MemoryCardDriver::DoOneUpdate( bool bMount, vector<UsbStorageDevice>& vStorageDevicesOut )
bool MemoryCardDriver::DoOneUpdate( bool bMount, std::vector<UsbStorageDevice>& vStorageDevicesOut )
{
if( !NeedUpdate(bMount) )
return false;
vector<UsbStorageDevice> vOld = m_vDevicesLastSeen; // copy
std::vector<UsbStorageDevice> vOld = m_vDevicesLastSeen; // copy
GetUSBStorageDevices( vStorageDevicesOut );
// log connects
for (UsbStorageDevice &newd : vStorageDevicesOut)
{
vector<UsbStorageDevice>::iterator iter = find( vOld.begin(), vOld.end(), newd );
std::vector<UsbStorageDevice>::iterator iter = find( vOld.begin(), vOld.end(), newd );
if( iter == vOld.end() ) // didn't find
LOG->Trace( "New device connected: %s", newd.sDevice.c_str() );
}
@@ -85,7 +85,7 @@ bool MemoryCardDriver::DoOneUpdate( bool bMount, vector<UsbStorageDevice>& vStor
/* If this device was just connected (it wasn't here last time), set it to
* CHECKING and return it, to let the main thread know about the device before
* we start checking. */
vector<UsbStorageDevice>::iterator iter = find( vOld.begin(), vOld.end(), d );
std::vector<UsbStorageDevice>::iterator iter = find( vOld.begin(), vOld.end(), d );
if( iter == vOld.end() ) // didn't find
{
LOG->Trace( "New device entering CHECKING: %s", d.sDevice.c_str() );
+3 -3
View File
@@ -87,19 +87,19 @@ public:
/* Poll for memory card changes. If anything has changed, fill in vStorageDevicesOut
* and return true. */
bool DoOneUpdate( bool bMount, vector<UsbStorageDevice>& vStorageDevicesOut );
bool DoOneUpdate( bool bMount, std::vector<UsbStorageDevice>& vStorageDevicesOut );
protected:
/* This may be called before GetUSBStorageDevices; return false if the results of
* GetUSBStorageDevices have not changed. (This is an optimization.) */
virtual bool USBStorageDevicesChanged() { return true; }
virtual void GetUSBStorageDevices( vector<UsbStorageDevice>& /* vDevicesOut */ ) { }
virtual void GetUSBStorageDevices( std::vector<UsbStorageDevice>& /* vDevicesOut */ ) { }
/* Test the device. On failure, call pDevice->SetError() appropriately, and return false. */
virtual bool TestWrite( UsbStorageDevice* ) { return true; }
private:
vector<UsbStorageDevice> m_vDevicesLastSeen;
std::vector<UsbStorageDevice> m_vDevicesLastSeen;
bool NeedUpdate( bool bMount );
};
@@ -74,7 +74,7 @@ bool MemoryCardDriverThreaded_Folder::USBStorageDevicesChanged()
return GetActivePlayerMask() != m_LastDevices;
}
void MemoryCardDriverThreaded_Folder::GetUSBStorageDevices( vector<UsbStorageDevice>& vDevicesOut )
void MemoryCardDriverThreaded_Folder::GetUSBStorageDevices( std::vector<UsbStorageDevice>& vDevicesOut )
{
LOG->Trace( "GetUSBStorageDevices" );
@@ -13,7 +13,7 @@ public:
virtual void Unmount( UsbStorageDevice* pDevice );
protected:
void GetUSBStorageDevices( vector<UsbStorageDevice>& vDevicesOut );
void GetUSBStorageDevices( std::vector<UsbStorageDevice>& vDevicesOut );
bool USBStorageDevicesChanged();
bool TestWrite( UsbStorageDevice* pDevice );
bool FolderExists(RString path);
@@ -80,7 +80,7 @@ static bool ReadFile( const RString &sPath, RString &sBuf )
return true;
}
static void GetFileList( const RString &sPath, vector<RString> &out )
static void GetFileList( const RString &sPath, std::vector<RString> &out )
{
out.clear();
@@ -101,8 +101,8 @@ bool MemoryCardDriverThreaded_Linux::USBStorageDevicesChanged()
/* If a device is removed and reinserted, the inode of the /sys/block entry
* will change. */
RString sDevicePath = "/sys/block/";
vector<RString> asDevices;
std::vector<RString> asDevices;
GetFileList( sDevicePath, asDevices );
for( unsigned i = 0; i < asDevices.size(); ++i )
@@ -121,14 +121,14 @@ bool MemoryCardDriverThreaded_Linux::USBStorageDevicesChanged()
return bChanged;
}
void MemoryCardDriverThreaded_Linux::GetUSBStorageDevices( vector<UsbStorageDevice>& vDevicesOut )
void MemoryCardDriverThreaded_Linux::GetUSBStorageDevices( std::vector<UsbStorageDevice>& vDevicesOut )
{
LOG->Trace( "GetUSBStorageDevices" );
vDevicesOut.clear();
{
vector<RString> asDevices;
std::vector<RString> asDevices;
RString sBlockDevicePath = "/sys/block/";
GetFileList( sBlockDevicePath, asDevices );
@@ -232,7 +232,7 @@ void MemoryCardDriverThreaded_Linux::GetUSBStorageDevices( vector<UsbStorageDevi
* the number of hops.
*/
szLink[iRet] = 0;
vector<RString> asBits;
std::vector<RString> asBits;
split( szLink, "/", asBits );
RString sHostPort = asBits[asBits.size()-1];
@@ -240,7 +240,7 @@ void MemoryCardDriverThreaded_Linux::GetUSBStorageDevices( vector<UsbStorageDevi
{
/* Strip off the endpoint information after the colon. */
size_t pos = sHostPort.find(':');
if( pos != string::npos )
if( pos != std::string::npos )
sHostPort.erase( pos );
/* sHostPort is eg. 2-2.1. */
@@ -10,7 +10,7 @@ public:
virtual void Unmount( UsbStorageDevice* pDevice );
protected:
void GetUSBStorageDevices( vector<UsbStorageDevice>& vDevicesOut );
void GetUSBStorageDevices( std::vector<UsbStorageDevice>& vDevicesOut );
bool USBStorageDevicesChanged();
bool TestWrite( UsbStorageDevice* pDevice );
@@ -73,7 +73,7 @@ void MemoryCardDriverThreaded_MacOSX::Unmount( UsbStorageDevice *pDevice )
const RString& base = Basename( pDevice->sOsMountDir );
memset( &pb, 0, sizeof(pb) );
name[0] = min( base.length(), size_t(255) );
name[0] = std::min( base.length(), size_t(255) );
strncpy( (char *)&name[1], base, name[0] );
pb.volumeParam.ioNamePtr = name;
pb.volumeParam.ioVolIndex = -1; // Use ioNamePtr to find the volume.
@@ -133,7 +133,7 @@ static RString GetStringProperty( io_registry_entry_t entry, CFStringRef key )
return ret;
}
void MemoryCardDriverThreaded_MacOSX::GetUSBStorageDevices( vector<UsbStorageDevice>& vDevicesOut )
void MemoryCardDriverThreaded_MacOSX::GetUSBStorageDevices( std::vector<UsbStorageDevice>& vDevicesOut )
{
LockMut( m_ChangedLock );
// First, get all device paths
@@ -14,7 +14,7 @@ public:
protected:
bool USBStorageDevicesChanged();
void GetUSBStorageDevices( vector<UsbStorageDevice>& vStorageDevicesOut );
void GetUSBStorageDevices( std::vector<UsbStorageDevice>& vStorageDevicesOut );
bool TestWrite( UsbStorageDevice *pDevice );
private:
@@ -93,7 +93,7 @@ static bool IsFloppyDrive( const RString &sDrive )
return false;
}
void MemoryCardDriverThreaded_Windows::GetUSBStorageDevices( vector<UsbStorageDevice>& vDevicesOut )
void MemoryCardDriverThreaded_Windows::GetUSBStorageDevices( std::vector<UsbStorageDevice>& vDevicesOut )
{
LOG->Trace( "MemoryCardDriverThreaded_Windows::GetUSBStorageDevices" );
@@ -14,7 +14,7 @@ public:
virtual void Unmount( UsbStorageDevice* pDevice );
private:
void GetUSBStorageDevices( vector<UsbStorageDevice>& vDevicesOut );
void GetUSBStorageDevices( std::vector<UsbStorageDevice>& vDevicesOut );
bool USBStorageDevicesChanged();
bool TestWrite( UsbStorageDevice* pDevice );
+1 -1
View File
@@ -8,7 +8,7 @@ class MemoryCardDriver_Null : public MemoryCardDriver
public:
MemoryCardDriver_Null() {}
virtual bool USBStorageDevicesChanged() { return false; }
virtual void GetUSBStorageDevices( vector<UsbStorageDevice>& vDevicesOut ) { }
virtual void GetUSBStorageDevices( std::vector<UsbStorageDevice>& vDevicesOut ) { }
virtual bool Mount( UsbStorageDevice* pDevice ) { return false; }
virtual void Unmount( UsbStorageDevice* pDevice ) {}
virtual void Flush( UsbStorageDevice* pDevice ) {}
+2 -2
View File
@@ -85,8 +85,8 @@ RageMovieTexture *RageMovieTexture::Create( RageTextureID ID )
RString sDrivers = g_sMovieDrivers;
if( sDrivers.empty() )
sDrivers = DEFAULT_MOVIE_DRIVER_LIST;
vector<RString> DriversToTry;
std::vector<RString> DriversToTry;
split( sDrivers, ",", DriversToTry, true );
if( DriversToTry.empty() )
+3 -3
View File
@@ -387,7 +387,7 @@ RString MovieTexture_DShow::Create()
pCTR->SetRenderTarget(this);
/* Cap the max texture size to the hardware max. */
actualID.iMaxSize = min( actualID.iMaxSize, DISPLAY->GetMaxTextureSize() );
actualID.iMaxSize = std::min( actualID.iMaxSize, DISPLAY->GetMaxTextureSize() );
// The graph is built, now get the set the output video width and height.
// The source and image width will always be the same since we can't scale the video
@@ -395,8 +395,8 @@ RString MovieTexture_DShow::Create()
m_iSourceHeight = pCTR->GetVidHeight();
/* image size cannot exceed max size */
m_iImageWidth = min( m_iSourceWidth, actualID.iMaxSize );
m_iImageHeight = min( m_iSourceHeight, actualID.iMaxSize );
m_iImageWidth = std::min( m_iSourceWidth, actualID.iMaxSize );
m_iImageHeight = std::min( m_iSourceHeight, actualID.iMaxSize );
/* Texture dimensions need to be a power of two; jump to the next. */
m_iTextureWidth = power_of_two(m_iImageWidth);
@@ -117,9 +117,9 @@ public:
m_PixFmt = pixfmt;
m_iSourceWidth = iWidth;
m_iSourceHeight = iHeight;
/* int iMaxSize = min( GetID().iMaxSize, DISPLAY->GetMaxTextureSize() );
m_iImageWidth = min( m_iSourceWidth, iMaxSize );
m_iImageHeight = min( m_iSourceHeight, iMaxSize );
/* int iMaxSize = std::min( GetID().iMaxSize, DISPLAY->GetMaxTextureSize() );
m_iImageWidth = std::min( m_iSourceWidth, iMaxSize );
m_iImageHeight = std::min( m_iSourceHeight, iMaxSize );
m_iTextureWidth = power_of_two( m_iImageWidth );
m_iTextureHeight = power_of_two( m_iImageHeight );
*/
+2 -2
View File
@@ -4,7 +4,7 @@
void DriverList::Add( const istring &sName, CreateRageDriverFn pfn )
{
if( m_pRegistrees == nullptr )
m_pRegistrees = new map<istring, CreateRageDriverFn>;
m_pRegistrees = new std::map<istring, CreateRageDriverFn>;
ASSERT( m_pRegistrees->find(sName) == m_pRegistrees->end() );
(*m_pRegistrees)[sName] = pfn;
@@ -15,7 +15,7 @@ RageDriver *DriverList::Create( const RString &sDriverName )
if( m_pRegistrees == nullptr )
return nullptr;
map<istring, CreateRageDriverFn>::const_iterator iter = m_pRegistrees->find( istring(sDriverName) );
std::map<istring, CreateRageDriverFn>::const_iterator iter = m_pRegistrees->find( istring(sDriverName) );
if( iter == m_pRegistrees->end() )
return nullptr;
return (iter->second)();
+1 -1
View File
@@ -16,7 +16,7 @@ struct DriverList
{
void Add( const istring &sName, CreateRageDriverFn pfn );
RageDriver *Create( const RString &sDriverName );
map<istring, CreateRageDriverFn> *m_pRegistrees;
std::map<istring, CreateRageDriverFn> *m_pRegistrees;
};
struct RegisterRageDriver
+2 -2
View File
@@ -274,7 +274,7 @@ int Alsa9Buf::GetNumFramesToFill()
{
/* Make sure we can write ahead at least two chunks. Otherwise, we'll only
* fill one chunk ahead, and underrun. */
int ActualWriteahead = max( writeahead, chunksize*2 );
int ActualWriteahead = std::max( writeahead, chunksize*2 );
snd_pcm_sframes_t avail_frames = dsnd_pcm_avail_update(pcm);
@@ -308,7 +308,7 @@ int Alsa9Buf::GetNumFramesToFill()
}
/* Number of frames that have data: */
const snd_pcm_sframes_t filled_frames = max( 0l, total_frames - avail_frames );
const snd_pcm_sframes_t filled_frames = std::max( 0l, total_frames - avail_frames );
/* Number of frames that don't have data, that are within the writeahead: */
snd_pcm_sframes_t unfilled_frames = clamp( ActualWriteahead - filled_frames, 0l, (snd_pcm_sframes_t)ActualWriteahead );
+6 -6
View File
@@ -185,7 +185,7 @@ RString DSoundBuf::Init( DSound &ds, DSoundBuf::hw hardware,
/* The size of the actual DSound buffer. This can be large; we generally
* won't fill it completely. */
m_iBufferSize = 1024*64;
m_iBufferSize = max( m_iBufferSize, m_iWriteAhead );
m_iBufferSize = std::max( m_iBufferSize, m_iWriteAhead );
WAVEFORMATEX waveformat;
memset( &waveformat, 0, sizeof(waveformat) );
@@ -250,7 +250,7 @@ RString DSoundBuf::Init( DSound &ds, DSoundBuf::hw hardware,
{
LOG->Warn( "bcaps.dwBufferBytes (%i) != m_iBufferSize(%i); adjusting", bcaps.dwBufferBytes, m_iBufferSize );
m_iBufferSize = bcaps.dwBufferBytes;
m_iWriteAhead = min( m_iWriteAhead, m_iBufferSize );
m_iWriteAhead = std::min( m_iWriteAhead, m_iBufferSize );
}
if( !(bcaps.dwFlags & DSBCAPS_CTRLVOLUME) )
@@ -287,7 +287,7 @@ void DSoundBuf::SetVolume( float fVolume )
float iVolumeLog2 = log10f(fVolume) / log10f(2); /* vol log 2 */
/* Volume is a multiplier; SetVolume wants attenuation in hundredths of a decibel. */
const int iNewVolume = max( int(1000 * iVolumeLog2), DSBVOLUME_MIN );
const int iNewVolume = std::max( int(1000 * iVolumeLog2), DSBVOLUME_MIN );
if( m_iVolume == iNewVolume )
return;
@@ -488,11 +488,11 @@ bool DSoundBuf::get_output_buf( char **pBuffer, unsigned *pBufferSize, int iChun
wrap( bytes_played, m_iBufferSize );
m_iBufferBytesFilled -= bytes_played;
m_iBufferBytesFilled = max( 0, m_iBufferBytesFilled );
m_iBufferBytesFilled = std::max( 0, m_iBufferBytesFilled );
if( m_iExtraWriteahead )
{
int used = min( m_iExtraWriteahead, bytes_played );
int used = std::min( m_iExtraWriteahead, bytes_played );
RString s = ssprintf("used %i of %i (%i..%i)", used, m_iExtraWriteahead, iCursorStart, iCursorEnd );
s += "; last: ";
for( int i = 0; i < 4; ++i )
@@ -591,7 +591,7 @@ int64_t DSoundBuf::GetPosition() const
/* Failsafe: never return a value smaller than we've already returned.
* This can happen once in a while in underrun conditions. */
iRet = max( m_iLastPosition, iRet );
iRet = std::max( m_iLastPosition, iRet );
m_iLastPosition = iRet;
return iRet;
+1 -1
View File
@@ -10,7 +10,7 @@ DriverList RageSoundDriver::m_pDriverList;
RageSoundDriver *RageSoundDriver::Create( const RString& drivers )
{
vector<RString> drivers_to_try;
std::vector<RString> drivers_to_try;
if(drivers.empty())
{
split(DEFAULT_SOUND_DRIVER_LIST, ",", drivers_to_try);
@@ -120,13 +120,13 @@ RageSoundMixBuffer &RageSoundDriver::MixIntoBuffer( int iFrames, int64_t iFrameN
continue; // more data
/* We've used up p[0]. Try p[1]. */
swap( p[0], p[1] );
swap( pSize[0], pSize[1] );
std::swap( p[0], p[1] );
std::swap( pSize[0], pSize[1] );
continue;
}
/* Note that, until we call advance_read_pointer, we can safely write to p[0]. */
const int frames_to_read = min( iFramesLeft, p[0]->m_FramesInBuffer );
const int frames_to_read = std::min( iFramesLeft, p[0]->m_FramesInBuffer );
mix.SetWriteOffset( iGotFrames*channels );
mix.write( p[0]->m_BufferNext, frames_to_read * channels );
@@ -467,7 +467,7 @@ RageSoundDriver::~RageSoundDriver()
LOG->Flush();
LOG->Info( "Mixing %f ahead in %i Mix() calls",
float(g_iTotalAhead) / max( g_iTotalAheadCount, 1 ), g_iTotalAheadCount );
float(g_iTotalAhead) / std::max( g_iTotalAheadCount, 1 ), g_iTotalAheadCount );
}
}
@@ -525,7 +525,7 @@ int64_t RageSoundDriver::ClampHardwareFrame( int64_t iHardwareFrame ) const
}
}
m_iMaxHardwareFrame = iHardwareFrame = max( iHardwareFrame, m_iMaxHardwareFrame );
m_iMaxHardwareFrame = iHardwareFrame = std::max( iHardwareFrame, m_iMaxHardwareFrame );
//return iHardwareFrame;
m_iVMaxHardwareFrame += diff;
return m_iVMaxHardwareFrame;
+1 -1
View File
@@ -109,7 +109,7 @@ out_close:
RString RageSoundDriver_JACK::ConnectPorts()
{
vector<RString> portNames;
std::vector<RString> portNames;
split(PREFSMAN->m_iSoundDevice.Get(), ",", portNames, true);
const char *port_out_l = nullptr, *port_out_r = nullptr;
+14 -14
View File
@@ -58,7 +58,7 @@ struct WinWdmPin
HANDLE m_hHandle;
WinWdmFilter *m_pParentFilter;
int m_iPinId;
vector<KSDATARANGE_AUDIO> m_dataRangesItem;
std::vector<KSDATARANGE_AUDIO> m_dataRangesItem;
};
enum DeviceSampleFormat
@@ -115,7 +115,7 @@ struct WinWdmFilter
void Release();
HANDLE m_hHandle;
vector<WinWdmPin *> m_apPins;
std::vector<WinWdmPin *> m_apPins;
RString m_sFilterName;
RString m_sFriendlyName;
int m_iUsageCount;
@@ -189,7 +189,7 @@ static bool WdmGetPropertySimple( HANDLE hHandle, const GUID *pGuidPropertySet,
void *pValue, unsigned long iValueSize, void *pInstance, unsigned long iInstanceSize, RString &sError )
{
unsigned long iPropertySize = sizeof(KSPROPERTY) + iInstanceSize;
vector<char> buf;
std::vector<char> buf;
buf.resize( iPropertySize );
KSPROPERTY *ksProperty = (KSPROPERTY*) &buf[0];
@@ -209,7 +209,7 @@ static bool WdmSetPropertySimple(
void *pValue, unsigned long iValueSize,
void *instance, unsigned long iInstanceSize, RString &sError )
{
vector<char> buf;
std::vector<char> buf;
unsigned long iPropertySize = sizeof(KSPROPERTY) + iInstanceSize;
buf.resize( iPropertySize );
KSPROPERTY *ksProperty = (KSPROPERTY *) &buf[0];
@@ -638,12 +638,12 @@ WinWdmPin *WinWdmFilter::InstantiateRenderPin( const WAVEFORMATEX *wfex, RString
}
template<typename T, typename U>
void MoveToBeginning( vector<T> &v, const U &item )
void MoveToBeginning( std::vector<T> &v, const U &item )
{
vector<T>::iterator it = find( v.begin(), v.end(), item );
std::vector<T>::iterator it = find( v.begin(), v.end(), item );
if( it == v.end() )
return;
vector<T>::iterator next = it;
std::vector<T>::iterator next = it;
++next;
copy_backward( v.begin(), it, next );
*v.begin() = item;
@@ -695,7 +695,7 @@ WinWdmPin *WinWdmFilter::InstantiateRenderPin(
* more channels, since some drivers won't send audio to rear speakers in stereo modes. Sort
* the preferred channel count first.
*/
vector<int> aChannels;
std::vector<int> aChannels;
aChannels.push_back( 8 );
aChannels.push_back( 6 );
aChannels.push_back( 4 );
@@ -704,7 +704,7 @@ WinWdmPin *WinWdmFilter::InstantiateRenderPin(
MoveToBeginning( aChannels, iPreferredOutputChannels );
/* Try all sample formats. Try PreferredOutputSampleFormat first. */
vector<DeviceSampleFormat> SampleFormats;
std::vector<DeviceSampleFormat> SampleFormats;
SampleFormats.push_back( DeviceSampleFormat_Int16 );
SampleFormats.push_back( DeviceSampleFormat_Int24 );
SampleFormats.push_back( DeviceSampleFormat_Int32 );
@@ -719,7 +719,7 @@ WinWdmPin *WinWdmFilter::InstantiateRenderPin(
* Try all samplerates listed in the device's DATARANGES. Sort iSampleRate first,
* then 48k, then 44.1k, then higher sample rates first.
*/
vector<int> aSampleRates;
std::vector<int> aSampleRates;
{
for (WinWdmPin *pPin : m_apPins)
{
@@ -746,7 +746,7 @@ WinWdmPin *WinWdmFilter::InstantiateRenderPin(
}
/* Try WAVE_FORMAT_EXTENSIBLE, then WAVE_FORMAT_PCM. */
vector<bool> aTryPCM;
std::vector<bool> aTryPCM;
aTryPCM.push_back( false );
aTryPCM.push_back( true );
@@ -811,7 +811,7 @@ static bool GetDevicePath( HANDLE hHandle, SP_DEVICE_INTERFACE_DATA *pInterfaceD
}
/* Build a list of available filters. */
static bool BuildFilterList( vector<WinWdmFilter*> &aFilters, RString &sError )
static bool BuildFilterList( std::vector<WinWdmFilter*> &aFilters, RString &sError )
{
const GUID *pCategoryGuid = (GUID*) &KSCATEGORY_RENDER;
@@ -989,7 +989,7 @@ bool WinWdmStream::Open( WinWdmFilter *pFilter,
if( m_iFramesPerChunk == 0 )
{
m_iFramesPerChunk = 512 / m_iWriteAheadChunks;
m_iFramesPerChunk = max( m_iFramesPerChunk, iFrameSize ); // iFrameSize may be 0
m_iFramesPerChunk = std::max( m_iFramesPerChunk, iFrameSize ); // iFrameSize may be 0
}
LOG->Info( "KS: chunk size: %i; allocator framing: %i (%ims)", m_iFramesPerChunk, iFrameSize, (iFrameSize * 1000) / m_iSampleRate );
@@ -1276,7 +1276,7 @@ RString RageSoundDriver_WDMKS::Init()
if( !PaWinWdm_Initialize(sError) )
return sError;
vector<WinWdmFilter *> apFilters;
std::vector<WinWdmFilter *> apFilters;
if( !BuildFilterList(apFilters, sError) )
return "Error building filter list: " + sError;
if( apFilters.empty() )
+1 -1
View File
@@ -359,7 +359,7 @@ bool EventImpl_Win32::Wait( RageTimer *pTimeout )
if( pTimeout != nullptr )
{
float fSecondsInFuture = -pTimeout->Ago();
iMilliseconds = (unsigned) max( 0, int( fSecondsInFuture * 1000 ) );
iMilliseconds = (unsigned) std::max( 0, int( fSecondsInFuture * 1000 ) );
}
// Unlock the mutex and wait for a signal.