File: qjson.patch

package info (click to toggle)
classified-ads 0.15-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 6,788 kB
  • sloc: cpp: 34,610; tcl: 1,175; xml: 64; makefile: 45
file content (32 lines) | stat: -rw-r--r-- 1,763 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
diff -u -r q1/qjson-master/src/json_scanner.cc q2/qjson-master/src/json_scanner.cc
--- q1/qjson-master/src/json_scanner.cc 2014-12-12 17:46:47.000000000 +0200
+++ q2/qjson-master/src/json_scanner.cc 2014-12-21 18:39:44.000000000 +0200
@@ -3393,8 +3393,10 @@
 #line 82 "json_scanner.yy"
 {
                 m_yylloc->columns(yyleng);
-                *m_yylval = QVariant(strtoull(yytext, NULL, 10));
-                if (errno == ERANGE) {
+               unsigned long long converted = strtoull(yytext, NULL, 10);
+               fprintf(stderr, "Converted number %lu errno = %d\n", converted, errno) ;   
+                *m_yylval = QVariant(converted);
+                if (errno == ERANGE && converted == ULONG_LONG_MAX) {
                     qCritical() << "Number is out of range: " << yytext;
                     return yy::json_parser::token::INVALID;
                 }
diff -u -r q1/qjson-master/src/json_scanner.yy q2/qjson-master/src/json_scanner.yy
--- q1/qjson-master/src/json_scanner.yy 2014-12-12 17:46:47.000000000 +0200
+++ q2/qjson-master/src/json_scanner.yy 2014-12-21 18:39:18.000000000 +0200
@@ -81,8 +81,10 @@
 [0-9]         |
 [1-9][0-9]+   {
                 m_yylloc->columns(yyleng);
-                *m_yylval = QVariant(strtoull(yytext, NULL, 10));
-                if (errno == ERANGE) {
+               unsigned long long converted = strtoull(yytext, NULL, 10);
+               fprintf(stderr, "Converted number %lu errno = %d\n", converted, errno) ;   
+                *m_yylval = QVariant(converted);
+                if (errno == ERANGE && converted == ULONG_LONG_MAX) {
                     qCritical() << "Number is out of range: " << yytext;
                     return yy::json_parser::token::INVALID;
                 }