bool WandReadVector(std::string::iterator &buffer, std::string::iterator &buffer_end, binary_string &target, uint32_t len) { target.resize(len); binary_string::iterator target_pos = target.begin(); for (; len > 0 && buffer < buffer_end; len--, buffer++, target_pos++) { *target_pos = (unsigned char)*buffer; } return (len == 0); }
bool WandReadTagLenDataVector(std::string::iterator &buffer, std::string::iterator &buffer_end, uint32_t tag_len, uint32_t len_len, uint32_t &tag, binary_string &target) { target.resize(0); tag = 0; if (tag_len && !WandReadUintX(buffer, buffer_end, tag_len, tag, true)) return false; if ((tag & TAG_MSB) != 0) return true; uint32_t len = 0; if (len_len && !WandReadUintX(buffer, buffer_end, len_len, len)) return false; if (len == 0) return true; return WandReadVector(buffer, buffer_end, target, len); }