summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2009-03-10 19:45:01 -0700
committerPixel <pixel@nobis-crew.org>2009-03-10 19:45:01 -0700
commit0559c822cb43704436cb1535d25ffeedb8fce8c5 (patch)
treefdfe892f12b4f4ba68312a1f391a0348030f3d03
parentcc6519ad232abb62a35630a3b1fafee330db6878 (diff)
Fixing pathtable building.
-rw-r--r--includes/isobuilder.h3
-rw-r--r--lib/isobuilder.cpp35
2 files changed, 9 insertions, 29 deletions
diff --git a/includes/isobuilder.h b/includes/isobuilder.h
index a18e64d..16a3a4d 100644
--- a/includes/isobuilder.h
+++ b/includes/isobuilder.h
@@ -64,12 +64,11 @@ class isobuilder : public Base {
DirTree * Brother();
DirTree * Find(const String &);
private:
- int buildpath_r(Byte * data, int size, int current_level, int level_to_dump, bool bigendian) throw (GeneralException);
+ int buildpath_r(int * n, Byte * data, int size, int current_level, int level_to_dump, bool bigendian) throw (GeneralException);
int maxlevel(int current_level = 1);
DirTree * father, * child, * brother;
bool dir;
int node;
- int numerate(int);
};
isobuilder(Handle * w, int mode = MODE2_FORM1);
~isobuilder();
diff --git a/lib/isobuilder.cpp b/lib/isobuilder.cpp
index cf900d7..9bec34c 100644
--- a/lib/isobuilder.cpp
+++ b/lib/isobuilder.cpp
@@ -185,10 +185,10 @@ int isobuilder::DirTree::maxlevel(int current_level) {
}
int isobuilder::DirTree::buildpath(Byte * data, int size, bool bigendian) {
- int maxlv = maxlevel(), i, R, cumul = 0;
+ int maxlv = maxlevel(), i, R, cumul = 0, n = 1;
for (i = 1; i < maxlv; i++) {
- R = buildpath_r(data, size, 1, i, bigendian);
+ R = buildpath_r(&n, data, size, 1, i, bigendian);
data += R;
cumul += R;
}
@@ -196,14 +196,14 @@ int isobuilder::DirTree::buildpath(Byte * data, int size, bool bigendian) {
return cumul;
}
-int isobuilder::DirTree::buildpath_r(Byte * data, int size, int current_level, int level_to_dump, bool bigendian) throw (GeneralException) {
+int isobuilder::DirTree::buildpath_r(int * n, Byte * data, int size, int current_level, int level_to_dump, bool bigendian) throw (GeneralException) {
int N, r = 0, tr;
Uint16 pn;
char pbuf[256], pad;
if (!dir) {
if (brother) {
- return brother->buildpath_r(data, size, current_level, level_to_dump, bigendian);
+ return brother->buildpath_r(n, data, size, current_level, level_to_dump, bigendian);
} else {
return 0;
}
@@ -211,7 +211,6 @@ int isobuilder::DirTree::buildpath_r(Byte * data, int size, int current_level, i
if (current_level == level_to_dump) {
if (!father) {
- numerate(1);
N = 1;
pbuf[0] = 0;
pn = 1;
@@ -221,6 +220,8 @@ int isobuilder::DirTree::buildpath_r(Byte * data, int size, int current_level, i
pn = father->node;
}
+ node = (*n)++;
+
pad = N & 1;
size -= (r = N + pad + 8);
@@ -239,14 +240,14 @@ int isobuilder::DirTree::buildpath_r(Byte * data, int size, int current_level, i
}
if (child) {
- tr = child->buildpath_r(data, size, current_level + 1, level_to_dump, bigendian);
+ tr = child->buildpath_r(n, data, size, current_level + 1, level_to_dump, bigendian);
r += tr;
size -= tr;
data += tr;
}
if (brother) {
- tr = brother->buildpath_r(data, size, current_level, level_to_dump, bigendian);
+ tr = brother->buildpath_r(n, data, size, current_level, level_to_dump, bigendian);
r += tr;
size -= tr;
data += tr;
@@ -404,26 +405,6 @@ void isobuilder::DirTree::setbasicsxa() {
xa_form1 = true;
}
-int isobuilder::DirTree::numerate(int n) {
- if (!dir) {
- if (brother) {
- return brother->numerate(n);
- } else {
- return n;
- }
- }
-
- node = n++;
-
- if (brother)
- n = brother->numerate(n);
-
- if (child)
- n = child->numerate(n);
-
- return n;
-}
-
isobuilder::DirTree * isobuilder::DirTree::Father() {
return father;
}