2004-12-05 Tomer Levi <Tomer.Levi@nsc.com>
[deliverable/binutils-gdb.git] / binutils / resbin.c
index 8fc07fbb29253928b7aad22c7252dc7fdcb62b6c..ad14bdafcbbaea4e609178e7486fe7ae5b51bfc4 100644 (file)
@@ -1,5 +1,6 @@
 /* resbin.c -- manipulate the Windows binary resource format.
 /* resbin.c -- manipulate the Windows binary resource format.
-   Copyright 1997, 1998 Free Software Foundation, Inc.
+   Copyright 1997, 1998, 1999, 2002, 2003
+   Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Cygnus Support.
 
    This file is part of GNU Binutils.
    Written by Ian Lance Taylor, Cygnus Support.
 
    This file is part of GNU Binutils.
 
 /* Macros to swap in values.  */
 
 
 /* Macros to swap in values.  */
 
+#define get_8(s)      (*((unsigned char *)(s)))
 #define get_16(be, s) ((be) ? bfd_getb16 (s) : bfd_getl16 (s))
 #define get_32(be, s) ((be) ? bfd_getb32 (s) : bfd_getl32 (s))
 
 /* Local functions.  */
 
 #define get_16(be, s) ((be) ? bfd_getb16 (s) : bfd_getl16 (s))
 #define get_32(be, s) ((be) ? bfd_getb32 (s) : bfd_getl32 (s))
 
 /* Local functions.  */
 
-static void toosmall PARAMS ((const char *));
+static void toosmall (const char *);
+
 static unichar *get_unicode
 static unichar *get_unicode
-  PARAMS ((const unsigned char *, unsigned long, int, int *));
+  (const unsigned char *, unsigned long, int, int *);
 static int get_resid
 static int get_resid
-  PARAMS ((struct res_id *, const unsigned char *, unsigned long, int));
+  (struct res_id *, const unsigned char *, unsigned long, int);
 static struct res_resource *bin_to_res_generic
 static struct res_resource *bin_to_res_generic
-  PARAMS ((enum res_type, const unsigned char *, unsigned long));
+  (enum res_type, const unsigned char *, unsigned long);
 static struct res_resource *bin_to_res_cursor
 static struct res_resource *bin_to_res_cursor
-  PARAMS ((const unsigned char *, unsigned long, int));
+  (const unsigned char *, unsigned long, int);
 static struct res_resource *bin_to_res_menu
 static struct res_resource *bin_to_res_menu
-  PARAMS ((const unsigned char *, unsigned long, int));
+  (const unsigned char *, unsigned long, int);
 static struct menuitem *bin_to_res_menuitems
 static struct menuitem *bin_to_res_menuitems
-  PARAMS ((const unsigned char *, unsigned long, int, int *));
+  (const unsigned char *, unsigned long, int, int *);
 static struct menuitem *bin_to_res_menuexitems
 static struct menuitem *bin_to_res_menuexitems
-  PARAMS ((const unsigned char *, unsigned long, int, int *));
+  (const unsigned char *, unsigned long, int, int *);
 static struct res_resource *bin_to_res_dialog
 static struct res_resource *bin_to_res_dialog
-  PARAMS ((const unsigned char *, unsigned long, int));
+  (const unsigned char *, unsigned long, int);
 static struct res_resource *bin_to_res_string
 static struct res_resource *bin_to_res_string
-  PARAMS ((const unsigned char *, unsigned long, int));
+  (const unsigned char *, unsigned long, int);
 static struct res_resource *bin_to_res_fontdir
 static struct res_resource *bin_to_res_fontdir
-  PARAMS ((const unsigned char *, unsigned long, int));
+  (const unsigned char *, unsigned long, int);
 static struct res_resource *bin_to_res_accelerators
 static struct res_resource *bin_to_res_accelerators
-  PARAMS ((const unsigned char *, unsigned long, int));
+  (const unsigned char *, unsigned long, int);
 static struct res_resource *bin_to_res_rcdata
 static struct res_resource *bin_to_res_rcdata
-  PARAMS ((const unsigned char *, unsigned long, int));
+  (const unsigned char *, unsigned long, int);
 static struct res_resource *bin_to_res_group_cursor
 static struct res_resource *bin_to_res_group_cursor
-  PARAMS ((const unsigned char *, unsigned long, int));
+  (const unsigned char *, unsigned long, int);
 static struct res_resource *bin_to_res_group_icon
 static struct res_resource *bin_to_res_group_icon
-  PARAMS ((const unsigned char *, unsigned long, int));
+  (const unsigned char *, unsigned long, int);
 static struct res_resource *bin_to_res_version
 static struct res_resource *bin_to_res_version
-  PARAMS ((const unsigned char *, unsigned long, int));
+  (const unsigned char *, unsigned long, int);
 static struct res_resource *bin_to_res_userdata
 static struct res_resource *bin_to_res_userdata
