Handle enumerations with the full range of signed and unsigned values

The C compiler will pick an enumeration type that accomodates the specified
values for the enumeration, so ignoring 64-bit enumerations, we can
have enumeration values from MININT32 to MAXUINT32. To handle this properly:

 - Use gint64 for holding eumeration values when scanning
 - Add a 'unsigned_value' bit to ValueBlob so we can distinguish the
   int32 vs. uint32 cases in the typelib
 - Change the return value of g_value_info_get_value() to gint64.

https://bugzilla.gnome.org/show_bug.cgi?id=629704
This commit is contained in:
Owen W. Taylor
2010-09-14 11:59:03 -04:00
parent 7fa7162361
commit ec76ea8628
8 changed files with 28 additions and 17 deletions

View File

@@ -632,6 +632,7 @@ typedef struct {
/**
* ValueBlob:
* @deprecated: Whether this value is deprecated
* @unsigned_value: if set, value is a 32-bit unsigned integer cast to gint32
* @value: The numerical value
* @name: Name of blob
*
@@ -639,8 +640,9 @@ typedef struct {
*/
typedef struct {
guint32 deprecated : 1;
guint32 unsigned_value : 1;
/* <private> */
guint32 reserved :31;
guint32 reserved :30;
/* <public> */
guint32 name;
gint32 value;