aboutsummaryrefslogtreecommitdiff
path: root/src/substream.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-01-20 05:30:43 +0000
committerMike Buland <eichlan@xagasoft.com>2011-01-20 05:30:43 +0000
commit7c6c9538b03c9eae24e38fbeb30dd76a16aff1d2 (patch)
treee2d4bfccd81070adf7294ee54db2399df0c7171f /src/substream.cpp
parentf5aca1a1b402bd7ebc944dc6e6fe65828d863365 (diff)
downloadlibbu++-7c6c9538b03c9eae24e38fbeb30dd76a16aff1d2.tar.gz
libbu++-7c6c9538b03c9eae24e38fbeb30dd76a16aff1d2.tar.bz2
libbu++-7c6c9538b03c9eae24e38fbeb30dd76a16aff1d2.tar.xz
libbu++-7c6c9538b03c9eae24e38fbeb30dd76a16aff1d2.zip
Wow, got the Stream changes propegated, all tests build with string instead of
fstring, and updated the copyright notice to extend to 2011
Diffstat (limited to 'src/substream.cpp')
-rw-r--r--src/substream.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/substream.cpp b/src/substream.cpp
index 25d301a..c201752 100644
--- a/src/substream.cpp
+++ b/src/substream.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.
@@ -7,7 +7,7 @@
7 7
8#include "bu/substream.h" 8#include "bu/substream.h"
9 9
10Bu::SubStream::SubStream( Bu::Stream &rNext, long iSize ) : 10Bu::SubStream::SubStream( Bu::Stream &rNext, Bu::size iSize ) :
11 Bu::Filter( rNext ), 11 Bu::Filter( rNext ),
12 iStart( 0 ), 12 iStart( 0 ),
13 iPos( 0 ), 13 iPos( 0 ),
@@ -20,18 +20,18 @@ Bu::SubStream::~SubStream()
20{ 20{
21} 21}
22 22
23size_t Bu::SubStream::read( void *pBuf, size_t nBytes ) 23Bu::size Bu::SubStream::read( void *pBuf, Bu::size nBytes )
24{ 24{
25 if( (long)nBytes > iSize-iPos ) 25 if( (Bu::size)nBytes > iSize-iPos )
26 nBytes = iSize-iPos; 26 nBytes = iSize-iPos;
27 nBytes = rNext.read( pBuf, nBytes ); 27 nBytes = rNext.read( pBuf, nBytes );
28 iPos += nBytes; 28 iPos += nBytes;
29 return nBytes; 29 return nBytes;
30} 30}
31 31
32size_t Bu::SubStream::write( const void *pBuf, size_t nBytes ) 32Bu::size Bu::SubStream::write( const void *pBuf, Bu::size nBytes )
33{ 33{
34 if( (long)nBytes > iSize-iPos ) 34 if( (Bu::size)nBytes > iSize-iPos )
35 nBytes = iSize-iPos; 35 nBytes = iSize-iPos;
36 nBytes = rNext.write( pBuf, nBytes ); 36 nBytes = rNext.write( pBuf, nBytes );
37 iPos += nBytes; 37 iPos += nBytes;
@@ -43,7 +43,7 @@ void Bu::SubStream::start()
43 // doesn't mean anything... 43 // doesn't mean anything...
44} 44}
45 45
46size_t Bu::SubStream::stop() 46Bu::size Bu::SubStream::stop()
47{ 47{
48 // doesn't mean anything... 48 // doesn't mean anything...
49 return 0; 49 return 0;
@@ -54,12 +54,12 @@ void Bu::SubStream::close()
54 // don't do anything? maybe... 54 // don't do anything? maybe...
55} 55}
56 56
57long Bu::SubStream::tell() 57Bu::size Bu::SubStream::tell()
58{ 58{
59 return iPos; 59 return iPos;
60} 60}
61 61
62void Bu::SubStream::seek( long offset ) 62void Bu::SubStream::seek( Bu::size offset )
63{ 63{
64 if( iPos+offset < 0 ) 64 if( iPos+offset < 0 )
65 offset = -iPos; 65 offset = -iPos;
@@ -69,7 +69,7 @@ void Bu::SubStream::seek( long offset )
69 iPos += offset; 69 iPos += offset;
70} 70}
71 71
72void Bu::SubStream::setPos( long pos ) 72void Bu::SubStream::setPos( Bu::size pos )
73{ 73{
74 if( pos < 0 ) 74 if( pos < 0 )
75 pos = 0; 75 pos = 0;
@@ -80,7 +80,7 @@ void Bu::SubStream::setPos( long pos )
80 rNext.setPos( pos ); 80 rNext.setPos( pos );
81} 81}
82 82
83void Bu::SubStream::setPosEnd( long pos ) 83void Bu::SubStream::setPosEnd( Bu::size pos )
84{ 84{
85 if( iSize-pos < 0 ) 85 if( iSize-pos < 0 )
86 pos = 0; 86 pos = 0;