summaryrefslogtreecommitdiffstats
path: root/io/source/stm/odata.cxx
diff options
context:
space:
mode:
authorJörg Budischewski <jbu@openoffice.org>2000-12-08 07:24:40 +0000
committerJörg Budischewski <jbu@openoffice.org>2000-12-08 07:24:40 +0000
commitd8f189f40f992f4236d4790d8b64f14934ab6846 (patch)
treedfe501f8d25fd242f2052bcd9807e4becacae483 /io/source/stm/odata.cxx
parent#80304# vertical writing added (diff)
downloadcore-d8f189f40f992f4236d4790d8b64f14934ab6846.tar.gz
core-d8f189f40f992f4236d4790d8b64f14934ab6846.zip
#81032# hyper are now also read/written. Note that e.g. scripts using hypers won't be able to read/write them in older versions.
Diffstat (limited to 'io/source/stm/odata.cxx')
-rw-r--r--io/source/stm/odata.cxx34
1 files changed, 29 insertions, 5 deletions
diff --git a/io/source/stm/odata.cxx b/io/source/stm/odata.cxx
index 834ea08f12c7..b906cb3891cb 100644
--- a/io/source/stm/odata.cxx
+++ b/io/source/stm/odata.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: odata.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 17:24:18 $
+ * last change: $Author: jbu $ $Date: 2000-12-08 08:24:40 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -314,8 +314,22 @@ sal_Int32 ODataInputStream::readLong(void) throw (IOException, RuntimeException)
sal_Int64 ODataInputStream::readHyper(void) throw (IOException, RuntimeException)
{
- throw WrongFormatException( );
- return 0;
+ Sequence<sal_Int8> aTmp(8);
+ if( 8 != readBytes( aTmp, 8 ) )
+ {
+ throw UnexpectedEOFException( );
+ }
+
+ const sal_uInt8 * pBytes = ( const sal_uInt8 * ) aTmp.getConstArray();
+ return
+ (((sal_Int64)pBytes[0]) << 56) +
+ (((sal_Int64)pBytes[1]) << 48) +
+ (((sal_Int64)pBytes[2]) << 40) +
+ (((sal_Int64)pBytes[3]) << 32) +
+ (((sal_Int64)pBytes[4]) << 24) +
+ (((sal_Int64)pBytes[5]) << 16) +
+ (((sal_Int64)pBytes[6]) << 8) +
+ pBytes[7];
}
float ODataInputStream::readFloat(void) throw (IOException, RuntimeException)
@@ -735,7 +749,17 @@ void ODataOutputStream::writeHyper(sal_Int64 Value)
throw ( IOException,
RuntimeException)
{
- throw WrongFormatException();
+ Sequence<sal_Int8> aTmp( 8 );
+ sal_Int8 * pBytes = aTmp.getArray();
+ pBytes[0] = sal_Int8(Value >> 56);
+ pBytes[1] = sal_Int8(Value >> 48);
+ pBytes[2] = sal_Int8(Value >> 40);
+ pBytes[3] = sal_Int8(Value >> 32);
+ pBytes[4] = sal_Int8(Value >> 24);
+ pBytes[5] = sal_Int8(Value >> 16);
+ pBytes[6] = sal_Int8(Value >> 8);
+ pBytes[7] = sal_Int8(Value);
+ writeBytes( aTmp );
}