]> git.stg.codes - stg.git/blobdiff - stglibs/common.lib/common.cpp
Функцію перетворення радку на IP-адресу замынено на inet_pton
[stg.git] / stglibs / common.lib / common.cpp
index eb39da6a8138d6611406ca76956416a7dc2a5491..57b37bdfdbb98aeb5915e804962cbe0a45098c82 100644 (file)
@@ -23,8 +23,8 @@
  */
 
  /*
- $Revision: 1.41 $
- $Date: 2010/11/03 10:26:30 $
+ $Revision: 1.42 $
+ $Date: 2010/11/08 10:11:19 $
  $Author: faust $
  */
 
 #include <sys/socket.h>
 #endif*/
 
+#ifdef FREE_BSD
+#include <sys/types.h>
+#endif
+
+#ifdef WIN32
+#include <winsock2.h>
+#else
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
+#endif
+
 #include <iconv.h>
 
 #include <cstdlib>
@@ -406,7 +415,7 @@ for (int i = 0; i < maxIP; i++)
         }
 
     struct in_addr in;
-    if (!inet_aton(p1, &in))
+    if (inet_pton(AF_INET, p1, &in) != 1)
         {
         //printf("INADDR_NONE\n");
         return EINVAL;
@@ -779,6 +788,11 @@ const std::string & x2str(unsigned x, std::string & s)
 return unsigned2str(x, s);
 }
 //---------------------------------------------------------------------------
+const std::string & x2str(unsigned long x, std::string & s)
+{
+return unsigned2str(x, s);
+}
+//---------------------------------------------------------------------------
 const std::string & x2str(unsigned long long x, std::string & s)
 {
 return unsigned2str(x, s);