fix-gzfile-type-usage.patch 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. Description: Fix gzFile type usage
  2. Author: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
  3. Bug: https://bitbucket.org/ripencc/bgpdump/issues/32/
  4. Last-Update: 2016-07-20
  5. The gzFile type is already a pointer. Don't pointer it.
  6. --- a/cfile_tools.c
  7. +++ b/cfile_tools.c
  8. @@ -82,7 +82,7 @@
  9. #ifndef DONT_HAVE_GZ
  10. if((path == NULL) || (strcmp(path, "-") == 0)) {
  11. /* dump from stdin */
  12. - gzFile *f;
  13. + gzFile f;
  14. while (format < CFR_NUM_FORMATS) {
  15. if (strcmp(cfr_extensions[format], ".gz") == 0)
  16. break;
  17. @@ -157,7 +157,7 @@
  18. #ifndef DONT_HAVE_GZ
  19. case 3: // gzip
  20. {
  21. - gzFile *f;
  22. + gzFile f;
  23. // get file
  24. f = gzopen(path, "r");
  25. if(f == NULL) {
  26. @@ -302,8 +302,8 @@
  27. #ifndef DONT_HAVE_GZ
  28. case 3: // gzip
  29. {
  30. - gzFile * in;
  31. - in = (gzFile *)(stream->data2);
  32. + gzFile in;
  33. + in = (gzFile)(stream->data2);
  34. retval = gzread(in, ptr, size*nmemb);
  35. if (retval != nmemb*size) {
  36. // fprintf(stderr,"short read!!!\n");
  37. @@ -391,7 +391,7 @@
  38. #ifndef DONT_HAVE_GZ
  39. case 3: // gzip
  40. {
  41. - char * return_ptr = gzgets((gzFile *)(stream->data2), *lineptr, *n );
  42. + char * return_ptr = gzgets((gzFile)(stream->data2), *lineptr, *n );
  43. if (return_ptr == Z_NULL) {
  44. stream->error2 = errno;
  45. return(-1);
  46. @@ -474,7 +474,7 @@
  47. asprintf(&msg2,
  48. "%s: %s",
  49. msg,
  50. - gzerror((gzFile*)(stream->data2), &(stream->error2)));
  51. + gzerror((gzFile)(stream->data2), &(stream->error2)));
  52. free(msg);
  53. msg = msg2;
  54. }