git » fp-git.git » commit f749335

bugfixes: bug in the merging in case the first file is empty/memory leaks/etc

author ecalot
2005-12-29 14:34:32 UTC
committer ecalot
2005-12-29 14:34:32 UTC
parent f6630f63010740dc9f3a1df8300101e746346b53

bugfixes: bug in the merging in case the first file is empty/memory leaks/etc

PR/src/lib/xml/tree.c +7 -3
PR/src/lib/xml/unknown.c +7 -3

diff --git a/PR/src/lib/xml/tree.c b/PR/src/lib/xml/tree.c
index d7e8ef4..ae60d43 100644
--- a/PR/src/lib/xml/tree.c
+++ b/PR/src/lib/xml/tree.c
@@ -117,7 +117,7 @@ void unknown_item(int value,const char* index,const char* path,const char* type,
 	sprintf(aux,"0x%lx",flags);
 	item->flags=strallocandcopy(aux);
 	sprintf(aux,"Unknown %s %d",typedesc, count);
-	item->flags=strallocandcopy(aux);
+	item->desc=strallocandcopy(aux);
 	
 	if (!unknownFile.itemCursor) {
 		unknownFile.folderCursor->child=item;
@@ -325,8 +325,12 @@ int unknownLogStop () {
 	printf("parsed tree with files and inheritance deleted");showTag(0,unknownFile.tree);
 	/* now we'll add the new generated part of the tree at the end of the second level (resources id the first) */
 	if (unknownFile.tree) {
-		for (t=unknownFile.tree->child;t->next;t=t->next);
-		t->next=unknownFile.folderFirst; /* the first folder of the new tree */
+		if (unknownFile.tree->child) {
+			for (t=unknownFile.tree->child;t->next;t=t->next);
+			t->next=unknownFile.folderFirst; /* the first folder of the new tree */
+		} else {
+			unknownFile.tree->child=unknownFile.folderFirst; /* the first folder of the new tree */
+		}
 	}
 
 	/* show the new generated tree */
diff --git a/PR/src/lib/xml/unknown.c b/PR/src/lib/xml/unknown.c
index d7e8ef4..ae60d43 100644
--- a/PR/src/lib/xml/unknown.c
+++ b/PR/src/lib/xml/unknown.c
@@ -117,7 +117,7 @@ void unknown_item(int value,const char* index,const char* path,const char* type,
 	sprintf(aux,"0x%lx",flags);
 	item->flags=strallocandcopy(aux);
 	sprintf(aux,"Unknown %s %d",typedesc, count);
-	item->flags=strallocandcopy(aux);
+	item->desc=strallocandcopy(aux);
 	
 	if (!unknownFile.itemCursor) {
 		unknownFile.folderCursor->child=item;
@@ -325,8 +325,12 @@ int unknownLogStop () {
 	printf("parsed tree with files and inheritance deleted");showTag(0,unknownFile.tree);
 	/* now we'll add the new generated part of the tree at the end of the second level (resources id the first) */
 	if (unknownFile.tree) {
-		for (t=unknownFile.tree->child;t->next;t=t->next);
-		t->next=unknownFile.folderFirst; /* the first folder of the new tree */
+		if (unknownFile.tree->child) {
+			for (t=unknownFile.tree->child;t->next;t=t->next);
+			t->next=unknownFile.folderFirst; /* the first folder of the new tree */
+		} else {
+			unknownFile.tree->child=unknownFile.folderFirst; /* the first folder of the new tree */
+		}
 	}
 
 	/* show the new generated tree */