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

Function pj_param

ThirdParty/libproj/vtklibproj/src/param.cpp:154–238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152/************************************************************************/
153
154PROJVALUE pj_param (PJ_CONTEXT *ctx, paralist *pl, const char *opt) {
155
156 int type;
157 unsigned l;
158 PROJVALUE value = {0};
159
160 if ( ctx == nullptr )
161 ctx = pj_get_default_ctx();
162
163 type = *opt++;
164
165 if (nullptr==strchr ("tbirds", type)) {
166 fprintf(stderr, "invalid request to pj_param, fatal\n");
167 exit(1);
168 }
169
170 pl = pj_param_exists (pl, opt);
171 if (type == 't') {
172 value.i = pl != nullptr;
173 return value;
174 }
175
176 /* Not found */
177 if (nullptr==pl) {
178 /* Return value after the switch, so that the return path is */
179 /* taken in all cases */
180 switch (type) {
181 case 'b': case 'i':
182 value.i = 0;
183 break;
184 case 'd': case 'r':
185 value.f = 0.;
186 break;
187 case 's':
188 value.s = nullptr;
189 break;
190 }
191 return value;
192 }
193
194 /* Found parameter - now find its value */
195 pl->used |= 1;
196 l = (int) strlen(opt);
197 opt = pl->param + l;
198 if (*opt == '=')
199 ++opt;
200
201 switch (type) {
202 case 'i': /* integer input */
203 value.i = atoi(opt);
204 for( const char* ptr = opt; *ptr != '\0'; ++ptr )
205 {
206 if( !(*ptr >= '0' && *ptr <= '9') )
207 {
208 proj_context_errno_set (ctx, PROJ_ERR_INVALID_OP_ILLEGAL_ARG_VALUE);
209 value.i = 0;
210 }
211 }

Callers 15

pj_generic_grid_initFunction · 0.85
pj_hgrid_initFunction · 0.85
pj_vgrid_initFunction · 0.85
pipeline.cppFile · 0.85
proj_pj_infoFunction · 0.85
proj_init_infoFunction · 0.85
pj_datum_setFunction · 0.85
PROJECTIONFunction · 0.85
PROJECTIONFunction · 0.85
PROJECTIONFunction · 0.85
PROJECTIONFunction · 0.85

Calls 6

pj_get_default_ctxFunction · 0.85
fprintfFunction · 0.85
pj_param_existsFunction · 0.85
proj_context_errno_setFunction · 0.85
pj_atofFunction · 0.85
dmstor_ctxFunction · 0.85

Tested by

no test coverage detected