~ubuntu-branches/ubuntu/natty/zziplib/natty

« back to all changes in this revision

Viewing changes to zzip/info.c

  • Committer: Bazaar Package Importer
  • Author(s): Anibal Monsalve Salazar
  • Date: 2009-03-23 21:13:57 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090323211357-6j35t8532ie9wlxf
Tags: 0.13.50-1
* New upstream version 
  - Update 01-fetch.patch
* debhelper compat version is 7
* Standards version is 3.8.1
* Run dh_prep instead of dh_clean -k
* Add debian/watch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
1
2
/*
2
3
 * Author: 
3
4
 *      Guido Draheim <guidod@gmx.de>
10
11
 *          of the Mozilla Public License 1.1
11
12
 */
12
13
 
13
 
#include <zzip/lib.h>                                   /* exported... */
 
14
#include <zzip/lib.h>           /* exported... */
14
15
#include <zzip/file.h>
15
16
#include <zzip/format.h>
16
17
 
25
26
 *  just returns dir->errcode of the ZZIP_DIR handle 
26
27
 *  see: => zzip_dir_open, => zzip_diropen, => zzip_readdir, => zzip_dir_read
27
28
 */
28
 
int 
29
 
zzip_error(ZZIP_DIR * dir)   
30
 
{   
31
 
    return dir->errcode; 
 
29
int
 
30
zzip_error(ZZIP_DIR * dir)
 
31
{
 
32
    return dir->errcode;
32
33
}
33
34
 
34
35
/** => zzip_error
35
36
 *  This function just does dir->errcode = errcode 
36
37
 */
37
 
void 
38
 
zzip_seterror(ZZIP_DIR * dir, int errcode)   
39
 
{ dir->errcode = errcode; }
 
38
void
 
39
zzip_seterror(ZZIP_DIR * dir, int errcode) { dir->errcode = errcode; }
40
40
 
41
41
/** 
42
42
 * This function will just return fp->dir 
44
44
 * If a ZZIP_FILE is contained within a zip-file that one will be a valid
45
45
 * pointer, otherwise a NULL is returned and the ZZIP_FILE wraps a real file.
46
46
 */
47
 
ZZIP_DIR * 
48
 
zzip_dirhandle(ZZIP_FILE * fp)   
49
 
50
 
    return fp->dir; 
 
47
ZZIP_DIR *
 
48
zzip_dirhandle(ZZIP_FILE * fp)
 
49
{
 
50
    return fp->dir;
51
51
}
52
52
 
53
53
/** => zzip_dirhandle
57
57
 * zipfile is returned, otherwise a NULL is returned and the ZZIP_DIR wraps 
58
58
 * a real directory DIR (if you have dirent on your system).
59
59
 */
60
 
int 
61
 
zzip_dirfd(ZZIP_DIR* dir)   
62
 
63
 
    return dir->fd; 
 
60
int
 
61
zzip_dirfd(ZZIP_DIR * dir)
 
62
{
 
63
    return dir->fd;
64
64
}
65
65
 
66
66
/**
67
67
 * return static const string of the known compression methods, 
68
68
 * otherwise just "zipped" is returned
69
69
 */
70
 
zzip_char_t*
 
70
zzip_char_t *
71
71
zzip_compr_str(int compr)
72
72
{
73
 
    switch(compr)
 
73
    switch (compr)
74
74
    {
 
75
        /* *INDENT-OFF* */
75
76
    case ZZIP_IS_STORED:                return "stored";
76
77
    case ZZIP_IS_SHRUNK:                return "shrunk";
77
78
    case ZZIP_IS_REDUCEDx1:
107
108
#       endif
108
109
            return "special";
109
110
        }
110
 
    }/*switch*/
 
111
        /* *INDENT-ON* */
 
112
    }                           /*switch */
111
113
}
112
114
 
113
115
/** => zzip_file_real
114
116
 * This function checks if the ZZIP_DIR-handle is wrapping 
115
117
 * a real directory or a zip-archive. 
116
118
 * Returns 1 for a stat'able directory, and 0 for a handle to zip-archive.
117
 
 */ 
 
119
 */
118
120
int
119
 
zzip_dir_real(ZZIP_DIR* dir)
 
121
zzip_dir_real(ZZIP_DIR * dir)
120
122
{
121
123
    return dir->realdir != 0;
122
124
}
127
129
 * Returns 1 for a stat'able file, and 0 for a file inside a zip-archive.
128
130
 */
129
131
int
130
 
zzip_file_real(ZZIP_FILE* fp)
 
132
zzip_file_real(ZZIP_FILE * fp)
131
133
{
132
 
    return fp->dir == 0; /* ie. not dependent on a zip-arch-dir  */
 
134
    return fp->dir == 0;        /* ie. not dependent on a zip-arch-dir  */
133
135
}
134
136
 
135
137
/** => zzip_file_real
137
139
 * Check before with => zzip_dir_real if the
138
140
 * the ZZIP_DIR points to a real directory.
139
141
 */
140
 
void*
141
 
zzip_realdir(ZZIP_DIR* dir)
 
142
void *
 
143
zzip_realdir(ZZIP_DIR * dir)
142
144
{
143
145
    return dir->realdir;
144
146
}
149
151
 * the ZZIP_FILE points to a real file.
150
152
 */
151
153
int
152
 
zzip_realfd(ZZIP_FILE* fp)
 
154
zzip_realfd(ZZIP_FILE * fp)
153
155
{
154
156
    return fp->fd;
155
157
}