[Box Backup-dev] COMMIT r439 - box/chris/win32/vc2005-compile-fixes/lib/common

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Sun Feb 12 13:13:44 GMT 2006


Author: chris
Date: 2006-02-12 13:13:43 +0000 (Sun, 12 Feb 2006)
New Revision: 439

Modified:
   box/chris/win32/vc2005-compile-fixes/lib/common/FdGetLine.cpp
Log:
* FdGetLine.cpp
- Use console_read on Windows instead of messing around with _cgetws


Modified: box/chris/win32/vc2005-compile-fixes/lib/common/FdGetLine.cpp
===================================================================
--- box/chris/win32/vc2005-compile-fixes/lib/common/FdGetLine.cpp	2006-02-12 13:13:12 UTC (rev 438)
+++ box/chris/win32/vc2005-compile-fixes/lib/common/FdGetLine.cpp	2006-02-12 13:13:43 UTC (rev 439)
@@ -125,37 +125,7 @@
 
 			if (mFileHandle == _fileno(stdin))
 			{
-#ifdef HAVE_CGETWS
-				int size = sizeof(mBuffer) - 3;
-				if (size > 80) size = 80;
-				WCHAR tempbuf[83] = { size };
-				::_cgetws(tempbuf);
-				size = tempbuf[1];
-				tempbuf[size + 2] = '\n';
-				tempbuf[size + 3] = 0;
-				char* utf8buf = ConvertFromWideString
-				(
-					tempbuf + 2, GetConsoleCP()
-				);
-				strncpy(mBuffer, utf8buf, sizeof(mBuffer));
-				bytes = strlen(utf8buf);
-				delete [] utf8buf;
-#else // !HAVE_CGETWS
-				int size = sizeof(mBuffer) - 3;
-				if (size > 80) size = 80;
-				char tempbuf[83] = { (char)size };
-				::_cgets(tempbuf);
-				size = tempbuf[1];
-				tempbuf[size + 2] = '\n';
-				tempbuf[size + 3] = 0;
-				char* utf8buf = ConvertConsoleToUtf8
-				(
-					tempbuf + 2
-				);
-				strncpy(mBuffer, utf8buf, sizeof(mBuffer));
-				bytes = strlen(utf8buf);
-				delete [] utf8buf;
-#endif // HAVE_CGETWS
+				bytes = console_read(mBuffer, sizeof(mBuffer));
 			}
 			else
 			{




More information about the Boxbackup-dev mailing list