rename got_zstream_* to got_inflate_*
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373
diff --git a/lib/got_lib_inflate.h b/lib/got_lib_inflate.h
index 45fce72..ea3d77c 100644
--- a/lib/got_lib_inflate.h
+++ b/lib/got_lib_inflate.h
@@ -14,28 +14,28 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-struct got_zstream_buf {
+struct got_inflate_buf {
z_stream z;
char *inbuf;
size_t inlen;
char *outbuf;
size_t outlen;
int flags;
-#define GOT_ZSTREAM_F_HAVE_MORE 0x01
-#define GOT_ZSTREAM_F_OWN_OUTBUF 0x02
+#define GOT_INFLATE_F_HAVE_MORE 0x01
+#define GOT_INFLATE_F_OWN_OUTBUF 0x02
};
-#define GOT_ZSTREAM_BUFSIZE 8192
+#define GOT_INFLATE_BUFSIZE 8192
-const struct got_error *got_inflate_init(struct got_zstream_buf *, uint8_t *,
+const struct got_error *got_inflate_init(struct got_inflate_buf *, uint8_t *,
size_t);
-const struct got_error *got_inflate_read(struct got_zstream_buf *, FILE *,
+const struct got_error *got_inflate_read(struct got_inflate_buf *, FILE *,
size_t *);
-const struct got_error *got_inflate_read_fd(struct got_zstream_buf *, int,
+const struct got_error *got_inflate_read_fd(struct got_inflate_buf *, int,
size_t *);
-const struct got_error *got_inflate_read_mmap(struct got_zstream_buf *,
+const struct got_error *got_inflate_read_mmap(struct got_inflate_buf *,
uint8_t *, size_t, size_t, size_t *, size_t *);
-void got_inflate_end(struct got_zstream_buf *);
+void got_inflate_end(struct got_inflate_buf *);
const struct got_error *got_inflate_to_mem(uint8_t **, size_t *, FILE *);
const struct got_error *got_inflate_to_mem_fd(uint8_t **, size_t *, int);
const struct got_error *got_inflate_to_mem_mmap(uint8_t **, size_t *, uint8_t *,
diff --git a/lib/inflate.c b/lib/inflate.c
index 8d7a9af..28506a8 100644
--- a/lib/inflate.c
+++ b/lib/inflate.c
@@ -34,7 +34,7 @@
#endif
const struct got_error *
-got_inflate_init(struct got_zstream_buf *zb, uint8_t *outbuf, size_t bufsize)
+got_inflate_init(struct got_inflate_buf *zb, uint8_t *outbuf, size_t bufsize)
{
const struct got_error *err = NULL;
@@ -62,7 +62,7 @@ got_inflate_init(struct got_zstream_buf *zb, uint8_t *outbuf, size_t bufsize)
err = got_error_from_errno();
goto done;
}
- zb->flags |= GOT_ZSTREAM_F_OWN_OUTBUF;
+ zb->flags |= GOT_INFLATE_F_OWN_OUTBUF;
} else
zb->outbuf = outbuf;
@@ -73,7 +73,7 @@ done:
}
const struct got_error *
-got_inflate_read(struct got_zstream_buf *zb, FILE *f, size_t *outlenp)
+got_inflate_read(struct got_inflate_buf *zb, FILE *f, size_t *outlenp)
{
size_t last_total_out = zb->z.total_out;
z_stream *z = &zb->z;
@@ -100,11 +100,11 @@ got_inflate_read(struct got_zstream_buf *zb, FILE *f, size_t *outlenp)
} while (ret == Z_OK && z->avail_out > 0);
if (ret == Z_OK) {
- zb->flags |= GOT_ZSTREAM_F_HAVE_MORE;
+ zb->flags |= GOT_INFLATE_F_HAVE_MORE;
} else {
if (ret != Z_STREAM_END)
return got_error(GOT_ERR_DECOMPRESSION);
- zb->flags &= ~GOT_ZSTREAM_F_HAVE_MORE;
+ zb->flags &= ~GOT_INFLATE_F_HAVE_MORE;
}
*outlenp = z->total_out - last_total_out;
@@ -112,7 +112,7 @@ got_inflate_read(struct got_zstream_buf *zb, FILE *f, size_t *outlenp)
}
const struct got_error *
-got_inflate_read_fd(struct got_zstream_buf *zb, int fd, size_t *outlenp)
+got_inflate_read_fd(struct got_inflate_buf *zb, int fd, size_t *outlenp)
{
size_t last_total_out = zb->z.total_out;
z_stream *z = &zb->z;
@@ -139,11 +139,11 @@ got_inflate_read_fd(struct got_zstream_buf *zb, int fd, size_t *outlenp)
} while (ret == Z_OK && z->avail_out > 0);
if (ret == Z_OK) {
- zb->flags |= GOT_ZSTREAM_F_HAVE_MORE;
+ zb->flags |= GOT_INFLATE_F_HAVE_MORE;
} else {
if (ret != Z_STREAM_END)
return got_error(GOT_ERR_DECOMPRESSION);
- zb->flags &= ~GOT_ZSTREAM_F_HAVE_MORE;
+ zb->flags &= ~GOT_INFLATE_F_HAVE_MORE;
}
*outlenp = z->total_out - last_total_out;
@@ -151,7 +151,7 @@ got_inflate_read_fd(struct got_zstream_buf *zb, int fd, size_t *outlenp)
}
const struct got_error *
-got_inflate_read_mmap(struct got_zstream_buf *zb, uint8_t *map, size_t offset,
+got_inflate_read_mmap(struct got_inflate_buf *zb, uint8_t *map, size_t offset,
size_t len, size_t *outlenp, size_t *consumed)
{
size_t last_total_out = zb->z.total_out;
@@ -181,11 +181,11 @@ got_inflate_read_mmap(struct got_zstream_buf *zb, uint8_t *map, size_t offset,
} while (ret == Z_OK && z->avail_out > 0);
if (ret == Z_OK) {
- zb->flags |= GOT_ZSTREAM_F_HAVE_MORE;
+ zb->flags |= GOT_INFLATE_F_HAVE_MORE;
} else {
if (ret != Z_STREAM_END)
return got_error(GOT_ERR_DECOMPRESSION);
- zb->flags &= ~GOT_ZSTREAM_F_HAVE_MORE;
+ zb->flags &= ~GOT_INFLATE_F_HAVE_MORE;
}
*outlenp = z->total_out - last_total_out;
@@ -193,10 +193,10 @@ got_inflate_read_mmap(struct got_zstream_buf *zb, uint8_t *map, size_t offset,
}
void
-got_inflate_end(struct got_zstream_buf *zb)
+got_inflate_end(struct got_inflate_buf *zb)
{
free(zb->inbuf);
- if (zb->flags & GOT_ZSTREAM_F_OWN_OUTBUF)
+ if (zb->flags & GOT_INFLATE_F_OWN_OUTBUF)
free(zb->outbuf);
inflateEnd(&zb->z);
}
@@ -206,14 +206,14 @@ got_inflate_to_mem(uint8_t **outbuf, size_t *outlen, FILE *f)
{
const struct got_error *err;
size_t avail;
- struct got_zstream_buf zb;
+ struct got_inflate_buf zb;
void *newbuf;
int nbuf = 1;
- *outbuf = calloc(1, GOT_ZSTREAM_BUFSIZE);
+ *outbuf = calloc(1, GOT_INFLATE_BUFSIZE);
if (*outbuf == NULL)
return got_error_from_errno();
- err = got_inflate_init(&zb, *outbuf, GOT_ZSTREAM_BUFSIZE);
+ err = got_inflate_init(&zb, *outbuf, GOT_INFLATE_BUFSIZE);
if (err)
return err;
@@ -224,10 +224,10 @@ got_inflate_to_mem(uint8_t **outbuf, size_t *outlen, FILE *f)
if (err)
goto done;
*outlen += avail;
- if (zb.flags & GOT_ZSTREAM_F_HAVE_MORE) {
+ if (zb.flags & GOT_INFLATE_F_HAVE_MORE) {
nbuf++;
newbuf = recallocarray(*outbuf, nbuf - 1, nbuf,
- GOT_ZSTREAM_BUFSIZE);
+ GOT_INFLATE_BUFSIZE);
if (newbuf == NULL) {
err = got_error_from_errno();
free(*outbuf);
@@ -237,9 +237,9 @@ got_inflate_to_mem(uint8_t **outbuf, size_t *outlen, FILE *f)
}
*outbuf = newbuf;
zb.outbuf = newbuf + *outlen;
- zb.outlen = (nbuf * GOT_ZSTREAM_BUFSIZE) - *outlen;
+ zb.outlen = (nbuf * GOT_INFLATE_BUFSIZE) - *outlen;
}
- } while (zb.flags & GOT_ZSTREAM_F_HAVE_MORE);
+ } while (zb.flags & GOT_INFLATE_F_HAVE_MORE);
done:
got_inflate_end(&zb);
@@ -251,14 +251,14 @@ got_inflate_to_mem_fd(uint8_t **outbuf, size_t *outlen, int infd)
{
const struct got_error *err;
size_t avail;
- struct got_zstream_buf zb;
+ struct got_inflate_buf zb;
void *newbuf;
int nbuf = 1;
- *outbuf = calloc(1, GOT_ZSTREAM_BUFSIZE);
+ *outbuf = calloc(1, GOT_INFLATE_BUFSIZE);
if (*outbuf == NULL)
return got_error_from_errno();
- err = got_inflate_init(&zb, *outbuf, GOT_ZSTREAM_BUFSIZE);
+ err = got_inflate_init(&zb, *outbuf, GOT_INFLATE_BUFSIZE);
if (err)
goto done;
@@ -269,10 +269,10 @@ got_inflate_to_mem_fd(uint8_t **outbuf, size_t *outlen, int infd)
if (err)
goto done;
*outlen += avail;
- if (zb.flags & GOT_ZSTREAM_F_HAVE_MORE) {
+ if (zb.flags & GOT_INFLATE_F_HAVE_MORE) {
nbuf++;
newbuf = recallocarray(*outbuf, nbuf - 1, nbuf,
- GOT_ZSTREAM_BUFSIZE);
+ GOT_INFLATE_BUFSIZE);
if (newbuf == NULL) {
err = got_error_from_errno();
free(*outbuf);
@@ -282,9 +282,9 @@ got_inflate_to_mem_fd(uint8_t **outbuf, size_t *outlen, int infd)
}
*outbuf = newbuf;
zb.outbuf = newbuf + *outlen;
- zb.outlen = (nbuf * GOT_ZSTREAM_BUFSIZE) - *outlen;
+ zb.outlen = (nbuf * GOT_INFLATE_BUFSIZE) - *outlen;
}
- } while (zb.flags & GOT_ZSTREAM_F_HAVE_MORE);
+ } while (zb.flags & GOT_INFLATE_F_HAVE_MORE);
done:
got_inflate_end(&zb);
@@ -297,14 +297,14 @@ got_inflate_to_mem_mmap(uint8_t **outbuf, size_t *outlen, uint8_t *map,
{
const struct got_error *err;
size_t avail, consumed;
- struct got_zstream_buf zb;
+ struct got_inflate_buf zb;
void *newbuf;
int nbuf = 1;
- *outbuf = calloc(1, GOT_ZSTREAM_BUFSIZE);
+ *outbuf = calloc(1, GOT_INFLATE_BUFSIZE);
if (*outbuf == NULL)
return got_error_from_errno();
- err = got_inflate_init(&zb, *outbuf, GOT_ZSTREAM_BUFSIZE);
+ err = got_inflate_init(&zb, *outbuf, GOT_INFLATE_BUFSIZE);
if (err) {
free(*outbuf);
*outbuf = NULL;
@@ -323,10 +323,10 @@ got_inflate_to_mem_mmap(uint8_t **outbuf, size_t *outlen, uint8_t *map,
*outlen += avail;
if (len == 0)
break;
- if (zb.flags & GOT_ZSTREAM_F_HAVE_MORE) {
+ if (zb.flags & GOT_INFLATE_F_HAVE_MORE) {
nbuf++;
newbuf = recallocarray(*outbuf, nbuf - 1, nbuf,
- GOT_ZSTREAM_BUFSIZE);
+ GOT_INFLATE_BUFSIZE);
if (newbuf == NULL) {
err = got_error_from_errno();
free(*outbuf);
@@ -336,9 +336,9 @@ got_inflate_to_mem_mmap(uint8_t **outbuf, size_t *outlen, uint8_t *map,
}
*outbuf = newbuf;
zb.outbuf = newbuf + *outlen;
- zb.outlen = (nbuf * GOT_ZSTREAM_BUFSIZE) - *outlen;
+ zb.outlen = (nbuf * GOT_INFLATE_BUFSIZE) - *outlen;
}
- } while (zb.flags & GOT_ZSTREAM_F_HAVE_MORE);
+ } while (zb.flags & GOT_INFLATE_F_HAVE_MORE);
done:
got_inflate_end(&zb);
return err;
@@ -349,9 +349,9 @@ got_inflate_to_fd(size_t *outlen, FILE *infile, int outfd)
{
const struct got_error *err = NULL;
size_t avail;
- struct got_zstream_buf zb;
+ struct got_inflate_buf zb;
- err = got_inflate_init(&zb, NULL, GOT_ZSTREAM_BUFSIZE);
+ err = got_inflate_init(&zb, NULL, GOT_INFLATE_BUFSIZE);
if (err)
goto done;
@@ -370,7 +370,7 @@ got_inflate_to_fd(size_t *outlen, FILE *infile, int outfd)
}
*outlen += avail;
}
- } while (zb.flags & GOT_ZSTREAM_F_HAVE_MORE);
+ } while (zb.flags & GOT_INFLATE_F_HAVE_MORE);
done:
if (err == NULL) {
@@ -386,9 +386,9 @@ got_inflate_to_file(size_t *outlen, FILE *infile, FILE *outfile)
{
const struct got_error *err;
size_t avail;
- struct got_zstream_buf zb;
+ struct got_inflate_buf zb;
- err = got_inflate_init(&zb, NULL, GOT_ZSTREAM_BUFSIZE);
+ err = got_inflate_init(&zb, NULL, GOT_INFLATE_BUFSIZE);
if (err)
goto done;
@@ -407,7 +407,7 @@ got_inflate_to_file(size_t *outlen, FILE *infile, FILE *outfile)
}
*outlen += avail;
}
- } while (zb.flags & GOT_ZSTREAM_F_HAVE_MORE);
+ } while (zb.flags & GOT_INFLATE_F_HAVE_MORE);
done:
if (err == NULL)
@@ -421,9 +421,9 @@ got_inflate_to_file_fd(size_t *outlen, int infd, FILE *outfile)
{
const struct got_error *err;
size_t avail;
- struct got_zstream_buf zb;
+ struct got_inflate_buf zb;
- err = got_inflate_init(&zb, NULL, GOT_ZSTREAM_BUFSIZE);
+ err = got_inflate_init(&zb, NULL, GOT_INFLATE_BUFSIZE);
if (err)
goto done;
@@ -442,7 +442,7 @@ got_inflate_to_file_fd(size_t *outlen, int infd, FILE *outfile)
}
*outlen += avail;
}
- } while (zb.flags & GOT_ZSTREAM_F_HAVE_MORE);
+ } while (zb.flags & GOT_INFLATE_F_HAVE_MORE);
done:
if (err == NULL)
@@ -457,10 +457,10 @@ got_inflate_to_file_mmap(size_t *outlen, uint8_t *map, size_t offset,
{
const struct got_error *err;
size_t avail;
- struct got_zstream_buf zb;
+ struct got_inflate_buf zb;
size_t consumed;
- err = got_inflate_init(&zb, NULL, GOT_ZSTREAM_BUFSIZE);
+ err = got_inflate_init(&zb, NULL, GOT_INFLATE_BUFSIZE);
if (err)
goto done;
@@ -482,7 +482,7 @@ got_inflate_to_file_mmap(size_t *outlen, uint8_t *map, size_t offset,
}
*outlen += avail;
}
- } while (zb.flags & GOT_ZSTREAM_F_HAVE_MORE);
+ } while (zb.flags & GOT_INFLATE_F_HAVE_MORE);
done:
if (err == NULL)
diff --git a/lib/object_parse.c b/lib/object_parse.c
index 0852ad5..61e58f7 100644
--- a/lib/object_parse.c
+++ b/lib/object_parse.c
@@ -188,7 +188,7 @@ const struct got_error *
got_object_read_header(struct got_object **obj, int fd)
{
const struct got_error *err;
- struct got_zstream_buf zb;
+ struct got_inflate_buf zb;
char *buf;
const size_t zbsize = 64;
size_t outlen, totlen;