mirror of
https://github.com/MaskRay/ccls.git
synced 2025-01-19 12:05:50 +00:00
Fix Range serialization for -1:-1--1:-1
This commit is contained in:
parent
cef1559f6d
commit
d49679d885
@ -77,21 +77,18 @@ Range::Range(Position position) : Range(position, position) {}
|
||||
Range::Range(Position start, Position end) : start(start), end(end) {}
|
||||
|
||||
Range::Range(const char* encoded) {
|
||||
end = start;
|
||||
char* p = const_cast<char*>(encoded);
|
||||
start.line = strtol(p, &p, 10);
|
||||
assert(*p == ':');
|
||||
p++;
|
||||
start.column = strtol(p, &p, 10);
|
||||
assert(*p == '-');
|
||||
p++;
|
||||
|
||||
start.line = (int16_t)atoi(encoded);
|
||||
|
||||
encoded = SkipAfter(encoded, ':');
|
||||
assert(encoded);
|
||||
start.column = (int16_t)atoi(encoded);
|
||||
|
||||
encoded = SkipAfter(encoded, '-');
|
||||
assert(encoded);
|
||||
end.line = (int16_t)atoi(encoded);
|
||||
|
||||
encoded = SkipAfter(encoded, ':');
|
||||
assert(encoded);
|
||||
end.column = (int16_t)atoi(encoded);
|
||||
end.line = strtol(p, &p, 10);
|
||||
assert(*p == ':');
|
||||
p++;
|
||||
end.column = strtol(p, nullptr, 10);
|
||||
}
|
||||
|
||||
bool Range::Contains(int line, int column) const {
|
||||
|
Loading…
Reference in New Issue
Block a user