pdf_bookmark.c

changeset 77
544fff830581
parent 76
2129cfb36fcc
child 78
74b6b230f85d
     1.1 --- a/pdf_bookmark.c	Wed Mar 05 02:26:43 2003 +0000
     1.2 +++ b/pdf_bookmark.c	Wed Mar 05 20:39:50 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_bookmark.c,v 1.2 2003/03/04 18:26:43 eric Exp $
     1.8 + * $Id: pdf_bookmark.c,v 1.3 2003/03/05 12:39:50 eric Exp $
     1.9   * Copyright 2001, 2002, 2003 Eric Smith <eric@brouhaha.com>
    1.10   *
    1.11   * This program is free software; you can redistribute it and/or modify
    1.12 @@ -40,18 +40,15 @@
    1.13  
    1.14  static void pdf_bookmark_update_count (pdf_bookmark_handle entry)
    1.15  {
    1.16 -  struct pdf_obj *count_obj;
    1.17 -
    1.18    while (entry)
    1.19      {
    1.20 -      count_obj = pdf_get_dict_entry (entry->dict, "Count");
    1.21 -      if (! count_obj)
    1.22 +      if (! entry->count)
    1.23  	{
    1.24 -	  count_obj = pdf_new_integer (0);
    1.25 -	  pdf_set_dict_entry (entry->dict, "Count", count_obj);
    1.26 +	  entry->count = pdf_new_integer (0);
    1.27 +	  pdf_set_dict_entry (entry->dict, "Count", entry->count);
    1.28  	}
    1.29 -      pdf_set_integer (count_obj,
    1.30 -		       pdf_get_integer (count_obj) +
    1.31 +      pdf_set_integer (entry->count,
    1.32 +		       pdf_get_integer (entry->count) +
    1.33  		       ((entry->open) ? 1 : -1));
    1.34        if (! entry->open)
    1.35  	break;
    1.36 @@ -78,7 +75,6 @@
    1.37      {
    1.38        root = pdf_calloc (1, sizeof (struct pdf_bookmark));
    1.39        root->dict = pdf_new_ind_ref (pdf_file, pdf_new_obj (PT_DICTIONARY));
    1.40 -      pdf_set_dict_entry (root->dict, "Count", pdf_new_integer (0));
    1.41  
    1.42        pdf_file->outline_root = root;
    1.43        pdf_set_dict_entry (pdf_file->catalog, "Outlines", root->dict);