Revert "Fix Compiler Warning on using std::copy: no point using STL routines inside low-level C-style code"

This reverts commit 5dfe48b043.
This commit is contained in:
Peter Thorson
2012-10-12 06:31:18 -05:00
parent d80d9afd88
commit 47a3c060ee

View File

@@ -79,7 +79,9 @@ public:
// TODO: decide if it is best to silently fail here or produce some sort
// of warning or exception.
const std::string& key3 = request.header("Sec-WebSocket-Key3");
memcpy(&key_final[8],key3.c_str(),std::min(static_cast<size_t>(8), key3.size()));
std::copy(key3.c_str(),
key3.c_str()+std::min(static_cast<size_t>(8), key3.size()),
&key_final[8]);
m_key3 = md5_hash_string(std::string(key_final,16));
@@ -329,9 +331,11 @@ private:
num = atoi(digits.c_str());
if (spaces > 0 && num > 0) {
num = htonl(num/spaces);
memcpy(result,&num,4);
std::copy(reinterpret_cast<char*>(&num),
reinterpret_cast<char*>(&num)+4,
result);
} else {
memset(result,0,4);
std::fill(result,result+4,0);
}
}