diff options
Diffstat (limited to 'src/myriadstream.cpp')
| -rw-r--r-- | src/myriadstream.cpp | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/src/myriadstream.cpp b/src/myriadstream.cpp index 74dca04..a968a0c 100644 --- a/src/myriadstream.cpp +++ b/src/myriadstream.cpp | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Copyright (C) 2007-2010 Xagasoft, All rights reserved. | 2 | * Copyright (C) 2007-2011 Xagasoft, All rights reserved. |
| 3 | * | 3 | * |
| 4 | * This file is part of the libbu++ library and is released under the | 4 | * This file is part of the libbu++ library and is released under the |
| 5 | * terms of the license contained in the file LICENSE. | 5 | * terms of the license contained in the file LICENSE. |
| @@ -46,13 +46,13 @@ void Bu::MyriadStream::close() | |||
| 46 | { | 46 | { |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | size_t Bu::MyriadStream::read( void *pBuf, size_t nBytes ) | 49 | Bu::size Bu::MyriadStream::read( void *pBuf, Bu::size nBytes ) |
| 50 | { | 50 | { |
| 51 | #ifdef MYRIAD_STREAM_DEBUG | 51 | #ifdef MYRIAD_STREAM_DEBUG |
| 52 | sio << "MyriadStream: read: " << __LINE__ << ": Started, asked to read " << nBytes << "b." | 52 | sio << "MyriadStream: read: " << __LINE__ << ": Started, asked to read " << nBytes << "b." |
| 53 | << sio.nl; | 53 | << sio.nl; |
| 54 | #endif | 54 | #endif |
| 55 | if( nBytes > (size_t)pStream->iSize-iPos ) | 55 | if( nBytes > (Bu::size)pStream->iSize-iPos ) |
| 56 | nBytes = pStream->iSize-iPos; | 56 | nBytes = pStream->iSize-iPos; |
| 57 | if( nBytes <= 0 ) | 57 | if( nBytes <= 0 ) |
| 58 | return 0; | 58 | return 0; |
| @@ -109,7 +109,7 @@ size_t Bu::MyriadStream::read( void *pBuf, size_t nBytes ) | |||
| 109 | return nBytes; | 109 | return nBytes; |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | size_t Bu::MyriadStream::write( const void *pBuf, size_t nBytes ) | 112 | Bu::size Bu::MyriadStream::write( const void *pBuf, Bu::size nBytes ) |
| 113 | { | 113 | { |
| 114 | if( nBytes <= 0 ) | 114 | if( nBytes <= 0 ) |
| 115 | return 0; | 115 | return 0; |
| @@ -215,22 +215,22 @@ size_t Bu::MyriadStream::write( const void *pBuf, size_t nBytes ) | |||
| 215 | return nBytes; | 215 | return nBytes; |
| 216 | } | 216 | } |
| 217 | 217 | ||
| 218 | long Bu::MyriadStream::tell() | 218 | Bu::size Bu::MyriadStream::tell() |
| 219 | { | 219 | { |
| 220 | return iPos; | 220 | return iPos; |
| 221 | } | 221 | } |
| 222 | 222 | ||
| 223 | void Bu::MyriadStream::seek( long offset ) | 223 | void Bu::MyriadStream::seek( Bu::size offset ) |
| 224 | { | 224 | { |
| 225 | iPos += offset; | 225 | iPos += offset; |
| 226 | } | 226 | } |
| 227 | 227 | ||
| 228 | void Bu::MyriadStream::setPos( long pos ) | 228 | void Bu::MyriadStream::setPos( Bu::size pos ) |
| 229 | { | 229 | { |
| 230 | iPos = pos; | 230 | iPos = pos; |
| 231 | } | 231 | } |
| 232 | 232 | ||
| 233 | void Bu::MyriadStream::setPosEnd( long pos ) | 233 | void Bu::MyriadStream::setPosEnd( Bu::size pos ) |
| 234 | { | 234 | { |
| 235 | iPos = pStream->iSize-pos; | 235 | iPos = pStream->iSize-pos; |
| 236 | } | 236 | } |
| @@ -283,7 +283,7 @@ void Bu::MyriadStream::setBlocking( bool /*bBlocking*/ ) | |||
| 283 | { | 283 | { |
| 284 | } | 284 | } |
| 285 | 285 | ||
| 286 | void Bu::MyriadStream::setSize( long iSize ) | 286 | void Bu::MyriadStream::setSize( Bu::size iSize ) |
| 287 | { | 287 | { |
| 288 | if( iSize < 0 ) | 288 | if( iSize < 0 ) |
| 289 | iSize = 0; | 289 | iSize = 0; |
| @@ -292,3 +292,20 @@ void Bu::MyriadStream::setSize( long iSize ) | |||
| 292 | iPos = iSize; | 292 | iPos = iSize; |
| 293 | } | 293 | } |
| 294 | 294 | ||
| 295 | Bu::size Bu::MyriadStream::getSize() const | ||
| 296 | { | ||
| 297 | return pStream->iSize; | ||
| 298 | } | ||
| 299 | |||
| 300 | Bu::size Bu::MyriadStream::getBlockSize() const | ||
| 301 | { | ||
| 302 | return rMyriad.getBlockSize(); | ||
| 303 | } | ||
| 304 | |||
| 305 | Bu::String Bu::MyriadStream::getLocation() const | ||
| 306 | { | ||
| 307 | Bu::String s; | ||
| 308 | s.format("%d", pStream->iId ); | ||
| 309 | return s; | ||
| 310 | } | ||
| 311 | |||
