fixed issues with static wariables

This commit is contained in:
Maxim Kokryashkin 2021-02-21 00:28:32 +03:00
parent 51a8a977d9
commit ce7d08eb0e
17 changed files with 1181 additions and 2 deletions

View File

@ -0,0 +1 @@
---

View File

@ -0,0 +1,3 @@
Start testing: Feb 18 22:20 MSK
----------------------------------------------------------
End testing: Feb 18 22:20 MSK

View File

@ -1,3 +1,4 @@
#define CROW_MAIN_
#include "crow.h" #include "crow.h"
#include <sstream> #include <sstream>

View File

@ -1,3 +1,4 @@
#define CROW_MAIN_
#include "crow.h" #include "crow.h"
#include <string> #include <string>
#include <vector> #include <vector>

View File

@ -1,3 +1,4 @@
#define CROW_MAIN_
#include "crow.h" #include "crow.h"
#include "crow/compression.h" #include "crow/compression.h"

View File

@ -1,5 +1,6 @@
//#define CROW_STATIC_DRIECTORY "alternative_directory/" //#define CROW_STATIC_DRIECTORY "alternative_directory/"
//#define CROW_STATIC_ENDPOINT "/alternative_endpoint/<path>" //#define CROW_STATIC_ENDPOINT "/alternative_endpoint/<path>"
#define CROW_MAIN_
#include "crow.h" #include "crow.h"
int main() int main()

View File

@ -1,3 +1,4 @@
#define CROW_MAIN_
#include "crow.h" #include "crow.h"
#include <sstream> #include <sstream>

View File

@ -1,3 +1,4 @@
#define CROW_MAIN_
#include "crow_all.h" #include "crow_all.h"
#include <sstream> #include <sstream>

View File

@ -1,3 +1,4 @@
#define CROW_MAIN_
#include "crow.h" #include "crow.h"
int main() int main()

View File

@ -1,4 +1,5 @@
#define CROW_ENABLE_SSL #define CROW_ENABLE_SSL
#define CROW_MAIN_
#include "crow.h" #include "crow.h"
int main() int main()

View File

@ -1,3 +1,4 @@
#define CROW_MAIN_
#include "crow.h" #include "crow.h"
#include <unordered_set> #include <unordered_set>
#include <mutex> #include <mutex>

View File

@ -29,7 +29,10 @@
namespace crow namespace crow
{ {
#ifdef CROW_MAIN_
int detail::dumb_timer_queue::tick = 5; int detail::dumb_timer_queue::tick = 5;
#endif
#ifdef CROW_ENABLE_SSL #ifdef CROW_ENABLE_SSL
using ssl_context_t = boost::asio::ssl::context; using ssl_context_t = boost::asio::ssl::context;
#endif #endif

View File

@ -19,7 +19,7 @@ namespace crow
GZIP = 15|16, GZIP = 15|16,
}; };
std::string compress_string(std::string const & str, algorithm algo) inline std::string compress_string(std::string const & str, algorithm algo)
{ {
std::string compressed_str; std::string compressed_str;
z_stream stream{}; z_stream stream{};
@ -56,7 +56,7 @@ namespace crow
return compressed_str; return compressed_str;
} }
std::string decompress_string(std::string const & deflated_string) inline std::string decompress_string(std::string const & deflated_string)
{ {
std::string inflated_string; std::string inflated_string;
Bytef tmp[8192]; Bytef tmp[8192];

View File

@ -12,6 +12,7 @@ namespace crow
{ {
namespace detail namespace detail
{ {
/// Fast timer queue for fixed tick value. /// Fast timer queue for fixed tick value.
class dumb_timer_queue class dumb_timer_queue
{ {

View File

@ -3,6 +3,8 @@
#include <string> #include <string>
namespace crow { namespace crow {
#ifdef CROW_MAIN_
std::unordered_map<std::string, std::string> mime_types { std::unordered_map<std::string, std::string> mime_types {
{"shtml", "text/html"}, {"shtml", "text/html"},
{"htm", "text/html"}, {"htm", "text/html"},
@ -113,4 +115,7 @@ namespace crow {
{"wmv", "video/x-ms-wmv"}, {"wmv", "video/x-ms-wmv"},
{"avi", "video/x-msvideo"} {"avi", "video/x-msvideo"}
}; };
#else
extern std::unordered_map<std::string, std::string> mime_types;
#endif
} }

1156
include/crow/tags Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,6 @@
#define CATCH_CONFIG_MAIN #define CATCH_CONFIG_MAIN
#define CROW_LOG_LEVEL 0 #define CROW_LOG_LEVEL 0
#define CROW_MAIN_
#include <sys/stat.h> #include <sys/stat.h>
#include <iostream> #include <iostream>