~ubuntu-branches/ubuntu/vivid/abyss/vivid-proposed

« back to all changes in this revision

Viewing changes to debian/patches/fix-ftbfs-on-32-bit.patch

  • Committer: Package Import Robot
  • Author(s): Graham Inggs
  • Date: 2015-03-15 10:37:57 UTC
  • Revision ID: package-import@ubuntu.com-20150315103757-bc04f9la16jfc1tg
Tags: 1.5.2-1ubuntu1
Fix FTBFS on 32-bit architectures (armhf, i386 and powerpc).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Description: Fix FTBFS on 32-bit architectures
 
2
 This patch changes the datatypes of some variables that were introduced
 
3
 in version 1.5.2 from size_t to unsigned long long or unsigned long
 
4
 in order to fix a FTBFS on 32-bit architectures.
 
5
Author: Graham Inggs <graham@nerve.org.za>
 
6
Forwarded: no
 
7
Last-Update: 2015-03-15
 
8
--- a/Common/StringUtil.h
 
9
+++ b/Common/StringUtil.h
 
10
@@ -106,7 +106,7 @@
 
11
        return false;
 
12
 }
 
13
 
 
14
-static inline size_t SIToBytes(std::istringstream& iss)
 
15
+static inline unsigned long long SIToBytes(std::istringstream& iss)
 
16
 {
 
17
        double size;
 
18
        std::string units;
 
19
@@ -122,7 +122,7 @@
 
20
                // no units given; clear fail flag
 
21
                // and assume bytes
 
22
                iss.clear(std::ios::eofbit);
 
23
-               return (size_t)ceil(size);
 
24
+               return (unsigned long long)ceil(size);
 
25
        }
 
26
 
 
27
        if (units.size() > 1) {
 
28
@@ -133,22 +133,22 @@
 
29
 
 
30
        switch(tolower(units[0])) {
 
31
                case 'k':
 
32
-                       size *= (size_t)1<<10; break;
 
33
+                       size *= (unsigned long long)1<<10; break;
 
34
                case 'm':
 
35
-                       size *= (size_t)1<<20; break;
 
36
+                       size *= (unsigned long long)1<<20; break;
 
37
                case 'g':
 
38
-                       size *= (size_t)1<<30; break;
 
39
+                       size *= (unsigned long long)1<<30; break;
 
40
                case 't':
 
41
-                       size *= (size_t)1<<40; break;
 
42
+                       size *= (unsigned long long)1<<40; break;
 
43
                default:
 
44
                        iss.setstate(std::ios::failbit);
 
45
                        return 0;
 
46
        }
 
47
 
 
48
-       return (size_t)ceil(size);
 
49
+       return (unsigned long long)ceil(size);
 
50
 }
 
51
 
 
52
-static inline size_t SIToBytes(const std::string& str)
 
53
+static inline unsigned long long SIToBytes(const std::string& str)
 
54
 {
 
55
        std::istringstream iss(str);
 
56
        return SIToBytes(iss);
 
57
--- a/Bloom/Bloom.h
 
58
+++ b/Bloom/Bloom.h
 
59
@@ -165,10 +165,10 @@
 
60
                // bloom filter bits
 
61
 
 
62
                size_t bits = endBitPos - startBitPos + 1;
 
63
-               size_t bytes = (bits + 7) / 8;
 
64
+               unsigned long bytes = (bits + 7) / 8;
 
65
                char buf[IO_BUFFER_SIZE];
 
66
                for (size_t i = 0, j = 0; i < bytes;) {
 
67
-                       size_t writeSize = std::min(IO_BUFFER_SIZE, bytes - i);
 
68
+                       unsigned long writeSize = std::min(IO_BUFFER_SIZE, bytes - i);
 
69
                        for (size_t k = 0; k < writeSize; k++) {
 
70
                                buf[k] = 0;
 
71
                                for (unsigned l = 0; l < 8; l++, j++) {
 
72
@@ -270,11 +270,11 @@
 
73
 
 
74
                size_t offset = header.startBitPos;
 
75
                size_t bits = header.endBitPos - header.startBitPos + 1;
 
76
-               size_t bytes = (bits + 7) / 8;
 
77
+               unsigned long bytes = (bits + 7) / 8;
 
78
 
 
79
                char buf[IO_BUFFER_SIZE];
 
80
                for (size_t i = 0, j = offset; i < bytes; ) {
 
81
-                       size_t readSize = std::min(IO_BUFFER_SIZE, bytes - i);
 
82
+                       unsigned long readSize = std::min(IO_BUFFER_SIZE, bytes - i);
 
83
                        in.read(buf, readSize);
 
84
                        assert(in);
 
85
                        for (size_t k = 0; k < readSize; k++) {