Back to index

scribus-ng  1.3.4.dfsg+svn20071115
Defines | Functions
ioapi.c File Reference
#include "scconfig.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "zlib.h"
#include "ioapi.h"

Go to the source code of this file.

Defines

#define SEEK_CUR   1
#define SEEK_END   2
#define SEEK_SET   0

Functions

voidpf ZCALLBACK fopen_file_func OF ((voidpf opaque, const char *filename, int mode))
uLong ZCALLBACK fread_file_func OF ((voidpf opaque, voidpf stream, void *buf, uLong size))
uLong ZCALLBACK fwrite_file_func OF ((voidpf opaque, voidpf stream, const void *buf, uLong size))
long ZCALLBACK ftell_file_func OF ((voidpf opaque, voidpf stream))
long ZCALLBACK fseek_file_func OF ((voidpf opaque, voidpf stream, uLong offset, int origin))
voidpf ZCALLBACK fopen_file_func (voidpf opaque, const char *filename, int mode)
uLong ZCALLBACK fread_file_func (voidpf opaque, voidpf stream, void *buf, uLong size)
uLong ZCALLBACK fwrite_file_func (voidpf opaque, voidpf stream, const void *buf, uLong size)
long ZCALLBACK ftell_file_func (voidpf opaque, voidpf stream)
long ZCALLBACK fseek_file_func (voidpf opaque, voidpf stream, uLong offset, int origin)
int ZCALLBACK fclose_file_func (voidpf opaque, voidpf stream)
int ZCALLBACK ferror_file_func (voidpf opaque, voidpf stream)
void fill_fopen_filefunc (zlib_filefunc_def *pzlib_filefunc_def)

Define Documentation

#define SEEK_CUR   1

Definition at line 23 of file ioapi.c.

#define SEEK_END   2

Definition at line 27 of file ioapi.c.

#define SEEK_SET   0

Definition at line 31 of file ioapi.c.


Function Documentation

int ZCALLBACK fclose_file_func ( voidpf  opaque,
voidpf  stream 
)

Definition at line 150 of file ioapi.c.

{
    int ret;
    ret = fclose((FILE *)stream);
    return ret;
}

Here is the caller graph for this function:

int ZCALLBACK ferror_file_func ( voidpf  opaque,
voidpf  stream 
)

Definition at line 159 of file ioapi.c.

{
    int ret;
    ret = ferror((FILE *)stream);
    return ret;
}

Here is the caller graph for this function:

void fill_fopen_filefunc ( zlib_filefunc_def pzlib_filefunc_def)

Definition at line 168 of file ioapi.c.

{
    pzlib_filefunc_def->zopen_file = fopen_file_func;
    pzlib_filefunc_def->zread_file = fread_file_func;
    pzlib_filefunc_def->zwrite_file = fwrite_file_func;
    pzlib_filefunc_def->ztell_file = ftell_file_func;
    pzlib_filefunc_def->zseek_file = fseek_file_func;
    pzlib_filefunc_def->zclose_file = fclose_file_func;
    pzlib_filefunc_def->zerror_file = ferror_file_func;
    pzlib_filefunc_def->opaque = NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

voidpf ZCALLBACK fopen_file_func ( voidpf  opaque,
const char*  filename,
int  mode 
)

Definition at line 70 of file ioapi.c.

{
    FILE* file = NULL;
    const char* mode_fopen = NULL;
    if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
        mode_fopen = "rb";
    else
    if (mode & ZLIB_FILEFUNC_MODE_EXISTING)
        mode_fopen = "r+b";
    else
    if (mode & ZLIB_FILEFUNC_MODE_CREATE)
        mode_fopen = "wb";

    if ((filename!=NULL) && (mode_fopen != NULL))
        file = fopen(filename, mode_fopen);
    return file;
}

Here is the caller graph for this function:

uLong ZCALLBACK fread_file_func ( voidpf  opaque,
voidpf  stream,
void*  buf,
uLong  size 
)

Definition at line 92 of file ioapi.c.

{
    uLong ret;
    ret = fread(buf, 1, (size_t)size, (FILE *)stream);
    return ret;
}

Here is the call graph for this function:

Here is the caller graph for this function:

long ZCALLBACK fseek_file_func ( voidpf  opaque,
voidpf  stream,
uLong  offset,
int  origin 
)

Definition at line 124 of file ioapi.c.

{
    int fseek_origin=0;
    long ret;
    switch (origin)
    {
    case ZLIB_FILEFUNC_SEEK_CUR :
        fseek_origin = SEEK_CUR;
        break;
    case ZLIB_FILEFUNC_SEEK_END :
        fseek_origin = SEEK_END;
        break;
    case ZLIB_FILEFUNC_SEEK_SET :
        fseek_origin = SEEK_SET;
        break;
    default: return -1;
    }
    ret = 0;
    fseek((FILE *)stream, offset, fseek_origin);
    return ret;
}

Here is the caller graph for this function:

long ZCALLBACK ftell_file_func ( voidpf  opaque,
voidpf  stream 
)

Definition at line 115 of file ioapi.c.

{
    long ret;
    ret = ftell((FILE *)stream);
    return ret;
}

Here is the caller graph for this function:

uLong ZCALLBACK fwrite_file_func ( voidpf  opaque,
voidpf  stream,
const void*  buf,
uLong  size 
)

Definition at line 104 of file ioapi.c.

{
    uLong ret;
    ret = fwrite(buf, 1, (size_t)size, (FILE *)stream);
    return ret;
}

Here is the call graph for this function:

Here is the caller graph for this function:

voidpf ZCALLBACK fopen_file_func OF ( (voidpf opaque, const char *filename, int mode )