diff options
author | Lionel Elie Mamane <lionel@mamane.lu> | 2015-06-17 14:00:46 +0200 |
---|---|---|
committer | Lionel Elie Mamane <lionel@mamane.lu> | 2015-06-17 14:19:26 +0200 |
commit | 5652313e8a1aee00fd973cdcdd0d04071a8abd31 (patch) | |
tree | c778c9f1fbc83d80155f21e686a63c91b8749d07 /connectivity/source | |
parent | eb0c95c56efedf60e59a56bd6d64b04f4697e66b (diff) |
postgresql-sdbc: fixup string2intarray
this allows getGeneratedValues to work
Change-Id: Ia87e87afa8cdb01f1d39c84bc7d7143c101d8891
Diffstat (limited to 'connectivity/source')
-rw-r--r-- | connectivity/source/drivers/postgresql/pq_tools.cxx | 34 |
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; |