]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
compare.c (uuid_compare), copy.c (uuid_copy),
authorTheodore Ts'o <tytso@mit.edu>
Tue, 11 Sep 2001 00:30:09 +0000 (20:30 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 11 Sep 2001 00:30:09 +0000 (20:30 -0400)
isnull.c (uuid_is_null), pack.c (uuid_pack),
parse.c (uuid_parse), unpack.c (uuid_unpack),
unparse.c (uuid_unparse), uuid.h, uuidP.h,
uuid_time.c (uuid_time, uuid_type, uuid_variant):
Use const for pointer variables that we don't modify.  Add
the appropriate ifdef's in uuid.h to make it be C++ friendly.

lib/uuid/ChangeLog
lib/uuid/compare.c
lib/uuid/copy.c
lib/uuid/isnull.c
lib/uuid/pack.c
lib/uuid/parse.c
lib/uuid/unpack.c
lib/uuid/unparse.c
lib/uuid/uuid.h
lib/uuid/uuidP.h
lib/uuid/uuid_time.c

index a63d278e7135578aa6abba67e72a116d196a8e18..0501731a1a42b54090a9db851c9864b618e1c7a1 100644 (file)
@@ -1,3 +1,13 @@
+2001-09-10  Theodore Tso  <tytso@valinux.com>
+
+       * compare.c (uuid_compare), copy.c (uuid_copy), 
+               isnull.c (uuid_is_null), pack.c (uuid_pack), 
+               parse.c (uuid_parse), unpack.c (uuid_unpack),
+               unparse.c (uuid_unparse), uuid.h, uuidP.h, 
+               uuid_time.c (uuid_time, uuid_type, uuid_variant):
+               Use const for pointer variables that we don't modify.  Add
+               the appropriate ifdef's in uuid.h to make it be C++ friendly.
+
 2001-09-02  Theodore Tso  <tytso@thunk.org>
 
        * Release of E2fsprogs 1.24a
index cc335f5e98866adddbd61f244352daaa49e1b287..0f9737c5cf5859526a87422df57c07e2fa24e92c 100644 (file)
@@ -16,7 +16,7 @@
 
 #define UUCMP(u1,u2) if (u1 != u2) return((u1 < u2) ? -1 : 1);
 
-int uuid_compare(uuid_t uu1, uuid_t uu2)
+int uuid_compare(const uuid_t uu1, const uuid_t uu2)
 {
        struct uuid     uuid1, uuid2;
 
index 213a9e51f646d0171c86ebb6d4b5bb6ac3b36415..b9a34dac58866541e86fcbe83426543a47056b80 100644 (file)
 
 #include "uuidP.h"
 
-void uuid_copy(uuid_t dst, uuid_t src)
+void uuid_copy(uuid_t dst, const uuid_t src)
 {
-       unsigned char   *cp1, *cp2;
-       int             i;
+       unsigned char           *cp1;
+       const unsigned char     *cp2;
+       int                     i;
 
        for (i=0, cp1 = dst, cp2 = src; i < 16; i++)
                *cp1++ = *cp2++;
index ea3e5540afb3fe01b0c9147683dabd0ae1ce6dfb..8aba238a0ebbd97d5113bc9ec14b3abee9b2c79e 100644 (file)
 #include "uuidP.h"
 
 /* Returns 1 if the uuid is the NULL uuid */
-int uuid_is_null(uuid_t uu)
+int uuid_is_null(const uuid_t uu)
 {
-       unsigned char   *cp;
-       int             i;
+       const unsigned char     *cp;
+       int                     i;
 
        for (i=0, cp = uu; i < 16; i++)
                if (*cp++)
index b7a1a91a5cb6dbf343e4e11f50261f2959ea20f3..1303ef5236b8e56d32f69ea0f00845704534b302 100644 (file)
@@ -12,7 +12,7 @@
 #include <string.h>
 #include "uuidP.h"
 
-void uuid_pack(struct uuid *uu, uuid_t ptr)
+void uuid_pack(const struct uuid *uu, uuid_t ptr)
 {
        __u32   tmp;
        unsigned char   *out = ptr;
index 6c6fe315b862b6d09cb58d680bc774327f8b7fa6..13d529733d4ad34a11c0bb2c0c5121bc44c25c17 100644 (file)
 
 #include "uuidP.h"
 
-int uuid_parse(char *in, uuid_t uu)
+int uuid_parse(const char *in, uuid_t uu)
 {
-       struct uuid uuid;
-       int i;
-       char *cp, buf[3];
+       struct uuid     uuid;
+       int             i;
+       const char      *cp;
+       char            buf[3];
 
        if (strlen(in) != 36)
                return -1;
index 46ab6bc51079f89fe9906d481a7ccdd3d9656b2d..02005dde13fa723bc3f4c6ab252a42baa475ed9b 100644 (file)
 #include <string.h>
 #include "uuidP.h"
 
-void uuid_unpack(uuid_t in, struct uuid *uu)
+void uuid_unpack(const uuid_t in, struct uuid *uu)
 {
-       __u8    *ptr = in;
-       __u32   tmp;
+       const __u8      *ptr = in;
+       __u32           tmp;
 
        tmp = *ptr++;
        tmp = (tmp << 8) | *ptr++;
index bae5c1be5c315bf3d7c78edbb03150b3168e1017..db3ef0480c7dea60cc0ce6e52224b57744e6649d 100644 (file)
@@ -13,7 +13,7 @@
 
 #include "uuidP.h"
 
-void uuid_unparse(uuid_t uu, char *out)
+void uuid_unparse(const uuid_t uu, char *out)
 {
        struct uuid uuid;
 
index db0147c7252b1cf4b038157ac41a2423202dbb13..5720d7f09b2e0b066c17013da8dc668e96e29ab9 100644 (file)
@@ -24,14 +24,18 @@ typedef unsigned char uuid_t[16];
 #define UUID_VARIANT_MICROSOFT 2
 #define UUID_VARIANT_OTHER     3
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /* clear.c */
 void uuid_clear(uuid_t uu);
 
 /* compare.c */
-int uuid_compare(uuid_t uu1, uuid_t uu2);
+int uuid_compare(const uuid_t uu1, const uuid_t uu2);
 
 /* copy.c */
-void uuid_copy(uuid_t dst, uuid_t src);
+void uuid_copy(uuid_t dst, const uuid_t src);
 
 /* gen_uuid.c */
 void uuid_generate(uuid_t out);
@@ -39,17 +43,21 @@ void uuid_generate_random(uuid_t out);
 void uuid_generate_time(uuid_t out);
 
 /* isnull.c */
-int uuid_is_null(uuid_t uu);
+int uuid_is_null(const uuid_t uu);
 
 /* parse.c */
-int uuid_parse(char *in, uuid_t uu);
+int uuid_parse(const char *in, uuid_t uu);
 
 /* unparse.c */
-void uuid_unparse(uuid_t uu, char *out);
+void uuid_unparse(const uuid_t uu, char *out);
 
 /* uuid_time.c */
-time_t uuid_time(uuid_t uu, struct timeval *ret_tv);
-int uuid_type(uuid_t uu);
-int uuid_variant(uuid_t uu);
+time_t uuid_time(const uuid_t uu, struct timeval *ret_tv);
+int uuid_type(const uuid_t uu);
+int uuid_variant(const uuid_t uu);
+
+#ifdef __cplusplus
+}
+#endif
 
 #endif /* _UUID_UUID_H */
index e6bc00e19dbe98a9fab33c5f738cb2e821f4034b..50407c02f624ffb0ea01ad3c51f1562ccd3e7454 100644 (file)
@@ -32,8 +32,8 @@ struct uuid {
 /*
  * prototypes
  */
-void uuid_pack(struct uuid *uu, uuid_t ptr);
-void uuid_unpack(uuid_t in, struct uuid *uu);
+void uuid_pack(const struct uuid *uu, uuid_t ptr);
+void uuid_unpack(const uuid_t in, struct uuid *uu);
 
 
 
index 2783875d350a8a2d7bd01e292d8a3828cfc2f72d..dee87e108f3f0aa59019bc6e5f3b9de74e7363f2 100644 (file)
@@ -20,7 +20,7 @@
 
 #include "uuidP.h"
 
-time_t uuid_time(uuid_t uu, struct timeval *ret_tv)
+time_t uuid_time(const uuid_t uu, struct timeval *ret_tv)
 {
        struct uuid             uuid;
        __u32                   high;
@@ -42,7 +42,7 @@ time_t uuid_time(uuid_t uu, struct timeval *ret_tv)
        return tv.tv_sec;
 }
 
-int uuid_type(uuid_t uu)
+int uuid_type(const uuid_t uu)
 {
        struct uuid             uuid;
 
@@ -50,7 +50,7 @@ int uuid_type(uuid_t uu)
        return ((uuid.time_hi_and_version >> 12) & 0xF);
 }
 
-int uuid_variant(uuid_t uu)
+int uuid_variant(const uuid_t uu)
 {
        struct uuid             uuid;
        int                     var;