MCPcopy Create free account
hub / github.com/Kitware/VTK / parse_coefs

Function parse_coefs

ThirdParty/libproj/vtklibproj/src/transformations/horner.cpp:409–439  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

407
408
409static int parse_coefs (PJ *P, double *coefs, const char *param, int ncoefs) {
410 char *buf, *init, *next = nullptr;
411 int i;
412
413 buf = static_cast<char*>(calloc (strlen (param) + 2, sizeof(char)));
414 if (nullptr==buf) {
415 proj_log_error (P, "No memory left");
416 return 0;
417 }
418
419 sprintf (buf, "t%s", param);
420 if (0==pj_param (P->ctx, P->params, buf).i) {
421 free (buf);
422 return 0;
423 }
424 sprintf (buf, "s%s", param);
425 init = pj_param(P->ctx, P->params, buf).s;
426 free (buf);
427
428 for (i = 0; i < ncoefs; i++) {
429 if (i > 0) {
430 if ( next == nullptr || ','!=*next) {
431 proj_log_error (P, "Malformed polynomium set %s. need %d coefs", param, ncoefs);
432 return 0;
433 }
434 init = ++next;
435 }
436 coefs[i] = pj_strtod (init, &next);
437 }
438 return 1;
439}
440
441
442/*********************************************************************/

Callers 1

PROJECTIONFunction · 0.85

Calls 4

proj_log_errorFunction · 0.85
sprintfFunction · 0.85
pj_paramFunction · 0.85
pj_strtodFunction · 0.85

Tested by

no test coverage detected