summaryrefslogtreecommitdiff
path: root/ext/zip/lib/zip_source_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/zip/lib/zip_source_file.c')
-rw-r--r--ext/zip/lib/zip_source_file.c28
1 files changed, 4 insertions, 24 deletions
diff --git a/ext/zip/lib/zip_source_file.c b/ext/zip/lib/zip_source_file.c
index 486e1900d..ab6466dcb 100644
--- a/ext/zip/lib/zip_source_file.c
+++ b/ext/zip/lib/zip_source_file.c
@@ -1,11 +1,9 @@
/*
- $NiH: zip_source_file.c,v 1.2 2004/11/18 16:28:13 wiz Exp $
-
zip_source_file.c -- create data source from file
- Copyright (C) 1999, 2003, 2004 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2009 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <nih@giga.or.at>
+ The authors can be contacted at <libzip@nih.at>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -38,17 +36,13 @@
#include <errno.h>
#include <stdio.h>
-#include "zip.h"
#include "zipint.h"
-PHPZIPAPI struct zip_source *
+ZIP_EXTERN(struct zip_source *)
zip_source_file(struct zip *za, const char *fname, off_t start, off_t len)
{
- struct zip_source *zs;
- FILE *fp;
-
if (za == NULL)
return NULL;
@@ -57,19 +51,5 @@ zip_source_file(struct zip *za, const char *fname, off_t start, off_t len)
return NULL;
}
- if ((fp=fopen(fname, "rb")) == NULL) {
- _zip_error_set(&za->error, ZIP_ER_OPEN, errno);
- return NULL;
- }
-
-#ifdef PHP_WIN32
- _setmode(_fileno(fp), _O_BINARY );
-#endif
-
- if ((zs=zip_source_filep(za, fp, start, len)) == NULL) {
- fclose(fp);
- return NULL;
- }
-
- return zs;
+ return _zip_source_file_or_p(za, fname, NULL, start, len);
}