[btparser] fix 32bit build

Karel Klíč kklic at fedoraproject.org
Wed Jan 4 09:17:54 UTC 2012


commit 18ab63af2c1da1ae2d0ef256ba3e9b325a5d8c65
Author: Karel Klic <kklic at redhat.com>
Date:   Wed Jan 4 11:18:09 2012 +0100

    fix 32bit build

 btparser-32bitbuild.patch |   86 +++++++++++++++++++++++++++++++++++++++++++++
 btparser.spec             |    3 ++
 2 files changed, 89 insertions(+), 0 deletions(-)
---
diff --git a/btparser-32bitbuild.patch b/btparser-32bitbuild.patch
new file mode 100644
index 0000000..b5dc09b
--- /dev/null
+++ b/btparser-32bitbuild.patch
@@ -0,0 +1,86 @@
+diff --git a/lib/sharedlib.c b/lib/sharedlib.c
+index f522fec..afad261 100644
+--- a/lib/sharedlib.c
++++ b/lib/sharedlib.c
+@@ -79,7 +79,7 @@ btp_sharedlib_count(struct btp_sharedlib *a)
+ 
+ struct btp_sharedlib *
+ btp_sharedlib_find_address(struct btp_sharedlib *first,
+-                           unsigned long address)
++                           unsigned long long address)
+ {
+     struct btp_sharedlib *tmp = first;
+     while (tmp)
+@@ -99,17 +99,15 @@ find_sharedlib_section_start(const char *input)
+     /* searching for
+        From      To      Syms Read      Shared Object Library
+     */
+-    char *tmp, *result;
+-
+-    /* ugly */
+-    for (result = strstr(input, "From"); result; result = strstr(result + 1, "From"))
++    char *result = strstr(input, "From");
++    for (; result; result = strstr(result + 1, "From"))
+     {
+         /* must be at the beginning of the line
+            or at the beginning of whole input */
+         if (result != input && *(result - 1) != '\n')
+             continue;
+ 
+-        tmp = result + strlen("From");
++        char *tmp = result + strlen("From");
+         while (isspace(*tmp))
+             ++tmp;
+ 
+@@ -144,23 +142,23 @@ btp_sharedlib_parse(const char *input)
+     if (!tmp)
+         return NULL;
+ 
+-    struct btp_sharedlib *first = NULL, *current = NULL;
+-    unsigned long from, to;
+-    int symbols;
+     /* Parsing
+        From                 To                  Syms Read        Shared Object Library
+        0x0123456789abcdef   0xfedcba987654321   Yes (*)|Yes|No   /usr/lib64/libbtparser.so.2.2.2
+     */
++    struct btp_sharedlib *first = NULL, *current = NULL;
+     while (1)
+     {
+         /* From To */
+-        if (sscanf(tmp, "0x%lx 0x%lx", &from, &to) != 2)
++        unsigned long long from, to;
++        if (sscanf(tmp, "%Lx %Lx", &from, &to) != 2)
+             break;
+ 
+         while (isxdigit(*tmp) || isspace(*tmp) || *tmp == 'x')
+             ++tmp;
+ 
+         /* Syms Read */
++        int symbols;
+         if (strncmp("Yes (*)", tmp, strlen("Yes (*)")) == 0)
+         {
+             tmp += strlen("Yes (*)");
+diff --git a/lib/sharedlib.h b/lib/sharedlib.h
+index 862426b..0a49a12 100644
+--- a/lib/sharedlib.h
++++ b/lib/sharedlib.h
+@@ -33,8 +33,8 @@ enum
+ 
+ struct btp_sharedlib
+ {
+-    unsigned long from;
+-    unsigned long to;
++    unsigned long long from;
++    unsigned long long to;
+     int symbols;
+     char *soname;
+     struct btp_sharedlib *next;
+@@ -88,7 +88,7 @@ btp_sharedlib_count(struct btp_sharedlib *sharedlib);
+  */
+ struct btp_sharedlib *
+ btp_sharedlib_find_address(struct btp_sharedlib *first,
+-                           unsigned long address);
++                           unsigned long long address);
+ 
+ /**
+  * Parses the output of GDB's 'info sharedlib' command.
diff --git a/btparser.spec b/btparser.spec
index 68b0128..9183440 100644
--- a/btparser.spec
+++ b/btparser.spec
@@ -6,6 +6,8 @@ Group: Development/Libraries
 License: GPLv2+
 URL: http://fedorahosted.org/btparser
 Source0: https://fedorahosted.org/released/btparser/btparser-%{version}.tar.xz
+# Applied upstream.
+Patch0: btparser-32bitbuild.patch
 BuildRequires: python-devel
 
 %description
@@ -44,6 +46,7 @@ Python bindings for %{name}.
 
 %prep
 %setup -q
+%patch0 -p1 -b .32bitbuild
 
 %build
 %configure --disable-static


More information about the scm-commits mailing list