-  PARAMS ((const unsigned char *, unsigned long, int));
+  (const unsigned char *, unsigned long, int);
+static void get_version_header
+  (const unsigned char *, unsigned long, int, const char *,
+   unichar **, int *, int *, int *, int *);
 
 /* Given a resource type ID, a pointer to data, a length, return a
    res_resource structure which represents that resource.  The caller
 
 /* Given a resource type ID, a pointer to data, a length, return a
    res_resource structure which represents that resource.  The caller
@@ -75,11 +81,8 @@ static struct res_resource *bin_to_res_userdata
    of the returned structure.  */
 
 struct res_resource *
    of the returned structure.  */
 
 struct res_resource *
-bin_to_res (type, data, length, big_endian)
-     struct res_id type;
-     const unsigned char *data;
-     unsigned long length;
-     int big_endian;
+bin_to_res (struct res_id type, const unsigned char *data,
+           unsigned long length, int big_endian)
 {
   if (type.named)
     return bin_to_res_userdata (data, length, big_endian);
 {
   if (type.named)
     return bin_to_res_userdata (data, length, big_endian);
@@ -124,8 +127,7 @@ bin_to_res (type, data, length, big_endian)
 /* Give an error if the binary data is too small.  */
 
 static void
 /* Give an error if the binary data is too small.  */
 
 static void
-toosmall (msg)
-     const char *msg;
+toosmall (const char *msg)
 {
   fatal (_("%s: not enough binary data"), msg);
 }
 {
   fatal (_("%s: not enough binary data"), msg);
 }
@@ -133,11 +135,8 @@ toosmall (msg)
 /* Swap in a NULL terminated unicode string.  */
 
 static unichar *
 /* Swap in a NULL terminated unicode string.  */
 
 static unichar *
-get_unicode (data, length, big_endian, retlen)
-     const unsigned char *data;
-     unsigned long length;
-     int big_endian;
-     int *retlen;
+get_unicode (const unsigned char *data, unsigned long length,
+            int big_endian, int *retlen)
 {
   int c, i;
   unichar *ret;
 {
   int c, i;
   unichar *ret;
@@ -167,11 +166,8 @@ get_unicode (data, length, big_endian, retlen)
 /* Get a resource identifier.  This returns the number of bytes used.  */
 
 static int
 /* Get a resource identifier.  This returns the number of bytes used.  */
 
 static int
-get_resid (id, data, length, big_endian)
-     struct res_id *id;
-     const unsigned char *data;
-     unsigned long length;
-     int big_endian;
+get_resid (struct res_id *id, const unsigned char *data,
+          unsigned long length, int big_endian)
 {
   int first;
 
 {
   int first;
 
@@ -199,10 +195,8 @@ get_resid (id, data, length, big_endian)
    binary.  */
 
 struct res_resource *
    binary.  */
 
 struct res_resource *
-bin_to_res_generic (type, data, length)
-     enum res_type type;
-     const unsigned char *data;
-     unsigned long length;
+bin_to_res_generic (enum res_type type, const unsigned char *data,
+                   unsigned long length)
 {
   struct res_resource *r;
 
 {
   struct res_resource *r;
 
@@ -217,10 +211,8 @@ bin_to_res_generic (type, data, length)
 /* Convert a cursor resource from binary.  */
 
 struct res_resource *
 /* Convert a cursor resource from binary.  */
 
 struct res_resource *
-bin_to_res_cursor (data, length, big_endian)
-     const unsigned char *data;
-     unsigned long length;
-     int big_endian;
+bin_to_res_cursor (const unsigned char *data, unsigned long length,
+                  int big_endian)
 {
   struct cursor *c;
   struct res_resource *r;
 {
   struct cursor *c;
   struct res_resource *r;
@@ -244,10 +236,8 @@ bin_to_res_cursor (data, length, big_endian)
 /* Convert a menu resource from binary.  */
 
 struct res_resource *
 /* Convert a menu resource from binary.  */
 
 struct res_resource *
-bin_to_res_menu (data, length, big_endian)
-     const unsigned char *data;
-     unsigned long length;
-     int big_endian;
+bin_to_res_menu (const unsigned char *data, unsigned long length,
+                int big_endian)
 {
   struct res_resource *r;
   struct menu *m;
 {
   struct res_resource *r;
   struct menu *m;
@@ -296,11 +286,8 @@ bin_to_res_menu (data, length, big_endian)
 /* Convert menu items from binary.  */
 
 static struct menuitem *
 /* Convert menu items from binary.  */
 
 static struct menuitem *
-bin_to_res_menuitems (data, length, big_endian, read)
-     const unsigned char *data;
-     unsigned long length;
-     int big_endian;
-     int *read;
+bin_to_res_menuitems (const unsigned char *data, unsigned long length,
+                     int big_endian, int *read)
 {
   struct menuitem *first, **pp;
 
 {
   struct menuitem *first, **pp;
 
@@ -377,11 +364,8 @@ bin_to_res_menuitems (data, length, big_endian, read)
 /* Convert menuex items from binary.  */
 
 static struct menuitem *
 /* Convert menuex items from binary.  */
 
 static struct menuitem *
-bin_to_res_menuexitems (data, length, big_endian, read)
-     const unsigned char *data;
-     unsigned long length;
-     int big_endian;
-     int *read;
+bin_to_res_menuexitems (const unsigned char *data, unsigned long length,
+                       int big_endian, int *read)
 {
   struct menuitem *first, **pp;
 
 {
   struct menuitem *first, **pp;
 
@@ -455,12 +439,10 @@ bin_to_res_menuexitems (data, length, big_endian, read)
 /* Convert a dialog resource from binary.  */
 
 static struct res_resource *
 /* Convert a dialog resource from binary.  */
 
 static struct res_resource *
-bin_to_res_dialog (data, length, big_endian)
-     const unsigned char *data;
-     unsigned long length;
-     int big_endian;
+bin_to_res_dialog (const unsigned char *data, unsigned long length,
+                  int big_endian)
 {
 {
-  int version;
+  int signature;
   struct dialog *d;
   int c, sublen, i;
   unsigned int off;
   struct dialog *d;
   int c, sublen, i;
   unsigned int off;
@@ -472,8 +454,8 @@ bin_to_res_dialog (data, length, big_endian)
 
   d = (struct dialog *) res_alloc (sizeof *d);
 
 
   d = (struct dialog *) res_alloc (sizeof *d);
 
-  version = get_16 (big_endian, data);
-  if (version != 1)
+  signature = get_16 (big_endian, data + 2);
+  if (signature != 0xffff)
     {
       d->ex = NULL;
       d->style = get_32 (big_endian, data);
     {
       d->ex = NULL;
       d->style = get_32 (big_endian, data);
@@ -482,11 +464,11 @@ bin_to_res_dialog (data, length, big_endian)
     }
   else
     {
     }
   else
     {
-      int signature;
+      int version;
 
 
-      signature = get_16 (big_endian, data + 2);
-      if (signature != 0xffff)
-       fatal (_("unexpected dialog signature %d"), signature);
+      version = get_16 (big_endian, data);
+      if (version != 1)
+       fatal (_("unexpected DIALOGEX version %d"), version);
 
       d->ex = (struct dialog_ex *) res_alloc (sizeof (struct dialog_ex));
       d->ex->help = get_32 (big_endian, data + 4);
 
       d->ex = (struct dialog_ex *) res_alloc (sizeof (struct dialog_ex));
       d->ex->help = get_32 (big_endian, data + 4);
@@ -514,6 +496,8 @@ bin_to_res_dialog (data, length, big_endian)
 
   d->caption = get_unicode (data + off, length - off, big_endian, &sublen);
   off += sublen * 2 + 2;
 
   d->caption = get_unicode (data + off, length - off, big_endian, &sublen);
   off += sublen * 2 + 2;
+  if (sublen == 0)
+    d->caption = NULL;
 
   if ((d->style & DS_SETFONT) == 0)
     {
 
   if ((d->style & DS_SETFONT) == 0)
     {
@@ -523,6 +507,7 @@ bin_to_res_dialog (data, length, big_endian)
        {
          d->ex->weight = 0;
          d->ex->italic = 0;
        {
          d->ex->weight = 0;
          d->ex->italic = 0;
+         d->ex->charset = 1; /* Default charset.  */
        }
     }
   else
        }
     }
   else
@@ -538,7 +523,8 @@ bin_to_res_dialog (data, length, big_endian)
          if (length < off + 4)
            toosmall (_("dialogex font information"));
          d->ex->weight = get_16 (big_endian, data + off);
          if (length < off + 4)
            toosmall (_("dialogex font information"));
          d->ex->weight = get_16 (big_endian, data + off);
-         d->ex->italic = get_16 (big_endian, data + off + 2);
+         d->ex->italic = get_8 (data + off + 2);
+         d->ex->charset = get_8 (data + off + 3);
          off += 4;
        }
 
          off += 4;
        }
 
@@ -587,9 +573,9 @@ bin_to_res_dialog (data, length, big_endian)
       dc->height = get_16 (big_endian, data + off + 6);
 
       if (d->ex != NULL)
       dc->height = get_16 (big_endian, data + off + 6);
 
       if (d->ex != NULL)
-        dc->id = get_32 (big_endian, data + off + 8);
+       dc->id = get_32 (big_endian, data + off + 8);
       else
       else
-        dc->id = get_16 (big_endian, data + off + 8);
+       dc->id = get_16 (big_endian, data + off + 8);
 
       off += 10 + (d->ex != NULL ? 2 : 0);
 
 
       off += 10 + (d->ex != NULL ? 2 : 0);
 
@@ -621,7 +607,7 @@ bin_to_res_dialog (data, length, big_endian)
          dc->data->u.buffer.length = datalen;
          dc->data->u.buffer.data = data + off;
 
          dc->data->u.buffer.length = datalen;
          dc->data->u.buffer.data = data + off;
 
-         off += datalen;         
+         off += datalen;
        }
 
       dc->next = NULL;
        }
 
       dc->next = NULL;
@@ -639,10 +625,8 @@ bin_to_res_dialog (data, length, big_endian)
 /* Convert a stringtable resource from binary.  */
 
 static struct res_resource *
 /* Convert a stringtable resource from binary.  */
 
 static struct res_resource *
-bin_to_res_string (data, length, big_endian)
-     const unsigned char *data;
-     unsigned long length;
-     int big_endian;
+bin_to_res_string (const unsigned char *data, unsigned long length,
+                  int big_endian)
 {
   struct stringtable *st;
   int i;
 {
   struct stringtable *st;
   int i;
@@ -688,10 +672,8 @@ bin_to_res_string (data, length, big_endian)
 /* Convert a fontdir resource from binary.  */
 
 static struct res_resource *
 /* Convert a fontdir resource from binary.  */
 
 static struct res_resource *
-bin_to_res_fontdir (data, length, big_endian)
-     const unsigned char *data;
-     unsigned long length;
-     int big_endian;
+bin_to_res_fontdir (const unsigned char *data, unsigned long length,
+                   int big_endian)
 {
   int c, i;
   struct fontdir *first, **pp;
 {
   int c, i;
   struct fontdir *first, **pp;
@@ -760,10 +742,8 @@ bin_to_res_fontdir (data, length, big_endian)
 /* Convert an accelerators resource from binary.  */
 
 static struct res_resource *
 /* Convert an accelerators resource from binary.  */
 
 static struct res_resource *
-bin_to_res_accelerators (data, length, big_endian)
-     const unsigned char *data;
-     unsigned long length;
-     int big_endian;
+bin_to_res_accelerators (const unsigned char *data, unsigned long length,
+                        int big_endian)
 {
   struct accelerator *first, **pp;
   struct res_resource *r;
 {
   struct accelerator *first, **pp;
   struct res_resource *r;
@@ -805,10 +785,8 @@ bin_to_res_accelerators (data, length, big_endian)
 /* Convert an rcdata resource from binary.  */
 
 static struct res_resource *
 /* Convert an rcdata resource from binary.  */
 
 static struct res_resource *
-bin_to_res_rcdata (data, length, big_endian)
-     const unsigned char *data;
-     unsigned long length;
-     int big_endian;
+bin_to_res_rcdata (const unsigned char *data, unsigned long length,
+                  int big_endian ATTRIBUTE_UNUSED)
 {
   struct rcdata_item *ri;
   struct res_resource *r;
 {
   struct rcdata_item *ri;
   struct res_resource *r;
@@ -830,10 +808,8 @@ bin_to_res_rcdata (data, length, big_endian)
 /* Convert a group cursor resource from binary.  */
 
 static struct res_resource *
 /* Convert a group cursor resource from binary.  */
 
 static struct res_resource *
-bin_to_res_group_cursor (data, length, big_endian)
-     const unsigned char *data;
-     unsigned long length;
-     int big_endian;
+bin_to_res_group_cursor (const unsigned char *data, unsigned long length,
+                        int big_endian)
 {
   int type, c, i;
   struct group_cursor *first, **pp;
 {
   int type, c, i;
   struct group_cursor *first, **pp;
@@ -888,10 +864,8 @@ bin_to_res_group_cursor (data, length, big_endian)
 /* Convert a group icon resource from binary.  */
 
 static struct res_resource *
 /* Convert a group icon resource from binary.  */
 
 static struct res_resource *
-bin_to_res_group_icon (data, length, big_endian)
-     const unsigned char *data;
-     unsigned long length;
-     int big_endian;
+bin_to_res_group_icon (const unsigned char *data, unsigned long length,
+                      int big_endian)
 {
   int type, c, i;
   struct group_icon *first, **pp;
 {
   int type, c, i;
   struct group_icon *first, **pp;
@@ -950,17 +924,9 @@ bin_to_res_group_icon (data, length, big_endian)
    to the type, and *OFF to the offset to the children.  */
 
 static void
    to the type, and *OFF to the offset to the children.  */
 
 static void
-get_version_header (data, length, big_endian, key, pkey, len, vallen, type,
-                   off)
-     const unsigned char *data;
-     unsigned long length;
-     int big_endian;
-     const char *key;
-     unichar **pkey;
-     int *len;
-     int *vallen;
-     int *type;
-     int *off;
+get_version_header (const unsigned char *data, unsigned long length,
+                   int big_endian, const char *key, unichar **pkey,
+                   int *len, int *vallen, int *type, int *off)
 {
   if (length < 8)
     toosmall (key);
 {
   if (length < 8)
     toosmall (key);
@@ -1007,10 +973,8 @@ get_version_header (data, length, big_endian, key, pkey, len, vallen, type,
 /* Convert a version resource from binary.  */
 
 static struct res_resource *
 /* Convert a version resource from binary.  */
 
 static struct res_resource *
-bin_to_res_version (data, length, big_endian)
-     const unsigned char *data;
-     unsigned long length;
-     int big_endian;
+bin_to_res_version (const unsigned char *data, unsigned long length,
+                   int big_endian)
 {
   int verlen, vallen, type, off;
   struct fixed_versioninfo *fi;
 {
   int verlen, vallen, type, off;
   struct fixed_versioninfo *fi;
@@ -1019,7 +983,7 @@ bin_to_res_version (data, length, big_endian)
   struct res_resource *r;
 
   get_version_header (data, length, big_endian, "VS_VERSION_INFO",
   struct res_resource *r;
 
   get_version_header (data, length, big_endian, "VS_VERSION_INFO",
-                     (unichar *) NULL, &verlen, &vallen, &type, &off);
+                     (unichar **) NULL, &verlen, &vallen, &type, &off);
 
   if ((unsigned int) verlen != length)
     fatal (_("version length %d does not match resource length %lu"),
 
   if ((unsigned int) verlen != length)
     fatal (_("version length %d does not match resource length %lu"),
@@ -1091,7 +1055,7 @@ bin_to_res_version (data, length, big_endian)
          vi->type = VERINFO_STRING;
 
          get_version_header (data, length, big_endian, "StringFileInfo",
          vi->type = VERINFO_STRING;
 
          get_version_header (data, length, big_endian, "StringFileInfo",
-                             (unichar *) NULL, &verlen, &vallen, &type,
+                             (unichar **) NULL, &verlen, &vallen, &type,
                              &off);
 
          if (vallen != 0)
                              &off);
 
          if (vallen != 0)
@@ -1163,7 +1127,7 @@ bin_to_res_version (data, length, big_endian)
          vi->type = VERINFO_VAR;
 
          get_version_header (data, length, big_endian, "VarFileInfo",
          vi->type = VERINFO_VAR;
 
          get_version_header (data, length, big_endian, "VarFileInfo",
-                             (unichar *) NULL, &verlen, &vallen, &type,
+                             (unichar **) NULL, &verlen, &vallen, &type,
                              &off);
 
          if (vallen != 0)
                              &off);
 
          if (vallen != 0)
@@ -1211,7 +1175,7 @@ bin_to_res_version (data, length, big_endian)
 
       vi->next = NULL;
       *pp = vi;
 
       vi->next = NULL;
       *pp = vi;
-      pp = &vi->next;      
+      pp = &vi->next;
     }
 
   v = (struct versioninfo *) res_alloc (sizeof *v);
     }
 
   v = (struct versioninfo *) res_alloc (sizeof *v);
@@ -1222,16 +1186,14 @@ bin_to_res_version (data, length, big_endian)
   r->type = RES_TYPE_VERSIONINFO;
   r->u.versioninfo = v;
 
   r->type = RES_TYPE_VERSIONINFO;
   r->u.versioninfo = v;
 
-  return r;  
+  return r;
 }
 
 /* Convert an arbitrary user defined resource from binary.  */
 
 static struct res_resource *
 }
 
 /* Convert an arbitrary user defined resource from binary.  */
 
 static struct res_resource *
-bin_to_res_userdata (data, length, big_endian)
-     const unsigned char *data;
-     unsigned long length;
-     int big_endian;
+bin_to_res_userdata (const unsigned char *data, unsigned long length,
+                    int big_endian ATTRIBUTE_UNUSED)
 {
   struct rcdata_item *ri;
   struct res_resource *r;
 {
   struct rcdata_item *ri;
   struct res_resource *r;
@@ -1252,48 +1214,47 @@ bin_to_res_userdata (data, length, big_endian)
 \f
 /* Macros to swap out values.  */
 
 \f
 /* Macros to swap out values.  */
 
+#define put_8(v, s)      (*((unsigned char *) (s)) = (unsigned char) (v))
 #define put_16(be, v, s) ((be) ? bfd_putb16 ((v), (s)) : bfd_putl16 ((v), (s)))
 #define put_32(be, v, s) ((be) ? bfd_putb32 ((v), (s)) : bfd_putl32 ((v), (s)))
 
 /* Local functions used to convert resources to binary format.  */
 
 #define put_16(be, v, s) ((be) ? bfd_putb16 ((v), (s)) : bfd_putl16 ((v), (s)))
 #define put_32(be, v, s) ((be) ? bfd_putb32 ((v), (s)) : bfd_putl32 ((v), (s)))
 
 /* Local functions used to convert resources to binary format.  */
 
-static void dword_align_bin PARAMS ((struct bindata ***, unsigned long *));
-static struct bindata *resid_to_bin PARAMS ((struct res_id, int));
-static struct bindata *unicode_to_bin PARAMS ((const unichar *, int));
+static void dword_align_bin (struct bindata ***, unsigned long *);
+static struct bindata *resid_to_bin (struct res_id, int);
+static struct bindata *unicode_to_bin (const unichar *, int);
 static struct bindata *res_to_bin_accelerator
 static struct bindata *res_to_bin_accelerator
-  PARAMS ((const struct accelerator *, int));
+  (const struct accelerator *, int);
 static struct bindata *res_to_bin_cursor
 static struct bindata *res_to_bin_cursor
-  PARAMS ((const struct cursor *, int));
+  (const struct cursor *, int);
 static struct bindata *res_to_bin_group_cursor
 static struct bindata *res_to_bin_group_cursor
-  PARAMS ((const struct group_cursor *, int));
+  (const struct group_cursor *, int);
 static struct bindata *res_to_bin_dialog
 static struct bindata *res_to_bin_dialog
-  PARAMS ((const struct dialog *, int));
+  (const struct dialog *, int);
 static struct bindata *res_to_bin_fontdir
 static struct bindata *res_to_bin_fontdir
-  PARAMS ((const struct fontdir *, int));
+  (const struct fontdir *, int);
 static struct bindata *res_to_bin_group_icon
 static struct bindata *res_to_bin_group_icon
-  PARAMS ((const struct group_icon *, int));
+  (const struct group_icon *, int);
 static struct bindata *res_to_bin_menu
 static struct bindata *res_to_bin_menu
-  PARAMS ((const struct menu *, int));
+  (const struct menu *, int);
 static struct bindata *res_to_bin_menuitems
 static struct bindata *res_to_bin_menuitems
-  PARAMS ((const struct menuitem *, int));
+  (const struct menuitem *, int);
 static struct bindata *res_to_bin_menuexitems
 static struct bindata *res_to_bin_menuexitems
-  PARAMS ((const struct menuitem *, int));
+  (const struct menuitem *, int);
 static struct bindata *res_to_bin_rcdata
 static struct bindata *res_to_bin_rcdata
-  PARAMS ((const struct rcdata_item *, int));
+  (const struct rcdata_item *, int);
 static struct bindata *res_to_bin_stringtable
 static struct bindata *res_to_bin_stringtable
-  PARAMS ((const struct stringtable *, int));
-static struct bindata *string_to_unicode_bin PARAMS ((const char *, int));
+  (const struct stringtable *, int);
+static struct bindata *string_to_unicode_bin (const char *, int);
 static struct bindata *res_to_bin_versioninfo
 static struct bindata *res_to_bin_versioninfo
-  PARAMS ((const struct versioninfo *, int));
+  (const struct versioninfo *, int);
 static struct bindata *res_to_bin_generic
 static struct bindata *res_to_bin_generic
-  PARAMS ((unsigned long, const unsigned char *));
+  (unsigned long, const unsigned char *);
 
 /* Convert a resource to binary.  */
 
 struct bindata *
 
 /* Convert a resource to binary.  */
 
 struct bindata *
-res_to_bin (res, big_endian)
-     const struct res_resource *res;
-     int big_endian;
+res_to_bin (const struct res_resource *res, int big_endian)
 {
   switch (res->type)
     {
 {
   switch (res->type)
     {
@@ -1335,9 +1296,7 @@ res_to_bin (res, big_endian)
    boundary.  It updates *PPP and *LENGTH.  */
 
 static void
    boundary.  It updates *PPP and *LENGTH.  */
 
 static void
-dword_align_bin (ppp, length)
-     struct bindata ***ppp;
-     unsigned long *length;
+dword_align_bin (struct bindata ***ppp, unsigned long *length)
 {
   int add;
   struct bindata *d;
 {
   int add;
   struct bindata *d;
@@ -1363,9 +1322,7 @@ dword_align_bin (ppp, length)
    bindata structure.  */
 
 static struct bindata *
    bindata structure.  */
 
 static struct bindata *
-resid_to_bin (id, big_endian)
-     struct res_id id;
-     int big_endian;
+resid_to_bin (struct res_id id, int big_endian)
 {
   struct bindata *d;
 
 {
   struct bindata *d;
 
@@ -1398,9 +1355,7 @@ resid_to_bin (id, big_endian)
    returns exactly one bindata structure.  */
 
 static struct bindata *
    returns exactly one bindata structure.  */
 
 static struct bindata *
-unicode_to_bin (str, big_endian)
-     const unichar *str;
-     int big_endian;
+unicode_to_bin (const unichar *str, int big_endian)
 {
   int len;
   struct bindata *d;
 {
   int len;
   struct bindata *d;
@@ -1438,9 +1393,8 @@ unicode_to_bin (str, big_endian)
 /* Convert an accelerator resource to binary.  */
 
 static struct bindata *
 /* Convert an accelerator resource to binary.  */
 
 static struct bindata *
-res_to_bin_accelerator (accelerators, big_endian)
-     const struct accelerator *accelerators;
-     int big_endian;
+res_to_bin_accelerator (const struct accelerator *accelerators,
+                       int big_endian)
 {
   struct bindata *first, **pp;
   const struct accelerator *a;
 {
   struct bindata *first, **pp;
   const struct accelerator *a;
@@ -1474,9 +1428,7 @@ res_to_bin_accelerator (accelerators, big_endian)
 /* Convert a cursor resource to binary.  */
 
 static struct bindata *
 /* Convert a cursor resource to binary.  */
 
 static struct bindata *
-res_to_bin_cursor (c, big_endian)
-     const struct cursor *c;
-     int big_endian;
+res_to_bin_cursor (const struct cursor *c, int big_endian)
 {
   struct bindata *d;
 
 {
   struct bindata *d;
 
@@ -1498,9 +1450,8 @@ res_to_bin_cursor (c, big_endian)
 /* Convert a group cursor resource to binary.  */
 
 static struct bindata *
 /* Convert a group cursor resource to binary.  */
 
 static struct bindata *
-res_to_bin_group_cursor (group_cursors, big_endian)
-     const struct group_cursor *group_cursors;
-     int big_endian;
+res_to_bin_group_cursor (const struct group_cursor *group_cursors,
+                        int big_endian)
 {
   struct bindata *first, **pp;
   int c;
 {
   struct bindata *first, **pp;
   int c;
@@ -1547,9 +1498,7 @@ res_to_bin_group_cursor (group_cursors, big_endian)
 /* Convert a dialog resource to binary.  */
 
 static struct bindata *
 /* Convert a dialog resource to binary.  */
 
 static struct bindata *
-res_to_bin_dialog (dialog, big_endian)
-     const struct dialog *dialog;
-     int big_endian;
+res_to_bin_dialog (const struct dialog *dialog, int big_endian)
 {
   int dialogex;
   struct bindata *first, **pp;
 {
   int dialogex;
   struct bindata *first, **pp;
@@ -1621,12 +1570,14 @@ res_to_bin_dialog (dialog, big_endian)
          if (dialog->ex == NULL)
            {
              put_16 (big_endian, 0, d->data + 2);
          if (dialog->ex == NULL)
            {
              put_16 (big_endian, 0, d->data + 2);
-             put_16 (big_endian, 0, d->data + 4);
+             put_8 (0, d->data + 4);
+             put_8 (1, d->data + 5);
            }
          else
            {
              put_16 (big_endian, dialog->ex->weight, d->data + 2);
            }
          else
            {
              put_16 (big_endian, dialog->ex->weight, d->data + 2);
-             put_16 (big_endian, dialog->ex->italic, d->data + 4);
+             put_8 (dialog->ex->italic, d->data + 4);
+             put_8 (dialog->ex->charset, d->data + 5);
            }
        }
 
            }
        }
 
@@ -1674,9 +1625,9 @@ res_to_bin_dialog (dialog, big_endian)
       put_16 (big_endian, dc->height, d->data + dcoff + 6);
 
       if (dialogex)
       put_16 (big_endian, dc->height, d->data + dcoff + 6);
 
       if (dialogex)
-        put_32 (big_endian, dc->id, d->data + dcoff + 8);
+       put_32 (big_endian, dc->id, d->data + dcoff + 8);
       else
       else
-        put_16 (big_endian, dc->id, d->data + dcoff + 8);
+       put_16 (big_endian, dc->id, d->data + dcoff + 8);
 
       *pp = d;
       pp = &d->next;
 
       *pp = d;
       pp = &d->next;
@@ -1728,9 +1679,7 @@ res_to_bin_dialog (dialog, big_endian)
 /* Convert a fontdir resource to binary.  */
 
 static struct bindata *
 /* Convert a fontdir resource to binary.  */
 
 static struct bindata *
-res_to_bin_fontdir (fontdirs, big_endian)
-     const struct fontdir *fontdirs;
-     int big_endian;
+res_to_bin_fontdir (const struct fontdir *fontdirs, int big_endian)
 {
   struct bindata *first, **pp;
   int c;
 {
   struct bindata *first, **pp;
   int c;
@@ -1765,20 +1714,18 @@ res_to_bin_fontdir (fontdirs, big_endian)
 
       d->next = NULL;
       *pp = d;
 
       d->next = NULL;
       *pp = d;
-      pp = &d->next;      
+      pp = &d->next;
     }
 
   put_16 (big_endian, c, first->data);
 
     }
 
   put_16 (big_endian, c, first->data);
 
-  return first;  
+  return first;
 }
 
 /* Convert a group icon resource to binary.  */
 
 static struct bindata *
 }
 
 /* Convert a group icon resource to binary.  */
 
 static struct bindata *
-res_to_bin_group_icon (group_icons, big_endian)
-     const struct group_icon *group_icons;
-     int big_endian;
+res_to_bin_group_icon (const struct group_icon *group_icons, int big_endian)
 {
   struct bindata *first, **pp;
   int c;
 {
   struct bindata *first, **pp;
   int c;
@@ -1827,9 +1774,7 @@ res_to_bin_group_icon (group_icons, big_endian)
 /* Convert a menu resource to binary.  */
 
 static struct bindata *
 /* Convert a menu resource to binary.  */
 
 static struct bindata *
-res_to_bin_menu (menu, big_endian)
-     const struct menu *menu;
-     int big_endian;
+res_to_bin_menu (const struct menu *menu, int big_endian)
 {
   int menuex;
   struct bindata *d;
 {
   int menuex;
   struct bindata *d;
@@ -1862,9 +1807,7 @@ res_to_bin_menu (menu, big_endian)
 /* Convert menu items to binary.  */
 
 static struct bindata *
 /* Convert menu items to binary.  */
 
 static struct bindata *
-res_to_bin_menuitems (items, big_endian)
-     const struct menuitem *items;
-     int big_endian;
+res_to_bin_menuitems (const struct menuitem *items, int big_endian)
 {
   struct bindata *first, **pp;
   const struct menuitem *mi;
 {
   struct bindata *first, **pp;
   const struct menuitem *mi;
@@ -1912,9 +1855,7 @@ res_to_bin_menuitems (items, big_endian)
 /* Convert menuex items to binary.  */
 
 static struct bindata *
 /* Convert menuex items to binary.  */
 
 static struct bindata *
-res_to_bin_menuexitems (items, big_endian)
-     const struct menuitem *items;
-     int big_endian;
+res_to_bin_menuexitems (const struct menuitem *items, int big_endian)
 {
   struct bindata *first, **pp;
   unsigned long length;
 {
   struct bindata *first, **pp;
   unsigned long length;
@@ -1986,9 +1927,7 @@ res_to_bin_menuexitems (items, big_endian)
    to binary.  */
 
 static struct bindata *
    to binary.  */
 
 static struct bindata *
-res_to_bin_rcdata (items, big_endian)
-     const struct rcdata_item *items;
-     int big_endian;
+res_to_bin_rcdata (const struct rcdata_item *items, int big_endian)
 {
   struct bindata *first, **pp;
   const struct rcdata_item *ri;
 {
   struct bindata *first, **pp;
   const struct rcdata_item *ri;
@@ -2052,9 +1991,7 @@ res_to_bin_rcdata (items, big_endian)
 /* Convert a stringtable resource to binary.  */
 
 static struct bindata *
 /* Convert a stringtable resource to binary.  */
 
 static struct bindata *
-res_to_bin_stringtable (st, big_endian)
-     const struct stringtable *st;
-     int big_endian;
+res_to_bin_stringtable (const struct stringtable *st, int big_endian)
 {
   struct bindata *first, **pp;
   int i;
 {
   struct bindata *first, **pp;
   int i;
@@ -2082,7 +2019,7 @@ res_to_bin_stringtable (st, big_endian)
 
       d->next = NULL;
       *pp = d;
 
       d->next = NULL;
       *pp = d;
-      pp = &d->next;      
+      pp = &d->next;
     }
 
   return first;
     }
 
   return first;
@@ -2092,9 +2029,7 @@ res_to_bin_stringtable (st, big_endian)
    returns exactly one bindata structure.  */
 
 static struct bindata *
    returns exactly one bindata structure.  */
 
 static struct bindata *
-string_to_unicode_bin (s, big_endian)
-     const char *s;
-     int big_endian;
+string_to_unicode_bin (const char *s, int big_endian)
 {
   size_t len, i;
   struct bindata *d;
 {
   size_t len, i;
   struct bindata *d;
@@ -2111,15 +2046,13 @@ string_to_unicode_bin (s, big_endian)
 
   d->next = NULL;
 
 
   d->next = NULL;
 
-  return d;  
+  return d;
 }
 
 /* Convert a versioninfo resource to binary.  */
 
 static struct bindata *
 }
 
 /* Convert a versioninfo resource to binary.  */
 
 static struct bindata *
-res_to_bin_versioninfo (versioninfo, big_endian)
-     const struct versioninfo *versioninfo;
-     int big_endian;
+res_to_bin_versioninfo (const struct versioninfo *versioninfo, int big_endian)
 {
   struct bindata *first, **pp;
   unsigned long length;
 {
   struct bindata *first, **pp;
   unsigned long length;
@@ -2276,7 +2209,7 @@ res_to_bin_versioninfo (versioninfo, big_endian)
                vsslen += length - hold;
 
                *pp = unicode_to_bin (vs->value, big_endian);
                vsslen += length - hold;
 
                *pp = unicode_to_bin (vs->value, big_endian);
-               put_16 (big_endian, (*pp)->length / 2, vssd->data + 2);
+               put_16 (big_endian, (*pp)->length / 2, vssd->data + 2);
                length += (*pp)->length;
                vilen += (*pp)->length;
                vslen += (*pp)->length;
                length += (*pp)->length;
                vilen += (*pp)->length;
                vslen += (*pp)->length;
@@ -2371,9 +2304,7 @@ res_to_bin_versioninfo (versioninfo, big_endian)
 /* Convert a generic resource to binary.  */
 
 static struct bindata *
 /* Convert a generic resource to binary.  */
 
 static struct bindata *
-res_to_bin_generic (length, data)
-     unsigned long length;
-     const unsigned char *data;
+res_to_bin_generic (unsigned long length, const unsigned char *data)
 {
   struct bindata *d;
 
 {
   struct bindata *d;
 
This page took 0.032756 seconds and 4 git commands to generate.