From 844ca09641ffb2ec5773738d830ca46533ffeda8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 15 Apr 2004 23:15:07 +0000 Subject: [PATCH] unused variable warning fix (patch 923094) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26825 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/filefn.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp index 293e9feecf..fbf8733e9f 100644 --- a/src/common/filefn.cpp +++ b/src/common/filefn.cpp @@ -751,17 +751,22 @@ wxContractPath (const wxString& filename, const wxString& envname, const wxStrin #endif // Handle User's home (ignore root homes!) - size_t len = 0; - if ((val = wxGetUserHome (user)) != NULL && - (len = wxStrlen(val)) > 2 && - wxStrncmp(dest, val, len) == 0) - { - wxStrcpy(wxFileFunctionsBuffer, wxT("~")); - if (user != wxT("")) - wxStrcat(wxFileFunctionsBuffer, (const wxChar*) user); - wxStrcat(wxFileFunctionsBuffer, dest + len); - wxStrcpy (dest, wxFileFunctionsBuffer); - } + val = wxGetUserHome (user); + if (!val) + return dest; + + const size_t len = wxStrlen(val); + if (len <= 2) + return dest; + + if (wxStrncmp(dest, val, len) == 0) + { + wxStrcpy(wxFileFunctionsBuffer, wxT("~")); + if (user != wxT("")) + wxStrcat(wxFileFunctionsBuffer, (const wxChar*) user); + wxStrcat(wxFileFunctionsBuffer, dest + len); + wxStrcpy (dest, wxFileFunctionsBuffer); + } return dest; }