]> git.draconx.ca Git - upkg.git/blobdiff - src/pack.h
libupkg: Remove checks for an unsigned quantity being less than 0.
[upkg.git] / src / pack.h
index 283f28cf0923bc71e66e6bc01f567ca5101946e0..8413fdb71c3c2b542484127c907697aa00e9049d 100644 (file)
@@ -1,3 +1,13 @@
+/*
+ *  Portable binary serialisation of integral types.
+ *  Copyright (C) 2009 Nick Bowler
+ *
+ *  Copying and distribution of this file, with or without modification,
+ *  are permitted in any medium without royalty provided the copyright
+ *  notice and this notice are preserved.  This file is offered as-is,
+ *  without any warranty.
+ */
+
 #ifndef PACK_H_
 #define PACK_H_
 
@@ -15,16 +25,28 @@ void pack_32_le(unsigned char *, unsigned long);
 void pack_64_le(unsigned char *, unsigned long long);
 #endif
 
-unsigned short unpack_16_be(unsigned char *);
-unsigned long  unpack_32_be(unsigned char *);
+unsigned short unpack_16_be(const unsigned char *);
+unsigned long  unpack_32_be(const unsigned char *);
 #ifdef ULLONG_MAX
-unsigned long long unpack_64_be(unsigned char *);
+unsigned long long unpack_64_be(const unsigned char *);
 #endif
 
-unsigned short unpack_16_le(unsigned char *);
-unsigned long  unpack_32_le(unsigned char *);
+unsigned short unpack_16_le(const unsigned char *);
+unsigned long  unpack_32_le(const unsigned char *);
 #ifdef ULLONG_MAX
-unsigned long long unpack_64_le(unsigned char *);
+unsigned long long unpack_64_le(const unsigned char *);
+#endif
+
+short unpack_s16_be(const unsigned char *);
+long  unpack_s32_be(const unsigned char *);
+#ifdef LLONG_MAX
+long long unpack_s64_be(const unsigned char *);
+#endif
+
+short unpack_s16_le(const unsigned char *);
+long  unpack_s32_le(const unsigned char *);
+#ifdef LLONG_MAX
+long long unpack_s64_le(const unsigned char *);
 #endif
 
 #endif