summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2015-06-17 14:00:46 +0200
committerMichael Stahl <mstahl@redhat.com>2015-06-18 12:02:57 +0000
commit35d939bb69fdc02b6baa47dc1e3181e5cfe23980 (patch)
treec9b8c58d1a4ec8820d131c0c50294603ba12c80a /connectivity
parente1c5fca182e970cb7ce1e3921ba85eb394fcb62b (diff)
postgresql-sdbc: fixup string2intarray
this allows getGeneratedValues to work Change-Id: Ia87e87afa8cdb01f1d39c84bc7d7143c101d8891 Reviewed-on: https://gerrit.libreoffice.org/16341 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/postgresql/pq_tools.cxx34
1 files changed, 24 insertions, 10 deletions
diff --git a/connectivity/source/drivers/postgresql/pq_tools.cxx b/connectivity/source/drivers/postgresql/pq_tools.cxx
index 8cd156f8efb2..4d75e8c3bc57 100644
--- a/connectivity/source/drivers/postgresql/pq_tools.cxx
+++ b/connectivity/source/drivers/postgresql/pq_tools.cxx
@@ -862,33 +862,46 @@ com::sun::star::uno::Sequence< sal_Int32 > string2intarray( const OUString & str
if( str.getLength() > 1 )
{
sal_Int32 start = 0;
- while ( iswspace( str.iterateCodePoints(&start) ) )
+ sal_uInt32 c;
+ while ( iswspace( (c=str.iterateCodePoints(&start)) ) )
if ( start == strlen)
return ret;
- if ( str.iterateCodePoints(&start) != L'{' )
+ if ( c != L'{' )
return ret;
- while ( iswspace( str.iterateCodePoints(&start) ) )
+ while ( iswspace( c=str.iterateCodePoints(&start) ) )
if ( start == strlen)
return ret;
- if ( str.iterateCodePoints(&start, 0) == L'}' )
+ if ( c == L'}' )
return ret;
std::vector< sal_Int32 > vec;
do
{
OUString digits;
- sal_Int32 c;
- while ( isdigit( c = str.iterateCodePoints(&start) ) )
+ do
{
+ if(!iswspace(c))
+ break;
if ( start == strlen)
return ret;
- digits += OUString(c);
- }
+ } while ( (c=str.iterateCodePoints(&start)) );
+ do
+ {
+ if (!iswdigit(c))
+ break;
+ if ( start == strlen)
+ return ret;
+ digits += OUString(&c, 1);
+ } while ( (c = str.iterateCodePoints(&start)) );
vec.push_back( digits.toInt32() );
- while ( iswspace( str.iterateCodePoints(&start) ) )
+ do
+ {
+ if(!iswspace(c))
+ break;
if ( start == strlen)
return ret;
- if ( str.iterateCodePoints(&start, 0) == L'}' )
+ } while ( (c=str.iterateCodePoints(&start)) );
+ if ( c == L'}' )
break;
if ( str.iterateCodePoints(&start) != L',' )
return ret;
@@ -896,6 +909,7 @@ com::sun::star::uno::Sequence< sal_Int32 > string2intarray( const OUString & str
return ret;
} while( true );
// vec is guaranteed non-empty
+ assert(vec.size() > 0);
ret = com::sun::star::uno::Sequence< sal_Int32 > ( &vec[0] , vec.size() );
}
return ret;