ossp-pkg/uuid/uuid.c 1.24 -> 1.25
--- uuid.c 2004/01/15 12:32:26 1.24
+++ uuid.c 2004/01/15 12:38:32 1.25
@@ -27,6 +27,7 @@
** uuid.c: library API implementation
*/
+/* system headers */
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
@@ -39,6 +40,7 @@
#include <sys/time.h>
#include <sys/types.h>
+/* own headers */
#include "config.h"
#include "uuid.h"
#include "uuid_md5.h"
@@ -47,69 +49,7 @@
#include "uuid_ui64.h"
#include "uuid_str.h"
#include "uuid_bm.h"
-
-/* determine types of 8-bit size */
-#if SIZEOF_CHAR == 1
-typedef char uuid_int8_t;
-#else
-#error uexpected: sizeof(char) != 1 !?
-#endif
-#if SIZEOF_UNSIGNED_CHAR == 1
-typedef unsigned char uuid_uint8_t;
-#else
-#error uexpected: sizeof(unsigned char) != 1 !?
-#endif
-
-/* determine types of 16-bit size */
-#if SIZEOF_SHORT == 2
-typedef short uuid_int16_t;
-#elif SIZEOF_INT == 2
-typedef int uuid_int16_t;
-#elif SIZEOF_LONG == 2
-typedef long uuid_int16_t;
-#else
-#error unexpected: no type found for uuid_int16_t
-#endif
-#if SIZEOF_UNSIGNED_SHORT == 2
-typedef unsigned short uuid_uint16_t;
-#elif SIZEOF_UNSIGNED_INT == 2
-typedef unsigned int uuid_uint16_t;
-#elif SIZEOF_UNSIGNED_LONG == 2
-typedef unsigned long uuid_uint16_t;
-#else
-#error unexpected: no type found for uuid_uint16_t
-#endif
-
-/* determine types of 32-bit size */
-#if SIZEOF_SHORT == 4
-typedef short uuid_int32_t;
-#elif SIZEOF_INT == 4
-typedef int uuid_int32_t;
-#elif SIZEOF_LONG == 4
-typedef long uuid_int32_t;
-#elif SIZEOF_LONG_LONG == 4
-typedef long long uuid_int32_t;
-#else
-#error unexpected: no type found for uuid_int32_t
-#endif
-#if SIZEOF_UNSIGNED_SHORT == 4
-typedef unsigned short uuid_uint32_t;
-#elif SIZEOF_UNSIGNED_INT == 4
-typedef unsigned int uuid_uint32_t;
-#elif SIZEOF_UNSIGNED_LONG == 4
-typedef unsigned long uuid_uint32_t;
-#elif SIZEOF_UNSIGNED_LONG_LONG == 4
-typedef unsigned long long uuid_uint32_t;
-#else
-#error unexpected: no type found for uuid_uint32_t
-#endif
-
-#ifndef FALSE
-#define FALSE 0
-#endif
-#ifndef TRUE
-#define TRUE !FALSE
-#endif
+#include "uuid_ac.h"
/* UUID binary representation according to UUID standards */
typedef struct {
@@ -206,10 +146,10 @@
return UUID_RC_ARG;
/* a "nil UUID" is defined as all octets zero, so check for this case */
- *result = TRUE;
+ *result = UUID_TRUE;
for (i = 0, ucp = (unsigned char *)&(uuid->obj); i < UUID_LEN_BIN; i++) {
if (*ucp++ != '\0') {
- *result = FALSE;
+ *result = UUID_FALSE;
break;
}
}
@@ -376,23 +316,23 @@
012345678901234567890123456789012345
0 1 2 3 */
if (str == NULL)
- return FALSE;
+ return UUID_FALSE;
if (strlen(str) != UUID_LEN_STR)
- return FALSE;
+ return UUID_FALSE;
for (i = 0, cp = str; i <= UUID_LEN_STR; i++, cp++) {
if ((i == 8) || (i == 13) || (i == 18) || (i == 23)) {
if (*cp == '-')
continue;
else
- return FALSE;
+ return UUID_FALSE;
}
if (i == UUID_LEN_STR)
if (*cp == '\0')
continue;
if (!isxdigit((int)(*cp)))
- return FALSE;
+ return UUID_FALSE;
}
- return TRUE;
+ return UUID_TRUE;
}
/* parse string representation into UUID object */
|
|