# HG changeset patch # User Jeandet Alexis # Date 2014-03-26 20:39:45 # Node ID 8a61222fe7d90e7414a77c6f4be1730e459217c8 # Parent 84df714fc1b4a60453672ce5dc77d62512bf7c6b Fixed wchar issue! diff --git a/src/RS232_win.c b/src/RS232_win.c --- a/src/RS232_win.c +++ b/src/RS232_win.c @@ -120,10 +120,10 @@ rs232port_t rs232open(char* psPortName) rs232port_t fd; /* Char to Wchar conversion*/ int neededSize = MultiByteToWideChar(CP_ACP, 0, psPortName, -1, 0, 0); - wchar_t* wcstr = new wchar_t[neededSize]; - MultiByteToWideChar(CP_ACP, 0, charString, -1, wcstr, neededSize); + wchar_t* wcstr = (wchar_t*)malloc(sizeof(wchar_t)*neededSize); + MultiByteToWideChar(CP_ACP, 0, psPortName, -1, wcstr, neededSize); fd = (rs232port_t)CreateFile(wcstr,GENERIC_READ | GENERIC_WRITE,0,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0); - delete wcstr; + free(wcstr); #ifdef RS232_debug if(fd==(rs232port_t)INVALID_HANDLE_VALUE) {