mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-26 23:10:38 +00:00
Issue 16646: strip leading zeros from IP address
This commit is contained in:
parent
2ff5747b1f
commit
fc281a1f96
@ -1096,12 +1096,20 @@ static void check_variables(CoreParameter &coreParam)
|
||||
if (changeProAdhocServer == "IP address")
|
||||
{
|
||||
g_Config.proAdhocServer = "";
|
||||
bool leadingZero = true;
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
if (i && i % 3 == 0)
|
||||
{
|
||||
g_Config.proAdhocServer += '.';
|
||||
leadingZero = true;
|
||||
}
|
||||
|
||||
int addressPt = ppsspp_pro_ad_hoc_ipv4[i];
|
||||
if (addressPt || i % 3 == 2)
|
||||
leadingZero = false; // We are either non-zero or the last digit of a byte
|
||||
|
||||
if (! leadingZero)
|
||||
g_Config.proAdhocServer += static_cast<char>('0' + addressPt);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user