# define SWAP64 OSSwapInt64
#endif
+/* Note that on Windows at least this file can be included from C++
+ source, so casts *from* void* are required. */
static inline void
store_16_be (unsigned int val, void *vp)
{
- unsigned char *p = vp;
-#if defined(__GNUC__) && defined(K5_BE)
+ unsigned char *p = (unsigned char *) vp;
+#if defined(__GNUC__) && defined(K5_BE) && !defined(__cplusplus)
PUT(16,p,val);
-#elif defined(__GNUC__) && defined(K5_LE) && defined(SWAP16)
+#elif defined(__GNUC__) && defined(K5_LE) && defined(SWAP16) && !defined(__cplusplus)
PUTSWAPPED(16,p,val);
#else
p[0] = (val >> 8) & 0xff;
static inline void
store_32_be (unsigned int val, void *vp)
{
- unsigned char *p = vp;
-#if defined(__GNUC__) && defined(K5_BE)
+ unsigned char *p = (unsigned char *) vp;
+#if defined(__GNUC__) && defined(K5_BE) && !defined(__cplusplus)
PUT(32,p,val);
-#elif defined(__GNUC__) && defined(K5_LE) && defined(SWAP32)
+#elif defined(__GNUC__) && defined(K5_LE) && defined(SWAP32) && !defined(__cplusplus)
PUTSWAPPED(32,p,val);
#else
p[0] = (val >> 24) & 0xff;
static inline void
store_64_be (UINT64_TYPE val, void *vp)
{
- unsigned char *p = vp;
-#if defined(__GNUC__) && defined(K5_BE)
+ unsigned char *p = (unsigned char *) vp;
+#if defined(__GNUC__) && defined(K5_BE) && !defined(__cplusplus)
PUT(64,p,val);
-#elif defined(__GNUC__) && defined(K5_LE) && defined(SWAP64)
+#elif defined(__GNUC__) && defined(K5_LE) && defined(SWAP64) && !defined(__cplusplus)
PUTSWAPPED(64,p,val);
#else
p[0] = (unsigned char)((val >> 56) & 0xff);
static inline unsigned short
load_16_be (const void *cvp)
{
- const unsigned char *p = cvp;
-#if defined(__GNUC__) && defined(K5_BE)
+ const unsigned char *p = (const unsigned char *) cvp;
+#if defined(__GNUC__) && defined(K5_BE) && !defined(__cplusplus)
return GET(16,p);
-#elif defined(__GNUC__) && defined(K5_LE) && defined(SWAP16)
+#elif defined(__GNUC__) && defined(K5_LE) && defined(SWAP16) && !defined(__cplusplus)
return GETSWAPPED(16,p);
#else
return (p[1] | (p[0] << 8));
static inline unsigned int
load_32_be (const void *cvp)
{
- const unsigned char *p = cvp;
-#if defined(__GNUC__) && defined(K5_BE)
+ const unsigned char *p = (const unsigned char *) cvp;
+#if defined(__GNUC__) && defined(K5_BE) && !defined(__cplusplus)
return GET(32,p);
-#elif defined(__GNUC__) && defined(K5_LE) && defined(SWAP32)
+#elif defined(__GNUC__) && defined(K5_LE) && defined(SWAP32) && !defined(__cplusplus)
return GETSWAPPED(32,p);
#else
return (p[3] | (p[2] << 8)
static inline UINT64_TYPE
load_64_be (const void *cvp)
{
- const unsigned char *p = cvp;
-#if defined(__GNUC__) && defined(K5_BE)
+ const unsigned char *p = (const unsigned char *) cvp;
+#if defined(__GNUC__) && defined(K5_BE) && !defined(__cplusplus)
return GET(64,p);
-#elif defined(__GNUC__) && defined(K5_LE) && defined(SWAP64)
+#elif defined(__GNUC__) && defined(K5_LE) && defined(SWAP64) && !defined(__cplusplus)
return GETSWAPPED(64,p);
#else
return ((UINT64_TYPE)load_32_be(p) << 32) | load_32_be(p+4);
static inline void
store_16_le (unsigned int val, void *vp)
{
- unsigned char *p = vp;
-#if defined(__GNUC__) && defined(K5_LE)
+ unsigned char *p = (unsigned char *) vp;
+#if defined(__GNUC__) && defined(K5_LE) && !defined(__cplusplus)
PUT(16,p,val);
-#elif defined(__GNUC__) && defined(K5_BE) && defined(SWAP16)
+#elif defined(__GNUC__) && defined(K5_BE) && defined(SWAP16) && !defined(__cplusplus)
PUTSWAPPED(16,p,val);
#else
p[1] = (val >> 8) & 0xff;
static inline void
store_32_le (unsigned int val, void *vp)
{
- unsigned char *p = vp;
-#if defined(__GNUC__) && defined(K5_LE)
+ unsigned char *p = (unsigned char *) vp;
+#if defined(__GNUC__) && defined(K5_LE) && !defined(__cplusplus)
PUT(32,p,val);
-#elif defined(__GNUC__) && defined(K5_BE) && defined(SWAP32)
+#elif defined(__GNUC__) && defined(K5_BE) && defined(SWAP32) && !defined(__cplusplus)
PUTSWAPPED(32,p,val);
#else
p[3] = (val >> 24) & 0xff;
static inline void
store_64_le (UINT64_TYPE val, void *vp)
{
- unsigned char *p = vp;
-#if defined(__GNUC__) && defined(K5_LE)
+ unsigned char *p = (unsigned char *) vp;
+#if defined(__GNUC__) && defined(K5_LE) && !defined(__cplusplus)
PUT(64,p,val);
-#elif defined(__GNUC__) && defined(K5_BE) && defined(SWAP64)
+#elif defined(__GNUC__) && defined(K5_BE) && defined(SWAP64) && !defined(__cplusplus)
PUTSWAPPED(64,p,val);
#else
p[7] = (unsigned char)((val >> 56) & 0xff);
static inline unsigned short
load_16_le (const void *cvp)
{
- const unsigned char *p = cvp;
-#if defined(__GNUC__) && defined(K5_LE)
+ const unsigned char *p = (const unsigned char *) cvp;
+#if defined(__GNUC__) && defined(K5_LE) && !defined(__cplusplus)
return GET(16,p);
-#elif defined(__GNUC__) && defined(K5_BE) && defined(SWAP16)
+#elif defined(__GNUC__) && defined(K5_BE) && defined(SWAP16) && !defined(__cplusplus)
return GETSWAPPED(16,p);
#else
return (p[0] | (p[1] << 8));
static inline unsigned int
load_32_le (const void *cvp)
{
- const unsigned char *p = cvp;
-#if defined(__GNUC__) && defined(K5_LE)
+ const unsigned char *p = (const unsigned char *) cvp;
+#if defined(__GNUC__) && defined(K5_LE) && !defined(__cplusplus)
return GET(32,p);
-#elif defined(__GNUC__) && defined(K5_BE) && defined(SWAP32)
+#elif defined(__GNUC__) && defined(K5_BE) && defined(SWAP32) && !defined(__cplusplus)
return GETSWAPPED(32,p);
#else
return (p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24));
static inline UINT64_TYPE
load_64_le (const void *cvp)
{
- const unsigned char *p = cvp;
-#if defined(__GNUC__) && defined(K5_LE)
+ const unsigned char *p = (const unsigned char *) cvp;
+#if defined(__GNUC__) && defined(K5_LE) && !defined(__cplusplus)
return GET(64,p);
-#elif defined(__GNUC__) && defined(K5_BE) && defined(SWAP64)
+#elif defined(__GNUC__) && defined(K5_BE) && defined(SWAP64) && !defined(__cplusplus)
return GETSWAPPED(64,p);
#else
return ((UINT64_TYPE)load_32_le(p+4) << 32) | load_32_le(p);
$(srcdir)/test_getpw.c \
$(srcdir)/test_getsockname.c \
$(srcdir)/test_cxx_krb5.cpp \
+ $(srcdir)/test_cxx_k5int.cpp \
$(srcdir)/test_cxx_gss.cpp \
$(srcdir)/test_cxx_rpc.cpp \
$(srcdir)/test_cxx_kadm5.cpp
all:: test_getpw
-check:: test_getpw test_cxx_krb5 test_cxx_gss test_cxx_rpc test_cxx_kadm5
+check:: test_getpw test_cxx_krb5 test_cxx_gss test_cxx_rpc test_cxx_k5int test_cxx_kadm5
$(RUN_SETUP) $(VALGRIND) ./test_getpw
$(RUN_SETUP) $(VALGRIND) ./test_cxx_krb5
+ $(RUN_SETUP) $(VALGRIND) ./test_cxx_k5int
$(RUN_SETUP) $(VALGRIND) ./test_cxx_gss
$(RUN_SETUP) $(VALGRIND) ./test_cxx_rpc
$(RUN_SETUP) $(VALGRIND) ./test_cxx_kadm5
test_cxx_krb5: $(OUTPRE)test_cxx_krb5.$(OBJEXT) $(KRB5_DEPLIB)
$(CXX_LINK) $(ALL_CXXFLAGS) -o test_cxx_krb5 $(OUTPRE)test_cxx_krb5.$(OBJEXT) $(KRB5_BASE_LIBS) $(LIBS)
+test_cxx_k5int: $(OUTPRE)test_cxx_k5int.$(OBJEXT) $(KRB5_DEPLIB)
+ $(CXX_LINK) $(ALL_CXXFLAGS) -o test_cxx_k5int $(OUTPRE)test_cxx_k5int.$(OBJEXT) $(KRB5_BASE_LIBS) $(LIBS)
test_cxx_gss: $(OUTPRE)test_cxx_gss.$(OBJEXT)
$(CXX_LINK) $(ALL_CXXFLAGS) -o test_cxx_gss $(OUTPRE)test_cxx_gss.$(OBJEXT) $(LIBS)
test_cxx_rpc: $(OUTPRE)test_cxx_rpc.$(OBJEXT) $(GSSRPC_DEPLIBS)