Windows: Use correct calling convention for com_err

This commit is contained in:
Asanka Herath
2010-07-14 01:20:23 -04:00
parent 4ea2e07b21
commit 225e142ac5
3 changed files with 51 additions and 19 deletions

View File

@@ -31,6 +31,8 @@
RELDIR = lib\com_err
intcflags=-DBUILD_KRB5_LIB
!include ../../windows/NTMakefile.w32
INCFILES=$(INCDIR)\com_err.h $(INCDIR)\com_right.h

View File

@@ -43,7 +43,7 @@
struct et_list *_et_list = NULL;
const char *
KRB5_LIB_FUNCTION const char * KRB5_LIB_CALL
error_message (long code)
{
static char msg[128];
@@ -61,18 +61,18 @@ error_message (long code)
return msg;
}
int
KRB5_LIB_FUNCTION int KRB5_LIB_CALL
init_error_table(const char **msgs, long base, int count)
{
initialize_error_table_r(&_et_list, msgs, count, base);
return 0;
}
static void
static void KRB5_CALLCONV
default_proc (const char *whoami, long code, const char *fmt, va_list args)
__attribute__((__format__(__printf__, 3, 0)));
static void
static void KRB5_CALLCONV
default_proc (const char *whoami, long code, const char *fmt, va_list args)
{
if (whoami)
@@ -86,7 +86,7 @@ default_proc (const char *whoami, long code, const char *fmt, va_list args)
static errf com_err_hook = default_proc;
void
KRB5_LIB_FUNCTION void KRB5_LIB_CALL
com_err_va (const char *whoami,
long code,
const char *fmt,
@@ -95,7 +95,7 @@ com_err_va (const char *whoami,
(*com_err_hook) (whoami, code, fmt, args);
}
void
KRB5_LIB_FUNCTION void KRB5_LIB_CALL
com_err (const char *whoami,
long code,
const char *fmt,
@@ -107,7 +107,7 @@ com_err (const char *whoami,
va_end(ap);
}
errf
KRB5_LIB_FUNCTION errf KRB5_LIB_CALL
set_com_err_hook (errf new)
{
errf old = com_err_hook;
@@ -120,7 +120,7 @@ set_com_err_hook (errf new)
return old;
}
errf
KRB5_LIB_FUNCTION errf KRB5_LIB_CALL
reset_com_err_hook (void)
{
return set_com_err_hook(NULL);
@@ -134,7 +134,7 @@ static const char char_set[] =
static char buf[6];
const char *
KRB5_LIB_FUNCTION const char * KRB5_LIB_CALL
error_table_name(int num)
{
int ch;
@@ -156,7 +156,7 @@ error_table_name(int num)
return(buf);
}
void
KRB5_LIB_FUNCTION void KRB5_LIB_CALL
add_to_error_table(struct et_list *new_table)
{
struct et_list *et;

View File

@@ -45,22 +45,52 @@
#define __attribute__(X)
#endif
typedef void (*errf) (const char *, long, const char *, va_list);
#ifndef KRB5_LIB
#ifndef KRB5_LIB_FUNCTION
#if defined(_WIN32)
#define KRB5_LIB_FUNCTION __declspec(dllimport)
#define KRB5_LIB_CALL __stdcall
#define KRB5_LIB_VARIABLE __declspec(dllimport)
#else
#define KRB5_LIB_FUNCTION
#define KRB5_LIB_CALL
#define KRB5_LIB_VARIABLE
#endif
#endif
#endif
const char * error_message (long);
int init_error_table (const char**, long, int);
#ifdef _WIN32
#define KRB5_CALLCONV __stdcall
#else
#define KRB5_CALLCONV
#endif
void com_err_va (const char *, long, const char *, va_list)
typedef void (KRB5_CALLCONV *errf) (const char *, long, const char *, va_list);
KRB5_LIB_FUNCTION const char * KRB5_LIB_CALL
error_message (long);
KRB5_LIB_FUNCTION int KRB5_LIB_CALL
init_error_table (const char**, long, int);
KRB5_LIB_FUNCTION void KRB5_LIB_CALL
com_err_va (const char *, long, const char *, va_list)
__attribute__((format(printf, 3, 0)));
void com_err (const char *, long, const char *, ...)
KRB5_LIB_FUNCTION void KRB5_LIB_CALL
com_err (const char *, long, const char *, ...)
__attribute__((format(printf, 3, 4)));
errf set_com_err_hook (errf);
errf reset_com_err_hook (void);
KRB5_LIB_FUNCTION errf KRB5_LIB_CALL
set_com_err_hook (errf);
const char *error_table_name (int num);
KRB5_LIB_FUNCTION errf KRB5_LIB_CALL
reset_com_err_hook (void);
void add_to_error_table (struct et_list *new_table);
KRB5_LIB_FUNCTION const char * KRB5_LIB_CALL
error_table_name (int num);
KRB5_LIB_FUNCTION void KRB5_LIB_CALL
add_to_error_table (struct et_list *new_table);
#endif /* __COM_ERR_H__ */