MCPcopy Create free account
hub / github.com/Tencent/MMKV / readNSData

Method readNSData

Core/CodedInputData_OSX.cpp:74–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74NSData *CodedInputData::readNSData() {
75 int32_t size = this->readRawVarint32();
76 if (size < 0) {
77 throw length_error("InvalidProtocolBuffer negativeSize");
78 }
79
80 auto s_size = static_cast<size_t>(size);
81 if (s_size <= m_size - m_position) {
82 NSData *result = [NSData dataWithBytes:(m_ptr + m_position) length:s_size];
83 m_position += s_size;
84 return result;
85 } else {
86 throw out_of_range("InvalidProtocolBuffer truncatedMessage");
87 }
88}
89
90} // namespace mmkv
91

Callers 1

Calls 1

readRawVarint32Method · 0.95

Tested by

no test coverage detected