]> granicus.if.org Git - recode/commitdiff
Towards C++
authorFrançois Pinard <pinard@iro.umontreal.ca>
Fri, 14 Mar 2008 17:18:57 +0000 (13:18 -0400)
committerFrançois Pinard <pinard@iro.umontreal.ca>
Fri, 14 Mar 2008 17:18:57 +0000 (13:18 -0400)
15 files changed:
src/ChangeLog
src/combine.c
src/hash.c
src/html.c
src/ibmpc.c
src/localcharset.c
src/names.c
src/outer.c
src/quotearg.c
src/recode.c
src/request.c
src/rfc1345.c
src/task.c
src/testdump.c
src/xmalloc.c

index 7c8060ceb5302221d2d34122a301364b49954973..0dfcbb9195a035b7ac19a363a8a457613b308ad4 100644 (file)
@@ -3,6 +3,10 @@
        * main.c: Inhibit iconv whenever -h is used.
        Reported by Richard Nault.
 
+       * combine.c, hash.c, html.c, ibmpc.c, localcharset.c, names.c,
+       outer.c, quotearg.c, recode.c, request.c, rfc1345.c, task.c,
+       testdump.c, xmalloc.c: Changes in view of C++.
+
 2008-03-13  François Pinard  <pinard@iro.umontreal.ca>
 
        * java.c: New.
index 02dcbac123d9533987ed0897398efcf270bac49b..b7fc116f0be5f30bbdfb04fa277fbb7d1f2896d2 100644 (file)
@@ -65,7 +65,7 @@
 static size_t
 combined_hash (const void *void_data, size_t table_size)
 {
-  const unsigned short *data = void_data;
+  const unsigned short *data = (const unsigned short *) void_data;
 
   return *data % table_size;
 }
@@ -73,8 +73,8 @@ combined_hash (const void *void_data, size_t table_size)
 static bool
 combined_compare (const void *void_first, const void *void_second)
 {
-  const unsigned short *first = void_first;
-  const unsigned short *second = void_second;
+  const unsigned short *first = (const unsigned short *) void_first;
+  const unsigned short *second = (const unsigned short *) void_second;
 
   return *first == *second;
 }
