Skip to content

Commit a5bb908

Browse files
committed
Merge pull request XRPLF#252 from breyed/visual-studio
Fixed Visual Studio 2012 warnings and formatting
2 parents c2a5f0b + e68d492 commit a5bb908

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

websocketpp/logger/basic.hpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,17 @@ class basic {
111111
typedef typename concurrency::scoped_lock_type scoped_lock_type;
112112
typedef typename concurrency::mutex_type mutex_type;
113113

114-
const char* get_timestamp() {
114+
// The timestamp does not include the time zone, because on Windows with the default registry settings,
115+
// the time zone would be written out in full, which would be obnoxiously verbose.
116+
std::string get_timestamp() {
115117
std::time_t t = std::time(NULL);
116-
std::strftime(buffer,39,"%Y-%m-%d %H:%M:%S%z",std::localtime(&t));
118+
char buffer[40];
119+
std::strftime(buffer,sizeof(buffer),"%Y-%m-%d %H:%M:%S",std::localtime(&t));
117120
return buffer;
118121
}
119122

120123
mutex_type m_lock;
121124

122-
char buffer[40];
123125
const level m_static_channels;
124126
level m_dynamic_channels;
125127
std::ostream* m_out;

websocketpp/processors/hybi00.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,8 @@ class hybi00 : public processor<config> {
338338
}
339339

340340
std::string val;
341-
val.append(1,0xff);
342-
val.append(1,0x00);
341+
val.append(1,'\xff');
342+
val.append(1,'\x00');
343343
out->set_payload(val);
344344
out->set_prepared(true);
345345

websocketpp/sha1/sha1.hpp

+7
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,14 @@ class SHA1
102102

103103
while(length-- && !Corrupted)
104104
{
105+
#ifdef _MSC_VER
106+
#pragma warning(push)
107+
#pragma warning(suppress: 6386) // Suppresses Visual Studio code analysis for write overrun. It doesn't know the index into Message_Block is protected by checking length.
108+
#endif
105109
Message_Block[Message_Block_Index++] = (*message_array & 0xFF);
110+
#ifdef _MSC_VER
111+
#pragma warning(pop)
112+
#endif
106113

107114
Length_Low += 8;
108115
Length_Low &= 0xFFFFFFFF; // Force it to 32 bits

0 commit comments

Comments
 (0)