![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello On Linux/ppc, gcc uses unsigned char's by default. query.cpp constructs an object of SQLParseElement and gives it a value of -1 for the "char" parameter (n). Later this value is compared to -1, which will be 255 when using unsigned chars. The result is a wrongly thrown exception. The attached patch changes the type to "short int" where the number is used. Signed-off-by: Michael Hanselmann <mysql (AT) hansmi (DOT) ch Greets, Michael ------------------------------------------------------------------------ diff -ru mysql++-2.1.1.orig/lib/qparms.h mysql++-2.1.1/lib/qparms.h --- mysql++-2.1.1.orig/lib/qparms.h 2006-04-05 06:44:49.000000000 +0200 +++ mysql++-2.1.1/lib/qparms.h 2006-11-23 00:11:05.000000000 +0100 @@ -232,7 +232,7 @@ /// \param b the 'before' value /// \param o the 'option' value /// \param n the 'num' value - SQLParseElement(std::string b, char o, char n) : + SQLParseElement(std::string b, char o, short int n) : before(b), option(o), num(n) @@ -241,7 +241,7 @@ std::string before; ///< string inserted before the parameter char option; ///< the parameter option, or blank if none - char num; ///< the parameter position to use + short int num; ///< the parameter position to use }; } // end namespace mysqlpp diff -ru mysql++-2.1.1.orig/lib/query.cpp mysql++-2.1.1/lib/query.cpp --- mysql++-2.1.1.orig/lib/query.cpp 2006-04-05 06:44:49.000000000 +0200 +++ mysql++-2.1.1/lib/query.cpp 2006-11-23 00:16:04.000000000 +0100 @@ -220,7 +220,7 @@ } // Finished parsing parameter; save it. - parse_elems_.push_back(SQLParseElement(str, option, char(n))); + parse_elems_.push_back(SQLParseElement(str, option, n)); str = ""; name = ""; } @@ -304,7 +304,7 @@ { sbuffer_.str(""); - char num; + short int num; SQLString* ss; SQLQueryParms* c; |
#3
| |||
| |||
|
|
On Linux/ppc, gcc uses unsigned char's by default. query.cpp constructs an object of SQLParseElement and gives it a value of -1 for the "char" parameter (n). Later this value is compared to -1, which will be 255 when using unsigned chars. The result is a wrongly thrown exception. The attached patch changes the type to "short int" where the number is used. |
#4
| |||
| |||
|
|
Unfortunately, that will change the ABI of the library, which would force this change to wait for v3.0. |
|
Instead, why not just make the required signedness explicit? Then the library interface stays the same, so I can apply it immediately. |
#5
| |||
| |||
|
|
Instead, why not just make the required signedness explicit? Then the library interface stays the same, so I can apply it immediately. See attached patch. |
![]() |
| Thread Tools | |
| Display Modes | |
| |