mirror of https://github.com/AxioDL/boo.git
HIDParser: Eliminate variable shadowing
We can rename some locals to avoid shadowing other variables.
This commit is contained in:
parent
14369a9853
commit
c8bebc9948
|
@ -461,17 +461,17 @@ HIDParser::ParserStatus HIDParser::Parse(const PHIDP_PREPARSED_DATA descriptorDa
|
||||||
USHORT length = caps.NumberInputButtonCaps;
|
USHORT length = caps.NumberInputButtonCaps;
|
||||||
std::vector<HIDP_BUTTON_CAPS> bCaps(caps.NumberInputButtonCaps, HIDP_BUTTON_CAPS());
|
std::vector<HIDP_BUTTON_CAPS> bCaps(caps.NumberInputButtonCaps, HIDP_BUTTON_CAPS());
|
||||||
HidP_GetButtonCaps(HidP_Input, bCaps.data(), &length, descriptorData);
|
HidP_GetButtonCaps(HidP_Input, bCaps.data(), &length, descriptorData);
|
||||||
for (const HIDP_BUTTON_CAPS& caps : bCaps) {
|
for (const HIDP_BUTTON_CAPS& buttonCaps : bCaps) {
|
||||||
if (caps.IsRange) {
|
if (buttonCaps.IsRange) {
|
||||||
int usage = caps.Range.UsageMin;
|
int usage = buttonCaps.Range.UsageMin;
|
||||||
for (int i = caps.Range.DataIndexMin; i <= caps.Range.DataIndexMax; ++i, ++usage) {
|
for (int i = buttonCaps.Range.DataIndexMin; i <= buttonCaps.Range.DataIndexMax; ++i, ++usage) {
|
||||||
inputItems.insert(std::make_pair(
|
inputItems.insert(std::make_pair(i, HIDMainItem(buttonCaps.BitField, HIDUsagePage(buttonCaps.UsagePage),
|
||||||
i, HIDMainItem(caps.BitField, HIDUsagePage(caps.UsagePage), HIDUsage(usage), std::make_pair(0, 1), 1)));
|
HIDUsage(usage), std::make_pair(0, 1), 1)));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
inputItems.insert(std::make_pair(caps.NotRange.DataIndex,
|
inputItems.insert(std::make_pair(buttonCaps.NotRange.DataIndex,
|
||||||
HIDMainItem(caps.BitField, HIDUsagePage(caps.UsagePage),
|
HIDMainItem(buttonCaps.BitField, HIDUsagePage(buttonCaps.UsagePage),
|
||||||
HIDUsage(caps.NotRange.Usage), std::make_pair(0, 1), 1)));
|
HIDUsage(buttonCaps.NotRange.Usage), std::make_pair(0, 1), 1)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -481,19 +481,19 @@ HIDParser::ParserStatus HIDParser::Parse(const PHIDP_PREPARSED_DATA descriptorDa
|
||||||
USHORT length = caps.NumberInputValueCaps;
|
USHORT length = caps.NumberInputValueCaps;
|
||||||
std::vector<HIDP_VALUE_CAPS> vCaps(caps.NumberInputValueCaps, HIDP_VALUE_CAPS());
|
std::vector<HIDP_VALUE_CAPS> vCaps(caps.NumberInputValueCaps, HIDP_VALUE_CAPS());
|
||||||
HidP_GetValueCaps(HidP_Input, vCaps.data(), &length, descriptorData);
|
HidP_GetValueCaps(HidP_Input, vCaps.data(), &length, descriptorData);
|
||||||
for (const HIDP_VALUE_CAPS& caps : vCaps) {
|
for (const HIDP_VALUE_CAPS& valueCaps : vCaps) {
|
||||||
if (caps.IsRange) {
|
if (valueCaps.IsRange) {
|
||||||
int usage = caps.Range.UsageMin;
|
int usage = valueCaps.Range.UsageMin;
|
||||||
for (int i = caps.Range.DataIndexMin; i <= caps.Range.DataIndexMax; ++i, ++usage) {
|
for (int i = valueCaps.Range.DataIndexMin; i <= valueCaps.Range.DataIndexMax; ++i, ++usage) {
|
||||||
inputItems.insert(
|
inputItems.insert(std::make_pair(
|
||||||
std::make_pair(i, HIDMainItem(caps.BitField, HIDUsagePage(caps.UsagePage), HIDUsage(usage),
|
i, HIDMainItem(valueCaps.BitField, HIDUsagePage(valueCaps.UsagePage), HIDUsage(usage),
|
||||||
std::make_pair(caps.LogicalMin, caps.LogicalMax), caps.BitSize)));
|
std::make_pair(valueCaps.LogicalMin, valueCaps.LogicalMax), valueCaps.BitSize)));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
inputItems.insert(
|
inputItems.insert(std::make_pair(
|
||||||
std::make_pair(caps.NotRange.DataIndex,
|
valueCaps.NotRange.DataIndex,
|
||||||
HIDMainItem(caps.BitField, HIDUsagePage(caps.UsagePage), HIDUsage(caps.NotRange.Usage),
|
HIDMainItem(valueCaps.BitField, HIDUsagePage(valueCaps.UsagePage), HIDUsage(valueCaps.NotRange.Usage),
|
||||||
HIDRange(caps.LogicalMin, caps.LogicalMax), caps.BitSize)));
|
HIDRange(valueCaps.LogicalMin, valueCaps.LogicalMax), valueCaps.BitSize)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -822,9 +822,9 @@ void HIDParser::ScanValues(const std::function<bool(const HIDMainItem& item, int
|
||||||
continue;
|
continue;
|
||||||
int32_t value = 0;
|
int32_t value = 0;
|
||||||
if (it != end) {
|
if (it != end) {
|
||||||
const HIDP_DATA& data = *it;
|
const HIDP_DATA& hidData = *it;
|
||||||
if (data.DataIndex == idx) {
|
if (hidData.DataIndex == idx) {
|
||||||
value = data.RawValue;
|
value = hidData.RawValue;
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue