aboutsummaryrefslogtreecommitdiff
path: root/src/stable/file.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-06-15 13:27:59 +0000
committerMike Buland <eichlan@xagasoft.com>2012-06-15 13:27:59 +0000
commit7ea5c06059ee6668d6e6d04c3b3dcb8557061696 (patch)
tree9ae2f93d09346c0272240015443e1a2bc660dd68 /src/stable/file.cpp
parent026cd6f71a15edd1a242c59d5cb9f8271a108506 (diff)
downloadlibbu++-7ea5c06059ee6668d6e6d04c3b3dcb8557061696.tar.gz
libbu++-7ea5c06059ee6668d6e6d04c3b3dcb8557061696.tar.bz2
libbu++-7ea5c06059ee6668d6e6d04c3b3dcb8557061696.tar.xz
libbu++-7ea5c06059ee6668d6e6d04c3b3dcb8557061696.zip
Bu::Myriad now only uses BitString during initialization, and I'm going to
replace that with just an array, no problem. It's many, many, many times faster while streams are growing, and it should be constant time, not linear like it was before. It also handles myriad files in excess of 2gb correctly now, at least, it seems to just fine :)
Diffstat (limited to 'src/stable/file.cpp')
-rw-r--r--src/stable/file.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/stable/file.cpp b/src/stable/file.cpp
index 33420f1..14e4f3c 100644
--- a/src/stable/file.cpp
+++ b/src/stable/file.cpp
@@ -91,7 +91,11 @@ Bu::size Bu::File::tell()
91 if( fd < 0 ) 91 if( fd < 0 )
92 throw FileException("File not open."); 92 throw FileException("File not open.");
93 93
94#ifdef USE_64BIT_IO
95 return lseek64( fd, 0, SEEK_CUR );
96#else
94 return lseek( fd, 0, SEEK_CUR ); 97 return lseek( fd, 0, SEEK_CUR );
98#endif
95} 99}
96 100
97void Bu::File::seek( Bu::size offset ) 101void Bu::File::seek( Bu::size offset )
@@ -99,7 +103,11 @@ void Bu::File::seek( Bu::size offset )
99 if( fd < 0 ) 103 if( fd < 0 )
100 throw FileException("File not open."); 104 throw FileException("File not open.");
101 105
106#ifdef USE_64BIT_IO
107 lseek64( fd, offset, SEEK_CUR );
108#else
102 lseek( fd, offset, SEEK_CUR ); 109 lseek( fd, offset, SEEK_CUR );
110#endif
103 bEos = false; 111 bEos = false;
104} 112}
105 113
@@ -108,7 +116,11 @@ void Bu::File::setPos( Bu::size pos )
108 if( fd < 0 ) 116 if( fd < 0 )
109 throw FileException("File not open."); 117 throw FileException("File not open.");
110 118
119#ifdef USE_64BIT_IO
120 lseek64( fd, pos, SEEK_SET );
121#else
111 lseek( fd, pos, SEEK_SET ); 122 lseek( fd, pos, SEEK_SET );
123#endif
112 bEos = false; 124 bEos = false;
113} 125}
114 126
@@ -117,7 +129,7 @@ void Bu::File::setPosEnd( Bu::size pos )
117 if( fd < 0 ) 129 if( fd < 0 )
118 throw FileException("File not open."); 130 throw FileException("File not open.");
119 131
120 lseek( fd, pos, SEEK_END ); 132 lseek64( fd, pos, SEEK_END );
121 bEos = false; 133 bEos = false;
122} 134}
123 135