@@ -85,7 +85,7 @@ init_explode (RECODE_STEP step,
              RECODE_CONST_OPTION_LIST before_options,
              RECODE_CONST_OPTION_LIST after_options)
 {
-  const unsigned short *data = step->step_table;
+  const unsigned short *data = (const unsigned short *) step->step_table;
   Hash_table *table;
 
   if (before_options || after_options)
@@ -121,13 +121,13 @@ init_explode (RECODE_STEP step,
 bool
 explode_byte_byte (RECODE_SUBTASK subtask)
 {
-  Hash_table *table = subtask->step->step_table;
+  Hash_table *table = (Hash_table *) subtask->step->step_table;
   unsigned value;
 
   while (value = get_byte (subtask), value != EOF)
     {
       unsigned short lookup = value;
-      unsigned short *result = hash_lookup (table, &lookup);
+      unsigned short *result = (unsigned short *) hash_lookup (table, &lookup);
 
       if (result)
        {
@@ -148,13 +148,13 @@ explode_byte_byte (RECODE_SUBTASK subtask)
 bool
 explode_ucs2_byte (RECODE_SUBTASK subtask)
 {
-  Hash_table *table = subtask->step->step_table;
+  Hash_table *table = (Hash_table *) subtask->step->step_table;
   unsigned value;
 
   while (get_ucs2 (&value, subtask))
     {
       unsigned short lookup = value;
-      unsigned short *result = hash_lookup (table, &lookup);
+      unsigned short *result = (unsigned short *) hash_lookup (table, &lookup);
 
       if (result)
        {
@@ -175,7 +175,7 @@ explode_ucs2_byte (RECODE_SUBTASK subtask)
 bool
 explode_byte_ucs2 (RECODE_SUBTASK subtask)
 {
-  Hash_table *table = subtask->step->step_table;
+  Hash_table *table = (Hash_table *) subtask->step->step_table;
   unsigned value;
 
   if (value = get_byte (subtask), value != EOF)
@@ -186,7 +186,8 @@ explode_byte_ucs2 (RECODE_SUBTASK subtask)
       while (true)
        {
          unsigned short lookup = value;
-         unsigned short *result = hash_lookup (table, &lookup);
+         unsigned short *result
+            = (unsigned short *) hash_lookup (table, &lookup);
 
          if (result)
            {
@@ -208,7 +209,7 @@ explode_byte_ucs2 (RECODE_SUBTASK subtask)
 bool
 explode_ucs2_ucs2 (RECODE_SUBTASK subtask)
 {
-  Hash_table *table = subtask->step->step_table;
+  Hash_table *table = (Hash_table *) subtask->step->step_table;
   unsigned value;
 
   if (get_ucs2 (&value, subtask))
@@ -219,7 +220,8 @@ explode_ucs2_ucs2 (RECODE_SUBTASK subtask)
       while (true)
        {
          unsigned short lookup = value;
-         unsigned short *result = hash_lookup (table, &lookup);
+         unsigned short *result
+            = (unsigned short *) hash_lookup (table, &lookup);
 
          if (result)
            {
@@ -265,7 +267,7 @@ struct state
 static size_t
 state_hash (const void *void_data, size_t table_size)
 {
-  const struct state *data = void_data;
+  const struct state *data = (const struct state *) void_data;
 
   return data->character % table_size;
 }
@@ -273,8 +275,8 @@ state_hash (const void *void_data, size_t table_size)
 static bool
 state_compare (const void *void_first, const void *void_second)
 {
-  const struct state *first = void_first;
-  const struct state *second = void_second;
+  const struct state *first = (const struct state *) void_first;
+  const struct state *second = (const struct state *) void_second;
 
   return first->character == second->character;
 }
@@ -282,8 +284,8 @@ state_compare (const void *void_first, const void *void_second)
 static void
 state_free (void *void_state)
 {
-  struct state *state = void_state;
-  struct state *shift = state->shift;
+  struct state *state = (struct state *) void_state;
+  struct state *shift = (struct state *) state->shift;
 
   while (shift != NULL)
     {
@@ -321,11 +323,11 @@ prepare_shifted_state (struct state *state, unsigned character,
     }
   else
     {
-      Hash_table *table = step->step_table;
+      Hash_table *table = (Hash_table *) step->step_table;
       struct state lookup;
 
       lookup.character = character;
-      state = hash_lookup (table, &lookup);
+      state = (struct state *) hash_lookup (table, &lookup);
       if (!state)
        {
          if (state= (struct state *) malloc (sizeof (struct state)), !state)
@@ -362,11 +364,11 @@ find_shifted_state (struct state *state, unsigned character,
     }
   else
     {
-      Hash_table *table = step->step_table;
+      Hash_table *table = (Hash_table *) step->step_table;
       struct state lookup;
 
       lookup.character = character;
-      return hash_lookup (table, &lookup);
+      return (struct state *) hash_lookup (table, &lookup);
     }
 }
 
@@ -376,7 +378,7 @@ init_combine (RECODE_STEP step,
              RECODE_CONST_OPTION_LIST before_options,
              RECODE_CONST_OPTION_LIST after_options)
 {
-  const unsigned short *data = step->step_table;
+  const unsigned short *data = (const unsigned short *) step->step_table;
   Hash_table *table;
 
   if (before_options || after_options)
index b926c3daa0d2056792861351f0949f7e95e7ce89..d8ba8d59b79c0cf69c2657b29e20db62ca17a73d 100644 (file)
@@ -546,7 +546,7 @@ hash_initialize (size_t candidate, const Hash_tuning *tuning,
   if (hasher == NULL || comparator == NULL)
     return NULL;
 
-  table = malloc (sizeof *table);
+  table = (Hash_table *) malloc (sizeof *table);
   if (table == NULL)
     return NULL;
 
@@ -577,7 +577,8 @@ hash_initialize (size_t candidate, const Hash_tuning *tuning,
   if (xalloc_oversized (table->n_buckets, sizeof *table->bucket))
     goto fail;
 
-  table->bucket = calloc (table->n_buckets, sizeof *table->bucket);
+  table->bucket
+    = (struct hash_entry *) calloc (table->n_buckets, sizeof *table->bucket);
   table->bucket_limit = table->bucket + table->n_buckets;
   table->n_buckets_used = 0;
   table->n_entries = 0;
@@ -704,23 +705,24 @@ hash_free (Hash_table *table)
 static struct hash_entry *
 allocate_entry (Hash_table *table)
 {
-  struct hash_entry *new;
+  struct hash_entry *new_;
 
   if (table->free_entry_list)
     {
-      new = table->free_entry_list;
-      table->free_entry_list = new->next;
+      new_ = table->free_entry_list;
+      table->free_entry_list = new_->next;
     }
   else
     {
 #if USE_OBSTACK
-      new = obstack_alloc (&table->entry_stack, sizeof *new);
+      new_ = (struct hash_entry *) obstack_alloc (&table->entry_stack,
+                                                 sizeof *new_);
 #else
-      new = malloc (sizeof *new);
+      new_ = (struct hash_entry *) malloc (sizeof *new_);
 #endif
     }
 
-  return new;
+  return new_;
 }
 
 /* Free a hash entry which was part of some bucket overflow,
@@ -742,7 +744,7 @@ free_entry (Hash_table *table, struct hash_entry *entry)
 
 static void *
 hash_find_entry (Hash_table *table, const void *entry,
-                struct hash_entry **bucket_head, bool delete)
+                struct hash_entry **bucket_head, bool delete_)
 {
   struct hash_entry *bucket
     = table->bucket + table->hasher (entry, table->n_buckets);
@@ -762,7 +764,7 @@ hash_find_entry (Hash_table *table, const void *entry,
     {
       void *data = bucket->data;
 
-      if (delete)
+      if (delete_)
        {
          if (bucket->next)
            {
@@ -789,7 +791,7 @@ hash_find_entry (Hash_table *table, const void *entry,
        {
          void *data = cursor->next->data;
 
-         if (delete)
+         if (delete_)
            {
              struct hash_entry *next = cursor->next;
 
index 08a7acd3e5edc2ad2c84c0621d7877d9d16257f6..2f4a3400ffa6bd26d3906d52f019b6ff5dd5af45 100644 (file)
@@ -390,7 +390,7 @@ static struct ucs2_to_string translations [] =
 static size_t
 code_hash (const void *void_data, size_t table_size)
 {
-  struct ucs2_to_string const *data = void_data;
+  struct ucs2_to_string const *data = (struct ucs2_to_string const *) void_data;
 
   return data->code % table_size;
 }
@@ -402,8 +402,10 @@ code_hash (const void *void_data, size_t table_size)
 static bool
 code_compare (const void *void_first, const void *void_second)
 {
-  struct ucs2_to_string const *first = void_first;
-  struct ucs2_to_string const *second = void_second;
+  struct ucs2_to_string const *first
+    = (struct ucs2_to_string const *) void_first;
+  struct ucs2_to_string const *second
+    = (struct ucs2_to_string const *) void_second;
 
   return first->code == second->code;
 }
@@ -507,7 +509,7 @@ init_ucs2_html_v40 (RECODE_STEP step,
 static bool
 transform_ucs2_html (RECODE_SUBTASK subtask)
 {
-  Hash_table *table = subtask->step->step_table;
+  Hash_table *table = (Hash_table *) subtask->step->step_table;
   unsigned value;
 
   while (get_ucs2 (&value, subtask))
@@ -516,7 +518,7 @@ transform_ucs2_html (RECODE_SUBTASK subtask)
       struct ucs2_to_string *entry;
 
       lookup.code = value;
-      entry = hash_lookup (table, &lookup);
+      entry = (struct ucs2_to_string *) hash_lookup (table, &lookup);
       if (entry)
        {
          const char *cursor = entry->string;
@@ -571,7 +573,7 @@ transform_ucs2_html (RECODE_SUBTASK subtask)
 static size_t
 string_hash (const void *void_data, size_t table_size)
 {
-  struct ucs2_to_string const *data = void_data;
+  struct ucs2_to_string const *data = (struct ucs2_to_string const *) void_data;
 
   return hash_string (data->string, table_size);
 }
@@ -583,8 +585,8 @@ string_hash (const void *void_data, size_t table_size)
 static bool
 string_compare (const void *void_first, const void *void_second)
 {
-  struct ucs2_to_string const *first = void_first;
-  struct ucs2_to_string const *second = void_second;
+  struct ucs2_to_string const *first = (struct ucs2_to_string const *) void_first;
+  struct ucs2_to_string const *second = (struct ucs2_to_string const *) void_second;
 
   return strcmp (first->string, second->string) == 0;
 }
@@ -825,7 +827,8 @@ transform_html_ucs2 (RECODE_SUBTASK subtask)
                struct ucs2_to_string *entry;
 
                lookup.string = buffer;
-               entry = hash_lookup (subtask->step->step_table, &lookup);
+               entry = (struct ucs2_to_string *) hash_lookup
+                 ((const Hash_table *) subtask->step->step_table, &lookup);
                if (entry)
                  {
                    put_ucs2 (entry->code, subtask);
index c7e422e45d5a9b2a9fc18dbef78858a1819316da..6fcdffae16fca72423933ed20e54acbc9e03f3b0 100644 (file)
@@ -164,14 +164,16 @@ static struct recode_known_pair known_pairs[] =
 
     {255, 160},                        /* no-break space */
   };
-#define NUMBER_OF_PAIRS (sizeof (known_pairs) / sizeof (struct recode_known_pair))
+#define NUMBER_OF_PAIRS \
+  (sizeof (known_pairs) / sizeof (struct recode_known_pair))
 
 static bool
 transform_latin1_ibmpc (RECODE_SUBTASK subtask)
 {
   if (subtask->step->fallback_routine == reversibility)
     {
-      const unsigned char *table = subtask->step->step_table;
+      const unsigned char *table
+       = (const unsigned char *) subtask->step->step_table;
       int input_char;
 
       while (input_char = get_byte (subtask), input_char != EOF)
@@ -185,7 +187,8 @@ transform_latin1_ibmpc (RECODE_SUBTASK subtask)
     }
   else
     {
-      const char *const *table = subtask->step->step_table;
+      const char *const *table
+       = (const char *const *) subtask->step->step_table;
       int input_char;
 
       while (input_char = get_byte (subtask), input_char != EOF)
@@ -207,7 +210,8 @@ transform_ibmpc_latin1 (RECODE_SUBTASK subtask)
 {
   if (subtask->step->fallback_routine == reversibility)
     {
-      const unsigned char *table = subtask->step->step_table;
+      const unsigned char *table
+       = (const unsigned char *) subtask->step->step_table;
       int input_char = get_byte (subtask);
 
       while (input_char != EOF)
@@ -240,7 +244,8 @@ transform_ibmpc_latin1 (RECODE_SUBTASK subtask)
     }
   else
     {
-      const char *const *table = subtask->step->step_table;
+      const char *const *table
+       = (const char *const *) subtask->step->step_table;
       int input_char = get_byte (subtask);
 
       while (input_char != EOF)
index 54c75ba2b836adf962d6d3c1071c706a8c7d2c75..564b2d7d1c0c4deb8b836c8d118f0dea4f29e28d 100644 (file)
@@ -78,6 +78,7 @@ static char * volatile charset_aliases;
 static const char *
 get_charset_aliases (void)
 {
+  static char empty[1] = "";
   char *cp;
 
   cp = charset_aliases;
@@ -106,7 +107,7 @@ get_charset_aliases (void)
 
       if (file_name == NULL || (fp = fopen (file_name, "r")) == NULL)
        /* Out of memory or file not found, treat it as empty.  */
-       cp = "";
+       cp = empty;
       else
        {
          /* Parse the file's contents.  */
@@ -142,12 +143,12 @@ get_charset_aliases (void)
              if (res_size == 0)
                {
                  res_size = l1 + 1 + l2 + 1;
-                 res_ptr = malloc (res_size + 1);
+                 res_ptr = (char *) malloc (res_size + 1);
                }
              else
                {
                  res_size += l1 + 1 + l2 + 1;
-                 res_ptr = realloc (res_ptr, res_size + 1);
+                 res_ptr = (char *) realloc (res_ptr, res_size + 1);
                }
              if (res_ptr == NULL)
                {
@@ -160,7 +161,7 @@ get_charset_aliases (void)
            }
          fclose (fp);
          if (res_size == 0)
-           cp = "";
+           cp = empty;
          else
            {
              *(res_ptr + res_size) = '\0';
index 6e3e86a368de424fd653d86a8ef6685b4cb05f6a..1758520c9275dec00262f274190a41ca3b16e39d 100644 (file)
@@ -29,7 +29,7 @@
 int
 code_to_ucs2 (RECODE_CONST_SYMBOL charset, unsigned code)
 {
-  const struct strip_data *data = charset->data;
+  const struct strip_data *data = (const struct strip_data *) charset->data;
   const recode_ucs2 *pool = data->pool;
   unsigned offset = data->offset[code / STRIP_SIZE];
   unsigned value = pool[offset + code % STRIP_SIZE];
@@ -87,7 +87,7 @@ check_restricted (RECODE_CONST_OUTER outer,
 static size_t
 alias_hasher (const void *void_alias, size_t limit)
 {
-  RECODE_CONST_ALIAS alias = void_alias;
+  RECODE_CONST_ALIAS alias = (RECODE_CONST_ALIAS) void_alias;
 
   return hash_string (alias->name, limit);
 }
@@ -95,8 +95,8 @@ alias_hasher (const void *void_alias, size_t limit)
 static bool
 alias_comparator (const void *void_first, const void *void_second)
 {
-  RECODE_CONST_ALIAS first = void_first;
-  RECODE_CONST_ALIAS second = void_second;
+  RECODE_CONST_ALIAS first = (RECODE_CONST_ALIAS) void_first;
+  RECODE_CONST_ALIAS second = (RECODE_CONST_ALIAS) void_second;
 
   return strcmp (first->name, second->name) == 0;
 }
@@ -104,7 +104,7 @@ alias_comparator (const void *void_first, const void *void_second)
 static void
 alias_free (void *void_alias)
 {
-  RECODE_ALIAS alias = void_alias;
+  RECODE_ALIAS alias = (RECODE_ALIAS) void_alias;
   struct recode_surface_list *list, *next;
 
   for (list = alias->implied_surfaces; list; list = next)
@@ -291,7 +291,8 @@ find_alias (RECODE_OUTER outer, const char *name,
   if (!name)
     return NULL;
   lookup.name = name;
-  if (alias = hash_lookup (outer->alias_table, &lookup), alias)
+  if (alias = (RECODE_ALIAS) hash_lookup
+      ((const Hash_table *) outer->alias_table, &lookup), alias)
     return alias;
 
   /* If we reach this point, find_type is necessarily one of SYMBOL_CREATE_*.
@@ -318,7 +319,7 @@ find_alias (RECODE_OUTER outer, const char *name,
   alias->name = name;
   alias->symbol = symbol;
   alias->implied_surfaces = NULL;
-  if (!hash_insert (outer->alias_table, alias))
+  if (!hash_insert ((Hash_table *) outer->alias_table, alias))
     {
       free (symbol);
       free (alias);
@@ -350,7 +351,8 @@ declare_alias (RECODE_OUTER outer, const char *name, const char *old_name)
   symbol = alias->symbol;
 
   lookup.name = name;
-  if (alias = hash_lookup (outer->alias_table, &lookup), alias)
+  if (alias = (RECODE_ALIAS) hash_lookup
+      ((Hash_table *) outer->alias_table, &lookup), alias)
     {
       if (alias->symbol == symbol)
        return alias;
@@ -366,7 +368,7 @@ declare_alias (RECODE_OUTER outer, const char *name, const char *old_name)
   alias->name = name;
   alias->symbol = symbol;
   alias->implied_surfaces = NULL;
-  if (!hash_insert (outer->alias_table, alias))
+  if (!hash_insert ((Hash_table *) outer->alias_table, alias))
     {
       free (alias);
       return NULL;
@@ -420,8 +422,8 @@ struct make_argmatch_walk
 static bool
 make_argmatch_walker_1 (void *void_alias, void *void_walk)
 {
-  RECODE_ALIAS alias = void_alias;
-  struct make_argmatch_walk *walk = void_walk;
+  RECODE_ALIAS alias = (RECODE_ALIAS) void_alias;
+  struct make_argmatch_walk *walk = (struct make_argmatch_walk *) void_walk;
 
   if (alias->symbol->type == RECODE_CHARSET)
     walk->charset_counter++;
@@ -434,8 +436,8 @@ make_argmatch_walker_1 (void *void_alias, void *void_walk)
 static bool
 make_argmatch_walker_2 (void *void_alias, void *void_walk)
 {
-  RECODE_ALIAS alias = void_alias;
-  struct make_argmatch_walk *walk = void_walk;
+  RECODE_ALIAS alias = (RECODE_ALIAS) void_alias;
+  struct make_argmatch_walk *walk = (struct make_argmatch_walk *) void_walk;
   RECODE_OUTER outer = walk->outer;
 
   if (alias->symbol->type == RECODE_CHARSET)
@@ -490,7 +492,8 @@ make_argmatch_arrays (RECODE_OUTER outer)
   walk.outer = outer;
   walk.charset_counter = 0;
   walk.surface_counter = 0;
-  hash_do_for_each (outer->alias_table, make_argmatch_walker_1, &walk);
+  hash_do_for_each ((Hash_table *) outer->alias_table,
+                   make_argmatch_walker_1, &walk);
 
   /* Allocate the argmatch and realname arrays, each with a NULL sentinel.  */
 
@@ -522,7 +525,8 @@ make_argmatch_arrays (RECODE_OUTER outer)
 
   walk.charset_counter = 0;
   walk.surface_counter = 0;
-  hash_do_for_each (outer->alias_table, make_argmatch_walker_2, &walk);
+  hash_do_for_each ((Hash_table *) outer->alias_table,
+                   make_argmatch_walker_2, &walk);
 
   return true;
 }
@@ -645,8 +649,8 @@ struct list_symbols_walk
 static bool
 list_symbols_walker_1 (void *void_alias, void *void_walk)
 {
-  RECODE_ALIAS alias = void_alias;
-  struct list_symbols_walk *walk = void_walk;
+  RECODE_ALIAS alias = (RECODE_ALIAS) void_alias;
+  struct list_symbols_walk *walk = (struct list_symbols_walk *) void_walk;
 
   if (!alias->symbol->ignore)
     walk->number++;
@@ -657,8 +661,8 @@ list_symbols_walker_1 (void *void_alias, void *void_walk)
 static bool
 list_symbols_walker_2 (void *void_alias, void *void_walk)
 {
-  RECODE_ALIAS alias = void_alias;
-  struct list_symbols_walk *walk = void_walk;
+  RECODE_ALIAS alias = (RECODE_ALIAS) void_alias;
+  struct list_symbols_walk *walk = (struct list_symbols_walk *) void_walk;
 
   if (!alias->symbol->ignore)
     walk->array[walk->number++] = *alias;
@@ -676,7 +680,8 @@ list_all_symbols (RECODE_OUTER outer, RECODE_CONST_SYMBOL after)
   /* Count how many symbols we have.  */
 
   walk.number = 0;
-  hash_do_for_each (outer->alias_table, list_symbols_walker_1, &walk);
+  hash_do_for_each ((Hash_table *) outer->alias_table,
+                   list_symbols_walker_1, &walk);
 
   /* Allocate a structure to hold them.  */
 
@@ -686,7 +691,8 @@ list_all_symbols (RECODE_OUTER outer, RECODE_CONST_SYMBOL after)
   /* Copy all symbols in it.  */
 
   walk.number = 0;
-  hash_do_for_each (outer->alias_table, list_symbols_walker_2, &walk);
+  hash_do_for_each ((Hash_table *) outer->alias_table,
+                   list_symbols_walker_2, &walk);
 
   /* Sort it.  */
 
@@ -995,7 +1001,7 @@ list_full_charset (RECODE_OUTER outer, RECODE_CONST_SYMBOL charset)
     {
     case RECODE_EXPLODE_DATA:
       {
-       const unsigned short *data = charset->data;
+       const unsigned short *data = (const unsigned short *) charset->data;
        unsigned code;          /* code counter */
        unsigned expected;      /* expected value for code counter */
        bool insert_white;      /* insert a while line before printing */
@@ -1088,7 +1094,8 @@ find_and_report_subsets (RECODE_OUTER outer)
        charset1;
        charset1 = charset1->next)
     {
-      const struct strip_data *table1 = charset1->data;
+      const struct strip_data *table1
+       = (const struct strip_data *) charset1->data;
       RECODE_SYMBOL charset2;
 
       if (charset1->ignore || charset1->data_type != RECODE_STRIP_DATA)
@@ -1098,7 +1105,8 @@ find_and_report_subsets (RECODE_OUTER outer)
           charset2;
           charset2 = charset2->next)
        {
-         const struct strip_data *table2 = charset2->data;
+         const struct strip_data *table2
+           = (const struct strip_data *) charset2->data;
 
          if (charset2->ignore || charset2->data_type != RECODE_STRIP_DATA
              || charset2 == charset1)
index 1d95d93224e6b5d410755de0c57af97bff3b0c1b..77bc183583f4d69563a4e4052ed1c3d513dd0eb8 100644 (file)
@@ -542,7 +542,7 @@ unregister_all_modules (RECODE_OUTER outer)
 RECODE_OUTER
 recode_new_outer (unsigned flags)
 {
-  RECODE_OUTER outer = malloc (sizeof (struct recode_outer));
+  RECODE_OUTER outer = (RECODE_OUTER) malloc (sizeof (struct recode_outer));
 
   if (!outer)
     {
@@ -621,7 +621,7 @@ recode_delete_outer (RECODE_OUTER outer)
   if (outer->pair_restriction)
     free (outer->pair_restriction);
   if (outer->alias_table)
-    hash_free (outer->alias_table);
+    hash_free ((Hash_table *) outer->alias_table);
   if (outer->argmatch_charset_array)
     {
       char **cursor;
index 06f5fea843f5bd46fd68656a648ee60a67488269..0bef8cb71adf3bfd3913069402901335da6701f2 100644 (file)
@@ -352,7 +352,7 @@ quotearg_n_options (int n, char const *arg,
     if (size <= qsize)
       {
        slotvec[n].size = size = qsize + 1;
-       slotvec[n].val = val = xrealloc (val, size);
+       slotvec[n].val = val = (char *) xrealloc (val, size);
        quotearg_buffer (val, size, arg, (size_t) -1, options);
       }
 
index e2ce127fbf76ff5bf87960d7ba0fbd51a41e68b5..7c4760aa3cd0dacd5af98f9276488ad07653b10f 100644 (file)
@@ -391,7 +391,7 @@ transform_byte_to_ucs2 (RECODE_SUBTASK subtask)
 static size_t
 ucs2_to_byte_hash (const void *void_data, size_t table_size)
 {
-  const struct ucs2_to_byte *data = void_data;
+  const struct ucs2_to_byte *data = (const struct ucs2_to_byte *) void_data;
 
   return data->code % table_size;
 }
@@ -399,8 +399,8 @@ ucs2_to_byte_hash (const void *void_data, size_t table_size)
 static bool
 ucs2_to_byte_compare (const void *void_first, const void *void_second)
 {
-  const struct ucs2_to_byte *first = void_first;
-  const struct ucs2_to_byte *second = void_second;
+  const struct ucs2_to_byte *first = (const struct ucs2_to_byte *) void_first;
+  const struct ucs2_to_byte *second = (const struct ucs2_to_byte *) void_second;
 
   return first->code == second->code;
 }
@@ -449,7 +449,7 @@ init_ucs2_to_byte (RECODE_STEP step,
 bool
 transform_ucs2_to_byte (RECODE_SUBTASK subtask)
 {
-  Hash_table *table = subtask->step->local;
+  Hash_table *table = (Hash_table *) subtask->step->local;
   struct ucs2_to_byte lookup;
   struct ucs2_to_byte *entry;
   unsigned input_value;                /* current UCS-2 character */
@@ -457,7 +457,7 @@ transform_ucs2_to_byte (RECODE_SUBTASK subtask)
   while (get_ucs2 (&input_value, subtask))
     {
       lookup.code = input_value;
-      entry = hash_lookup (table, &lookup);
+      entry = (struct ucs2_to_byte *) hash_lookup (table, &lookup);
       if (entry)
        put_byte (entry->byte, subtask);
       else
@@ -575,7 +575,7 @@ recode_format_table (RECODE_REQUEST request,
 
   if (step->step_type == RECODE_BYTE_TO_BYTE)
     {
-      const unsigned char *table = step->step_table;
+      const unsigned char *table = (const unsigned char *) step->step_table;
 
       /* Produce a one to one recoding table.  */
 
@@ -617,7 +617,7 @@ recode_format_table (RECODE_REQUEST request,
     }
   else if (step->step_type == RECODE_BYTE_TO_STRING)
     {
-      const char *const *table = step->step_table;
+      const char *const *table = (const char *const *) step->step_table;
 
       /* Produce a one to many recoding table.  */
 
index 9317101eef107f3611d56c1a832d64c1ce9ff3d0..9964425115d8dedf3b4e85d60a11cb48c17487be 100644 (file)
@@ -472,7 +472,7 @@ complete_double_ucs2_step (RECODE_OUTER outer, RECODE_STEP step)
     {
       /* Construct the array of binding items for the charset.  */
 
-      data = side->charset->data;
+      data = (const struct strip_data *) side->charset->data;
       pool = data->pool;
       item_cursor = side->item;
       byte = 0;
@@ -649,7 +649,7 @@ simplify_sequence (RECODE_REQUEST request)
        while (in < limit
               && (table_type (request, in) == RECODE_BYTE_TO_BYTE))
          {
-           const unsigned char *table = in->step_table;
+           const unsigned char *table = (const unsigned char *) in->step_table;
 
            for (counter = 0; counter < 256; counter++)
              temp[counter] = table[accum[counter]];
@@ -670,7 +670,7 @@ simplify_sequence (RECODE_REQUEST request)
 
            && (ALLOC (string, 256, const char *)))
          {
-           const char *const *table = in->step_table;
+           const char *const *table = (const char *const *) in->step_table;
 
            for (counter = 0; counter < 256; counter++)
              string[counter] = table[accum[counter]];
@@ -754,11 +754,11 @@ scan_options (RECODE_REQUEST request)
 
   while (*request->scan_cursor == '+')
     {
-      RECODE_OPTION_LIST new
-       = ALLOC (new, 1, struct recode_option_list);
+      RECODE_OPTION_LIST new_
+       = ALLOC (new_, 1, struct recode_option_list);
       char *copy;
 
-      if (!new)
+      if (!new_)
        break;                  /* FIXME: should interrupt decoding */
 
       request->scan_cursor++;
@@ -768,11 +768,11 @@ scan_options (RECODE_REQUEST request)
        break;                  /* FIXME: should interrupt decoding */
       strcpy (copy, request->scanned_string);
 
-      new->option = copy;
+      new_->option = copy;
       if (!list)
-       list = new;
-      new->next = last;
-      last = new;
+       list = new_;
+      new_->next = last;
+      last = new_;
     }
   return list;
 }
index 16afe1d0fd674ba746989de27b2faac1742107c8..e80c146ed47f37d23d962082858e3ef995be2402 100644 (file)
@@ -92,7 +92,7 @@ struct local
 static bool
 transform_ucs2_rfc1345 (RECODE_SUBTASK subtask)
 {
-  struct local *local = subtask->step->local;
+  struct local *local = (struct local *) subtask->step->local;
   const char intro = local->intro;
   unsigned value;
 
@@ -144,7 +144,7 @@ transform_ucs2_rfc1345 (RECODE_SUBTASK subtask)
 static bool
 transform_rfc1345_ucs2 (RECODE_SUBTASK subtask)
 {
-  struct local *local = subtask->step->local;
+  struct local *local = (struct local *) subtask->step->local;
   const char intro = local->intro;
   int character;
 
index 9bdf6c24b129fa5cc95b6852e5464ee04664bed8..ad1d5a6168a5e8253948978cc7966f447c6d1c1b 100644 (file)
@@ -223,7 +223,8 @@ transform_mere_copy (RECODE_SUBTASK subtask)
 bool
 transform_byte_to_byte (RECODE_SUBTASK subtask)
 {
-  unsigned const char *table = subtask->step->step_table;
+  unsigned const char *table
+    = (unsigned const char *) subtask->step->step_table;
   int input_char;
 
   while (input_char = get_byte (subtask), input_char != EOF)
@@ -239,7 +240,7 @@ transform_byte_to_byte (RECODE_SUBTASK subtask)
 bool
 transform_byte_to_variable (RECODE_SUBTASK subtask)
 {
-  const char *const *table = subtask->step->step_table;
+  const char *const *table = (const char *const *) subtask->step->step_table;
   int input_char;
   const char *output_string;
 
index 4252a53e8521dfb6ed2245a15dfd208a3c5512bb..7cb49503b89d8ad798957abe8817e520691cbbb1 100644 (file)
@@ -121,7 +121,7 @@ struct ucs2_to_count
 static size_t
 ucs2_to_count_hash (const void *void_data, size_t table_size)
 {
-  const struct ucs2_to_count *data = void_data;
+  const struct ucs2_to_count *data = (const struct ucs2_to_count *) void_data;
 
   return data->code % table_size;
 }
@@ -129,8 +129,10 @@ ucs2_to_count_hash (const void *void_data, size_t table_size)
 static bool
 ucs2_to_count_compare (const void *void_first, const void *void_second)
 {
-  const struct ucs2_to_count *first = void_first;
-  const struct ucs2_to_count *second = void_second;
+  const struct ucs2_to_count *first
+    = (const struct ucs2_to_count *) void_first;
+  const struct ucs2_to_count *second
+    = (const struct ucs2_to_count *) void_second;
 
   return first->code == second->code;
 }
@@ -138,8 +140,10 @@ ucs2_to_count_compare (const void *void_first, const void *void_second)
 static int
 compare_item (const void *void_first, const void *void_second)
 {
-  struct ucs2_to_count *const *first = void_first;
-  struct ucs2_to_count *const *second = void_second;
+  struct ucs2_to_count *const *first
+    = (struct ucs2_to_count *const *) void_first;
+  struct ucs2_to_count *const *second
+    = (struct ucs2_to_count *const *) void_second;
 
   return (*first)->code - (*second)->code;
 }
@@ -177,7 +181,7 @@ produce_count (RECODE_SUBTASK subtask)
        struct ucs2_to_count *entry;
 
        lookup.code = character;
-       entry = hash_lookup (table, &lookup);
+       entry = (struct ucs2_to_count *) hash_lookup (table, &lookup);
        if (entry)
          entry->count++;
        else
index 687633c250cfeee9eaa1e9227feec92d1281612f..d66054fe62df8e9539ce55a31be6ffffad5425ae 100644 (file)
@@ -237,5 +237,5 @@ xmemdup (void const *p, size_t s)
 char *
 xstrdup (char const *string)
 {
-  return xmemdup (string, strlen (string) + 1);
+  return (char *) xmemdup (string, strlen (string) + 1);
 }