stdlibs/libz/zlib/libzgzio.h
changeset 59 09fa7c3c5079
parent 52 bf6a71c50e42
child 63 a117ad66e027
equal deleted inserted replaced
52:bf6a71c50e42 59:09fa7c3c5079
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef LIBZGZIO_H
       
    20 #define LIBZGZIO_H
       
    21 
       
    22 #if (defined(__TOOLS2__) || defined(__TOOLS__))
       
    23 	#include "zconf.h"
       
    24 #else
       
    25 	#include <zconf.h> 
       
    26 #endif
       
    27 
       
    28 #include <stdarg.h>
       
    29  
       
    30 
       
    31 #ifdef SYMBIAN_EZLIB_DEVICE
       
    32 	#include <e32def.h>
       
    33 #endif
       
    34 
       
    35 #ifdef __cplusplus
       
    36 	extern "C" {
       
    37 #endif
       
    38 
       
    39 typedef voidp gzFile;
       
    40 
       
    41 /* 
       
    42  * Flushes all pending output if necessary, closes the compressed file
       
    43  * and deallocates all the (de)compression state.
       
    44  */
       
    45 int gzclose_r (gzFile file);
       
    46 
       
    47 
       
    48 /*
       
    49  * Clears the error and end-of-file flags for file.This is analogous to the
       
    50  * clearerr() function in stdio.
       
    51  */
       
    52 void gzclearerr_r (gzFile file);
       
    53 
       
    54  
       
    55 /* 
       
    56  * gzdopen() associates a gzFile with the file descriptor fd.  File
       
    57  * descriptors are obtained from calls like open, dup, creat, pipe or
       
    58  * fileno (in the file has been previously opened with fopen).
       
    59  * The mode parameter is as in gzopen.
       
    60  */
       
    61 gzFile gzdopen_r (int fd, const char *mode);
       
    62 
       
    63 
       
    64 /*
       
    65  * Returns 1 if file is being read directly without decompression, otherwise
       
    66  * zero.
       
    67  */
       
    68 int gzdirect_r (gzFile file);
       
    69 
       
    70 
       
    71 /*
       
    72  * Returns 1 when EOF has previously been detected reading the given
       
    73  * input stream, otherwise zero.
       
    74  */ 
       
    75 int gzeof_r (gzFile file);
       
    76 
       
    77 
       
    78 /*
       
    79  * Returns the error message for the last error which occurred on the
       
    80  * given compressed file. errnum is set to zlib error number. If an
       
    81  * error occurred in the file system and not in the compression library,
       
    82  * errnum is set to Z_ERRNO and the application may consult errno
       
    83  * to get the exact error code.
       
    84  */
       
    85 const char* gzerror_r (gzFile file, int *errnum);
       
    86 
       
    87 
       
    88 /* 
       
    89  * Flushes all pending output into the compressed file.gzflush should 
       
    90  * be called only when strictly necessary because it can degrade compression.
       
    91  */
       
    92 int gzflush_r (gzFile file, int flush);
       
    93 
       
    94 
       
    95 /*
       
    96  * Reads one byte from the compressed file. gzgetc returns this byte
       
    97  * or -1 in case of end of file or error.
       
    98  */
       
    99 int gzgetc_r (gzFile file);
       
   100 
       
   101 
       
   102 /*
       
   103  * Reads bytes from the compressed file until len-1 characters are read, or
       
   104  * a newline character is read and transferred to buf, or an end-of-file
       
   105  * condition is encountered.  The string is then terminated with a null
       
   106  * character.
       
   107  */
       
   108 char* gzgets_r (gzFile file, char *buf, int len);
       
   109 
       
   110 /*
       
   111  * Opens a gzip (.gz) file for reading or writing. The mode parameter
       
   112  * is as in fopen ("rb" or "wb") but can also include a compression level
       
   113  * ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for
       
   114  * Huffman only compression as in "wb1h", or 'R' for run-length encoding
       
   115  * as in "wb1R".
       
   116  */ 
       
   117 gzFile gzopen_r (const char *path, const char *mode);
       
   118 
       
   119 
       
   120 /*
       
   121  * Converts, formats, and writes the args to the compressed file under
       
   122  * control of the format string, as in fprintf. gzprintf returns the number of
       
   123  * uncompressed bytes actually written (0 in case of error).
       
   124  */
       
   125 int gzprintf_r (gzFile file, const char *format, va_list va);
       
   126 
       
   127 
       
   128 /*
       
   129  * Writes c, converted to an unsigned char, into the compressed file.
       
   130  * gzputc returns the value that was written, or -1 in case of error.
       
   131  */
       
   132 int gzputc_r (gzFile file, int c);
       
   133 
       
   134 
       
   135 /*
       
   136  * Writes the given null-terminated string to the compressed file, excluding
       
   137  * the terminating null character. gzputs returns the number of characters 
       
   138  * written, or -1 in case of error.
       
   139  */
       
   140 int gzputs_r (gzFile file, const char *s);
       
   141 
       
   142 
       
   143 /*
       
   144  * Reads the given number of uncompressed bytes from the compressed file.
       
   145  * gzread returns the number of uncompressed bytes actually read (0 for
       
   146  * end of file, -1 for error).
       
   147  */
       
   148 int gzread_r (gzFile file, voidp buf, unsigned len);
       
   149 
       
   150 
       
   151 /*
       
   152  * Rewinds the given file. This function is supported only for reading.
       
   153  * gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
       
   154  */
       
   155  
       
   156 int gzrewind_r (gzFile file);
       
   157 
       
   158 
       
   159 /*
       
   160  * Sets the starting position for the next gzread or gzwrite on the
       
   161  * given compressed file. If the file is opened for writing, only 
       
   162  * forward seeks are supported.
       
   163  */ 
       
   164 z_off_t gzseek_r (gzFile file, z_off_t offset, int whence);
       
   165 
       
   166 
       
   167 /*
       
   168  * Dynamically update the compression level or strategy. See the description
       
   169  * of deflateInit2 for the meaning of these parameters.
       
   170  */                                    
       
   171 int gzsetparams_r (gzFile file, int level, int strategy);
       
   172 
       
   173 
       
   174 /*
       
   175  * Returns the starting position for the next gzread or gzwrite on the
       
   176  * given compressed file. This position represents a number of bytes in the
       
   177  * uncompressed data stream.
       
   178  */ 
       
   179 z_off_t gztell_r (gzFile file);
       
   180 
       
   181 
       
   182 /*
       
   183  * Push one character back onto the stream to be read again later.
       
   184  * Only one character of push-back is allowed. 
       
   185  */ 
       
   186 int gzungetc_r (int c, gzFile file);
       
   187 
       
   188 
       
   189 /*
       
   190  * Writes the given number of uncompressed bytes into the compressed file.
       
   191  * gzwrite returns the number of uncompressed bytes actually written
       
   192  * (0 in case of error).
       
   193  */ 
       
   194 int gzwrite_r (gzFile file, voidpc buf, unsigned len);
       
   195 
       
   196                                    
       
   197 #ifdef __cplusplus
       
   198 	}
       
   199 #endif
       
   200 
       
   201 #endif /* LIBZGZIO_H */
       
   202 
       
   203 
       
   204 
       
   205 
       
   206 
       
   207