open.mp
open.mp copied to clipboard
Some natives should return string length
Describe the bug All the following natives:
- GetWeaponName
- NetStats_GetIpPort
- GetPVarNameAtIndex
- GetSVarNameAtIndex
should return the length of a string it wrote the data to.
GetWeaponName
To Reproduce
new str[32];
new ret = GetWeaponName(WEAPON_DEAGLE, str, sizeof str);
printf("ret %d, str '%s'", ret, str);
Expected behavior
ret 12, str 'Desert Eagle'
Current behavior
ret 1, str 'Desert Eagle'
NetStats_GetIpPort
To Reproduce
new str[32];
new ret = NetStats_GetIpPort(playerid, str, sizeof str);
printf("ret %d, str '%s'", ret, str);
Expected behavior
ret 15, str '127.0.0.1:62365'
Current behavior
ret 1, str '127.0.0.1:62365'
GetPVarNameAtIndex
To Reproduce
new str[32];
SetPVarString(playerid, "test", "abracadabra");
new ret = GetPVarNameAtIndex(playerid, 0, str, sizeof str);
printf("ret %d, str '%s'", ret, str);
Expected behavior
ret 4, str 'TEST'
Current behavior
ret 1, str 'TEST'
GetSVarNameAtIndex
To Reproduce
new str[32];
SetSVarString("test", "abracadabra");
new ret = GetSVarNameAtIndex(0, str, sizeof str);
printf("ret %d, str '%s'", ret, str);
Expected behavior
ret 4, str 'TEST'
Current behavior
ret 1, str 'TEST'