Gentoo Archives: gentoo-commits

From: "Gilles Dartiguelongue (eva)" <eva@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in dev-libs/libofx/files: libofx-0.9.0-gcc43.patch
Date: Mon, 05 May 2008 22:29:51
Message-Id: E1Jt9Bs-0000B5-Fx@stork.gentoo.org
1 eva 08/05/05 22:29:48
2
3 Added: libofx-0.9.0-gcc43.patch
4 Log:
5 Fix compilation with gcc 4.3, see bug #218782.
6 (Portage version: 2.1.5_rc6)
7
8 Revision Changes Path
9 1.1 dev-libs/libofx/files/libofx-0.9.0-gcc43.patch
10
11 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-libs/libofx/files/libofx-0.9.0-gcc43.patch?rev=1.1&view=markup
12 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-libs/libofx/files/libofx-0.9.0-gcc43.patch?rev=1.1&content-type=text/plain
13
14 Index: libofx-0.9.0-gcc43.patch
15 ===================================================================
16 diff -NrU5 libofx-0.9.0.orig/lib/ofx_container_transaction.cpp libofx-0.9.0/lib/ofx_container_transaction.cpp
17 --- libofx-0.9.0.orig/lib/ofx_container_transaction.cpp 2007-11-10 00:10:49.000000000 +0100
18 +++ libofx-0.9.0/lib/ofx_container_transaction.cpp 2008-04-21 22:26:24.000000000 +0200
19 @@ -19,10 +19,11 @@
20
21 #ifdef HAVE_CONFIG_H
22 #include <config.h>
23 #endif
24
25 +#include <cstdlib>
26 #include <string>
27 #include "messages.hh"
28 #include "libofx.h"
29 #include "ofx_containers.hh"
30 #include "ofx_utilities.hh"
31 diff -NrU5 libofx-0.9.0.orig/lib/ofx_request_accountinfo.cpp libofx-0.9.0/lib/ofx_request_accountinfo.cpp
32 --- libofx-0.9.0.orig/lib/ofx_request_accountinfo.cpp 2007-10-28 03:33:43.000000000 +0100
33 +++ libofx-0.9.0/lib/ofx_request_accountinfo.cpp 2008-04-21 22:26:24.000000000 +0200
34 @@ -19,10 +19,11 @@
35
36 #ifdef HAVE_CONFIG_H
37 #include <config.h>
38 #endif
39
40 +#include <cstdlib>
41 #include <string>
42 #include "libofx.h"
43 #include "ofx_request_accountinfo.hh"
44
45 using namespace std;
46 diff -NrU5 libofx-0.9.0.orig/lib/ofx_request.cpp libofx-0.9.0/lib/ofx_request.cpp
47 --- libofx-0.9.0.orig/lib/ofx_request.cpp 2007-10-28 03:37:52.000000000 +0100
48 +++ libofx-0.9.0/lib/ofx_request.cpp 2008-04-21 22:26:24.000000000 +0200
49 @@ -19,10 +19,11 @@
50
51 #ifdef HAVE_CONFIG_H
52 #include <config.h>
53 #endif
54
55 +#include <cstring>
56 #include <string>
57 #include "messages.hh"
58 #include "libofx.h"
59 #include "ofx_request.hh"
60
61 diff -NrU5 libofx-0.9.0.orig/lib/ofx_request_statement.cpp libofx-0.9.0/lib/ofx_request_statement.cpp
62 --- libofx-0.9.0.orig/lib/ofx_request_statement.cpp 2007-10-28 13:57:18.000000000 +0100
63 +++ libofx-0.9.0/lib/ofx_request_statement.cpp 2008-04-21 22:26:24.000000000 +0200
64 @@ -19,10 +19,11 @@
65
66 #ifdef HAVE_CONFIG_H
67 #include <config.h>
68 #endif
69
70 +#include <cstdlib>
71 #include <string>
72 #include "libofx.h"
73 #include "ofx_utilities.hh"
74 #include "ofx_request_statement.hh"
75
76 diff -NrU5 libofx-0.9.0.orig/lib/ofx_utilities.cpp libofx-0.9.0/lib/ofx_utilities.cpp
77 --- libofx-0.9.0.orig/lib/ofx_utilities.cpp 2007-10-27 14:12:49.000000000 +0200
78 +++ libofx-0.9.0/lib/ofx_utilities.cpp 2008-04-21 22:26:24.000000000 +0200
79 @@ -19,11 +19,12 @@
80 #include <iostream>
81 #include <assert.h>
82
83 #include "ParserEventGeneratorKit.h"
84 #include "SGMLApplication.h"
85 -#include <time.h>
86 +#include <ctime>
87 +#include <cstdlib>
88 #include <string>
89 #include <locale.h>
90 #include "messages.hh"
91 #include "ofx_utilities.hh"
92
93 diff -NrU5 libofx-0.9.0.orig/lib/ofx_utilities.cpp.orig libofx-0.9.0/lib/ofx_utilities.cpp.orig
94 --- libofx-0.9.0.orig/lib/ofx_utilities.cpp.orig 1970-01-01 01:00:00.000000000 +0100
95 +++ libofx-0.9.0/lib/ofx_utilities.cpp.orig 2007-10-27 14:12:49.000000000 +0200
96 @@ -0,0 +1,245 @@
97 +/***************************************************************************
98 + ofx_util.cpp
99 + -------------------
100 + copyright : (C) 2002 by Benoit Grégoire
101 + email : bock@××××××××××××.ca
102 + ***************************************************************************/
103 +/**@file
104 + * \brief Various simple functions for type conversion & al
105 + */
106 +/***************************************************************************
107 + * *
108 + * This program is free software; you can redistribute it and/or modify *
109 + * it under the terms of the GNU General Public License as published by *
110 + * the Free Software Foundation; either version 2 of the License, or *
111 + * (at your option) any later version. *
112 + * *
113 + ***************************************************************************/
114 +#include <config.h>
115 +#include <iostream>
116 +#include <assert.h>
117 +
118 +#include "ParserEventGeneratorKit.h"
119 +#include "SGMLApplication.h"
120 +#include <time.h>
121 +#include <string>
122 +#include <locale.h>
123 +#include "messages.hh"
124 +#include "ofx_utilities.hh"
125 +
126 +#ifdef OS_WIN32
127 +# define DIRSEP "\\"
128 +#else
129 +# define DIRSEP "/"
130 +#endif
131 +
132 +
133 +using namespace std;
134 +/**
135 + Convert an OpenSP CharString directly to a C++ stream, to enable the use of cout directly for debugging.
136 +*/
137 +/*ostream &operator<<(ostream &os, SGMLApplication::CharString s)
138 + {
139 + for (size_t i = 0; i < s.len; i++)
140 + {
141 + os << ((char *)(s.ptr))[i*sizeof(SGMLApplication::Char)];
142 + }
143 + return os;
144 + }*/
145 +
146 +/*wostream &operator<<(wostream &os, SGMLApplication::CharString s)
147 + {
148 + for (size_t i = 0; i < s.len; i++)
149 + {//cout<<i;
150 + os << wchar_t(s.ptr[i*MULTIPLY4]);
151 + }
152 + return os;
153 + } */
154 +
155 +/*wchar_t* CharStringtowchar_t(SGMLApplication::CharString source, wchar_t *dest)
156 + {
157 + size_t i;
158 + for (i = 0; i < source.len; i++)
159 + {
160 + dest[i]+=wchar_t(source.ptr[i*sizeof(SGMLApplication::Char)*(sizeof(char)/sizeof(wchar_t))]);
161 + }
162 + return dest;
163 + }*/
164 +
165 +string CharStringtostring(const SGMLApplication::CharString source, string &dest)
166 +{
167 + size_t i;
168 + dest.assign("");//Empty the provided string
169 + // cout<<"Length: "<<source.len<<"sizeof(Char)"<<sizeof(SGMLApplication::Char)<<endl;
170 + for (i = 0; i < source.len; i++){
171 + dest+=(char)(((source.ptr)[i]));
172 + // cout<<i<<" "<<(char)(((source.ptr)[i]))<<endl;
173 + }
174 + return dest;
175 +}
176 +
177 +string AppendCharStringtostring(const SGMLApplication::CharString source, string &dest)
178 +{
179 + size_t i;
180 + for (i = 0; i < source.len; i++)
181 + {
182 + dest+=(char)(((source.ptr)[i]));
183 + }
184 + return dest;
185 +}
186 +
187 +/**
188 + * Converts a date from the YYYYMMDDHHMMSS.XXX[gmt offset:tz name] OFX format (see OFX 2.01 spec p.66) to a C time_t.
189 + * @param ofxdate date from the YYYYMMDDHHMMSS.XXX[gmt offset:tz name] OFX format
190 + * @return C time_t in the local time zone
191 + * @note
192 + * @li The library always returns the time in the systems local time
193 + * @li OFX defines the date up to the millisecond. The library ignores those milliseconds, since ANSI C does not handle such precision cleanly. The date provided by LibOFX is precise to the second, assuming that information this precise was provided in the ofx file. So you wont know the millisecond you were ruined...
194 +
195 + * @note DEVIATION FROM THE SPECS : The OFX specifications (both version 1.6 and 2.02) state that a client should assume that if the server returns a date without à specific time, we assume it means 0h00 GMT. As such, when we apply the local timezone and for example you are in the EST timezone, we will remove 5h, and the transaction will have occurred on the prior day! This is probably not what the bank intended (and will lead to systematic errors), but the spec is quite explicit in this respect (Ref: OFX 2.01 spec pp. 66-68)<BR><BR>
196 + * To solve this problem (since usually a time error is relatively unimportant, but date error is), and to avoid problems in Australia caused by the behaviour in libofx up to 0.6.4, it was decided starting with 0.6.5 to use the following behavior:<BR><BR>
197 + * -No specific time is given in the file (date only): Considering that most banks seem to be sending dates in this format represented as local time (not compliant with the specs), the transaction is assumed to have occurred 11h59 (just before noon) LOCAL TIME. This way, we should never change the date, since you'd have to travel in a timezone at least 11 hours backwards or 13 hours forward from your own to introduce mistakes. However, if you are in timezone +13 or +14, and your bank meant the data to be interpreted by the spec, you will get the wrong date. We hope that banks in those timezone will either represent in local time like most, or specify the timezone properly.<BR><BR>
198 + * -No timezone is specified, but exact time is, the same behavior is mostly used, as many banks just append zeros instead of using the short notation. However, the time specified is used, even if 0 (midnight).<BR><BR>
199 + * -When a timezone is specified, it is always used to properly convert in local time, following the spec.
200 + *
201 + */
202 +time_t ofxdate_to_time_t(const string ofxdate)
203 +{
204 + struct tm time;
205 + double local_offset; /* in seconds */
206 + float ofx_gmt_offset; /* in fractionnal hours */
207 + char timezone[4]; /* Original timezone: the library does not expose this value*/
208 + char exact_time_specified = false;
209 + char time_zone_specified = false;
210 +
211 + time_t temptime;
212 + std::time(&temptime);
213 + local_offset = difftime(mktime(localtime(&temptime)), mktime(gmtime(&temptime)));
214 +
215 + if(ofxdate.size()!=0){
216 + time.tm_year=atoi(ofxdate.substr(0,4).c_str())-1900;
217 + time.tm_mon=atoi(ofxdate.substr(4,2).c_str())-1;
218 + time.tm_mday=atoi(ofxdate.substr(6,2).c_str());
219 + if(ofxdate.size()>8) {
220 + /* if exact time is specified */
221 +exact_time_specified = true;
222 + time.tm_hour=atoi(ofxdate.substr(8,2).c_str());
223 + time.tm_min=atoi(ofxdate.substr(10,2).c_str());
224 + time.tm_sec=atoi(ofxdate.substr(12,2).c_str());
225 + }
226 +
227 + /* Check if the timezone has been specified */
228 + string::size_type startidx = ofxdate.find("[");
229 + string::size_type endidx;
230 + if(startidx!=string::npos){
231 + /* Time zone was specified */
232 + time_zone_specified = true;
233 + startidx++;
234 + endidx = ofxdate.find(":", startidx)-1;
235 + ofx_gmt_offset=atof(ofxdate.substr(startidx,(endidx-startidx)+1).c_str());
236 + startidx = endidx+2;
237 + strncpy(timezone,ofxdate.substr(startidx,3).c_str(),4);
238 + }
239 + else{
240 + /* Time zone was not specified, assume GMT (provisionnaly) in case exact time is specified */
241 + ofx_gmt_offset=0;
242 + strcpy(timezone, "GMT");
243 + }
244 +
245 + if(time_zone_specified == true)
246 + {
247 + /* If the timezone is specified always correct the timezone */
248 + /* If the timezone is not specified, but the exact time is, correct the timezone, assuming GMT following the spec */
249 + /* Correct the time for the timezone */
250 + time.tm_sec = time.tm_sec + (int)(local_offset - (ofx_gmt_offset*60*60));//Convert from fractionnal hours to seconds
251 + }
252 + else if (exact_time_specified == false)
253 + {
254 + /*Time zone data missing and exact time not specified, diverge from the OFX spec ans assume 11h59 local time */
255 + time.tm_hour=11;
256 + time.tm_min=59;
257 + time.tm_sec=0;
258 + }
259 + }
260 + else{
261 + message_out(ERROR, "ofxdate_to_time_t(): Unable to convert time, string is 0 length!");
262 + }
263 + return mktime(&time);
264 +}
265 +
266 +/**
267 + * Convert a C++ string containing an amount of money as specified by the OFX standard and convert it to a double float.
268 + *\note The ofx number format is the following: "." or "," as decimal separator, NO thousands separator.
269 + */
270 +double ofxamount_to_double(const string ofxamount)
271 +{
272 + //Replace commas and decimal points for atof()
273 + string::size_type idx;
274 + string tmp = ofxamount;
275 +
276 + idx = tmp.find(',');
277 + if(idx==string::npos){
278 + idx = tmp.find('.');
279 + }
280 +
281 + if(idx!=string::npos){
282 + tmp.replace(idx,1,1,((localeconv())->decimal_point)[0]);
283 + }
284 +
285 + return atof(tmp.c_str());
286 +}
287 +
288 +/**
289 +Many weird caracters can be present inside a SGML element, as a result on the transfer protocol, or for any reason. This function greatly enhances the reliability of the library by zapping those gremlins (backspace,formfeed,newline,carriage return, horizontal and vertical tabs) as well as removing whitespace at the begining and end of the string. Otherwise, many problems will occur during stringmatching.
290 +*/
291 +string strip_whitespace(const string para_string)
292 +{
293 + size_t index;
294 + size_t i;
295 + string temp_string = para_string;
296 + const char *whitespace = " \b\f\n\r\t\v";
297 + const char *abnormal_whitespace = "\b\f\n\r\t\v";//backspace,formfeed,newline,cariage return, horizontal and vertical tabs
298 + message_out(DEBUG4,"strip_whitespace() Before: |"+temp_string+"|");
299 + for(i=0;i<=temp_string.size()&&temp_string.find_first_of(whitespace, i)==i&&temp_string.find_first_of(whitespace, i)!=string::npos;i++);
300 + temp_string.erase(0,i);//Strip leading whitespace
301 + for(i=temp_string.size()-1;(i>=0)&&(temp_string.find_last_of(whitespace, i)==i)&&(temp_string.find_last_of(whitespace, i)!=string::npos);i--);
302 + temp_string.erase(i+1,temp_string.size()-(i+1));//Strip trailing whitespace
303 +
304 +while ((index = temp_string.find_first_of(abnormal_whitespace))!=string::npos)
305 + {
306 + temp_string.erase(index,1);//Strip leading whitespace
307 + };
308 +
309 + message_out(DEBUG4,"strip_whitespace() After: |"+temp_string+"|");
310 +
311 + return temp_string;
312 +}
313 +
314 +
315 +int mkTempFileName(const char *tmpl, char *buffer, unsigned int size) {
316 + const char *tmp_dir;
317 +
318 + tmp_dir = getenv ("TMPDIR");
319 + if (!tmp_dir)
320 + tmp_dir = getenv ("TMP");
321 + if (!tmp_dir)
322 + tmp_dir = getenv ("TEMP");
323 +
324 + if (!tmp_dir)
325 + {
326 +#ifdef OS_WIN32
327 + tmp_dir = "C:\\";
328 +#else
329 + tmp_dir = "/tmp";
330 +#endif /* !OS_WIN32 */
331 + }
332 +
333 + strncpy(buffer, tmp_dir, size);
334 + assert((strlen(buffer)+strlen(tmpl)+2)<size);
335 + strcat(buffer, DIRSEP);
336 + strcat(buffer, tmpl);
337 + return 0;
338 +}
339 +
340 +
341 +
342 diff -NrU5 libofx-0.9.0.orig/ofxconnect/ofxconnect.cpp libofx-0.9.0/ofxconnect/ofxconnect.cpp
343 --- libofx-0.9.0.orig/ofxconnect/ofxconnect.cpp 2007-10-26 20:24:10.000000000 +0200
344 +++ libofx-0.9.0/ofxconnect/ofxconnect.cpp 2008-04-21 22:31:18.000000000 +0200
345 @@ -34,10 +34,11 @@
346 #include "libofx.h"
347 #include <config.h> /* Include config constants, e.g., VERSION TF */
348 #include <stdio.h>
349 #include <stdlib.h>
350 #include <unistd.h>
351 +#include <cstring>
352
353 #ifdef HAVE_LIBCURL
354 #include <curl/curl.h>
355 #endif
356
357 diff -NrU5 libofx-0.9.0.orig/ofxconnect/ofxpartner.cpp libofx-0.9.0/ofxconnect/ofxpartner.cpp
358 --- libofx-0.9.0.orig/ofxconnect/ofxpartner.cpp 2006-03-26 06:49:54.000000000 +0200
359 +++ libofx-0.9.0/ofxconnect/ofxpartner.cpp 2008-04-21 22:28:26.000000000 +0200
360 @@ -33,10 +33,13 @@
361 #include <sys/stat.h>
362
363 #include <iostream>
364 #include <string>
365 #include <vector>
366 +#include <algorithm>
367 +#include <cstring>
368 +
369
370 using std::string;
371 using std::vector;
372 using std::cout;
373 using std::endl;
374 diff -NrU5 libofx-0.9.0.orig/ofxdump/ofxdump.cpp libofx-0.9.0/ofxdump/ofxdump.cpp
375 --- libofx-0.9.0.orig/ofxdump/ofxdump.cpp 2006-08-02 06:19:22.000000000 +0200
376 +++ libofx-0.9.0/ofxdump/ofxdump.cpp 2008-04-21 22:26:24.000000000 +0200
377 @@ -27,10 +27,12 @@
378 * (at your option) any later version. *
379 * *
380 ***************************************************************************/
381 #include <iostream>
382 #include <iomanip>
383 +#include <cstdlib>
384 +#include <cstring>
385 #include <string>
386 #include "libofx.h"
387 #include <stdio.h> /* for printf() */
388 #include <config.h> /* Include config constants, e.g., VERSION TF */
389 #include <errno.h>
390
391
392
393 --
394 gentoo-commits@l.g.o mailing list