Created
September 26, 2014 02:51
-
-
Save zhangce/b3e3c9b3039882b1e51a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| bool Deserialize(int fd) { | |
| int flag; | |
| int length; | |
| ReadN(fd, (char*) &flag, sizeof(flag)); | |
| contains_value_ = flag; | |
| ReadN(fd, (char*) &length, sizeof(length)); | |
| ReadN(fd, (char*) buf, length); | |
| key_ = std::string(buf); | |
| ReadN(fd, (char*) &length, sizeof(length)); | |
| ReadN(fd, (char*) buf, length); | |
| value_ = std::string(buf); | |
| /* | |
| if (ReadN(fd, (char*) &contains_value_, sizeof(contains_value_)) <= 0) | |
| return false; | |
| if (!ReadString(fd, &key_)) | |
| return false; | |
| if (contains_value_ && !ReadString(fd, &value_)) | |
| return false; | |
| */ | |
| return true; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment