pdf_bookmark.c

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