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