summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-05-14 14:00:59 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-05-14 14:34:11 +0100
commit6b3bf27cb56d661725ac3fcfb756562e0ad75564 (patch)
tree6520eb10cb524d458d8145014018f70ccf36715c
parent7ef203d2bf72f7d96fd10d1297af06e82550a1c4 (diff)
ppc: yyinput returns a int, truncating to (unsigned)char does't work
retain this as an int so that on platforms where char is unsigned we don't mangle the value and get this all wrong. Fixes database opening tables on ppc if -fsigned-char is removed Change-Id: I66f0c6b1b19191595f8b348377579f2daabf7ada
-rwxr-xr-xconnectivity/source/parse/sqlflex.l18
1 files changed, 9 insertions, 9 deletions
diff --git a/connectivity/source/parse/sqlflex.l b/connectivity/source/parse/sqlflex.l
index d5b2f142bac0..fd27cb83d01a 100755
--- a/connectivity/source/parse/sqlflex.l
+++ b/connectivity/source/parse/sqlflex.l
@@ -76,7 +76,7 @@ using namespace connectivity;
static ::rtl::OUString aEmptyString;
-static sal_Int32 gatherString(sal_Int32 delim, sal_Int32 nTyp);
+static sal_Int32 gatherString(int delim, sal_Int32 nTyp);
static sal_Int32 gatherName(const sal_Char*);
static sal_Int32 gatherNamePre(const sal_Char* );
// has to be set before the parser starts
@@ -94,8 +94,8 @@ OSQLScanner* xxx_pGLOBAL_SQLSCAN = NULL;
#define YY_INPUT(buf,result,max_size) \
{ \
- buf[0] = xxx_pGLOBAL_SQLSCAN->SQLyygetc(); \
- result = buf[0] != -1; \
+ int c = xxx_pGLOBAL_SQLSCAN->SQLyygetc(); \
+ result = (c == EOF) ? YY_NULL : (buf[0] = c, 1);\
}
#define YY_FATAL_ERROR(msg) \
@@ -518,9 +518,9 @@ inline bool checkeof(int c) { return c == 0 || c == EOF; }
* nTyp == 1 -> SQL_NODE_STRING
* nTyp == 2 -> SQL_NODE_ACCESS_DATE
*/
-sal_Int32 gatherString( sal_Int32 delim, sal_Int32 nTyp)
+sal_Int32 gatherString(int delim, sal_Int32 nTyp)
{
- sal_Char ch;
+ int ch;
::rtl::OStringBuffer sBuffer(256);
while (!checkeof(ch = yyinput()))
@@ -547,7 +547,7 @@ sal_Int32 gatherString( sal_Int32 delim, sal_Int32 nTyp)
}
else
{
- sBuffer.append(ch);
+ sBuffer.append(static_cast<sal_Char>(ch));
}
}
@@ -555,7 +555,7 @@ sal_Int32 gatherString( sal_Int32 delim, sal_Int32 nTyp)
break;
else
{
- sBuffer.append(ch);
+ sBuffer.append(static_cast<sal_Char>(ch));
}
}
YY_FATAL_ERROR("Unterminated name string");
@@ -746,7 +746,7 @@ void OSQLScanner::SQLyyerror(sal_Char *fmt)
sal_Char *s = Buffer;
sal_Int32 nPos = 1;
- sal_Int32 ch = SQLyytext ? (SQLyytext[0] == 0 ? ' ' : SQLyytext[0]): ' ';
+ int ch = SQLyytext ? (SQLyytext[0] == 0 ? ' ' : SQLyytext[0]): ' ';
*s++ = ch;
while (!checkeof(ch = yyinput()))
{
@@ -800,7 +800,7 @@ void OSQLScanner::prepareScan(const ::rtl::OUString & rNewStatement, const IPars
//------------------------------------------------------------------------------
sal_Int32 OSQLScanner::SQLyygetc(void)
{
- sal_Int32 nPos = (m_nCurrentPos >= m_sStatement.getLength()) ? -1 : m_sStatement.getStr()[m_nCurrentPos];
+ sal_Int32 nPos = (m_nCurrentPos >= m_sStatement.getLength()) ? EOF : m_sStatement.getStr()[m_nCurrentPos];
m_nCurrentPos++;
return nPos;
}