Change prop_number_t to store a uint64_t, rather than a uintmax_t. No

ABI change, and we ought to explicitly state that this is a fixed-width
type, since that what it needs to be for binary plist support.
This commit is contained in:
thorpej 2006-07-07 22:29:55 +00:00
parent d266f72a20
commit 723e715a3b
4 changed files with 21 additions and 21 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: prop_number.h,v 1.1 2006/04/27 20:11:27 thorpej Exp $ */
/* $NetBSD: prop_number.h,v 1.2 2006/07/07 22:29:55 thorpej Exp $ */
/*-
* Copyright (c) 2006 The NetBSD Foundation, Inc.
@ -47,16 +47,16 @@
typedef struct _prop_number *prop_number_t;
__BEGIN_DECLS
prop_number_t prop_number_create_integer(uintmax_t);
prop_number_t prop_number_create_integer(uint64_t);
prop_number_t prop_number_copy(prop_number_t);
int prop_number_size(prop_number_t);
uintmax_t prop_number_integer_value(prop_number_t);
uint64_t prop_number_integer_value(prop_number_t);
boolean_t prop_number_equals(prop_number_t, prop_number_t);
boolean_t prop_number_equals_integer(prop_number_t, uintmax_t);
boolean_t prop_number_equals_integer(prop_number_t, uint64_t);
__END_DECLS
#endif /* _PROPLIB_PROP_NUMBER_H_ */

View File

@ -1,4 +1,4 @@
.\" $NetBSD: prop_number.3,v 1.1 2006/04/27 20:11:27 thorpej Exp $
.\" $NetBSD: prop_number.3,v 1.2 2006/07/07 22:29:55 thorpej Exp $
.\"
.\" Copyright (c) 2006 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -52,27 +52,27 @@
.In prop/proplib.h
.\"
.Ft prop_number_t
.Fn prop_number_create_integer "uintmax_t val"
.Fn prop_number_create_integer "uint64_t val"
.Ft prop_number_t
.Fn prop_numbery_copy "prop_number_t number"
.\"
.Ft int
.Fn prop_number_size "prop_number_t number"
.Ft uintmax_t
.Ft uint64_t
.Fn prop_number_integer_value "prop_number_t number"
.\"
.Ft boolean_t
.Fn prop_number_equals "prop_number_t num1" "prop_number_t num2"
.Ft boolean_t
.Fn prop_number_equals_integer "prop_number_t number" "uintmax_t val"
.Fn prop_number_equals_integer "prop_number_t number" "uint64_t val"
.Sh DESCRIPTION
The
.Nm prop_number
family of functions operate on a numeric value property object type.
All values are unsigned and promoted to the type
.Sq uintmax_t .
.Sq uint64_t .
.Bl -tag -width "xxxxx"
.It Fn prop_number_create_integer "uintmax_t val"
.It Fn prop_number_create_integer "uint64_t val"
Create a numeric value object with the value
.Fa val .
.It Fn prop_number_copy "prop_number_t number"
@ -86,7 +86,7 @@ Returns the integer value of the numeric value object.
Returns
.Dv TRUE
if the two numeric value objects are equivalent.
.It Fn prop_number_equals_integer "prop_number_t number" "uintmax_t val"
.It Fn prop_number_equals_integer "prop_number_t number" "uint64_t val"
Returns
.Dv TRUE
if the object's value is equivalent to

View File

@ -1,4 +1,4 @@
/* $NetBSD: prop_number.c,v 1.2 2006/05/18 03:05:19 thorpej Exp $ */
/* $NetBSD: prop_number.c,v 1.3 2006/07/07 22:29:55 thorpej Exp $ */
/*-
* Copyright (c) 2006 The NetBSD Foundation, Inc.
@ -53,7 +53,7 @@
struct _prop_number {
struct _prop_object pn_obj;
uintmax_t pn_number;
uint64_t pn_number;
};
_PROP_POOL_INIT(_prop_number_pool, sizeof(struct _prop_number), "propnmbr")
@ -88,7 +88,7 @@ _prop_number_externalize(struct _prop_object_externalize_context *ctx,
prop_number_t pn = v;
char tmpstr[32];
sprintf(tmpstr, "0x%" PRIxMAX, pn->pn_number);
sprintf(tmpstr, "0x%" PRIx64, pn->pn_number);
if (_prop_object_externalize_start_tag(ctx, "integer") == FALSE ||
_prop_object_externalize_append_cstring(ctx, tmpstr) == FALSE ||
@ -110,7 +110,7 @@ _prop_number_equals(void *v1, void *v2)
}
static prop_number_t
_prop_number_alloc(uintmax_t val)
_prop_number_alloc(uint64_t val)
{
prop_number_t pn;
@ -130,7 +130,7 @@ _prop_number_alloc(uintmax_t val)
* provided integer value.
*/
prop_number_t
prop_number_create_integer(uintmax_t val)
prop_number_create_integer(uint64_t val)
{
return (_prop_number_alloc(val));
@ -172,7 +172,7 @@ prop_number_size(prop_number_t pn)
* prop_number_integer_value --
* Get the integer value of a prop_number_t.
*/
uintmax_t
uint64_t
prop_number_integer_value(prop_number_t pn)
{
@ -196,7 +196,7 @@ prop_number_equals(prop_number_t num1, prop_number_t num2)
* Return TRUE if the number is equivalent to the specified integer.
*/
boolean_t
prop_number_equals_integer(prop_number_t pn, uintmax_t val)
prop_number_equals_integer(prop_number_t pn, uint64_t val)
{
_PROP_ASSERT(prop_object_is_number(pn));
@ -211,7 +211,7 @@ prop_number_equals_integer(prop_number_t pn, uintmax_t val)
prop_object_t
_prop_number_internalize(struct _prop_object_internalize_context *ctx)
{
uintmax_t val = 0;
uint64_t val = 0;
char *cp;
/* No attributes, no empty elements. */

View File

@ -1,4 +1,4 @@
.\" $NetBSD: proplib.3,v 1.1 2006/04/27 20:11:27 thorpej Exp $
.\" $NetBSD: proplib.3,v 1.2 2006/07/07 22:29:55 thorpej Exp $
.\"
.\" Copyright (c) 2006 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -126,7 +126,7 @@ is able to parse base 8, base 10, and base 16
elements.
.It
Internally, integers are always stored as unsigned numbers
.Pq uintmax_t .
.Pq uint64_t .
Therefore, the external representation will never be negative.
.It
Because floating point numbers are not supported,