pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/rpm2pkg Update "rpm2pkg" to version 3.0.1. Ch...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/7bc7fd740aea
branches:  trunk
changeset: 576551:7bc7fd740aea
user:      tron <tron%pkgsrc.org@localhost>
date:      Mon Jun 14 11:24:47 2010 +0000

description:
Update "rpm2pkg" to version 3.0.1. Changes since 3.0:
- Fix detection of BZip2/GZip signature which would have failed if the
  signature was located behind a prefix of the signature.
- Increase I/O buffer size so that "rpm2pkg" will usually find the data
  section after only one read(2) system call.

diffstat:

 pkgtools/rpm2pkg/Makefile        |   4 ++--
 pkgtools/rpm2pkg/files/rpm2pkg.c |  18 ++++++++++--------
 2 files changed, 12 insertions(+), 10 deletions(-)

diffs (70 lines):

diff -r d50d239b2f01 -r 7bc7fd740aea pkgtools/rpm2pkg/Makefile
--- a/pkgtools/rpm2pkg/Makefile Mon Jun 14 10:32:24 2010 +0000
+++ b/pkgtools/rpm2pkg/Makefile Mon Jun 14 11:24:47 2010 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.44 2010/06/13 13:08:51 tron Exp $
+# $NetBSD: Makefile,v 1.45 2010/06/14 11:24:47 tron Exp $
 
-DISTNAME=      rpm2pkg-3.0
+DISTNAME=      rpm2pkg-3.0.1
 CATEGORIES=    pkgtools
 MASTER_SITES=  # empty
 DISTFILES=     # empty
diff -r d50d239b2f01 -r 7bc7fd740aea pkgtools/rpm2pkg/files/rpm2pkg.c
--- a/pkgtools/rpm2pkg/files/rpm2pkg.c  Mon Jun 14 10:32:24 2010 +0000
+++ b/pkgtools/rpm2pkg/files/rpm2pkg.c  Mon Jun 14 11:24:47 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rpm2pkg.c,v 1.9 2010/06/13 13:08:52 tron Exp $ */
+/*     $NetBSD: rpm2pkg.c,v 1.10 2010/06/14 11:24:48 tron Exp $        */
 
 /*-
  * Copyright (c) 2004-2009 The NetBSD Foundation, Inc.
@@ -179,7 +179,7 @@
 static FileHandle *
 Open(int fd)
 {
-       unsigned char   buffer[4096];
+       unsigned char   buffer[16384];
        size_t          bzMatch, gzMatch;
        int             archive_type;
        off_t           offset;
@@ -197,8 +197,12 @@
                        return NULL;
 
                for (i = 0; i < bytes; i++) {
+                       unsigned char cur_char;
+
+                       cur_char = buffer[i];
+
                        /* Look for bzip2 header. */
-                       if (buffer[i] == BZipMagic[bzMatch]) {
+                       if (cur_char == BZipMagic[bzMatch]) {
                                bzMatch++;
                                if (bzMatch == sizeof(BZipMagic)) {
                                        archive_type = 1;
@@ -207,11 +211,11 @@
                                        break;
                                }
                        } else {
-                               bzMatch = 0;
+                               bzMatch = (cur_char == BZipMagic[0]) ? 1 : 0;
                        }
 
                        /* Look for gzip header. */
-                       if (buffer[i] == GZipMagic[gzMatch]) {
+                       if (cur_char == GZipMagic[gzMatch]) {
                                gzMatch++;
                                if (gzMatch == sizeof(GZipMagic)) {
                                        archive_type = 2;
@@ -220,10 +224,8 @@
                                        break;
                                }
                        } else {
-                               gzMatch = 0;
+                               gzMatch = (cur_char == GZipMagic[0]) ? 1 : 0;
                        }
-
-                       offset++;
                }
        } while (archive_type == 0);
 



Home | Main Index | Thread Index | Old Index