110{
111 uint64_t nVal = 0;
112 int nShift = 0;
113 uint8_t nByte;
114 const uint8_t *ptr = the_start;
115
116
117 while( ptr < the_end )
118 {
119 nByte = *ptr;
120
121 if (nByte & 0x80)
122 {
123
124
125
126 nVal |= ((uint64_t)(nByte & 0x7f)) << nShift;
127
128 ptr++;
129
130 nShift += 7;
131 }
132 else
133 {
134
135 ptr++;
136
137
138 *size = ptr - the_start;
139 return nVal | ((uint64_t)nByte << nShift);
140 }
141 }
142 lwerror(
"%s: varint extends past end of buffer", __func__);
143 *size = 0;
144 return 0;
145}
void void lwerror(const char *fmt,...) __attribute__((format(printf
Write a notice out to the error handler.