MCPcopy Create free account
hub / github.com/OSGeo/PROJ / pj_wkt_error

Function pj_wkt_error

src/wkt_parser.cpp:35–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33// ---------------------------------------------------------------------------
34
35void pj_wkt_error(pj_wkt_parse_context *context, const char *msg) {
36 context->errorMsg = "Parsing error : ";
37 context->errorMsg += msg;
38 context->errorMsg += ". Error occurred around:\n";
39
40 std::string ctxtMsg;
41 const int n = static_cast<int>(context->pszLastSuccess - context->pszInput);
42 int start_i = std::max(0, n - 40);
43 for (int i = start_i; i < n + 40 && context->pszInput[i]; i++) {
44 if (context->pszInput[i] == '\r' || context->pszInput[i] == '\n') {
45 if (i > n) {
46 break;
47 } else {
48 ctxtMsg.clear();
49 start_i = i + 1;
50 }
51 } else {
52 ctxtMsg += context->pszInput[i];
53 }
54 }
55 context->errorMsg += ctxtMsg;
56 context->errorMsg += '\n';
57 for (int i = start_i; i < n; i++)
58 context->errorMsg += ' ';
59 context->errorMsg += '^';
60}

Callers 2

pj_wkt2_errorFunction · 0.85
pj_wkt1_errorFunction · 0.85

Calls 1

clearMethod · 0.45

Tested by

no test coverage detected