| 178 | } |
| 179 | |
| 180 | int32_t CodedInputDataCrypt::readRawVarint32(bool discardPreData) { |
| 181 | consumeBytes(10, discardPreData); |
| 182 | |
| 183 | int8_t tmp = this->readRawByte(); |
| 184 | if (tmp >= 0) { |
| 185 | return tmp; |
| 186 | } |
| 187 | int32_t result = tmp & 0x7f; |
| 188 | if ((tmp = this->readRawByte()) >= 0) { |
| 189 | result |= tmp << 7; |
| 190 | } else { |
| 191 | result |= (tmp & 0x7f) << 7; |
| 192 | if ((tmp = this->readRawByte()) >= 0) { |
| 193 | result |= tmp << 14; |
| 194 | } else { |
| 195 | result |= (tmp & 0x7f) << 14; |
| 196 | if ((tmp = this->readRawByte()) >= 0) { |
| 197 | result |= tmp << 21; |
| 198 | } else { |
| 199 | result |= (tmp & 0x7f) << 21; |
| 200 | result |= (tmp = this->readRawByte()) << 28; |
| 201 | if (tmp < 0) { |
| 202 | // discard upper 32 bits |
| 203 | for (int i = 0; i < 5; i++) { |
| 204 | if (this->readRawByte() >= 0) { |
| 205 | return result; |
| 206 | } |
| 207 | } |
| 208 | throw invalid_argument("InvalidProtocolBuffer malformed varint32"); |
| 209 | } |
| 210 | } |
| 211 | } |
| 212 | } |
| 213 | return result; |
| 214 | } |
| 215 | |
| 216 | int32_t CodedInputDataCrypt::readInt32() { |
| 217 | return this->readRawVarint32(); |
no test coverage detected