]> git.ipfire.org Git - thirdparty/cups.git/blob - cups/file-private.h
Merge changes from CUPS 1.5svn-r9675.
[thirdparty/cups.git] / cups / file-private.h
1 /*
2 * "$Id$"
3 *
4 * Private file definitions for CUPS.
5 *
6 * Since stdio files max out at 256 files on many systems, we have to
7 * write similar functions without this limit. At the same time, using
8 * our own file functions allows us to provide transparent support of
9 * gzip'd print files, PPD files, etc.
10 *
11 * Copyright 2007-2010 by Apple Inc.
12 * Copyright 1997-2007 by Easy Software Products, all rights reserved.
13 *
14 * These coded instructions, statements, and computer programs are the
15 * property of Apple Inc. and are protected by Federal copyright
16 * law. Distribution and use rights are outlined in the file "LICENSE.txt"
17 * which should have been included with this file. If this file is
18 * file is missing or damaged, see the license at "http://www.cups.org/".
19 */
20
21 #ifndef _CUPS_FILE_PRIVATE_H_
22 # define _CUPS_FILE_PRIVATE_H_
23
24 /*
25 * Include necessary headers...
26 */
27
28 # include "cups-private.h"
29 # include <stdio.h>
30 # include <stdlib.h>
31 # include <stdarg.h>
32 # include <fcntl.h>
33
34 # ifdef HAVE_LIBZ
35 # include <zlib.h>
36 # endif /* HAVE_LIBZ */
37 # ifdef WIN32
38 # include <io.h>
39 # include <sys/locking.h>
40 # endif /* WIN32 */
41
42
43 /*
44 * Some operating systems support large files via open flag O_LARGEFILE...
45 */
46
47 # ifndef O_LARGEFILE
48 # define O_LARGEFILE 0
49 # endif /* !O_LARGEFILE */
50
51
52 /*
53 * Some operating systems don't define O_BINARY, which is used by Microsoft
54 * and IBM to flag binary files...
55 */
56
57 # ifndef O_BINARY
58 # define O_BINARY 0
59 # endif /* !O_BINARY */
60
61
62 /*
63 * Types and structures...
64 */
65
66 struct _cups_file_s /**** CUPS file structure... ****/
67
68 {
69 int fd; /* File descriptor */
70 char mode, /* Mode ('r' or 'w') */
71 compressed, /* Compression used? */
72 is_stdio, /* stdin/out/err? */
73 eof, /* End of file? */
74 buf[4096], /* Buffer */
75 *ptr, /* Pointer into buffer */
76 *end; /* End of buffer data */
77 off_t pos, /* Position in file */
78 bufpos; /* File position for start of buffer */
79
80 #ifdef HAVE_LIBZ
81 z_stream stream; /* (De)compression stream */
82 Bytef cbuf[4096]; /* (De)compression buffer */
83 uLong crc; /* (De)compression CRC */
84 #endif /* HAVE_LIBZ */
85
86 char *printf_buffer; /* cupsFilePrintf buffer */
87 size_t printf_size; /* Size of cupsFilePrintf buffer */
88 };
89
90
91 #endif /* !_CUPS_FILE_PRIVATE_H_ */
92
93 /*
94 * End of "$Id$".
95 */