shell/inc/infotips.hxx                                |    2 +-
 shell/source/win32/shlxthandler/infotips/infotips.cxx |   15 ++++-----------
 2 files changed, 5 insertions(+), 12 deletions(-)

New commits:
commit c6e2626f7dab0097971d0dceea4326f185fdf1ac
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Sun Feb 25 19:09:24 2024 +0600
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Mon Feb 26 02:23:03 2024 +0100

    Remove an instance of MAX_PATH limitation
    
    ... and avoid manual memory management.
    
    Change-Id: I901cfc1dbede3241d387003c04fa11c1371fa8d1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163905
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/shell/inc/infotips.hxx b/shell/inc/infotips.hxx
index 5a1128cb7d61..a569be54b55e 100644
--- a/shell/inc/infotips.hxx
+++ b/shell/inc/infotips.hxx
@@ -79,7 +79,7 @@ public:
 
 private:
     LONG            m_RefCnt;
-    Filepath_char_t m_szFileName[MAX_PATH];
+    std::wstring    m_FileName;
     std::wstring    m_FileNameOnly;
 };
 
diff --git a/shell/source/win32/shlxthandler/infotips/infotips.cxx 
b/shell/source/win32/shlxthandler/infotips/infotips.cxx
index af03f4a32faa..501c04032ba5 100644
--- a/shell/source/win32/shlxthandler/infotips/infotips.cxx
+++ b/shell/source/win32/shlxthandler/infotips/infotips.cxx
@@ -42,7 +42,6 @@ const std::wstring WSPACE(SPACE);
 CInfoTip::CInfoTip(LONG RefCnt) :
     m_RefCnt(RefCnt)
 {
-    ZeroMemory(m_szFileName, sizeof(m_szFileName));
     InterlockedIncrement(&g_DllRefCnt);
 }
 
@@ -197,7 +196,7 @@ COM_DECLSPEC_NOTHROW HRESULT STDMETHODCALLTYPE 
CInfoTip::GetInfoTip(DWORD /*dwFl
     const std::wstring CONST_SPACE(SPACE);
 
     //display File Type, no matter other info is loaded successfully or not.
-    std::wstring tmpTypeStr = getFileTypeInfo( 
get_file_name_extension(m_szFileName) );
+    std::wstring tmpTypeStr = getFileTypeInfo( 
get_file_name_extension(m_FileName) );
     if ( tmpTypeStr != EMPTY_STRING )
     {
         msg += GetResString(IDS_TYPE_COLON) + CONST_SPACE;
@@ -206,7 +205,7 @@ COM_DECLSPEC_NOTHROW HRESULT STDMETHODCALLTYPE 
CInfoTip::GetInfoTip(DWORD /*dwFl
 
     try
     {
-        CMetaInfoReader meta_info_accessor(m_szFileName);
+        CMetaInfoReader meta_info_accessor(m_FileName);
 
         //display document title;
         if ( meta_info_accessor.getTagData( META_INFO_TITLE ).length() > 0)
@@ -265,7 +264,7 @@ COM_DECLSPEC_NOTHROW HRESULT STDMETHODCALLTYPE 
CInfoTip::GetInfoTip(DWORD /*dwFl
     }
 
     //display file size, no matter other information is loaded successfully or 
not.
-    std::wstring tmpSizeStr = getFileSizeInfo( m_szFileName );
+    std::wstring tmpSizeStr = getFileSizeInfo(m_FileName.c_str());
     if ( tmpSizeStr != EMPTY_STRING )
     {
         msg += L"
";
@@ -327,13 +326,7 @@ HRESULT STDMETHODCALLTYPE CInfoTip::Load(LPCOLESTR 
pszFileName, DWORD /*dwMode*/
 
     m_FileNameOnly = std::wstring(begin, end);
 
-    fname = getShortPathName( fname );
-
-    // ZeroMemory because strncpy doesn't '
-    // string; reserve the last place in the buffer for the final '
-    // that's why '(sizeof(m_szFileName) - 1)'
-    ZeroMemory(m_szFileName, sizeof(m_szFileName));
-    wcsncpy(m_szFileName, fname.c_str(), 
(sizeof(m_szFileName)/sizeof(*m_szFileName) - 1));
+    m_FileName = getShortPathName(fname);
 
     return S_OK;
 }

Reply via email to