Commit 3f792d8c68dda1a77dd8972faaee8d227e288d10
Committed by
Moritz Wirger
1 parent
03696ce8
Return return_code of WSAStartup rather than calling WSAGetLastError()
This is recommended by windows https://msdn.microsoft.com/de-de/library/windows/desktop/ms742213(v=vs.85).aspx
Showing
1 changed file
with
3 additions
and
2 deletions
hueplusplus/winHttpHandler.cpp
| ... | ... | @@ -30,9 +30,10 @@ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 30 | 30 | winHttpHandler::winHttpHandler() |
| 31 | 31 | { |
| 32 | 32 | // Initialize Winsock |
| 33 | - if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) | |
| 33 | + int return_code = WSAStartup(MAKEWORD(2, 2), &wsaData); | |
| 34 | + if (return_code != 0) | |
| 34 | 35 | { |
| 35 | - std::cerr << "winHttpHandler: Failed to open socket: " << WSAGetLastError() << std::endl; | |
| 36 | + std::cerr << "Failed to open socket: " << return_code << std::endl; | |
| 36 | 37 | throw(std::runtime_error("winHttpHandler: Failed to open socket")); |
| 37 | 38 | } |
| 38 | 39 | } | ... | ... |