| 171 | } |
| 172 | |
| 173 | static bool parsePortOffset(const char* value, uint16_t& parsedOffset) |
| 174 | { |
| 175 | if (value == nullptr or *value == '\0') |
| 176 | { |
| 177 | return false; |
| 178 | } |
| 179 | |
| 180 | uint32_t parsed = 0; |
| 181 | for (const char* ch = value; *ch != '\0'; ++ch) |
| 182 | { |
| 183 | if (*ch < '0' or *ch > '9') |
| 184 | { |
| 185 | return false; |
| 186 | } |
| 187 | parsed = parsed * 10 + static_cast<uint32_t>(*ch - '0'); |
| 188 | if (parsed > 65535) |
| 189 | { |
| 190 | return false; |
| 191 | } |
| 192 | } |
| 193 | parsedOffset = static_cast<uint16_t>(parsed); |
| 194 | return true; |
| 195 | } |
| 196 | |
| 197 | static Result getDirectoryName(StringSpan path, StringPath& directory) |
| 198 | { |