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

Function cupsFileGetChar

cups/file.c:660–705  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

658 */
659
660int /* O - Character or -1 on end of file */
661cupsFileGetChar(cups_file_t *fp) /* I - CUPS file */
662{
663 /*
664 * Range check input...
665 */
666
667 DEBUG_printf(("4cupsFileGetChar(fp=%p)", (void *)fp));
668
669 if (!fp || (fp->mode != 'r' && fp->mode != 's'))
670 {
671 DEBUG_puts("5cupsFileGetChar: Bad arguments!");
672 return (-1);
673 }
674
675 if (fp->eof)
676 {
677 DEBUG_puts("5cupsFileGetChar: End-of-file!");
678 return (-1);
679 }
680
681 /*
682 * If the input buffer is empty, try to read more data...
683 */
684
685 DEBUG_printf(("5cupsFileGetChar: fp->eof=%d, fp->ptr=%p, fp->end=%p", fp->eof, (void *)fp->ptr, (void *)fp->end));
686
687 if (fp->ptr >= fp->end)
688 if (cups_fill(fp) <= 0)
689 {
690 DEBUG_puts("5cupsFileGetChar: Unable to fill buffer!");
691 return (-1);
692 }
693
694 /*
695 * Return the next character in the buffer...
696 */
697
698 DEBUG_printf(("5cupsFileGetChar: Returning %d...", *(fp->ptr) & 255));
699
700 fp->pos ++;
701
702 DEBUG_printf(("6cupsFileGetChar: pos=" CUPS_LLFMT, CUPS_LLCAST fp->pos));
703
704 return (*(fp->ptr)++ & 255);
705}
706
707
708/*

Callers 9

copy_bannerFunction · 0.85
cupsdInitCertsFunction · 0.85
get_utf16Function · 0.85
getMethod · 0.85
do_config_serverFunction · 0.85
check_basicsFunction · 0.85
read_write_testsFunction · 0.85
ppd_readFunction · 0.85
_ippFileReadTokenFunction · 0.85

Calls 1

cups_fillFunction · 0.85

Tested by 2

check_basicsFunction · 0.68
read_write_testsFunction · 0.68