convert a pair of hex digits to an integer value [0,255] */
| 155 | |
| 156 | /* convert a pair of hex digits to an integer value [0,255] */ |
| 157 | static int dav_parse_hexpair(const char *s) |
| 158 | { |
| 159 | int result; |
| 160 | int temp; |
| 161 | |
| 162 | result = s[0] - '0'; |
| 163 | if (result > 48) |
| 164 | result = (result - 39) << 4; |
| 165 | else if (result > 16) |
| 166 | result = (result - 7) << 4; |
| 167 | else |
| 168 | result = result << 4; |
| 169 | |
| 170 | temp = s[1] - '0'; |
| 171 | if (temp > 48) |
| 172 | result |= temp - 39; |
| 173 | else if (temp > 16) |
| 174 | result |= temp - 7; |
| 175 | else |
| 176 | result |= temp; |
| 177 | |
| 178 | return result; |
| 179 | } |
| 180 | |
| 181 | /* dav_parse_locktoken: Parses string produced from |
| 182 | * dav_format_opaquelocktoken back into a xuuid_t |