2006-03-07 Ken Raeburn <raeburn@mit.edu>
+ * k5-platform.h ({load,store}_{16,32,64}_le): Enable little-endian
+ versions.
+
* k5-locate.h: Renamed from k5-plugin.h.
* k5-plugin.h: New file, with plugin support function declarations
moved from k5-int.h. Change return types from krb5_error_code to
return ((UINT64_TYPE)load_32_be(p) << 32) | load_32_be(p+4);
#endif
}
-#if 0 /* don't need little-endian so far */
static inline void
store_16_le (unsigned int val, unsigned char *p)
{
return ((UINT64_TYPE)load_32_le(p+4) << 32) | load_32_le(p);
#endif
}
-#endif
/* Make the interfaces to getpwnam and getpwuid consistent.
Model the wrappers on the POSIX thread-safe versions, but
+2006-03-07 Ken Raeburn <raeburn@mit.edu>
+
+ * kdb.h: Include k5-platform.h.
+ (krb5_kdb_decode_int16, krb5_kdb_decode_int32): Use load_*_le
+ helper functions.
+ (krb5_kdb_encode_int16, krb5_kdb_encode_int32): Use store_*_le
+ helper functions.
+
2006-03-06 Ken Raeburn <raeburn@mit.edu>
* Makefile.in (PROCESS_REPLACE): Use MODULE_DIR instead of
*
* Data encoding is little-endian.
*/
+#include "k5-platform.h"
#define krb5_kdb_decode_int16(cp, i16) \
- *((krb5_int16 *) &(i16)) = (((krb5_int16) ((unsigned char) (cp)[0]))| \
- ((krb5_int16) ((unsigned char) (cp)[1]) << 8))
+ *((krb5_int16 *) &(i16)) = load_16_le(cp)
#define krb5_kdb_decode_int32(cp, i32) \
- *((krb5_int32 *) &(i32)) = (((krb5_int32) ((unsigned char) (cp)[0]))| \
- ((krb5_int32) ((unsigned char) (cp)[1]) << 8) | \
- ((krb5_int32) ((unsigned char) (cp)[2]) << 16)| \
- ((krb5_int32) ((unsigned char) (cp)[3]) << 24))
-#define krb5_kdb_encode_int16(i16, cp) \
- { \
- (cp)[0] = (unsigned char) ((i16) & 0xff); \
- (cp)[1] = (unsigned char) (((i16) >> 8) & 0xff); \
- }
-#define krb5_kdb_encode_int32(i32, cp) \
- { \
- (cp)[0] = (unsigned char) ((i32) & 0xff); \
- (cp)[1] = (unsigned char) (((i32) >> 8) & 0xff); \
- (cp)[2] = (unsigned char) (((i32) >> 16) & 0xff); \
- (cp)[3] = (unsigned char) (((i32) >> 24) & 0xff); \
- }
+ *((krb5_int32 *) &(i32)) = load_32_le(cp)
+#define krb5_kdb_encode_int16(i16, cp) store_16_le(i16, cp)
+#define krb5_kdb_encode_int32(i32, cp) store_32_le(i32, cp)
#define KRB5_KDB_OPEN_RW 0
#define KRB5_KDB_OPEN_RO 1