diff --git a/plugins/LilyPad/InputManager.cpp b/plugins/LilyPad/InputManager.cpp index 97976952d4..b6b5e7c31c 100644 --- a/plugins/LilyPad/InputManager.cpp +++ b/plugins/LilyPad/InputManager.cpp @@ -26,7 +26,7 @@ InputDeviceManager::InputDeviceManager() { } void InputDeviceManager::ClearDevices() { - for (int i=0; iaxes = (AxisEffectInfo*) realloc(b->axes, sizeof(AxisEffectInfo) * (numFFAxes)); memset(b->axes + (numFFAxes-1), 0, sizeof(AxisEffectInfo)); @@ -244,7 +244,7 @@ void Device::CalcVirtualState() { } VirtualControl *Device::GetVirtualControl(unsigned int uid) { - for (int i=0; imotor == motor) { SetEffect(binding, force); @@ -380,7 +380,7 @@ void InputDeviceManager::AddDevice(Device *d) { } void InputDeviceManager::Update(InitInfo *info) { - for (int i=0; ienabled) { if (!devices[i]->active) { if (!devices[i]->Activate(info) || !devices[i]->Update()) continue; @@ -394,14 +394,14 @@ void InputDeviceManager::Update(InitInfo *info) { } void InputDeviceManager::PostRead() { - for (int i=0; iactive) devices[i]->PostRead(); } } Device *InputDeviceManager::GetActiveDevice(InitInfo *info, unsigned int *uid, int *index, int *value) { - int i, j; + size_t i, j; Update(info); int bestDiff = FULLY_DOWN/2; Device *bestDevice = 0; @@ -461,13 +461,13 @@ Device *InputDeviceManager::GetActiveDevice(InitInfo *info, unsigned int *uid, i } void InputDeviceManager::ReleaseInput() { - for (int i=0; iactive) devices[i]->Deactivate(); } } void InputDeviceManager::EnableDevices(DeviceType type, DeviceAPI api) { - for (int i=0; iapi == api && devices[i]->type == type) { EnableDevice(i); } @@ -475,7 +475,7 @@ void InputDeviceManager::EnableDevices(DeviceType type, DeviceAPI api) { } void InputDeviceManager::DisableAllDevices() { - for (int i=0; ipads[port][slot].numFFBindings) { dev->pads[port][slot].ffBindings = (ForceFeedbackBinding*) malloc(old->pads[port][slot].numFFBindings * sizeof(ForceFeedbackBinding)); - for (int j=0; jpads[port][slot].numFFBindings; j++) { + for (size_t j=0; jpads[port][slot].numFFBindings; j++) { ForceFeedbackBinding *bo = old->pads[port][slot].ffBindings + j; ForceFeedbackBinding *bn = dev->pads[port][slot].ffBindings + dev->pads[port][slot].numFFBindings; ForceFeedbackEffectType *en = dev->GetForcefeedbackEffect(old->ffEffectTypes[bo->effectIndex].effectID); @@ -596,7 +596,7 @@ void InputDeviceManager::CopyBindings(int numOldDevices, Device **oldDevices) { *bn = *bo; bn->effectIndex = en - dev->ffEffectTypes; bn->axes = (AxisEffectInfo*)calloc(dev->numFFAxes, sizeof(AxisEffectInfo)); - for (int k=0; knumFFAxes; k++) { + for (size_t k=0; knumFFAxes; k++) { ForceFeedbackAxis *newAxis = dev->GetForceFeedbackAxis(old->ffAxes[k].id); if (newAxis) { bn->axes[newAxis - dev->ffAxes] = bo->axes[k]; @@ -615,7 +615,7 @@ void InputDeviceManager::CopyBindings(int numOldDevices, Device **oldDevices) { } void InputDeviceManager::SetEffect(unsigned char port, unsigned int slot, unsigned char motor, unsigned char force) { - for (int i=0; ienabled && dev->numFFEffectTypes) { dev->SetEffects(port, slot, motor, force); diff --git a/plugins/LilyPad/InputManager.h b/plugins/LilyPad/InputManager.h index 673c8203e8..c070805454 100644 --- a/plugins/LilyPad/InputManager.h +++ b/plugins/LilyPad/InputManager.h @@ -188,7 +188,7 @@ struct PadBindings { Binding *bindings; int numBindings; ForceFeedbackBinding *ffBindings; - int numFFBindings; + size_t numFFBindings; }; class WndProcEater; @@ -254,7 +254,7 @@ public: // are allowed, but *only* for absolute axes (Which don't support the flip checkbox). // Each control on a device must have a unique id, used for binding. VirtualControl *virtualControls; - int numVirtualControls; + size_t numVirtualControls; int *virtualControlState; int *oldVirtualControlState; @@ -264,9 +264,9 @@ public: int *physicalControlState; ForceFeedbackEffectType *ffEffectTypes; - int numFFEffectTypes; + size_t numFFEffectTypes; ForceFeedbackAxis *ffAxes; - int numFFAxes; + size_t numFFAxes; void AddFFAxis(const wchar_t *displayName, int id); void AddFFEffectType(const wchar_t *displayName, const wchar_t *effectID, EffectType type); @@ -331,7 +331,7 @@ public: class InputDeviceManager { public: Device **devices; - int numDevices; + size_t numDevices; void ClearDevices(); @@ -342,7 +342,7 @@ public: // When old devices are missing, I do a slightly more careful search // using productIDs and then (in desperation) displayName. // Finally create new dummy devices if no matches found. - void CopyBindings(int numDevices, Device **devices); + void CopyBindings(size_t numDevices, Device **devices); InputDeviceManager(); diff --git a/plugins/LilyPad/LilyPad.cpp b/plugins/LilyPad/LilyPad.cpp index a247152fbe..2d6a8b56cf 100644 --- a/plugins/LilyPad/LilyPad.cpp +++ b/plugins/LilyPad/LilyPad.cpp @@ -263,7 +263,7 @@ void UpdateEnabledDevices(int updateList = 0) { } } } - for (int i=0; inumDevices; i++) { + for (size_t i=0; inumDevices; i++) { Device *dev = dm->devices[i]; if (!dev->enabled) continue; @@ -490,7 +490,7 @@ void Update(unsigned int port, unsigned int slot) { LastCheck = t; - int i; + size_t i; ButtonSum s[2][4]; u8 lockStateChanged[2][4]; memset(lockStateChanged, 0, sizeof(lockStateChanged)); diff --git a/plugins/LilyPad/Linux/Config.cpp b/plugins/LilyPad/Linux/Config.cpp index 214bb54ea4..ebc4193576 100644 --- a/plugins/LilyPad/Linux/Config.cpp +++ b/plugins/LilyPad/Linux/Config.cpp @@ -238,7 +238,7 @@ int SaveSettings(wchar_t *file=0) { if (!dm) return 0; - for (int i=0; inumDevices; i++) { + for (size_t i=0; inumDevices; i++) { wchar_t id[50]; wchar_t temp[50], temp2[1000]; wsprintfW(id, L"Device %i", i); @@ -270,12 +270,12 @@ int SaveSettings(wchar_t *file=0) { cfg.WriteStr(id, temp, temp2); } - for (int j=0; jpads[port][slot].numFFBindings; j++) { + for (size_t j=0; jpads[port][slot].numFFBindings; j++) { ForceFeedbackBinding *b = dev->pads[port][slot].ffBindings+j; ForceFeedbackEffectType *eff = &dev->ffEffectTypes[b->effectIndex]; wsprintfW(temp, L"FF Binding %i", ffBindingCount++); wsprintfW(temp2, L"%s %i, %i, %i", eff->effectID, port, b->motor, slot); - for (int k=0; knumFFAxes; k++) { + for (size_t k=0; knumFFAxes; k++) { ForceFeedbackAxis *axis = dev->ffAxes + k; AxisEffectInfo *info = b->axes + k; //wsprintfW(wcschr(temp2,0), L", %i, %i", axis->id, info->force); @@ -463,7 +463,7 @@ void RefreshEnabledDevices(int updateDeviceList) { lastXInputState = config.gameApis.xInput; } - for (int i=0; inumDevices; i++) { + for (size_t i=0; inumDevices; i++) { Device *dev = dm->devices[i]; // XXX windows magic?