22 #include <sys/types.h> 48 while (t->
nb[level][t->
used[level][i]].
pos != pos &&
54 which = t->
used[level][i];
55 t->
nb[level][which].
pos = -1;
62 t->
nb[level][t->
used[level][i + 1]].
pos != -1) {
63 t->
used[level][i] = t->
used[level][i + 1];
67 t->
used[level][i] = which;
79 return lseek(t->
fd, 0, SEEK_END);
100 lseek(t->
fd, nodepos, SEEK_SET);
101 size += read(t->
fd, &(n->
count),
sizeof(
int));
102 size += read(t->
fd, &(n->
level),
sizeof(
int));
104 for (i = 0; i <
MAXCARD; i++) {
117 while (t->
nb[level][t->
used[level][i]].
pos != nodepos &&
118 t->
nb[level][t->
used[level][i]].
pos >= 0 &&
124 if (t->
nb[level][which].
pos != nodepos) {
126 if (t->
nb[level][which].
dirty) {
128 t->
nb[level][which].
pos, t);
159 G_fatal_error(
"RTreeWriteBranch(): Unable to write (%s)", strerror(errno));
162 G_fatal_error(
"RTreeWriteBranch(): Unable to write (%s)", strerror(errno));
175 if (write(t->
fd, &(n->
count),
sizeof(
int)) !=
sizeof(
int))
176 G_fatal_error(
"RTreeWriteNode(): Unable to write (%s)", strerror(errno));
178 if (write(t->
fd, &(n->
level),
sizeof(
int)) !=
sizeof(int))
179 G_fatal_error(
"RTreeWriteNode(): Unable to write (%s)", strerror(errno));
182 for (i = 0; i <
MAXCARD; i++) {
192 lseek(t->
fd, nodepos, SEEK_SET);
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
size_t RTreeRewriteNode(struct RTree_Node *n, off_t nodepos, struct RTree *t)
void RTreeNodeChanged(struct RTree_Node *n, off_t nodepos, struct RTree *t)
size_t RTreeReadNode(struct RTree_Node *n, off_t nodepos, struct RTree *t)
struct RTree::_recycle free_nodes
void RTreeFlushBuffer(struct RTree *t)
#define assert(condition)
struct RTree_Branch * branch
size_t RTreeReadBranch(struct RTree_Branch *b, struct RTree *t)
off_t RTreeGetNodePos(struct RTree *t)
struct RTree_Node * RTreeGetNode(off_t nodepos, int level, struct RTree *t)
size_t RTreeWriteBranch(struct RTree_Branch *b, struct RTree *t)
size_t RTreeWriteNode(struct RTree_Node *n, struct RTree *t)
void RTreeAddNodePos(off_t pos, int level, struct RTree *t)