Changeset 6557362 in rtems


Ignore:
Timestamp:
Mar 18, 2011, 10:11:44 AM (8 years ago)
Author:
Ralf Corsepius <ralf.corsepius@…>
Branches:
4.11, master
Children:
8e0d0c74, d0df2d5
Parents:
47a619ae
Message:

Import from zlib-1.2.5

Location:
cpukit/zlib
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cpukit/zlib/gzlib.c

    r47a619ae r6557362  
    66#include "gzguts.h"
    77
    8 #ifdef _LARGEFILE64_SOURCE
     8#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
    99#  define LSEEK lseek64
    1010#else
     
    1616local gzFile gz_open OF((const char *, int, const char *));
    1717
    18 #if defined UNDER_CE && defined NO_ERRNO_H
     18#if defined UNDER_CE
    1919
    2020/* Map the Windows error number in ERROR to a locale-dependent error message
     
    2727   The gz_strwinerror function does not change the current setting of
    2828   GetLastError. */
    29 char ZEXPORT *gz_strwinerror (error)
     29char ZLIB_INTERNAL *gz_strwinerror (error)
    3030     DWORD error;
    3131{
     
    6666}
    6767
    68 #endif /* UNDER_CE && NO_ERRNO_H */
     68#endif /* UNDER_CE */
    6969
    7070/* Reset gzip file state */
     
    173173            0666);
    174174    if (state->fd == -1) {
     175        free(state->path);
    175176        free(state);
    176177        return NULL;
     
    218219    if (fd == -1 || (path = malloc(7 + 3 * sizeof(int))) == NULL)
    219220        return NULL;
    220     sprintf(path, "<fd:%d>", fd);
     221    sprintf(path, "<fd:%d>", fd);   /* for debugging */
    221222    gz = gz_open(path, fd, mode);
    222223    free(path);
     
    306307    if (state->mode == GZ_READ && state->how == COPY &&
    307308        state->pos + offset >= state->raw) {
    308         ret = LSEEK(state->fd, offset, SEEK_CUR);
     309        ret = LSEEK(state->fd, offset - state->have, SEEK_CUR);
    309310        if (ret == -1)
    310311            return -1;
     
    433434
    434435    /* return end-of-file state */
    435     return state->mode == GZ_READ ? (state->eof && state->have == 0) : 0;
     436    return state->mode == GZ_READ ?
     437        (state->eof && state->strm.avail_in == 0 && state->have == 0) : 0;
    436438}
    437439
     
    481483   allocation failure constructing the error message, then convert the error to
    482484   out of memory. */
    483 void ZEXPORT gz_error(state, err, msg)
     485void ZLIB_INTERNAL gz_error(state, err, msg)
    484486    gz_statep state;
    485487    int err;
     
    521523   used, since C standard permits 1's complement and sign-bit representations,
    522524   otherwise we could just use ((unsigned)-1) >> 1 */
    523 unsigned ZEXPORT gz_intmax()
     525unsigned ZLIB_INTERNAL gz_intmax()
    524526{
    525527    unsigned p, q;
  • cpukit/zlib/zconf.h

    r47a619ae r6557362  
    316316#endif
    317317
    318 #ifdef HAVE_VISIBILITY_PRAGMA
    319 #  define ZEXTERN __attribute__((visibility ("default"))) extern
    320 #endif
    321 
    322318#ifndef ZEXTERN
    323319#  define ZEXTERN extern
     
    365361#endif
    366362
    367 #ifdef Z_HAVE_UNISTD_H
     363#ifdef STDC
    368364#  include <sys/types.h>    /* for off_t */
     365#endif
     366
     367/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
     368 * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
     369 * though the former does not conform to the LFS document), but considering
     370 * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
     371 * equivalently requesting no 64-bit operations
     372 */
     373#if -_LARGEFILE64_SOURCE - -1 == 1
     374#  undef _LARGEFILE64_SOURCE
     375#endif
     376
     377#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
    369378#  include <unistd.h>       /* for SEEK_* and off_t */
    370379#  ifdef VMS
     
    374383#    define z_off_t off_t
    375384#  endif
    376 #endif
    377 
    378 #ifdef _LARGEFILE64_SOURCE
    379 #  include <sys/types.h>
    380385#endif
    381386
     
    385390#  define SEEK_END        2       /* Set file pointer to EOF plus "offset" */
    386391#endif
     392
    387393#ifndef z_off_t
    388394#  define z_off_t long
     395#endif
     396
     397#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
     398#  define z_off64_t off64_t
     399#else
     400#  define z_off64_t z_off_t
    389401#endif
    390402
  • cpukit/zlib/zconf.h.cmakein

    r47a619ae r6557362  
    318318#endif
    319319
    320 #ifdef HAVE_VISIBILITY_PRAGMA
    321 #  define ZEXTERN __attribute__((visibility ("default"))) extern
    322 #endif
    323 
    324320#ifndef ZEXTERN
    325321#  define ZEXTERN extern
     
    367363#endif
    368364
    369 #ifdef Z_HAVE_UNISTD_H
     365#ifdef STDC
    370366#  include <sys/types.h>    /* for off_t */
     367#endif
     368
     369/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
     370 * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
     371 * though the former does not conform to the LFS document), but considering
     372 * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
     373 * equivalently requesting no 64-bit operations
     374 */
     375#if -_LARGEFILE64_SOURCE - -1 == 1
     376#  undef _LARGEFILE64_SOURCE
     377#endif
     378
     379#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
    371380#  include <unistd.h>       /* for SEEK_* and off_t */
    372381#  ifdef VMS
     
    376385#    define z_off_t off_t
    377386#  endif
    378 #endif
    379 
    380 #ifdef _LARGEFILE64_SOURCE
    381 #  include <sys/types.h>
    382387#endif
    383388
     
    387392#  define SEEK_END        2       /* Set file pointer to EOF plus "offset" */
    388393#endif
     394
    389395#ifndef z_off_t
    390396#  define z_off_t long
     397#endif
     398
     399#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
     400#  define z_off64_t off64_t
     401#else
     402#  define z_off64_t z_off_t
    391403#endif
    392404
  • cpukit/zlib/zconf.h.in

    r47a619ae r6557362  
    316316#endif
    317317
    318 #ifdef HAVE_VISIBILITY_PRAGMA
    319 #  define ZEXTERN __attribute__((visibility ("default"))) extern
    320 #endif
    321 
    322318#ifndef ZEXTERN
    323319#  define ZEXTERN extern
     
    365361#endif
    366362
    367 #ifdef Z_HAVE_UNISTD_H
     363#ifdef STDC
    368364#  include <sys/types.h>    /* for off_t */
     365#endif
     366
     367/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
     368 * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
     369 * though the former does not conform to the LFS document), but considering
     370 * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
     371 * equivalently requesting no 64-bit operations
     372 */
     373#if -_LARGEFILE64_SOURCE - -1 == 1
     374#  undef _LARGEFILE64_SOURCE
     375#endif
     376
     377#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
    369378#  include <unistd.h>       /* for SEEK_* and off_t */
    370379#  ifdef VMS
     
    374383#    define z_off_t off_t
    375384#  endif
    376 #endif
    377 
    378 #ifdef _LARGEFILE64_SOURCE
    379 #  include <sys/types.h>
    380385#endif
    381386
     
    385390#  define SEEK_END        2       /* Set file pointer to EOF plus "offset" */
    386391#endif
     392
    387393#ifndef z_off_t
    388394#  define z_off_t long
     395#endif
     396
     397#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
     398#  define z_off64_t off64_t
     399#else
     400#  define z_off64_t z_off_t
    389401#endif
    390402
Note: See TracChangeset for help on using the changeset viewer.