]> git.ipfire.org Git - thirdparty/cups.git/blob - cups/file-private.h
Merge changes from CUPS 1.4svn-r8394.
[thirdparty/cups.git] / cups / file-private.h
1 /*
2 * "$Id$"
3 *
4 * Private file definitions for the Common UNIX Printing System (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-2009 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 <stdio.h>
29 # include <stdlib.h>
30 # include <stdarg.h>
31 # include <errno.h>
32 # include <fcntl.h>
33 # include "http-private.h"
34 # include "globals.h"
35 # include "debug.h"
36
37 # ifdef HAVE_LIBZ
38 # include <zlib.h>
39 # endif /* HAVE_LIBZ */
40 # ifdef WIN32
41 # include <io.h>
42 # include <sys/locking.h>
43 # endif /* WIN32 */
44
45
46 /*
47 * Some operating systems support large files via open flag O_LARGEFILE...
48 */
49
50 # ifndef O_LARGEFILE
51 # define O_LARGEFILE 0
52 # endif /* !O_LARGEFILE */
53
54
55 /*
56 * Some operating systems don't define O_BINARY, which is used by Microsoft
57 * and IBM to flag binary files...
58 */
59
60 # ifndef O_BINARY
61 # define O_BINARY 0
62 # endif /* !O_BINARY */
63
64
65 /*
66 * Types and structures...
67 */
68
69 struct _cups_file_s /**** CUPS file structure... ****/
70
71 {
72 int fd; /* File descriptor */
73 char mode, /* Mode ('r' or 'w') */
74 compressed, /* Compression used? */
75 is_stdio, /* stdin/out/err? */
76 eof, /* End of file? */
77 buf[4096], /* Buffer */
78 *ptr, /* Pointer into buffer */
79 *end; /* End of buffer data */
80 off_t pos, /* Position in file */
81 bufpos; /* File position for start of buffer */
82
83 #ifdef HAVE_LIBZ
84 z_stream stream; /* (De)compression stream */
85 Bytef cbuf[4096]; /* (De)compression buffer */
86 uLong crc; /* (De)compression CRC */
87 #endif /* HAVE_LIBZ */
88
89 char *printf_buffer; /* cupsFilePrintf buffer */
90 size_t printf_size; /* Size of cupsFilePrintf buffer */
91 };
92
93
94 #endif /* !_CUPS_FILE_PRIVATE_H_ */
95
96 /*
97 * End of "$Id$".
98 */