void pdf_quote_name(PDF *p, const char *text, size_t len) { const unsigned char *goal, *s; static const char BinToHex[] = PDF_STRING_0123456789ABCDEF; goal = (const unsigned char *) text + len; for (s = (const unsigned char *) text; s < goal; s++) { if (PDF_NEEDS_QUOTE(*s)) { pdf_putc(p, PDF_HASH); pdf_putc(p, BinToHex[*s >> 4]); /* first nibble */ pdf_putc(p, BinToHex[*s & 0x0F]); /* second nibble */ } else
void pdc_put_pdfname(pdc_output *out, const char *text, size_t len) { const unsigned char *goal, *s; static const char BinToHex[] = PDF_STRING_0123456789ABCDEF; if (!len) len = strlen(text); goal = (const unsigned char *) text + len; pdc_putc(out, PDF_SLASH); for (s = (const unsigned char *) text; s < goal; s++) { if (PDF_NEEDS_QUOTE(*s)) { pdc_putc(out, PDF_HASH); pdc_putc(out, BinToHex[*s >> 4]); /* first nibble */ pdc_putc(out, BinToHex[*s & 0x0F]); /* second nibble */ } else