-rw-r--r-- | qmake/tools/qbitarray.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/qmake/tools/qbitarray.cpp b/qmake/tools/qbitarray.cpp index 4f4e14b..1aaf963 100644 --- a/qmake/tools/qbitarray.cpp +++ b/qmake/tools/qbitarray.cpp | |||
@@ -176,49 +176,50 @@ QBitArray::QBitArray( uint size ) : QByteArray( 0, 0 ) | |||
176 | */ | 176 | */ |
177 | 177 | ||
178 | 178 | ||
179 | /*! | 179 | /*! |
180 | Pad last byte with 0-bits. | 180 | Pad last byte with 0-bits. |
181 | */ | 181 | */ |
182 | void QBitArray::pad0() | 182 | void QBitArray::pad0() |
183 | { | 183 | { |
184 | uint sz = size(); | 184 | uint sz = size(); |
185 | if ( sz && sz%8 ) | 185 | if ( sz && sz%8 ) |
186 | *(data()+sz/8) &= (1 << (sz%8)) - 1; | 186 | *(data()+sz/8) &= (1 << (sz%8)) - 1; |
187 | } | 187 | } |
188 | 188 | ||
189 | 189 | ||
190 | /*! | 190 | /*! |
191 | \fn uint QBitArray::size() const | 191 | \fn uint QBitArray::size() const |
192 | 192 | ||
193 | Returns the bit array's size (number of bits). | 193 | Returns the bit array's size (number of bits). |
194 | 194 | ||
195 | \sa resize() | 195 | \sa resize() |
196 | */ | 196 | */ |
197 | 197 | ||
198 | /*! | 198 | /*! |
199 | Resizes the bit array to \a size bits and returns TRUE if the bit | 199 | Resizes the bit array to \a size bits and returns TRUE if the bit |
200 | array could be resized; otherwise returns FALSE. | 200 | array could be resized; otherwise returns FALSE. The array becomes |
201 | a null array if \a size == 0. | ||
201 | 202 | ||
202 | If the array is expanded, the new bits are set to 0. | 203 | If the array is expanded, the new bits are set to 0. |
203 | 204 | ||
204 | \sa size() | 205 | \sa size() |
205 | */ | 206 | */ |
206 | 207 | ||
207 | bool QBitArray::resize( uint size ) | 208 | bool QBitArray::resize( uint size ) |
208 | { | 209 | { |
209 | uint s = this->size(); | 210 | uint s = this->size(); |
210 | if ( !QByteArray::resize( (size+7)/8 ) ) | 211 | if ( !QByteArray::resize( (size+7)/8 ) ) |
211 | return FALSE; // cannot resize | 212 | return FALSE; // cannot resize |
212 | SHBLOCK->nbits = size; | 213 | SHBLOCK->nbits = size; |
213 | if ( size != 0 ) { // not null array | 214 | if ( size != 0 ) { // not null array |
214 | int ds = (int)(size+7)/8 - (int)(s+7)/8;// number of bytes difference | 215 | int ds = (int)(size+7)/8 - (int)(s+7)/8;// number of bytes difference |
215 | if ( ds > 0 ) // expanding array | 216 | if ( ds > 0 ) // expanding array |
216 | memset( data() + (s+7)/8, 0, ds );// reset new data | 217 | memset( data() + (s+7)/8, 0, ds );// reset new data |
217 | } | 218 | } |
218 | return TRUE; | 219 | return TRUE; |
219 | } | 220 | } |
220 | 221 | ||
221 | 222 | ||
222 | /*! | 223 | /*! |
223 | Fills the bit array with \a v (1's if \a v is TRUE, or 0's if \a v | 224 | Fills the bit array with \a v (1's if \a v is TRUE, or 0's if \a v |
224 | is FALSE). | 225 | is FALSE). |