Bugzilla – Attachment 39074 Details for
Bug 30504
Incorrect save NUMBER value to DBF
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
diff for correct this iusse
DTable.diff (text/plain), 7.13 KB, created by
Tonal
on 2010-09-30 09:05:23 UTC
(
hide
)
Description:
diff for correct this iusse
Filename:
MIME Type:
Creator:
Tonal
Created:
2010-09-30 09:05:23 UTC
Size:
7.13 KB
patch
obsolete
>diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx >index 55518c8..f3dd4cd 100644 >--- a/connectivity/source/drivers/dbase/DTable.cxx >+++ b/connectivity/source/drivers/dbase/DTable.cxx >@@ -1780,7 +1780,7 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const > > for (i = 0; i < nColumnCount && nByteOffset <= m_nBufferSize ; ++i) > { >- // Laengen je nach Datentyp: >+ // Lengths for each data type: > OSL_ENSURE(i < m_aPrecisions.size(),"Illegal index!"); > sal_Int32 nLen = 0; > sal_Int32 nType = 0; >@@ -1817,7 +1817,7 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const > break; > case DataType::DECIMAL: > nLen = SvDbaseConverter::ConvertPrecisionToDbase(nLen,nScale); >- break; // das Vorzeichen und das Komma >+ break; // The sign and the comma > default: > break; > >@@ -1846,10 +1846,10 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const > > > ++nPos; // the row values start at 1 >- // Ist die Variable ueberhaupt gebunden? >+ // If the variable is bound at all? > if ( !rRow.get()[nPos]->isBound() ) > { >- // Nein - naechstes Feld. >+ // No - the next field. > nByteOffset += nLen; > continue; > } >@@ -1870,15 +1870,14 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const > if (rRow.get()[nPos]->getValue().isNull()) > { > if ( bSetZero ) >- memset(pData,0,nLen); // Zuruecksetzen auf NULL >+ memset(pData,0,nLen); // Clear to NULL > else >- memset(pData,' ',nLen); // Zuruecksetzen auf NULL >+ memset(pData,' ',nLen); // Clear to NULL > nByteOffset += nLen; > OSL_ENSURE( nByteOffset <= m_nBufferSize ,"ByteOffset > m_nBufferSize!"); > continue; > } > >- sal_Bool bHadError = sal_False; > try > { > switch (nType) >@@ -1887,7 +1886,7 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const > { > sal_Int32 nJulianDate = 0, nJulianTime = 0; > lcl_CalcJulDate(nJulianDate,nJulianTime,rRow.get()[nPos]->getValue()); >- // Genau 8 Byte kopieren: >+ // Exactly 8 bytes to copy: > memcpy(pData,&nJulianDate,4); > memcpy(pData+4,&nJulianTime,4); > } >@@ -1907,7 +1906,7 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const > (int)aDate.Month, > (int)aDate.Day); > >- // Genau 8 Byte kopieren: >+ // Exactly 8 bytes to copy: > strncpy(pData,s,sizeof s - 1); > } break; > case DataType::INTEGER: >@@ -1936,18 +1935,17 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const > break; > case DataType::DECIMAL: > { >- memset(pData,' ',nLen); // Zuruecksetzen auf NULL >+ memset(pData,' ',nLen); // Clear to NULL > > const double n = rRow.get()[nPos]->getValue(); > >- // ein const_cast, da GetFormatPrecision am SvNumberFormat nicht const ist, obwohl es das eigentlich >- // sein koennte und muesste >- >+ // one, because const_cast GetFormatPrecision on SvNumberFormat is not constant, >+ // even though it really could and should be > const ByteString aDefaultValue( ::rtl::math::doubleToString( n, rtl_math_StringFormat_F, nScale, '.', NULL, 0)); >- BOOL bValidLength = aDefaultValue.Len() <= nLen; >- if ( bValidLength ) >+ const sal_Int32 aLen = aDefaultValue.Len(); >+ if ( aLen <= nLen ) > { >- strncpy(pData,aDefaultValue.GetBuffer(),nLen); >+ memcpy(pData+nLen-aLen,aDefaultValue.GetBuffer(),aLen); > // write the resulting double back > *rRow.get()[nPos] = toDouble(aDefaultValue); > } >@@ -1975,12 +1973,12 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const > case DataType::LONGVARBINARY: > case DataType::LONGVARCHAR: > { >- char cNext = pData[nLen]; // merken und temporaer durch 0 ersetzen >- pData[nLen] = '\0'; // das geht, da der Puffer immer ein Zeichen groesser ist ... >+ char cNext = pData[nLen]; // Mark's scratch and replaced by 0 >+ pData[nLen] = '\0'; // This is because the buffer is always a sign of greater ... > >- ULONG nBlockNo = strtol((const char *)pData,NULL,10); // Blocknummer lesen >+ ULONG nBlockNo = strtol((const char *)pData,NULL,10); // Block number read > >- // Naechstes Anfangszeichen wieder restaurieren: >+ // Next initial character restore again: > pData[nLen] = cNext; > if (!m_pMemoStream || !WriteMemo(rRow.get()[nPos]->get(), nBlockNo)) > break; >@@ -1989,13 +1987,13 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const > ByteString aBlock(ByteString::CreateFromInt32(nBlockNo)); > aStr.Expand(static_cast<sal_uInt16>(nLen - aBlock.Len()), '0' ); > aStr += aBlock; >- // Zeichen kopieren: >- memset(pData,' ',nLen); // Zuruecksetzen auf NULL >+ // Copy characters: >+ memset(pData,' ',nLen); // Clear to NULL > memcpy(pData, aStr.GetBuffer(), nLen); > } break; > default: > { >- memset(pData,' ',nLen); // Zuruecksetzen auf NULL >+ memset(pData,' ',nLen); // Clear to NULL > > ::rtl::OUString sStringToWrite( rRow.get()[nPos]->getValue().getString() ); > >@@ -2013,9 +2011,7 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const > { > throw; > } >- catch ( Exception& ) { bHadError = sal_True; } >- >- if ( bHadError ) >+ catch ( Exception& ) > { > m_pColumns->getByIndex(i) >>= xCol; > OSL_ENSURE( xCol.is(), "ODbaseTable::UpdateBuffer column is null!" ); >@@ -2028,7 +2024,7 @@ BOOL ODbaseTable::UpdateBuffer(OValueRefVector& rRow, OValueRefRow pOrgRow,const > ) ); > ::dbtools::throwGenericSQLException( sError, *this ); > } >- // Und weiter ... >+ // And more ... > nByteOffset += nLen; > OSL_ENSURE( nByteOffset <= m_nBufferSize ,"ByteOffset > m_nBufferSize!"); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 30504
: 39074