diff options
author | Mike Buland <eichlan@xagasoft.com> | 2008-10-08 16:17:26 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2008-10-08 16:17:26 +0000 |
commit | 3f1c8998166466245aee2860197fb4908e55f1a2 (patch) | |
tree | b6d148679bbd87125f03cb723d5b59969b90c733 /src/nids.h | |
parent | 5883662909051e99093514483c32e2539a3cf850 (diff) | |
download | libbu++-3f1c8998166466245aee2860197fb4908e55f1a2.tar.gz libbu++-3f1c8998166466245aee2860197fb4908e55f1a2.tar.bz2 libbu++-3f1c8998166466245aee2860197fb4908e55f1a2.tar.xz libbu++-3f1c8998166466245aee2860197fb4908e55f1a2.zip |
Ok...corrected a problem with new block allocation in nids, and it no longer
goes into an infinite loop while doing certain kinds of read. Also, it zeros
out new blocks to make things easier to cope with in the hex editor, it'll
probably also compress better.
I also fixed Bu::MemBuf so that you can now write to arbitrary places
mid-stream.
Diffstat (limited to 'src/nids.h')
-rw-r--r-- | src/nids.h | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -1,3 +1,10 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007-2008 Xagasoft, All rights reserved. | ||
3 | * | ||
4 | * This file is part of the libbu++ library and is released under the | ||
5 | * terms of the license contained in the file LICENSE. | ||
6 | */ | ||
7 | |||
1 | #ifndef BU_NIDS_H | 8 | #ifndef BU_NIDS_H |
2 | #define BU_NIDS_H | 9 | #define BU_NIDS_H |
3 | 10 | ||
@@ -75,12 +82,17 @@ namespace Bu | |||
75 | blockUnused = 0xFFFFFFFFUL | 82 | blockUnused = 0xFFFFFFFFUL |
76 | }; | 83 | }; |
77 | 84 | ||
85 | void initBlock( uint32_t uPos, uint32_t uFirstBlock, | ||
86 | uint32_t uPrevBlock, bool bNew=false ); | ||
78 | uint32_t createBlock( uint32_t uFirstBlock, uint32_t uPrevBlock, | 87 | uint32_t createBlock( uint32_t uFirstBlock, uint32_t uPrevBlock, |
79 | int iPreAllocate=1 ); | 88 | int iPreAllocate=1 ); |
80 | void getBlock( uint32_t uIndex, struct Nids::Block *pBlock ); | 89 | void getBlock( uint32_t uIndex, struct Nids::Block *pBlock ); |
81 | void setBlock( uint32_t uIndex, struct Nids::Block *pBlock ); | 90 | void setBlock( uint32_t uIndex, struct Nids::Block *pBlock ); |
82 | void updateStreamSize( uint32_t uIndex, uint32_t uSize ); | 91 | void updateStreamSize( uint32_t uIndex, uint32_t uSize ); |
83 | uint32_t getNextBlock( uint32_t uIndex, struct Nids::Block *pBlock ); | 92 | uint32_t getNextBlock( uint32_t uIndex, struct Nids::Block *pBlock, |
93 | bool bCreate=true); | ||
94 | |||
95 | // Block allocation routines | ||
84 | Block *newBlock(); | 96 | Block *newBlock(); |
85 | void deleteBlock( Block *pBlock ); | 97 | void deleteBlock( Block *pBlock ); |
86 | 98 | ||