Skip to content

Commit

Permalink
WIN32: No need to use strlen() into MultiByteToWideChar()
Browse files Browse the repository at this point in the history
The call to strlen() can be removed because MultiByteToWideChar() already calculates its value if the parameter is -1.
Since the entire source is using spaces but this piece of code uses hardware tabs, I also adjusted this.
  • Loading branch information
carlo-bramini authored and JohannesLorenz committed Dec 2, 2023
1 parent 02989c6 commit 96eb2f3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/address.c
Original file line number Diff line number Diff line change
Expand Up @@ -684,12 +684,12 @@ int lo_inaddr_find_iface(lo_inaddr t, int fam,
if (strcmp(iface, aa->AdapterName)==0)
found = 1;
else {
WCHAR ifaceW[256];
MultiByteToWideChar(CP_ACP, 0, iface, strlen(iface),
ifaceW, 256);
if (lstrcmpW(ifaceW, aa->FriendlyName)==0)
found = 1;
}
WCHAR ifaceW[256];
MultiByteToWideChar(CP_ACP, 0, iface, -1,
ifaceW, 256);
if (lstrcmpW(ifaceW, aa->FriendlyName)==0)
found = 1;
}
}
if (ip) {
PIP_ADAPTER_UNICAST_ADDRESS pua = aa->FirstUnicastAddress;
Expand Down

0 comments on commit 96eb2f3

Please sign in to comment.