projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove unneeded Emacs declarations that say that a .c file is in C.
[pspp]
/
tests
/
libpspp
/
zip-test.c
diff --git
a/tests/libpspp/zip-test.c
b/tests/libpspp/zip-test.c
index 777b37a795259c2f4ca93062e8378d197cfd9140..3556926d6c2c01b77c078eb0d6a8fcd4c406df80 100644
(file)
--- a/
tests/libpspp/zip-test.c
+++ b/
tests/libpspp/zip-test.c
@@
-65,17
+65,16
@@
main (int argc, char **argv)
const int BUFSIZE=256;
char buf[BUFSIZE];
int i;
const int BUFSIZE=256;
char buf[BUFSIZE];
int i;
- struct
string st
r;
-
struct zip_reader *zr = zip_reader_create (argv[2], &st
r);
- if (
NULL == z
r)
+ struct
zip_reader *z
r;
+
char *error = zip_reader_create (argv[2], &z
r);
+ if (
erro
r)
{
{
- fprintf (stderr, "Could not create zip reader: %s\n",
ds_cstr (&str)
);
+ fprintf (stderr, "Could not create zip reader: %s\n",
error
);
check_die ();
}
for (i = 3; i < argc; ++i)
{
int x = 0;
check_die ();
}
for (i = 3; i < argc; ++i)
{
int x = 0;
- struct zip_member *zm ;
FILE *fp = fopen (argv[i], "wb");
if (NULL == fp)
{
FILE *fp = fopen (argv[i], "wb");
if (NULL == fp)
{
@@
-83,11
+82,13
@@
main (int argc, char **argv)
fprintf (stderr, "Could not create file %s: %s\n", argv[i], strerror(e));
check_die ();
}
fprintf (stderr, "Could not create file %s: %s\n", argv[i], strerror(e));
check_die ();
}
- zm = zip_member_open (zr, argv[i]);
- if (NULL == zm)
+
+ struct zip_member *zm ;
+ char *error = zip_member_open (zr, argv[i], &zm);
+ if (error)
{
fprintf (stderr, "Could not open zip member %s from archive: %s\n",
{
fprintf (stderr, "Could not open zip member %s from archive: %s\n",
- argv[i],
ds_cstr (&str)
);
+ argv[i],
error
);
check_die ();
}
check_die ();
}
@@
-95,15
+96,18
@@
main (int argc, char **argv)
{
fwrite (buf, x, 1, fp);
}
{
fwrite (buf, x, 1, fp);
}
+ error = zip_member_steal_error (zm);
zip_member_finish (zm);
fclose (fp);
zip_member_finish (zm);
fclose (fp);
+
+ assert ((error != NULL) == (x < 0));
if (x < 0)
{
if (x < 0)
{
- fprintf (stderr, "Unzip failed: %s\n",
ds_cstr (&str)
);
+ fprintf (stderr, "Unzip failed: %s\n",
error
);
check_die ();
}
}
check_die ();
}
}
- zip_reader_
destroy
(zr);
+ zip_reader_
unref
(zr);
}
else
exit (1);
}
else
exit (1);