summaryrefslogtreecommitdiff
path: root/module
diff options
context:
space:
mode:
Diffstat (limited to 'module')
-rw-r--r--module/cryptoki-constants.c4
-rw-r--r--module/cryptoki-log.c32
2 files changed, 22 insertions, 14 deletions
diff --git a/module/cryptoki-constants.c b/module/cryptoki-constants.c
index 8085421..d13488f 100644
--- a/module/cryptoki-constants.c
+++ b/module/cryptoki-constants.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Nate Nielsen
+ * Copyright (c) 2007, Stefan Walter
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -32,7 +32,7 @@
*
*
* CONTRIBUTORS
- * Nate Nielsen <nielsen@memberwebs.com>
+ * Stef Walter <stef@memberwebs.com>
*
*/
diff --git a/module/cryptoki-log.c b/module/cryptoki-log.c
index 7084ae8..f6555f5 100644
--- a/module/cryptoki-log.c
+++ b/module/cryptoki-log.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Nate Nielsen
+ * Copyright (c) 2007, Stefan Walter
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -32,7 +32,7 @@
*
*
* CONTRIBUTORS
- * Nate Nielsen <nielsen@memberwebs.com>
+ * Stef Walter <stef@memberwebs.com>
*
*/
@@ -96,8 +96,8 @@ static FILE* output_file = NULL;
#define PREFIX "PKCS11: "
#define PREFIX_LEN (sizeof(PREFIX) - 1)
-static char win32_line_buf_full[LINE_BUF_LEN + PREFIX_LEN] = { 0, };
-static char* win32_line_buf = win32_line_buf_full + PREFIX_LEN;
+static char the_line_buf_full[LINE_BUF_LEN + PREFIX_LEN] = { 0, };
+static char* the_line_buf = the_line_buf_full + PREFIX_LEN;
static void
cklog_line(const char* line)
@@ -127,29 +127,33 @@ cklog(const char* msg, ...)
va_start (va, msg);
/* Fill in the prefix if necessary */
- if(!win32_line_buf_full[0])
- memcpy(win32_line_buf_full, PREFIX, PREFIX_LEN);
+ if(!the_line_buf_full[0])
+ memcpy(the_line_buf_full, PREFIX, PREFIX_LEN);
/* Length of data already present */
- l = strlen(win32_line_buf);
+ l = strlen(the_line_buf);
/* Line is just too long? */
if(l >= 2048)
l = 0;
/* Print into the buffer */
- _vsnprintf(win32_line_buf + l, LINE_BUF_LEN - l, msg, va);
- win32_line_buf[LINE_BUF_LEN - 1] = 0;
+#ifdef _WIN32
+ _vsnprintf(the_line_buf + l, LINE_BUF_LEN - l, msg, va);
+#else
+ snprintf(the_line_buf + l, LINE_BUF_LEN - l, msg, va);
+#endif
+ the_line_buf[LINE_BUF_LEN - 1] = 0;
va_end (va);
/* Now send out all lines from the buffer */
- while((p = strchr(win32_line_buf, '\n')) != NULL) {
+ while((p = strchr(the_line_buf, '\n')) != NULL) {
ch = p[1];
p[1] = 0;
- cklog_line(win32_line_buf_full);
+ cklog_line(the_line_buf_full);
p[1] = ch;
- memmove(win32_line_buf, p + 1, LINE_BUF_LEN - ((p + 1) - win32_line_buf));
+ memmove(the_line_buf, p + 1, LINE_BUF_LEN - ((p + 1) - the_line_buf));
}
}
@@ -1660,7 +1664,11 @@ static struct CK_FUNCTION_LIST functionList = {
CL_C_WaitForSlotEvent
};
+#ifdef _WIN32
__declspec(dllexport) CK_RV
+#else
+CK_RV
+#endif
C_GetFunctionList (CK_FUNCTION_LIST_PTR_PTR list)
{
if (!list)