From 5ce0e4ac0617023b0eeabd836df338c77e5f478d Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Thu, 10 May 2001 16:41:58 +0000 Subject: [PATCH] supressed error messages when wxCSConv cannot find registry key and/or value when looking for charset information git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10113 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/strconv.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/common/strconv.cpp b/src/common/strconv.cpp index 1e36ac81b4..fdb714185f 100644 --- a/src/common/strconv.cpp +++ b/src/common/strconv.cpp @@ -369,20 +369,23 @@ static long CharsetToCodepage(const wxChar *name) wxString cn(name); do { - wxString path( wxT("MIME\\Database\\Charset\\") ); + wxString path(wxT("MIME\\Database\\Charset\\")); path += cn; - wxRegKey key( wxRegKey::HKCR, path ); - - /* two cases: either there's an AliasForCharset string, - * or there are Codepage and InternetEncoding dwords. - * The InternetEncoding gives us the actual encoding, - * the Codepage just says which Windows character set to - * use when displaying the data. - */ - if (key.QueryValue( wxT("InternetEncoding"), &CP )) break; + wxRegKey key(wxRegKey::HKCR, path); + + if (!key.Exists()) continue; + + // two cases: either there's an AliasForCharset string, + // or there are Codepage and InternetEncoding dwords. + // The InternetEncoding gives us the actual encoding, + // the Codepage just says which Windows character set to + // use when displaying the data. + if (key.HasValue(wxT("InternetEncoding")) && + key.QueryValue(wxT("InternetEncoding"), &CP)) break; // no encoding, see if it's an alias - if (!key.QueryValue( wxT("AliasForCharset"), cn )) break; + if (!key.HasValue(wxT("AliasForCharset")) || + !key.QueryValue(wxT("AliasForCharset"), cn)) break; } while (1); return CP; -- 2.45.2