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

Function cups_read_strings

cups/language.c:1514–1624  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1512 */
1513
1514static int /* O - 1 on success, 0 on failure */
1515cups_read_strings(cups_file_t *fp, /* I - .strings file */
1516 int flags, /* I - CUPS_MESSAGE_xxx flags */
1517 cups_array_t *a) /* I - Message catalog array */
1518{
1519 char buffer[8192], /* Line buffer */
1520 *bufptr, /* Pointer into buffer */
1521 *msg, /* Pointer to start of message */
1522 *str; /* Pointer to start of translation string */
1523 _cups_message_t *m; /* New message */
1524
1525
1526 while (cupsFileGets(fp, buffer, sizeof(buffer)))
1527 {
1528 /*
1529 * Skip any line (comments, blanks, etc.) that isn't:
1530 *
1531 * "message" = "translation";
1532 */
1533
1534 for (bufptr = buffer; *bufptr && isspace(*bufptr & 255); bufptr ++);
1535
1536 if (*bufptr != '\"')
1537 continue;
1538
1539 /*
1540 * Find the end of the message...
1541 */
1542
1543 bufptr ++;
1544 for (msg = bufptr; *bufptr && *bufptr != '\"'; bufptr ++)
1545 if (*bufptr == '\\' && bufptr[1])
1546 bufptr ++;
1547
1548 if (!*bufptr)
1549 continue;
1550
1551 *bufptr++ = '\0';
1552
1553 if (flags & _CUPS_MESSAGE_UNQUOTE)
1554 cups_unquote(msg, msg);
1555
1556 /*
1557 * Find the start of the translation...
1558 */
1559
1560 while (*bufptr && isspace(*bufptr & 255))
1561 bufptr ++;
1562
1563 if (*bufptr != '=')
1564 continue;
1565
1566 bufptr ++;
1567 while (*bufptr && isspace(*bufptr & 255))
1568 bufptr ++;
1569
1570 if (*bufptr != '\"')
1571 continue;

Callers 1

_cupsMessageLoadFunction · 0.85

Calls 3

cupsFileGetsFunction · 0.85
cups_unquoteFunction · 0.85
cupsArrayAddFunction · 0.85

Tested by

no test coverage detected