Hi,

The patch should be attached. I added the definitions of pdf_add/get_i/u32
into pdf-hash-helper.h. I documented the API regarding pdf_add/get_bool and
pdf_add/get_i/u32 in gnupdf.texi. I hope that I have not made mistakes.

Regards

--
Franck


On Fri, May 20, 2011 at 04:48:56PM +0200, Aleksander Morgado wrote:
> On Fri, 2011-05-20 at 15:30 +0200, Aleksander Morgado wrote:
> > On Fri, 2011-05-20 at 14:43 +0200, Franck Lesage wrote:
> > > Hi, I bring you a patch for FS#130. The task seemed to me to be pretty 
> > > easy.
> > > I guess that something will be wrong. I ran the Patch Safety Dispatcher 
> > > and it didn't underline syntax error.
> > > For the first patch I didn't run it... 
> > 
> > Seems ok to me. There was a note in the FS task about using these new
> > methods in the ColorTransform parameter of the DCT filter, but don't do
> > that, I converted that parameter to a boolean in a wip branch I'm
> > working on.
> > 
> 
> Ah, just realised that the patch didn't contain some things:
>   - The pdf-hash-helper.h isn't modified to include the new helper
> methods.
>   - doc/gnupdf.texi should be updated to document the new methods as
> well.
> 
> Could you fix those two things in the patch?
> 
> Thanks!
> 
> -- 
> Aleksander


# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: root@brazilia-20110521142011-fb6cfctc3wzhq5z6
# target_branch: bzr://bzr.savannah.gnu.org/pdf/libgnupdf/trunk/
# testament_sha1: 866e1aa94d5a251a28408bd54cc96da0bfce6f59
# timestamp: 2011-05-21 16:20:49 +0200
# base_revision_id: jema...@gnu.org-20110510184038-xs3mcx9v2dgb08wz
# 
# Begin patch
=== modified file 'AUTHORS'
--- AUTHORS     2011-03-24 17:58:36 +0000
+++ AUTHORS     2011-05-21 10:25:50 +0000
@@ -31,6 +31,8 @@
   pdf-crypt-md-hash.c pdf-crypt-md-new.c pdf-crypt-md-write.c pdf-crypt.c
   pdf-fp-func-4-new.c and 10 other files
 
+Franck Lesage: changed pdf-hash-helper.c pdf-hash-helper.h gnupdf.texi
+
 Gerardo E. Gidoni: changed gnupdf.texi pdf-stm-read.c gnupdf-tsd.texi
   pdf-stm-write.c configure.ac pdf-filter.c pdf-stm-f-flate.h
   pdf-stm-f-rl.c check-api-doc-consistency.pl

=== modified file 'ChangeLog'
--- ChangeLog   2011-05-10 18:40:38 +0000
+++ ChangeLog   2011-05-21 10:25:50 +0000
@@ -1,3 +1,11 @@
+2011-05-20 Franck Lesage  <address@hidden>
+
+       base,hash: Add hash helpers methods.
+       * src/base/pdf-hash-helper.c: Add hash helpers for integer value.
+       * src/base/pdf-hash-helper.h: Likewise
+
+       * doc/gnupdf.texi (Helper functions): API Documentation updated
+
 2011-05-10  Jose E. Marchesi  <jema...@gnu.org>
 
        lib: avoid name clash with PDF_OBJ_IS_NULL and provide a quick

=== modified file 'doc/gnupdf.texi'
--- doc/gnupdf.texi     2011-05-10 18:40:38 +0000
+++ doc/gnupdf.texi     2011-05-21 14:20:11 +0000
@@ -4252,6 +4252,210 @@
 @end table
 @end deftypefun
 
