stdlibs/libz/zlib/zlibapiwrapper.cpp
changeset 65 c4aad78f92f5
parent 50 79045913e4e9
child 66 38bdaa106551
equal deleted inserted replaced
50:79045913e4e9 65:c4aad78f92f5
     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 
       
    20 /*
       
    21 This file contains the C interface for all the APIs provided by the 
       
    22 compression Library on Symbian. The actual functionlaity of all the 
       
    23 API's are divided over two different libraries, libzcore.dll and libz.dll
       
    24 All the API's are exported from this library and will be the only interface 
       
    25 for the user of compression library
       
    26 */
       
    27 
       
    28 #ifndef SYMBIAN_EZLIB_EXCLUDE_GZ_FUNCTIONS
       
    29 	#include "libzgzio.h"
       
    30 #endif
       
    31 
       
    32 #include "libzcore.h"
       
    33 
       
    34 
       
    35 //================================================================= 
       
    36 
       
    37 EXPORT_C uLong  adler32(uLong adler,const Bytef *  buf,uInt len)
       
    38 	{
       
    39 	return(adler32_r(adler, buf, len));
       
    40 	}
       
    41 
       
    42 //================================================================= 
       
    43 
       
    44 EXPORT_C  int compress (Bytef * dest, uLongf *  destLen,   
       
    45 										 const Bytef * source, uLong sourceLen)
       
    46 	{
       
    47 	return (compress_r(dest, destLen, source, sourceLen));
       
    48 	}
       
    49 
       
    50 //================================================================= 	
       
    51 
       
    52 EXPORT_C int  compress2 (Bytef * dest, uLongf * destLen,
       
    53 							 const Bytef *  source,uLong  sourceLen, int level)
       
    54 	{
       
    55 	return (compress2_r(dest, destLen, source, sourceLen, level));
       
    56 	}
       
    57 	
       
    58 //================================================================= 	
       
    59 EXPORT_C  uLong  compressBound (uLong sourceLen)
       
    60 	{
       
    61 	return(compressBound_r(sourceLen));
       
    62 	}
       
    63 	
       
    64 //================================================================= 	
       
    65 EXPORT_C unsigned long  crc32( unsigned long crc,  
       
    66 								 const unsigned char FAR *  buf, unsigned len)
       
    67 	{
       
    68 	return (crc32_r(crc, buf, len));
       
    69 	}
       
    70 	
       
    71 //================================================================= 	
       
    72 EXPORT_C int   deflate (z_streamp strm, int  flush)
       
    73 	{
       
    74 	return(deflate_r(strm, flush));
       
    75 	}
       
    76 	
       
    77 //================================================================= 	
       
    78 EXPORT_C  uLong deflateBound(z_streamp strm, uLong  sourceLen)
       
    79 	{
       
    80 	return (deflateBound_r(strm, sourceLen));
       
    81 	}
       
    82 	
       
    83 //================================================================= 	
       
    84 EXPORT_C int deflateCopy (z_streamp dest, z_streamp source)
       
    85 	{
       
    86 	return (deflateCopy_r(dest, source));
       
    87 	}
       
    88 	
       
    89 //================================================================= 	
       
    90 EXPORT_C int   deflateEnd (z_streamp strm)
       
    91 	{
       
    92 	return (deflateEnd_r(strm));
       
    93 	}
       
    94 	
       
    95 //================================================================= 	
       
    96 EXPORT_C int  deflateInit2_(z_streamp strm, int level, int method,
       
    97 									int windowBits, int memLevel, int strategy,
       
    98 										 const char * version, int stream_size)
       
    99 	{
       
   100 	return (deflateInit2__r(strm, level, method, windowBits, memLevel, strategy, version, stream_size));
       
   101 	}
       
   102 	
       
   103 //================================================================= 	
       
   104 EXPORT_C int  deflateInit_( z_streamp strm, int  level,
       
   105 										const char * version, int  stream_size)
       
   106 	{
       
   107 	return(deflateInit__r(strm, level, version,stream_size));
       
   108 	}
       
   109 	
       
   110 //================================================================= 	
       
   111 EXPORT_C int deflateParams(z_streamp strm, int  level, int  strategy)
       
   112 	{
       
   113 	return (deflateParams_r(strm, level, strategy));
       
   114 	}
       
   115 	
       
   116 //================================================================= 	
       
   117 EXPORT_C int  deflateReset (z_streamp strm)
       
   118 	{
       
   119 	return (deflateReset_r(strm));
       
   120 	}
       
   121 	
       
   122 //================================================================= 	
       
   123 EXPORT_C int  deflateSetDictionary (z_streamp strm, const Bytef *  dictionary,uInt   dictLength)
       
   124 	{
       
   125 	return (deflateSetDictionary_r(strm, dictionary, dictLength ));
       
   126 	}
       
   127 	
       
   128 	
       
   129 //================================================================= 	
       
   130 EXPORT_C  const unsigned long FAR * get_crc_table()
       
   131 	{
       
   132 	return (get_crc_table_r());
       
   133 	}
       
   134 #ifndef SYMBIAN_EZLIB_EXCLUDE_GZ_FUNCTIONS	
       
   135 //=================================================================	
       
   136 EXPORT_C int gzclose (gzFile file)
       
   137 	{
       
   138 	return (gzclose_r(file));
       
   139 	}
       
   140 	
       
   141 //=================================================================
       
   142 EXPORT_C void gzclearerr (gzFile file)
       
   143 	{
       
   144 	gzclearerr_r(file);
       
   145 	return;
       
   146 	}
       
   147 	
       
   148 //================================================================= 
       
   149 EXPORT_C gzFile gzdopen (int fd, const char *  mode)
       
   150 	{
       
   151 	return (gzdopen_r(fd, mode));
       
   152 	}
       
   153 	
       
   154 //=================================================================
       
   155 EXPORT_C int gzdirect (gzFile file)
       
   156 	{
       
   157 	return ( gzdirect_r(file) );
       
   158 	}
       
   159 	
       
   160 //================================================================= 	
       
   161 EXPORT_C  int gzeof (gzFile file)
       
   162 	{
       
   163 	return (gzeof_r(file));
       
   164 	}
       
   165 	
       
   166 //================================================================= 	
       
   167 EXPORT_C const char *  gzerror (gzFile file, int *  errnum)
       
   168 	{
       
   169 	return (gzerror_r(file, errnum));
       
   170 	}
       
   171 	
       
   172 //================================================================= 	
       
   173 EXPORT_C  int gzflush (gzFile file,int flush)
       
   174 	{
       
   175 	return ( gzflush_r(file, flush) );
       
   176 	}
       
   177 	
       
   178 //================================================================= 
       
   179 EXPORT_C int gzgetc(gzFile file)
       
   180 	{
       
   181 	return ( gzgetc_r(file) ); 
       
   182 	}
       
   183 	
       
   184 //================================================================= 	
       
   185 EXPORT_C char * gzgets(gzFile file, char * buf, int len)
       
   186 	{
       
   187 	return ( gzgets_r(file, buf, len) );
       
   188 	}
       
   189 
       
   190 //================================================================= 	
       
   191 EXPORT_C gzFile gzopen (const char * path, const char * mode)	
       
   192 	{
       
   193 	return ( gzopen_r (path, mode) );
       
   194 	}
       
   195 	
       
   196 
       
   197 //================================================================= 
       
   198 EXPORT_C int gzprintf (gzFile file, const char *format, /*args*/ ...)
       
   199 	{
       
   200 	va_list va;
       
   201 	va_start(va, format);
       
   202 	return (gzprintf_r(file, format , va));
       
   203 	}
       
   204 
       
   205 
       
   206 //================================================================= 
       
   207 EXPORT_C int  gzputc(gzFile file, int c)
       
   208 	{
       
   209 	return ( gzputc_r (file, c) );
       
   210 	}
       
   211 	
       
   212 //================================================================= 
       
   213 EXPORT_C int  gzputs(gzFile file, const char * s)
       
   214 	{
       
   215 	return (gzputs_r(file, s) );
       
   216 	}
       
   217 
       
   218 //================================================================= 
       
   219 EXPORT_C int gzread (gzFile file, voidp buf,unsigned len)
       
   220 	{
       
   221 	return ( gzread_r(file, buf, len) );
       
   222 	}
       
   223 
       
   224 //================================================================= 
       
   225 EXPORT_C int  gzrewind (gzFile file)
       
   226 	{
       
   227 	return ( gzrewind_r(file) );
       
   228 	}
       
   229 
       
   230 //================================================================= 
       
   231 EXPORT_C  z_off_t gzseek (gzFile file, z_off_t  offset, int whence)
       
   232 	{
       
   233 	return (gzseek_r (file, offset, whence) );
       
   234 	}
       
   235 
       
   236 //================================================================= 
       
   237 EXPORT_C   int gzsetparams (gzFile file, int  level, int  strategy)
       
   238 	{
       
   239 	return ( gzsetparams_r (file, level, strategy ) );
       
   240 	}
       
   241 
       
   242 //================================================================= 
       
   243 EXPORT_C z_off_t gztell (gzFile file)
       
   244 	{
       
   245 	return ( gztell_r(file) );
       
   246 	}
       
   247 
       
   248 //================================================================= 
       
   249 EXPORT_C int gzungetc (int c, gzFile file)
       
   250 	{
       
   251 	return (gzungetc_r (c, file) );
       
   252 	}
       
   253 
       
   254 //================================================================= 
       
   255 EXPORT_C  int gzwrite (gzFile file,voidpc  buf, unsigned len)
       
   256 	{
       
   257 	return ( gzwrite_r (file , buf, len) );
       
   258 	}
       
   259 #endif //end SYMBIAN_EZLIB_EXCLUDE_GZ_FUNCTIONS
       
   260 
       
   261 //================================================================= 
       
   262 EXPORT_C  int inflate(z_streamp strm,int  flush)
       
   263 	{
       
   264 	return ( inflate_r(strm, flush) );
       
   265 	}
       
   266 
       
   267 //================================================================= 
       
   268 EXPORT_C  int inflateEnd(z_streamp strm)
       
   269 	{
       
   270 	return ( inflateEnd_r(strm) );
       
   271 	}
       
   272 
       
   273 //================================================================= 
       
   274 EXPORT_C int inflateInit2_(z_streamp strm, int windowBits,
       
   275 										const char * version, int  stream_size)
       
   276 	{
       
   277 	return (inflateInit2__r(strm, windowBits, version, stream_size ));
       
   278 	}
       
   279 	
       
   280 //================================================================= 
       
   281 EXPORT_C  int inflateInit_(z_streamp strm, const char * version, 
       
   282 															int stream_size)
       
   283 	{
       
   284 	return ( inflateInit__r(strm, version, stream_size) );
       
   285 	}
       
   286 	
       
   287 //================================================================= 
       
   288 EXPORT_C  int inflateReset(z_streamp strm)
       
   289 	{
       
   290 	return ( inflateReset_r(strm) );
       
   291 	}
       
   292 
       
   293 //=================================================================
       
   294 EXPORT_C int  inflateSetDictionary(z_streamp strm,
       
   295 									const Bytef *  dictionary, uInt dictLength)
       
   296 	{
       
   297 	return(inflateSetDictionary_r(strm, dictionary, dictLength));
       
   298 	}
       
   299 	
       
   300 //================================================================= 
       
   301 EXPORT_C int  inflateSync(z_streamp strm)
       
   302 	{
       
   303 	return ( inflateSync_r(strm) );
       
   304 	}
       
   305 
       
   306 //================================================================= 
       
   307 EXPORT_C  int inflateSyncPoint(z_streamp strm)
       
   308 	{
       
   309 	return ( inflateSyncPoint_r(strm) );
       
   310 	}
       
   311 
       
   312 //=================================================================
       
   313 EXPORT_C int  uncompress (Bytef * dest,uLongf *  destLen,  
       
   314 								const Bytef * source, uLong  sourceLen)
       
   315 	{
       
   316 	return ( uncompress_r(dest, destLen, source, sourceLen) );
       
   317 	}
       
   318 
       
   319 //=================================================================
       
   320 EXPORT_C const char *  zlibVersion()
       
   321 	{
       
   322 	return ( zlibVersion_r() );
       
   323 	}
       
   324 
       
   325 //================================================================= 
       
   326 EXPORT_C const char *  zError(int err)
       
   327 	{
       
   328 	return ( zError_r(err) );
       
   329 	}
       
   330 	
       
   331 //================================================================= 
       
   332 EXPORT_C uLong adler32_combine(uLong adler1, uLong adler2, z_off_t len2)
       
   333 	{
       
   334 	return ( adler32_combine_r (adler1, adler2, len2) );
       
   335 	}
       
   336 
       
   337 //=================================================================
       
   338 EXPORT_C uLong crc32_combine (uLong crc1, uLong crc2, z_off_t len2)
       
   339 	{
       
   340 	return ( crc32_combine_r (crc1, crc2, len2) );
       
   341 	}
       
   342 
       
   343 //=================================================================
       
   344 EXPORT_C uLong zlibCompileFlags ()
       
   345 	{
       
   346 	return ( zlibCompileFlags_r () );
       
   347 	}
       
   348 
       
   349 //=================================================================
       
   350 EXPORT_C int deflateSetHeader (z_streamp strm, gz_headerp head)
       
   351 	{
       
   352 	return ( deflateSetHeader_r (strm, head) );
       
   353 	}
       
   354 
       
   355 //=================================================================
       
   356 EXPORT_C int deflatePrime (z_streamp strm, int bits, int value)
       
   357 	{
       
   358 	return ( deflatePrime_r (strm, bits, value) );
       
   359 	}
       
   360 
       
   361 //=================================================================
       
   362 EXPORT_C int deflateTune (z_streamp strm, int good_length, int max_lazy, int nice_length, int max_chain)
       
   363 	{
       
   364 	return ( deflateTune_r (strm, good_length, max_lazy, nice_length, max_chain) );
       
   365 	}
       
   366 
       
   367 //=================================================================
       
   368 EXPORT_C int inflateCopy (z_streamp dest, z_streamp source)
       
   369 	{
       
   370 	return ( inflateCopy_r (dest, source) );
       
   371 	}
       
   372 
       
   373 //=================================================================
       
   374 EXPORT_C int inflatePrime (z_streamp strm, int bits, int value)
       
   375 	{
       
   376 	return ( inflatePrime_r (strm, bits, value) );
       
   377 	}
       
   378 
       
   379 //=================================================================
       
   380 EXPORT_C int inflateGetHeader (z_streamp strm, gz_headerp head)
       
   381 	{
       
   382 	return ( inflateGetHeader_r (strm, head) );
       
   383 	}
       
   384 
       
   385 //=================================================================
       
   386 EXPORT_C int inflateBackInit_ (z_streamp strm, int windowBits, unsigned char FAR *window, 
       
   387 											const char *version,
       
   388 											int stream_size)
       
   389 	{
       
   390 	return ( inflateBackInit__r (strm, windowBits, window,  version, stream_size) );
       
   391 	}
       
   392 
       
   393 //=================================================================
       
   394 EXPORT_C int inflateBack (z_streamp strm, in_func in, void FAR *in_desc,
       
   395         									out_func out, void FAR *out_desc)
       
   396 	{
       
   397 	return ( inflateBack_r (strm, in, in_desc,out, out_desc) );
       
   398 	}
       
   399 
       
   400 
       
   401 //=================================================================
       
   402 EXPORT_C int inflateBackEnd (z_streamp strm)
       
   403 	{
       
   404 	return	( inflateBackEnd_r (strm) );
       
   405 	}