Browse Source

Fix C++ build errors in Linux

bel 11 năm trước cách đây
mục cha
commit
724753a7da

+ 2 - 0
examples/embedded_cpp/embedded_cpp.cpp

@@ -9,6 +9,8 @@
 
 
 #ifdef _WIN32
 #ifdef _WIN32
 #include <Windows.h>
 #include <Windows.h>
+#else
+#include <unistd.h>
 #endif
 #endif
 
 
 #define DOCUMENT_ROOT "."
 #define DOCUMENT_ROOT "."

+ 2 - 8
include/CivetServer.h

@@ -281,14 +281,8 @@ protected:
         char * postData;
         char * postData;
         unsigned long postDataLen;
         unsigned long postDataLen;
 
 
-        CivetConnection() {
-            postData = NULL;
-            postDataLen = 0;
-        }
-
-        ~CivetConnection() {
-            free(postData);
-        }
+        CivetConnection();
+        ~CivetConnection();
     };
     };
 
 
     struct mg_context *context;
     struct mg_context *context;

+ 9 - 0
src/CivetServer.cpp

@@ -277,3 +277,12 @@ CivetServer::urlEncode(const char *src, size_t src_len, std::string &dst, bool a
         }
         }
     }
     }
 }
 }
+
+CivetServer::CivetConnection::CivetConnection() {
+    postData = NULL;
+    postDataLen = 0;
+}
+
+CivetServer::CivetConnection::~CivetConnection() {
+    free(postData);
+}