fixes to pdf_split_name_tree_node(). when splitting a non-leaf node, update children's parent field. recursively split upward if necessary.

Sat, 08 Mar 2003 09:31:23 +0000

author
eric
date
Sat, 08 Mar 2003 09:31:23 +0000
changeset 89
7a891425fa24
parent 88
a9991578aa3f
child 90
4830f4d7ba7a

fixes to pdf_split_name_tree_node(). when splitting a non-leaf node, update children's parent field. recursively split upward if necessary.

pdf_name_tree.c file | annotate | diff | revisions
     1.1 --- a/pdf_name_tree.c	Sat Mar 08 09:23:05 2003 +0000
     1.2 +++ b/pdf_name_tree.c	Sat Mar 08 09:31:23 2003 +0000
     1.3 @@ -4,7 +4,7 @@
     1.4   *      will be compressed using ITU-T T.6 (G4) fax encoding.
     1.5   *
     1.6   * PDF routines
     1.7 - * $Id: pdf_name_tree.c,v 1.6 2003/03/08 01:23:05 eric Exp $
     1.8 + * $Id: pdf_name_tree.c,v 1.7 2003/03/08 01:31:23 eric Exp $
     1.9   * Copyright 2003 Eric Smith <eric@brouhaha.com>
    1.10   *
    1.11   * This program is free software; you can redistribute it and/or modify
    1.12 @@ -116,6 +116,12 @@
    1.13        tree->root = new_root_node;
    1.14      }
    1.15  
    1.16 +  if (parent->count == MAX_NAME_TREE_NODE_ENTRIES)
    1.17 +    {
    1.18 +      pdf_split_name_tree_node (tree, parent);
    1.19 +      parent = node->parent;
    1.20 +    }
    1.21 +
    1.22    new_node = pdf_calloc (1, sizeof (struct pdf_name_tree_node));
    1.23    new_node->parent = parent;
    1.24    new_node->leaf = node->leaf;
    1.25 @@ -133,9 +139,14 @@
    1.26    memcpy (& new_node->values [0],
    1.27  	  & node->values [i],
    1.28  	  j * sizeof (struct pdf_obj *));
    1.29 +
    1.30    node->count = i;
    1.31    new_node->count = j;
    1.32  
    1.33 +  if (! new_node->leaf)
    1.34 +    for (i = 0; i < j; i++)
    1.35 +      new_node->kids [i]->parent = new_node;
    1.36 +
    1.37    /* set max_key of the old node */
    1.38    if (node->leaf)
    1.39      node->max_key = node->keys [node->count - 1];