-
Notifications
You must be signed in to change notification settings - Fork 522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compiling 'Packet32.cpp' with '-std:c++20' #752
Comments
A fix for this was to move some variables to the top: --- a/Packet32.cpp 2024-08-04 08:43:33
+++ b/Packet32.cpp 2024-09-26 12:30:29
@@ -347,6 +347,7 @@
BOOL fSuccess = FALSE;
DWORD cbRead, cbToWrite, cbWritten, dwMode;
HANDLE hPipe = g_hNpcapHelperPipe;
+ int nFields;
TRACE_ENTER();
@@ -411,7 +412,7 @@
goto Exit;
}
- int nFields = _snscanf_s(chBuf, cbRead, "%p,%lu", &hd, pdwError);
+ nFields = _snscanf_s(chBuf, cbRead, "%p,%lu", &hd, pdwError);
if (nFields != 2)
{
*pdwError = ERROR_OPEN_FAILED;
@@ -3218,6 +3219,10 @@
PCHAR Tname = NULL;
BOOLEAN Res = FALSE;
DWORD err = ERROR_SUCCESS;
+ LONG numEntries;
+ PIP_ADAPTER_UNICAST_ADDRESS pAddr;
+ PCCH AdapterGuid;
+ ULONG RetVal;
TRACE_ENTER();
@@ -3298,7 +3303,7 @@
goto END_PacketGetNetInfoEx;
}
- PCCH AdapterGuid = strchr(AdapterName, '{');
+ AdapterGuid = strchr(AdapterName, '{');
if (AdapterGuid == NULL)
{
err = ERROR_INVALID_NAME;
@@ -3311,7 +3316,7 @@
err = ERROR_NOT_ENOUGH_MEMORY;
goto END_PacketGetNetInfoEx;
}
- ULONG RetVal = ERROR_SUCCESS;
+ RetVal = ERROR_SUCCESS;
for (int i = 0; i < ADAPTERS_ADDRESSES_MAX_TRIES; i++)
{
@@ -3365,8 +3370,8 @@
// else found!
Res = TRUE;
- PIP_ADAPTER_UNICAST_ADDRESS pAddr = TmpAddr->FirstUnicastAddress;
- LONG numEntries = 0;
+ pAddr = TmpAddr->FirstUnicastAddress;
+ numEntries = 0;
while (pAddr != NULL && numEntries < *NEntries)
{
ULONG ul = 0; |
Thanks for pointing this out. The function in question doesn't have any resulting bugs, since the |
The default C++ standard in
cl
is C++14. And using that forpacketWin7/Dll/Packet32.cpp
works fine.But using
-std:c++20
or-std:c++latest
does not. This is what I did:The errors generated by MSVC version 19.42.34321.1 for x64 (the latest):
Googling this issue seems to be related to option
/Za
which is not in use.And further, using
-std:c++20
or-std:c++latest
with clang-cl ver. 18.1 works just fine.So I'm not sure what is the real issue with the
Packet32.cpp
code.The text was updated successfully, but these errors were encountered: