]> git.pld-linux.org Git - packages/par2cmdline.git/blob - par2cmdline-gcc41.patch
- mark uint64 fields as packed to avoid natual struct alignment
[packages/par2cmdline.git] / par2cmdline-gcc41.patch
1 --- par2cmdline-0.4/par1fileformat.h.orig       2003-08-01 23:42:21.000000000 +0000
2 +++ par2cmdline-0.4/par1fileformat.h    2005-11-04 10:37:10.725606960 +0000
3 @@ -31,7 +31,7 @@
4  #pragma warning(disable:4200)
5  #endif
6  
7 -struct PAR1MAGIC {u8 magic[8];}PACKED;
8 +struct PAR1MAGIC {u8 magic[8];};
9  
10  struct PAR1FILEHEADER
11  {
12 @@ -46,7 +46,7 @@
13    leu64       filelistsize;
14    leu64       dataoffset;
15    leu64       datasize;
16 -}PACKED;
17 +};
18  
19  struct PAR1FILEENTRY
20  {
21 @@ -56,7 +56,7 @@
22    MD5Hash     hashfull;
23    MD5Hash     hash16k;
24    leu16       name[];
25 -}PACKED;
26 +};
27  
28  enum FILEENTRYSTATUS
29  {
30 --- par2cmdline-0.4/par2fileformat.h.orig       2003-08-01 23:43:40.000000000 +0000
31 +++ par2cmdline-0.4/par2fileformat.h    2005-11-04 10:36:03.149880032 +0000
32 @@ -63,11 +63,11 @@
33  {
34    // Header
35    MAGIC            magic;  // = {'P', 'A', 'R', '2', '\0', 'P', 'K', 'T'}
36 -  leu64            length; // Length of entire packet including header
37 +  leu64            length PACKED; // Length of entire packet including header
38    MD5Hash          hash;   // Hash of entire packet excepting the first 3 fields
39    MD5Hash          setid;  // Normally computed as the Hash of body of "Main Packet"
40    PACKETTYPE       type;   // Used to specify the meaning of the rest of the packet
41 -} PACKED;
42 +};
43  
44  // The file verification packet is used to determine whether or not any
45  // parts of a damaged file are useable.
46 @@ -78,14 +78,14 @@
47  {
48    MD5Hash        hash;
49    leu32          crc;
50 -} PACKED;
51 +};
52  struct FILEVERIFICATIONPACKET
53  {
54    PACKET_HEADER         header;
55    // Body
56    MD5Hash               fileid;     // MD5hash of file_hash_16k, file_length, file_name
57    FILEVERIFICATIONENTRY entries[];
58 -} PACKED;
59 +};
60  
61  // The file description packet is used to record the name of the file,
62  // its size, and the Hash of both the whole file and the first 16k of
63 @@ -110,7 +110,7 @@
64  
65    //u8* name(void) {return (u8*)&this[1];}
66    //const u8* name(void) const {return (const u8*)&this[1];}
67 -} PACKED;
68 +};
69  
70  // The main packet is used to tie together the other packets in a recovery file.
71  // It specifies the block size used to virtually slice the source files, a count
72 @@ -126,12 +126,12 @@
73  {
74    PACKET_HEADER    header;
75    // Body
76 -  leu64            blocksize;
77 +  leu64            blocksize PACKED;
78    leu32            recoverablefilecount;
79    MD5Hash          fileid[0];
80    //MD5Hash* fileid(void) {return (MD5Hash*)&this[1];}
81    //const MD5Hash* fileid(void) const {return (const MD5Hash*)&this[1];}
82 -} PACKED;
83 +};
84  
85  // The creator packet is used to identify which program created a particular
86  // recovery file. It is not required for verification or recovery of damaged
87 @@ -142,7 +142,7 @@
88    // Body
89    u8               client[];
90    //u8* client(void) {return (u8*)&this[1];}
91 -} PACKED;
92 +};
93  
94  // The recovery block packet contains a single block of recovery data along
95  // with the exponent value used during the computation of that block.
96 @@ -153,7 +153,7 @@
97    leu32            exponent;
98  //  unsigned long    data[];
99  //  unsigned long* data(void) {return (unsigned long*)&this[1];}
100 -} PACKED;
101 +};
102  
103  #ifdef _MSC_VER
104  #pragma warning(default:4200)
105 --- par2cmdline-0.4/reedsolomon.cpp.orig        2003-05-26 18:01:31.000000000 +0000
106 +++ par2cmdline-0.4/reedsolomon.cpp     2005-11-04 10:40:23.855246792 +0000
107 @@ -51,6 +51,7 @@
108    }
109  }
110  
111 +template <>
112  bool ReedSolomon<Galois8>::SetInput(const vector<bool> &present)
113  {
114    inputcount = (u32)present.size();
115 @@ -80,6 +81,7 @@
116    return true;
117  }
118  
119 +template <>
120  bool ReedSolomon<Galois8>::SetInput(u32 count)
121  {
122    inputcount = count;
123 @@ -101,6 +103,7 @@
124    return true;
125  }
126  
127 +template <>
128  bool ReedSolomon<Galois8>::Process(size_t size, u32 inputindex, const void *inputbuffer, u32 outputindex, void *outputbuffer)
129  {
130    // Look up the appropriate element in the RS matrix
131 @@ -189,6 +192,7 @@
132  
133  // Set which of the source files are present and which are missing
134  // and compute the base values to use for the vandermonde matrix.
135 +template <>
136  bool ReedSolomon<Galois16>::SetInput(const vector<bool> &present)
137  {
138    inputcount = (u32)present.size();
139 @@ -233,6 +237,7 @@
140  
141  // Record that the specified number of source files are all present
142  // and compute the base values to use for the vandermonde matrix.
143 +template <>
144  bool ReedSolomon<Galois16>::SetInput(u32 count)
145  {
146    inputcount = count;
147 @@ -267,6 +272,7 @@
148    return true;
149  }
150  
151 +template <>
152  bool ReedSolomon<Galois16>::Process(size_t size, u32 inputindex, const void *inputbuffer, u32 outputindex, void *outputbuffer)
153  {
154    // Look up the appropriate element in the RS matrix
This page took 0.134088 seconds and 3 git commands to generate.