Revision | 6aafe536499e73bfaf2214099c3a189a9c2ce2a2 (tree) |
---|---|
Time | 2012-09-13 01:13:47 |
Author | angeart <angeart@git....> |
Commiter | angeart |
Merge branch 'master' of git.sourceforge.jp:/gitroot/mmo/main
@@ -7,7 +7,7 @@ | ||
7 | 7 | #include "unicode.hpp" |
8 | 8 | |
9 | 9 | #ifndef _WIN32 |
10 | -#define OutputDebugString(str) (str) | |
10 | +#define OutputDebugString(str) (std::cout << str) | |
11 | 11 | #endif |
12 | 12 | |
13 | 13 | class Logger { |
@@ -114,41 +114,41 @@ class Logger { | ||
114 | 114 | void Log(const tstring& prefix, const tstring& format) { |
115 | 115 | auto out = prefix + format + _T("\n"); |
116 | 116 | OutputDebugString(out.c_str()); |
117 | - std::wcout << unicode::ToWString(out); | |
118 | - ofs_ << unicode::ToString(out); | |
117 | + // std::wcout << unicode::ToWString(out); | |
118 | + //ofs_ << unicode::ToString(out); | |
119 | 119 | } |
120 | 120 | |
121 | 121 | template<class T1> |
122 | 122 | void Log(const tstring& prefix, const tstring& format, const T1& t1) { |
123 | 123 | auto out = prefix + (tformat(format) % t1).str() + _T("\n"); |
124 | 124 | OutputDebugString(out.c_str()); |
125 | - std::wcout << unicode::ToWString(out); | |
126 | - ofs_ << unicode::ToString(out); | |
125 | + // std::wcout << unicode::ToWString(out); | |
126 | + //ofs_ << unicode::ToString(out); | |
127 | 127 | } |
128 | 128 | |
129 | 129 | template<class T1, class T2> |
130 | 130 | void Log(const tstring& prefix, const tstring& format, const T1& t1, const T2& t2) { |
131 | 131 | auto out = prefix + (tformat(format) % t1 % t2).str() + _T("\n"); |
132 | 132 | OutputDebugString(out.c_str()); |
133 | - std::wcout << unicode::ToWString(out); | |
134 | - ofs_ << unicode::ToString(out); | |
133 | + // std::wcout << unicode::ToWString(out); | |
134 | + //ofs_ << unicode::ToString(out); | |
135 | 135 | } |
136 | 136 | |
137 | 137 | template<class T1, class T2, class T3> |
138 | 138 | void Log(const tstring& prefix, const tstring& format, const T1& t1, const T2& t2, const T3& t3) { |
139 | 139 | auto out = prefix + (tformat(format) % t1 % t2 % t3).str() + _T("\n"); |
140 | 140 | OutputDebugString(out.c_str()); |
141 | - std::wcout << unicode::ToWString(out); | |
142 | - ofs_ << unicode::ToString(out); | |
141 | + // std::wcout << unicode::ToWString(out); | |
142 | + //ofs_ << unicode::ToString(out); | |
143 | 143 | } |
144 | 144 | |
145 | 145 | template<class T1, class T2, class T3, class T4> |
146 | 146 | void Log(const tstring& prefix, const tstring& format, const T1& t1, const T2& t2, const T3& t3, const T4& t4) { |
147 | 147 | auto out = prefix + (tformat(format) % t1 % t2 % t3 % t4).str() + _T("\n"); |
148 | 148 | OutputDebugString(out.c_str()); |
149 | - std::wcout << unicode::ToWString(out); | |
150 | - ofs_ << unicode::ToString(out); | |
149 | + // std::wcout << unicode::ToWString(out); | |
150 | + //ofs_ << unicode::ToString(out); | |
151 | 151 | } |
152 | 152 | |
153 | - std::ofstream ofs_; | |
153 | + std::ofstream ofs_; | |
154 | 154 | }; |
@@ -166,10 +166,10 @@ std::string Encrypter::GetPublicKeyFingerPrint() | ||
166 | 166 | |
167 | 167 | std::string Encrypter::GetHash(const std::string& in) |
168 | 168 | { |
169 | - std::unique_ptr<byte[]> outbuf(new byte [CryptoPP::SHA512().DIGESTSIZE]); | |
169 | + std::unique_ptr<byte[]> outbuf(new byte [64]); | |
170 | 170 | CryptoPP::SHA512().CalculateDigest(outbuf.get(), (const byte*)in.data(), in.size()); |
171 | 171 | |
172 | - return std::string((char*)outbuf.get(), CryptoPP::SHA512().DIGESTSIZE); | |
172 | + return std::string((char*)outbuf.get(), 64); | |
173 | 173 | } |
174 | 174 | |
175 | 175 | std::string Encrypter::GetTrip(const std::string& in) |
@@ -28,8 +28,8 @@ namespace unicode { | ||
28 | 28 | |
29 | 29 | #ifdef _WIN32 |
30 | 30 | |
31 | -std::string sjis2utf8(const std::string&); | |
32 | -std::string utf82sjis(const std::string&); | |
31 | +std::string sjis2utf8(std::string); | |
32 | +std::string utf82sjis(std::string); | |
33 | 33 | |
34 | 34 | std::string ToString(const std::wstring& s); |
35 | 35 | std::wstring ToWString(const std::string& s); |
@@ -2,14 +2,15 @@ CC = gcc | ||
2 | 2 | CXX = g++ |
3 | 3 | LD = g++ |
4 | 4 | |
5 | -CXXFLAGS = -g -ggdb -Wall -std=gnu++0x | |
6 | -LIBS = -lboost_system -lboost_thread -lboost_date_time -lboost_filesystem -lboost_regex \ | |
7 | - -lpthread -lssl -lcrypto -ldl -lrt | |
8 | -LIBDIRS = -L/usr/local/lib | |
5 | +CXXFLAGS = -g -ggdb -Wall -std=gnu++0x -I/usr/include/cryptopp | |
6 | +LIBS = -lcryptopp -lboost_system -lboost_thread -lboost_date_time -lboost_filesystem -lboost_regex \ | |
7 | + -lpthread -lssl -ldl -lrt | |
8 | +LIBDIRS = -L/usr/lib -L/usr/local/lib | |
9 | 9 | |
10 | 10 | TARGET = server |
11 | 11 | OBJS := $(patsubst %.cpp,%.o,$(wildcard *.cpp)) |
12 | 12 | OBJS += $(patsubst %.cpp,%.o,$(wildcard ../common/network/*.cpp)) |
13 | +OBJS += $(patsubst %.c,%.o,$(wildcard ../common/network/lz4/*.c)) | |
13 | 14 | |
14 | 15 | all: $(OBJS) |
15 | 16 | $(LD) $(CXXFLAGS) -o $(TARGET) $(OBJS) $(LIBS) $(LIBDIRS) |
@@ -5,6 +5,7 @@ | ||
5 | 5 | #include "Server.hpp" |
6 | 6 | #include <algorithm> |
7 | 7 | #include <boost/make_shared.hpp> |
8 | +#include <boost/foreach.hpp> | |
8 | 9 | #include "../common/Logger.hpp" |
9 | 10 | #include "../common/network/Command.hpp" |
10 | 11 | #include "../common/network/Utils.hpp" |