+@deftypefun {pdf_bool_t} pdf_hash_add_bool (pdf_hash_t *@var{table}, const 
pdf_char_t *@var{key}, const pdf_bool_t @var{value}, pdf_error_t **@var{error});
+
+Adds the boolean @var{value} with the associated @var{key} to @var{table}. If 
@var{key} already exists nothing is done. The value is directly stored in the 
hash table and disposed when the hash table is destroyed.
+
+@table @strong
+@item Parameters
+@table @var
+@item table
+A hash table.
+@item key
+A valid @code{NUL}-terminated string key.
+@item value
+A valid @code{pdf_bool_t}.
+@item error
+A pdf_error_t to report errors or NULL.
+@end table
+@item Returns
+PDF_TRUE if correctly added, PDF_FALSE otherwise.
+@item Usage example
+@example
+pdf_hash_t *hash;
+pdf_error_t *error = NULL;
+
+/* Create a new hash */
+hash = pdf_hash_new (NULL);
+if (hash != NULL)
+   @{
+      if (pdf_hash_add_bool (hash,
+                             "a-key",
+                             PDF_TRUE,
+                             &error))
+         @{
+             pdf_error_destroy (error);
+         @}
+
+      /* Destroy the hash */
+      pdf_hash_destroy (hash);
+   @}
+@end example
+@end table
+@end deftypefun
+
+@deftypefun {pdf_bool_t} pdf_hash_get_bool (pdf_hash_t *@var{table}, const 
pdf_char_t *@var{key});
+
+Get a boolean value from a hash table.
+
+@table @strong
+@item Parameters
+@table @var
+@item table
+A hash table.
+@item key
+A valid @code{NUL}-terminated string key.
+@end table
+@item Returns
+The @code{pdf_bool_t} associated with @var{key}.
+@item Usage example
+@example
+pdf_bool_t bool;
+
+/* ... insert a boolean value into the hash ... */
+
+bool = pdf_hash_get_bool (table, "a-key"); 
+@end example
+@end table
+@end deftypefun
+
+
+@deftypefun {pdf_bool_t} pdf_hash_add_i32 (pdf_hash_t *@var{table}, const 
pdf_char_t *@var{key}, const pdf_i32_t @var{value}, pdf_error_t **@var{error});
+
+Adds the signed 32 bits integer @var{value} with the associated @var{key} to 
@var{table}. If @var{key} already exists nothing is done. The value is directly 
stored in the hash table and disposed when the hash table is destroyed. 
+
+@table @strong
+@item Parameters
+@table @var
+@item table
+A hash table.
+@item key
+A valid @code{NUL}-terminated string key.
+@item value
+A valid @code{pdf_i32_t}.
+@item error
+A @code{pdf_error_t} to report errors or NULL.
+@end table
+@item Returns
+PDF_TRUE if correctly added, PDF_FALSE otherwise.
+@item Usage example
+@example
+pdf_hash_t *hash;
+pdf_error_t *error = NULL;
+ 
+/* Create a new hash */
+hash = pdf_hash_new (NULL);
+if (hash != NULL)
+   @{
+      if (pdf_hash_add_i32 (hash,
+                            "a-key",
+                            (pdf_i32_t)-3,
+                            &error))
+         @{
+             pdf_error_destroy (error);
+         @}
+
+      /* Destroy the hash */
+      pdf_hash_destroy (hash);
+    @}
+@end example
+@end table
+@end deftypefun
+
+@deftypefun {pdf_i32_t} pdf_hash_get_i32 (pdf_hash_t *@var{table}, const 
pdf_char_t *@var{key});
+
+Get a signed 32 bits integer from a hash table.
+
+@table @strong
+@item Parameters
+@table @var
+@item table
+A hash table.
+@item key
+A valid @code{NUL}-terminated string key.
+@end table
+@item Returns
+The @code{pdf_i32_t} associated with @var{key}.
+@item Usage example
+@example
+pdf_i32_t i32;
+
+/* ... insert a signed 32 bits integer value into the hash ... */
+
+i32 = pdf_hash_get_i32 (table, "a-key");
+@end example
+@end table
+@end deftypefun
+
+@deftypefun {pdf_bool_t} pdf_hash_add_u32 (pdf_hash_t *@var{table}, const 
pdf_char_t *@var{key}, const pdf_u35_t @var{value}, pdf_error_t **@var{error});
+
+Adds the unsigned 32 bits integer @var{value} with the associated @var{key} to 
@var{table}. If @var{key} already exists nothing is done. The value is directly 
stored in the hash table and disposed when the hash table is destroyed.
+
+@table @strong
+@item Parameters
+@table @var
+@item table
+A hash table.
+@item key
+A valid @code{NUL}-terminated string key.
+@item value
+A valid @code{pdf_u32_t}.
+@item error
+A @code{pdf_error_t} to report errors or NULL.
+@end table
+@item Returns
+PDF_TRUE if correctly added, PDF_FALSE otherwise.
+@item Usage example
+@example
+pdf_hash_t *hash;
+pdf_error_t *error = NULL;
+ 
+/* Create a new hash */
+hash = pdf_hash_new (NULL);
+if (hash != NULL)
+   @{
+      if (pdf_hash_add_u32 (hash,
+                            "a-key",
+                            (pdf_u32_t)3,
+                            &error))
+         @{
+             pdf_error_destroy (error);
+         @}
+
+      /* Destroy the hash */
+      pdf_hash_destroy (hash);
+   @}
+
+@end example
+@end table
+@end deftypefun
+
+@deftypefun {pdf_u32_t} pdf_hash_get_u32 (pdf_hash_t *@var{table}, const 
pdf_char_t *@var{key});
+
+Get an unsigned 32 bits integer from a hash table.
+
+@table @strong
+@item Parameters
+@table @var
+@item table
+A hash table.
+@item key
+A valid @code{NUL}-terminated string key.
+@end table
+@item Returns
+The @code{pdf_u32_t} associated with @var{key}.
+@item Usage example
+@example
+pdf_u32_t u32;
+
+/* ... insert an unsigned 32 bits value into the hash ... */
+
+u32 = pdf_hash_get_u32 (table, "a-key");
+
+@end example
+@end table
+@end deftypefun
+
 @node Filtered Streams
 @section Filtered Streams
 

=== modified file 'src/base/pdf-hash-helper.c'
--- src/base/pdf-hash-helper.c  2011-04-02 13:50:54 +0000
+++ src/base/pdf-hash-helper.c  2011-05-21 10:25:50 +0000
@@ -230,6 +230,48 @@
   return (pdf_bool_t) pdf_hash_get_value (table, key);
 }
 
