Rev 1598 | Rev 1642 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1598 | Rev 1608 | ||
|---|---|---|---|
| Line 44... | Line 44... | ||
| 44 | memcpy(this->bytes_, set.bytes_, this->max_size_); |
44 | memcpy(this->bytes_, set.bytes_, this->max_size_); |
| 45 | } |
45 | } |
| 46 | 46 | ||
| 47 | Byteset::Byteset(std::string str) |
47 | Byteset::Byteset(std::string str) |
| 48 | { |
48 | { |
| 49 | this->max_size_ = str. |
49 | this->max_size_ = str.size() + 1; |
| 50 | this->size_ = this->max_size_; |
50 | this->size_ = this->max_size_; |
| 51 | this->bytes_ = new unsigned char[this->max_size_]; |
51 | this->bytes_ = new unsigned char[this->max_size_]; |
| 52 | 52 | ||
| 53 | memcpy(this->bytes_, str.data(), this->max_size_); |
53 | memcpy(this->bytes_, str.data(), this->max_size_); |
| 54 | } |
54 | } |
| Line 63... | Line 63... | ||
| 63 | return this->bytes_; |
63 | return this->bytes_; |
| 64 | } |
64 | } |
| 65 | 65 | ||
| 66 | std::string Byteset::ToCharString() |
66 | std::string Byteset::ToCharString() |
| 67 | { |
67 | { |
| 68 | return std::string((char*)this->bytes_, this->size_); |
68 | return std::string((char*)this->bytes_, this->size_ - 1); |
| 69 | } |
69 | } |
| 70 | 70 | ||
| 71 | std::string Byteset::ToDebugString() |
71 | std::string Byteset::ToDebugString() |
| 72 | { |
72 | { |
| 73 | std::string debug_string; |
73 | std::string debug_string; |