Win32:
authorChristian Taedcke <hacking@taedcke.com>
Tue, 08 Nov 2011 08:59:30 +0000
changeset 687 e23df9586397
parent 686 194289baf21b
child 688 514108c6e4c4
Win32:
CHANGED: - Switch character encoding to unicode.
- Changed logging format strings from %s to %S.
FIXED: - second argument to swprintf() is now the size of the target buffer

Win32 IXXAT:
CHANGED: - Changed logging format strings from %s to %S.
drivers/can_ixxat_win32/ixxat.cpp
drivers/win32/win32.c
include/win32/applicfg.h
--- a/drivers/can_ixxat_win32/ixxat.cpp	Tue Nov 08 08:59:05 2011 +0000
+++ b/drivers/can_ixxat_win32/ixxat.cpp	Tue Nov 08 08:59:30 2011 +0000
@@ -198,7 +198,7 @@
        }
    if (index == br_lut_size)
    {
-      MSG_ERR_DRV("IXXAT::open: The given baudrate %s is invalid.", baud_rate);
+      MSG_ERR_DRV("IXXAT::open: The given baudrate %S is invalid.", baud_rate);
       return false;
    }
    // close existing board   
@@ -273,7 +273,7 @@
 
 void VCI_CALLBACKATTR IXXAT::message_handler(char *msg_str)
   {
-  MSG_ERR_DRV("IXXAT Message: [%s]\n", msg_str);
+  MSG_ERR_DRV("IXXAT Message: [%S]\n", msg_str);
   }
 
 void VCI_CALLBACKATTR IXXAT::exception_handler(VCI_FUNC_NUM func_num, INT32 err_code, UINT16 ext_err, char* err_str)
@@ -310,7 +310,7 @@
     "VCI_CciReqData"
     };
 
-  MSG_ERR_DRV("IXXAT Exception: %s (%i / %u) [%s]\n", Num2Function[func_num], err_code, ext_err, err_str);
+  MSG_ERR_DRV("IXXAT Exception: %S (%i / %u) [%S]\n", Num2Function[func_num], err_code, ext_err, err_str);
   }
 
   void IXXAT::watchdog()
--- a/drivers/win32/win32.c	Tue Nov 08 08:59:05 2011 +0000
+++ b/drivers/win32/win32.c	Tue Nov 08 08:59:30 2011 +0000
@@ -189,7 +189,7 @@
 	}
 	else
 	{
-		MSG(("CanOpen : Cannot open board {busname='%s',baudrate='%s'}\n",board->busname, board->baudrate));
+		MSG("CanOpen : Cannot open board {busname='%S',baudrate='%S'}\n",board->busname, board->baudrate);
 		return NULL;
 	}
 }
--- a/include/win32/applicfg.h	Tue Nov 08 08:59:05 2011 +0000
+++ b/include/win32/applicfg.h	Tue Nov 08 08:59:30 2011 +0000
@@ -102,7 +102,7 @@
 #ifdef UNICODE
 #define MSG(...) \
   do{wchar_t msg[300];\
-   swprintf(msg,L##__VA_ARGS__);\
+   swprintf(msg,sizeof(msg)/sizeof(msg[0]), L##__VA_ARGS__); \
    OutputDebugString(msg);}while(0)
 #else
 #define MSG(...) \