aboutsummaryrefslogtreecommitdiff
path: root/src/substream.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-01-20 18:09:04 +0000
committerMike Buland <eichlan@xagasoft.com>2011-01-20 18:09:04 +0000
commit393f1b414746a7f1977971dd7659dd2b47092b11 (patch)
tree81d0ca1ee70ab86a7d79c1991abe5c387b655fb2 /src/substream.cpp
parentc259f95bd0e58b247940a339bb9b4b401b4e9438 (diff)
parent7e25a863325dc3e9762397e700030969e093b087 (diff)
downloadlibbu++-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/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;