Răsfoiți Sursa

fix compile error in some msvc version (snprintf not found)

Ariel Manzur 9 ani în urmă
părinte
comite
ddbf2ffd1d
1 a modificat fișierele cu 6 adăugiri și 1 ștergeri
  1. 6 1
      core/ustring.cpp

+ 6 - 1
core/ustring.cpp

@@ -44,6 +44,11 @@
 #include <stdlib.h>
 #include <stdio.h>
 #endif
+
+#if defined(MINGW_ENABLED) || defined(_MSC_VER)
+#define snprintf _snprintf
+#endif
+
 /** STRING **/
 
 const char *CharString::get_data() const {
@@ -3091,7 +3096,7 @@ String String::http_escape() const {
             res += ord;
         } else {
             char h_Val[3];
-            snprintf(h_Val, 3, "%.2X", ord);
+			_snprintf(h_Val, 3, "%.2X", ord);
             res += "%";
             res += h_Val;
         }