diff options
author | Mike Buland <eichlan@xagasoft.com> | 2011-01-20 18:09:04 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2011-01-20 18:09:04 +0000 |
commit | 393f1b414746a7f1977971dd7659dd2b47092b11 (patch) | |
tree | 81d0ca1ee70ab86a7d79c1991abe5c387b655fb2 /src/myriadstream.cpp | |
parent | c259f95bd0e58b247940a339bb9b4b401b4e9438 (diff) | |
parent | 7e25a863325dc3e9762397e700030969e093b087 (diff) | |
download | libbu++-393f1b414746a7f1977971dd7659dd2b47092b11.tar.gz libbu++-393f1b414746a7f1977971dd7659dd2b47092b11.tar.bz2 libbu++-393f1b414746a7f1977971dd7659dd2b47092b11.tar.xz libbu++-393f1b414746a7f1977971dd7659dd2b47092b11.zip |
Wow! Merged the branch, streams are updated, and there's no more FString, run
the fixstrings.sh script in the support directory to (hopefully) automatically
update your projects.
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 | |||