+/* Hash helpers to add/get integer */
+
+pdf_bool_t
+pdf_hash_add_i32 (pdf_hash_t        *table,
+                  const pdf_char_t  *key,
+                  const pdf_i32_t    value,
+                  pdf_error_t      **error)
+{
+  return pdf_hash_add (table,
+                       key,
+                       (void *)value,
+                       NULL,
+                       error);
+}
+
+pdf_i32_t
+pdf_hash_get_i32 (pdf_hash_t       *table,
+                  const pdf_char_t *key)
+{
+  return (pdf_i32_t) pdf_hash_get_value (table, key);
+}
+
+pdf_bool_t
+pdf_hash_add_u32 (pdf_hash_t        *table,
+                  const pdf_char_t  *key,
+                  const pdf_u32_t    value,
+                  pdf_error_t      **error)
+{
+  return pdf_hash_add (table,
+                       key,
+                       (void *)value,
+                       NULL,
+                       error);
+}
+
+pdf_u32_t
+pdf_hash_get_u32 (pdf_hash_t       *table,
+                  const pdf_char_t *key)
+{
+  return (pdf_u32_t) pdf_hash_get_value (table, key);
+}
+
 /* Hash helpers to add/get sizes */
 
 pdf_bool_t

=== modified file 'src/base/pdf-hash-helper.h'
--- src/base/pdf-hash-helper.h  2011-04-02 13:50:54 +0000
+++ src/base/pdf-hash-helper.h  2011-05-21 14:20:11 +0000
@@ -96,6 +96,20 @@
 pdf_bool_t        pdf_hash_get_bool   (pdf_hash_t        *table,
                                        const pdf_char_t  *key);
 
+/* Hash helpers to add/get integer */
+pdf_bool_t        pdf_hash_add_i32    (pdf_hash_t        *table,
+                                       const pdf_char_t  *key,
+                                       const pdf_i32_t    value,
+                                       pdf_error_t      **error);
+pdf_i32_t         pdf_hash_get_i32    (pdf_hash_t       *table,
+                                       const pdf_char_t *key);
+pdf_bool_t        pdf_hash_add_u32    (pdf_hash_t        *table,
+                                       const pdf_char_t  *key,
+                                       const pdf_u32_t    value,
+                                       pdf_error_t      **error);
+pdf_u32_t         pdf_hash_get_u32    (pdf_hash_t       *table,
+                                       const pdf_char_t *key);
+
 /* Hash helpers to add/get sizes */
 pdf_bool_t        pdf_hash_add_size   (pdf_hash_t        *table,
                                        const pdf_char_t  *key,

# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWY8JH2cADPZ/gF4xCGB5d///
f+XeAL////pgErz3VfVzuB73u1RHkhRcwDSgJh21O3Ia7sm7ukJFQUFREp2DFWxDUkGhoBoGgD1A
ABoAAAAACSIAhoE0jRRPU9qnpADQ0AAAAGgHGjJkYRiAYTQYBNBoGTJoyZDCAwk1TSTIU9E0Yk9R
5oh6pmkekwRhGIMmAAAiiIptBoTCaaZJip+CKfpqeppN6BR6ntUPU00b1TT0agVJECAE0hoxMTKP
VT/VT2UMjU/VG1NPSPU2kYAGkDjEJJkDHfHydb0eX7eauWohjQVWQZ2xNfHybF6mx07QZDLImfbK
lrCler/sXL0jy3ecUlPpL7Jy22W21zsZXG/Zo9bVo9qA0aHd8vpJaHH9KTcPBjb4t0Q8OL0ojwLm
zbRPQFIWwmFlYyf5ZlkD+gw4B8xoVWI/cbmxpOaMG32Ru3SU2zlwuQWSQv6eTF+5wXD41fANKwYp
HWxB7aFmrRN0rX4Go4uAtc8P6hLZRmZZx3Nc4WBsAB11KURImoX1BUKSKSkoiXEuWiwtALpSiOd5
WgDo/Z4nnYcJz6qtDgIIKyRTxeSy+5dvnF2VwS10TULz9E+uHiO6KqMBYqqsgimroEmvPcNwK4dd
y5+WIW4nFMJUuHC5rlzDexuy1SuiAmGWvPeWczMozLM5BrsSZ7xlle6pOkIBxoHK76HZbC7t+Qd2
ZgWxlq9jquMLiTqiCOMfLLJyPmW/BuYeZ/6DawOIhzsl5zPa0KjLqApTV+hkxIa3WPaMOp0Ucrib
BxDewhZooFNDxS9LDwEDlcw2Bh8m0NTQxphguQ9TePCSNetDIyOJwVQxdeJUub9xsDbERHpIbROR
2BiR4cxhrshjicohpHWrcIQ6bHE5hoZmC+SL6hkQjCwaOCxnGOBsI3hzk0UoEsKGDCDYsMLnPPoS
qoAASRIOgmkoQ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