MCPcopy Create free account
hub / github.com/OpenPrinting/cups / _cupsStrScand

Function _cupsStrScand

cups/string.c:394–522  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

392 */
393
394double /* O - Number */
395_cupsStrScand(const char *buf, /* I - Pointer to number */
396 char **bufptr, /* O - New pointer or NULL on error */
397 struct lconv *loc) /* I - Locale data */
398{
399 char temp[1024], /* Temporary buffer */
400 *tempptr; /* Pointer into temporary buffer */
401
402
403 /*
404 * Range check input...
405 */
406
407 if (!buf)
408 return (0.0);
409
410 /*
411 * Skip leading whitespace...
412 */
413
414 while (_cups_isspace(*buf))
415 buf ++;
416
417 /*
418 * Copy leading sign, numbers, period, and then numbers...
419 */
420
421 tempptr = temp;
422 if (*buf == '-' || *buf == '+')
423 *tempptr++ = *buf++;
424
425 while (isdigit(*buf & 255))
426 if (tempptr < (temp + sizeof(temp) - 1))
427 *tempptr++ = *buf++;
428 else
429 {
430 if (bufptr)
431 *bufptr = NULL;
432
433 return (0.0);
434 }
435
436 if (*buf == '.')
437 {
438 /*
439 * Read fractional portion of number...
440 */
441
442 buf ++;
443
444 if (loc && loc->decimal_point)
445 {
446 strlcpy(tempptr, loc->decimal_point, sizeof(temp) - (size_t)(tempptr - temp));
447 tempptr += strlen(tempptr);
448 }
449 else if (tempptr < (temp + sizeof(temp) - 1))
450 *tempptr++ = '.';
451 else

Callers 14

mainFunction · 0.85
token_cbFunction · 0.85
parse_variableFunction · 0.85
get_floatMethod · 0.85
get_measurementMethod · 0.85
mainFunction · 0.85
_ppdCacheGetSizeFunction · 0.85
ppd_mark_optionFunction · 0.85
httpGetContentEncodingFunction · 0.85
ppdPageSizeFunction · 0.85
scan_psFunction · 0.85

Calls 1

_cups_isspaceFunction · 0.85

Tested by 2

mainFunction · 0.68
test_languageFunction · 0.68