Replaced usage of apr_snprintf with snprintf (already in Windows exclusive code block)

- updated included headers to support compilation on Windows (using
  Visual C++)
This commit is contained in:
Eduardo Arias 2024-04-23 12:40:47 -03:00
parent 942c8ba606
commit abbd7b2f42

View File

@ -17,6 +17,7 @@
#include "src/config.h" #include "src/config.h"
#ifdef WIN32 #ifdef WIN32
#include "src/compat/msvc.h"
#include <winsock2.h> #include <winsock2.h>
#include <iphlpapi.h> #include <iphlpapi.h>
#endif #endif
@ -48,7 +49,11 @@
#endif #endif
#include <stdio.h> #include <stdio.h>
#ifndef WIN32
#include <unistd.h> #include <unistd.h>
#else
#include <io.h>
#endif
#include <string.h> #include <string.h>
#include "src/utils/sha1.h" #include "src/utils/sha1.h"
@ -207,7 +212,7 @@ std::string UniqueId::ethernetMacAddress() {
pAdapter = pAdapterInfo; pAdapter = pAdapterInfo;
while (pAdapter && !mac[0] && !mac[1] && !mac[2]) { while (pAdapter && !mac[0] && !mac[1] && !mac[2]) {
if (pAdapter->AddressLength > 4) { if (pAdapter->AddressLength > 4) {
apr_snprintf(mac, MAC_ADDRESS_SIZE, "%02x:%02x:%02x:%02x:%02x:%02x", snprintf(mac, MAC_ADDRESS_SIZE, "%02x:%02x:%02x:%02x:%02x:%02x",
(unsigned char)pAdapter->Address[0], (unsigned char)pAdapter->Address[0],
(unsigned char)pAdapter->Address[1], (unsigned char)pAdapter->Address[1],
(unsigned char)pAdapter->Address[2], (unsigned char)pAdapter->Address[2],