mirror of https://github.com/PCSX2/pcsx2.git
lilypad: use size_t instead of int for num* variable
Fix noisy GCC warning: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
This commit is contained in:
parent
4096e72835
commit
87d73684fa
|
@ -26,7 +26,7 @@ InputDeviceManager::InputDeviceManager() {
|
|||
}
|
||||
|
||||
void InputDeviceManager::ClearDevices() {
|
||||
for (int i=0; i<numDevices; i++) {
|
||||
for (size_t i=0; i<numDevices; i++) {
|
||||
delete devices[i];
|
||||
}
|
||||
free(devices);
|
||||
|
@ -84,7 +84,7 @@ Device::~Device() {
|
|||
Deactivate();
|
||||
// Generally called by deactivate, but just in case...
|
||||
FreeState();
|
||||
int i;
|
||||
size_t i;
|
||||
for (int port=0; port<2; port++) {
|
||||
for (int slot=0; slot<4; slot++) {
|
||||
free(pads[port][slot].bindings);
|
||||
|
@ -135,7 +135,7 @@ void Device::AddFFAxis(const wchar_t *displayName, int id) {
|
|||
int bindingsExist = 0;
|
||||
for (int port=0; port<2; port++) {
|
||||
for (int slot=0; slot<4; slot++) {
|
||||
for (int i=0; i<pads[port][slot].numFFBindings; i++) {
|
||||
for (size_t i=0; i<pads[port][slot].numFFBindings; i++) {
|
||||
ForceFeedbackBinding *b = pads[port][slot].ffBindings+i;
|
||||
b->axes = (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; i<numVirtualControls; i++) {
|
||||
for (size_t i=0; i<numVirtualControls; i++) {
|
||||
if (virtualControls[i].uid == uid)
|
||||
return virtualControls + i;
|
||||
}
|
||||
|
@ -303,7 +303,7 @@ PhysicalControl *Device::AddPhysicalControl(ControlType type, unsigned short id,
|
|||
}
|
||||
|
||||
void Device::SetEffects(unsigned char port, unsigned int slot, unsigned char motor, unsigned char force) {
|
||||
for (int i=0; i<pads[port][slot].numFFBindings; i++) {
|
||||
for (size_t i=0; i<pads[port][slot].numFFBindings; i++) {
|
||||
ForceFeedbackBinding *binding = pads[port][slot].ffBindings+i;
|
||||
if (binding->motor == motor) {
|
||||
SetEffect(binding, force);
|
||||
|
@ -380,7 +380,7 @@ void InputDeviceManager::AddDevice(Device *d) {
|
|||
}
|
||||
|
||||
void InputDeviceManager::Update(InitInfo *info) {
|
||||
for (int i=0; i<numDevices; i++) {
|
||||
for (size_t i=0; i<numDevices; i++) {
|
||||
if (devices[i]->enabled) {
|
||||
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; i<numDevices; i++) {
|
||||
for (size_t i=0; i<numDevices; i++) {
|
||||
if (devices[i]->active)
|
||||
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; i<numDevices; i++) {
|
||||
for (size_t i=0; i<numDevices; i++) {
|
||||
if (devices[i]->active) devices[i]->Deactivate();
|
||||
}
|
||||
}
|
||||
|
||||
void InputDeviceManager::EnableDevices(DeviceType type, DeviceAPI api) {
|
||||
for (int i=0; i<numDevices; i++) {
|
||||
for (size_t i=0; i<numDevices; i++) {
|
||||
if (devices[i]->api == 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; i<numDevices; i++) {
|
||||
for (size_t i=0; i<numDevices; i++) {
|
||||
DisableDevice(i);
|
||||
}
|
||||
}
|
||||
|
@ -488,7 +488,7 @@ void InputDeviceManager::DisableDevice(int index) {
|
|||
}
|
||||
|
||||
ForceFeedbackEffectType *Device::GetForcefeedbackEffect(wchar_t *id) {
|
||||
for (int i=0; i<numFFEffectTypes; i++) {
|
||||
for (size_t i=0; i<numFFEffectTypes; i++) {
|
||||
if (!wcsicmp(id, ffEffectTypes[i].effectID)) {
|
||||
return &ffEffectTypes[i];
|
||||
}
|
||||
|
@ -497,16 +497,16 @@ ForceFeedbackEffectType *Device::GetForcefeedbackEffect(wchar_t *id) {
|
|||
}
|
||||
|
||||
ForceFeedbackAxis *Device::GetForceFeedbackAxis(int id) {
|
||||
for (int i=0; i<numFFAxes; i++) {
|
||||
for (size_t i=0; i<numFFAxes; i++) {
|
||||
if (ffAxes[i].id == id) return &ffAxes[i];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void InputDeviceManager::CopyBindings(int numOldDevices, Device **oldDevices) {
|
||||
void InputDeviceManager::CopyBindings(size_t numOldDevices, Device **oldDevices) {
|
||||
int *oldMatches = (int*) malloc(sizeof(int) * numOldDevices);
|
||||
int *matches = (int*) malloc(sizeof(int) * numDevices);
|
||||
int i, j, port, slot;
|
||||
size_t i, j, port, slot;
|
||||
Device *old, *dev;
|
||||
for (i=0; i<numDevices; i++) {
|
||||
matches[i] = -1;
|
||||
|
@ -588,7 +588,7 @@ void InputDeviceManager::CopyBindings(int numOldDevices, Device **oldDevices) {
|
|||
}
|
||||
if (old->pads[port][slot].numFFBindings) {
|
||||
dev->pads[port][slot].ffBindings = (ForceFeedbackBinding*) malloc(old->pads[port][slot].numFFBindings * sizeof(ForceFeedbackBinding));
|
||||
for (int j=0; j<old->pads[port][slot].numFFBindings; j++) {
|
||||
for (size_t j=0; j<old->pads[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; k<old->numFFAxes; k++) {
|
||||
for (size_t k=0; k<old->numFFAxes; 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; i<numDevices; i++) {
|
||||
for (size_t i=0; i<numDevices; i++) {
|
||||
Device *dev = devices[i];
|
||||
if (dev->enabled && dev->numFFEffectTypes) {
|
||||
dev->SetEffects(port, slot, motor, force);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -263,7 +263,7 @@ void UpdateEnabledDevices(int updateList = 0) {
|
|||
}
|
||||
}
|
||||
}
|
||||
for (int i=0; i<dm->numDevices; i++) {
|
||||
for (size_t i=0; i<dm->numDevices; 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));
|
||||
|
|
|
@ -238,7 +238,7 @@ int SaveSettings(wchar_t *file=0) {
|
|||
if (!dm)
|
||||
return 0;
|
||||
|
||||
for (int i=0; i<dm->numDevices; i++) {
|
||||
for (size_t i=0; i<dm->numDevices; 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; j<dev->pads[port][slot].numFFBindings; j++) {
|
||||
for (size_t j=0; j<dev->pads[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; k<dev->numFFAxes; k++) {
|
||||
for (size_t k=0; k<dev->numFFAxes; 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; i<dm->numDevices; i++) {
|
||||
for (size_t i=0; i<dm->numDevices; i++) {
|
||||
Device *dev = dm->devices[i];
|
||||
|
||||
// XXX windows magic?
|
||||
|
|
Loading…
Reference in New Issue