From 03996a10212efd150de1a8509830f87e10b9bd7f Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Tue, 10 May 2005 13:45:01 +0000 Subject: [PATCH] Correct a minor build problem with wx-console. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2022 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/win32/compat/compat.cpp | 25 ++++++++---------------- bacula/src/wx-console/console_thread.cpp | 2 +- bacula/src/wx-console/wxbutils.cpp | 2 +- 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/bacula/src/win32/compat/compat.cpp b/bacula/src/win32/compat/compat.cpp index 481ff2e375..96c2131960 100644 --- a/bacula/src/win32/compat/compat.cpp +++ b/bacula/src/win32/compat/compat.cpp @@ -954,30 +954,21 @@ win32_cgets (char* buffer, int len) if ((g_platform_id == VER_PLATFORM_WIN32_NT) && p_WideCharToMultiByte && p_cgetws) { WCHAR szBuf[260]; szBuf[0] = min (255, len); /* max len, must be smaller than buffer */ - if (!p_cgetws (szBuf)) - return NULL; - - if (wchar_2_UTF8(buffer, &szBuf[2], len)) + if (p_cgetws(szBuf) && wchar_2_UTF8(buffer, &szBuf[2], len)) return buffer; - else - return NULL; } /* win 9x and unicode conversion */ if ((g_platform_id == VER_PLATFORM_WIN32_WINDOWS) && p_WideCharToMultiByte && p_MultiByteToWideChar) { char szBuf[260]; - szBuf[0] = min (255, len); /* max len, must be smaller than buffer */ - if (!_cgets (szBuf)) - return NULL; - - /* back and forth to get UTF-8 from ANSI */ - WCHAR wszBuf[260]; - p_MultiByteToWideChar(CP_OEMCP, 0, &szBuf[2], -1, wszBuf,260); + szBuf[0] = min(255, len); /* max len, must be smaller than buffer */ + if (_cgets(szBuf)) { + WCHAR wszBuf[260]; + p_MultiByteToWideChar(CP_OEMCP, 0, &szBuf[2], -1, wszBuf,260); - if (wchar_2_UTF8(buffer, wszBuf, len)) - return buffer; - else - return NULL; + if (wchar_2_UTF8(buffer, wszBuf, len)) + return buffer; + } } /* fallback */ diff --git a/bacula/src/wx-console/console_thread.cpp b/bacula/src/wx-console/console_thread.cpp index 0c26b3e48b..b47bc35b11 100644 --- a/bacula/src/wx-console/console_thread.cpp +++ b/bacula/src/wx-console/console_thread.cpp @@ -7,7 +7,7 @@ * Version $Id$ */ /* - Copyright (C) 2004 Kern Sibbald and John Walker + Copyright (C) 2004-2005 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/bacula/src/wx-console/wxbutils.cpp b/bacula/src/wx-console/wxbutils.cpp index 0fbe93921a..b15cf58c1f 100644 --- a/bacula/src/wx-console/wxbutils.cpp +++ b/bacula/src/wx-console/wxbutils.cpp @@ -7,7 +7,7 @@ * Version $Id$ */ /* - Copyright (C) 2004 Kern Sibbald and John Walker + Copyright (C) 2004-2005 Kern Sibbald This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License -- 2.39.5