| 205 | } |
| 206 | |
| 207 | MMBuffer MiniPBCoder::encodeDataWithObject(const MMBuffer &obj) { |
| 208 | try { |
| 209 | auto valueSize = static_cast<uint32_t>(obj.length()); |
| 210 | auto compiledSize = pbRawVarint32Size(valueSize) + valueSize; |
| 211 | MMBuffer result(compiledSize); |
| 212 | CodedOutputData output(result.getPtr(), result.length()); |
| 213 | output.writeData(obj); |
| 214 | return result; |
| 215 | } catch (const std::exception &exception) { |
| 216 | MMKVError("%s", exception.what()); |
| 217 | return MMBuffer(); |
| 218 | } catch (...) { |
| 219 | MMKVError("prepare encode fail"); |
| 220 | return MMBuffer(); |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | size_t MiniPBCoder::prepareObjectForEncode(const string &str) { |
| 225 | m_encodeItems->push_back(PBEncodeItem()); |
nothing calls this directly
no test coverage detected