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

Method readString

Core/CodedInputData.cpp:86–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86string CodedInputData::readString() {
87 int32_t size = readRawVarint32();
88 if (size < 0) {
89 throw length_error("InvalidProtocolBuffer negativeSize");
90 }
91
92 auto s_size = static_cast<size_t>(size);
93 if (s_size <= m_size - m_position) {
94 string result((char *) (m_ptr + m_position), s_size);
95 m_position += s_size;
96 return result;
97 } else {
98 throw out_of_range("InvalidProtocolBuffer truncatedMessage");
99 }
100}
101
102void CodedInputData::readString(string &s) {
103 int32_t size = readRawVarint32();

Callers 8

InfoMethod · 0.45
FakeInfoMethod · 0.45
TestParcelableMethod · 0.45
createFromParcelMethod · 0.45
getStringMethod · 0.45
decodeOneVectorMethod · 0.45
decodeOneMapMethod · 0.45
testAESToMMBufferMethod · 0.45

Calls 1

readRawVarint32Method · 0.95

Tested by 1

TestParcelableMethod · 0.36