Squashed 'subtree/rabit/' changes from 27340f9..fed1683

fed1683 minor
c01520f change

git-subtree-dir: subtree/rabit
git-subtree-split: fed1683b9bb031041cc2bf113633cfd40c9faf46
This commit is contained in:
tqchen 2015-04-25 21:24:54 -07:00
parent c0e0fc0c91
commit d16b2c9670
2 changed files with 7 additions and 5 deletions

View File

@ -310,9 +310,10 @@ template<typename T>
inline bool Stream::Read(std::vector<T> *out_vec) {
uint64_t sz;
if (this->Read(&sz, sizeof(sz)) == 0) return false;
out_vec->resize(static_cast<size_t>(sz));
size_t size = static_cast<size_t>(sz);
out_vec->resize(size);
if (sz != 0) {
if (this->Read(&(*out_vec)[0], sizeof(T) * sz) == 0) return false;
if (this->Read(&(*out_vec)[0], sizeof(T) * size) == 0) return false;
}
return true;
}
@ -326,9 +327,10 @@ inline void Stream::Write(const std::string &str) {
inline bool Stream::Read(std::string *out_str) {
uint64_t sz;
if (this->Read(&sz, sizeof(sz)) == 0) return false;
out_str->resize(static_cast<size_t>(sz));
size_t size = static_cast<size_t>(sz);
out_str->resize(size);
if (sz != 0) {
if (this->Read(&(*out_str)[0], sizeof(char) * sz) == 0) {
if (this->Read(&(*out_str)[0], sizeof(char) * size) == 0) {
return false;
}
}

View File

@ -34,7 +34,7 @@
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>