This is an automated email from the ASF dual-hosted git repository.
mseidel pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/trunk by this push:
new aa93e1fb1b Removed whitespace
aa93e1fb1b is described below
commit aa93e1fb1bbbfae99a07e8483e1c32d000bca7c3
Author: mseidel <[email protected]>
AuthorDate: Thu Jun 16 15:36:46 2022 +0200
Removed whitespace
---
.../win32/shlxthandler/infotips/infotips.cxx | 366 ++++++++++-----------
.../source/win32/shlxthandler/infotips/makefile.mk | 14 +-
2 files changed, 190 insertions(+), 190 deletions(-)
diff --git a/main/shell/source/win32/shlxthandler/infotips/infotips.cxx
b/main/shell/source/win32/shlxthandler/infotips/infotips.cxx
index 5d4fb89c05..95c9472096 100644
--- a/main/shell/source/win32/shlxthandler/infotips/infotips.cxx
+++ b/main/shell/source/win32/shlxthandler/infotips/infotips.cxx
@@ -49,10 +49,10 @@ const std::wstring WSPACE = std::wstring(SPACE);
//-----------------------------
CInfoTip::CInfoTip(long RefCnt) :
- m_RefCnt(RefCnt)
+ m_RefCnt(RefCnt)
{
- ZeroMemory(m_szFileName, sizeof(m_szFileName));
- InterlockedIncrement(&g_DllRefCnt);
+ ZeroMemory(m_szFileName, sizeof(m_szFileName));
+ InterlockedIncrement(&g_DllRefCnt);
}
//-----------------------------
@@ -61,7 +61,7 @@ CInfoTip::CInfoTip(long RefCnt) :
CInfoTip::~CInfoTip()
{
- InterlockedDecrement(&g_DllRefCnt);
+ InterlockedDecrement(&g_DllRefCnt);
}
//-----------------------------
@@ -70,26 +70,26 @@ CInfoTip::~CInfoTip()
HRESULT STDMETHODCALLTYPE CInfoTip::QueryInterface(REFIID riid, void __RPC_FAR
*__RPC_FAR *ppvObject)
{
- *ppvObject = 0;
-
- IUnknown* pUnk = 0;
-
- if (IID_IUnknown == riid || IID_IQueryInfo == riid)
- {
- pUnk = static_cast<IQueryInfo*>(this);
- pUnk->AddRef();
- *ppvObject = pUnk;
- return S_OK;
- }
- else if (IID_IPersistFile == riid)
- {
- pUnk = static_cast<IPersistFile*>(this);
- pUnk->AddRef();
- *ppvObject = pUnk;
- return S_OK;
- }
-
- return E_NOINTERFACE;
+ *ppvObject = 0;
+
+ IUnknown* pUnk = 0;
+
+ if (IID_IUnknown == riid || IID_IQueryInfo == riid)
+ {
+ pUnk = static_cast<IQueryInfo*>(this);
+ pUnk->AddRef();
+ *ppvObject = pUnk;
+ return S_OK;
+ }
+ else if (IID_IPersistFile == riid)
+ {
+ pUnk = static_cast<IPersistFile*>(this);
+ pUnk->AddRef();
+ *ppvObject = pUnk;
+ return S_OK;
+ }
+
+ return E_NOINTERFACE;
}
//----------------------------
@@ -98,7 +98,7 @@ HRESULT STDMETHODCALLTYPE CInfoTip::QueryInterface(REFIID
riid, void __RPC_FAR *
ULONG STDMETHODCALLTYPE CInfoTip::AddRef(void)
{
- return InterlockedIncrement(&m_RefCnt);
+ return InterlockedIncrement(&m_RefCnt);
}
//----------------------------
@@ -107,12 +107,12 @@ ULONG STDMETHODCALLTYPE CInfoTip::AddRef(void)
ULONG STDMETHODCALLTYPE CInfoTip::Release( void)
{
- long refcnt = InterlockedDecrement(&m_RefCnt);
+ long refcnt = InterlockedDecrement(&m_RefCnt);
- if (0 == m_RefCnt)
- delete this;
+ if (0 == m_RefCnt)
+ delete this;
- return refcnt;
+ return refcnt;
}
//********************helper functions for GetInfoTip
functions**********************
@@ -121,36 +121,36 @@ ULONG STDMETHODCALLTYPE CInfoTip::Release( void)
*/
std::wstring getFileTypeInfo(const std::string& file_extension)
{
- char extKeyValue[MAX_STRING];
- char typeKeyValue[MAX_STRING];
- ::std::string sDot(".");
- if (QueryRegistryKey(HKEY_CLASSES_ROOT,
(sDot.append(file_extension)).c_str(), "", extKeyValue, MAX_STRING))
+ char extKeyValue[MAX_STRING];
+ char typeKeyValue[MAX_STRING];
+ ::std::string sDot(".");
+ if (QueryRegistryKey(HKEY_CLASSES_ROOT,
(sDot.append(file_extension)).c_str(), "", extKeyValue, MAX_STRING))
if (QueryRegistryKey( HKEY_CLASSES_ROOT, extKeyValue,
"",typeKeyValue, MAX_STRING))
- return StringToWString(typeKeyValue);
+ return StringToWString(typeKeyValue);
- return EMPTY_STRING;
+ return EMPTY_STRING;
}
/** get file size.
*/
DWORD getSizeOfFile( char* FileName )
{
- HANDLE hFile = CreateFile(StringToWString(FileName).c_str(), //
open file
- GENERIC_READ, //
open for reading
- FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, //
share for all operations
- NULL, //
no security
- OPEN_EXISTING, //
existing file only
- FILE_ATTRIBUTE_NORMAL, //
normal file
- NULL); //
no attr. template
-
- if (hFile != INVALID_HANDLE_VALUE)
- {
- DWORD dwSize = GetFileSize( HANDLE(hFile), NULL );
- CloseHandle( HANDLE(hFile) );
- return dwSize;
- }
-
- return INVALID_FILE_SIZE;
+ HANDLE hFile = CreateFile(StringToWString(FileName).c_str(),
// open file
+ GENERIC_READ,
// open for reading
+
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, // share for all
operations
+ NULL,
// no security
+ OPEN_EXISTING,
// existing file only
+ FILE_ATTRIBUTE_NORMAL,
// normal file
+ NULL);
// no attr.
template
+
+ if (hFile != INVALID_HANDLE_VALUE)
+ {
+ DWORD dwSize = GetFileSize( HANDLE(hFile), NULL );
+ CloseHandle( HANDLE(hFile) );
+ return dwSize;
+ }
+
+ return INVALID_FILE_SIZE;
}
/** format file size in to be more readable.
@@ -166,31 +166,31 @@ std::wstring formatSizeOfFile( DWORD dwSize )
return StringToWString( buffer ).append(StringToWString(" B"));
}
- char *buffer=NULL;
- int decimal, sign;
- double dFileSize = (double)dwSize/(double)KB;
+ char *buffer=NULL;
+ int decimal, sign;
+ double dFileSize = (double)dwSize/(double)KB;
buffer = _fcvt( dFileSize, 1, &decimal, &sign );
- ::std::wstring wsTemp = StringToWString( buffer );
- int pos=decimal % 3;
- ::std::wstring wsBuffer = wsTemp.substr( 0,pos);
-
- if ( decimal )
- for (;decimal - pos > 2;pos += 3)
- {
- if (pos)
- wsBuffer.append(StringToWString(","));
- wsBuffer.append( wsTemp.substr( pos, 3) );
- }
- else
- wsBuffer.append(StringToWString("0"));
-
- wsBuffer.append(StringToWString("."));
- wsBuffer.append(wsTemp.substr( decimal, wsTemp.size()-decimal ));
- wsBuffer.append(StringToWString(" KB"));
-
- return wsBuffer;
+ ::std::wstring wsTemp = StringToWString( buffer );
+ int pos=decimal % 3;
+ ::std::wstring wsBuffer = wsTemp.substr( 0,pos);
+
+ if ( decimal )
+ for (;decimal - pos > 2;pos += 3)
+ {
+ if (pos)
+ wsBuffer.append(StringToWString(","));
+ wsBuffer.append( wsTemp.substr( pos, 3) );
+ }
+ else
+ wsBuffer.append(StringToWString("0"));
+
+ wsBuffer.append(StringToWString("."));
+ wsBuffer.append(wsTemp.substr( decimal, wsTemp.size()-decimal ));
+ wsBuffer.append(StringToWString(" KB"));
+
+ return wsBuffer;
}
@@ -198,11 +198,11 @@ std::wstring formatSizeOfFile( DWORD dwSize )
*/
std::wstring getFileSizeInfo(char* FileName)
{
- DWORD dwSize=getSizeOfFile(FileName);
- if (dwSize != INVALID_FILE_SIZE)
- return formatSizeOfFile( dwSize );
+ DWORD dwSize=getSizeOfFile(FileName);
+ if (dwSize != INVALID_FILE_SIZE)
+ return formatSizeOfFile( dwSize );
- return EMPTY_STRING;
+ return EMPTY_STRING;
}
//----------------------------
@@ -211,109 +211,109 @@ std::wstring getFileSizeInfo(char* FileName)
HRESULT STDMETHODCALLTYPE CInfoTip::GetInfoTip(DWORD /*dwFlags*/, wchar_t**
ppwszTip)
{
- std::wstring msg;
- 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) );
- if ( tmpTypeStr != EMPTY_STRING )
- {
- msg += GetResString(IDS_TYPE_COLON) + CONST_SPACE;
- msg += tmpTypeStr;
- }
-
- try
- {
- CMetaInfoReader meta_info_accessor(m_szFileName);
-
- //display document title;
- if ( meta_info_accessor.getTagData( META_INFO_TITLE ).length() > 0)
- {
+ std::wstring msg;
+ 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) );
+ if ( tmpTypeStr != EMPTY_STRING )
+ {
+ msg += GetResString(IDS_TYPE_COLON) + CONST_SPACE;
+ msg += tmpTypeStr;
+ }
+
+ try
+ {
+ CMetaInfoReader meta_info_accessor(m_szFileName);
+
+ // display document title;
+ if ( meta_info_accessor.getTagData( META_INFO_TITLE ).length()
> 0)
+ {
if ( msg != EMPTY_STRING )
- msg += L"\n";
- msg += GetResString(IDS_TITLE_COLON) + CONST_SPACE;
- msg += meta_info_accessor.getTagData( META_INFO_TITLE );
- }
- else
- {
+ msg += L"\n";
+ msg += GetResString(IDS_TITLE_COLON) + CONST_SPACE;
+ msg += meta_info_accessor.getTagData( META_INFO_TITLE );
+ }
+ else
+ {
if ( msg != EMPTY_STRING )
- msg += L"\n";
- msg += GetResString(IDS_TITLE_COLON) + CONST_SPACE;
- msg += m_FileNameOnly;
- }
-
- //display document author;
- if ( meta_info_accessor.getTagData( META_INFO_AUTHOR ).length() > 0)
- {
+ msg += L"\n";
+ msg += GetResString(IDS_TITLE_COLON) + CONST_SPACE;
+ msg += m_FileNameOnly;
+ }
+
+ // display document author;
+ if ( meta_info_accessor.getTagData( META_INFO_AUTHOR ).length()
> 0)
+ {
if ( msg != EMPTY_STRING )
- msg += L"\n";
- msg += GetResString( IDS_AUTHOR_COLON ) + CONST_SPACE;
- msg += meta_info_accessor.getTagData( META_INFO_AUTHOR );
- }
-
- //display document subject;
- if ( meta_info_accessor.getTagData( META_INFO_SUBJECT ).length() > 0)
- {
+ msg += L"\n";
+ msg += GetResString( IDS_AUTHOR_COLON ) + CONST_SPACE;
+ msg += meta_info_accessor.getTagData( META_INFO_AUTHOR
);
+ }
+
+ // display document subject;
+ if ( meta_info_accessor.getTagData( META_INFO_SUBJECT
).length() > 0)
+ {
if ( msg != EMPTY_STRING )
- msg += L"\n";
- msg += GetResString(IDS_SUBJECT_COLON) + CONST_SPACE;
- msg += meta_info_accessor.getTagData( META_INFO_SUBJECT );
- }
-
- //display document description;
- if ( meta_info_accessor.getTagData( META_INFO_DESCRIPTION ).length() >
0)
- {
+ msg += L"\n";
+ msg += GetResString(IDS_SUBJECT_COLON) + CONST_SPACE;
+ msg += meta_info_accessor.getTagData( META_INFO_SUBJECT
);
+ }
+
+ // display document description;
+ if ( meta_info_accessor.getTagData( META_INFO_DESCRIPTION
).length() > 0)
+ {
if ( msg != EMPTY_STRING )
- msg += L"\n";
- msg += GetResString( IDS_COMMENTS_COLON ) + CONST_SPACE;
- msg += meta_info_accessor.getTagData( META_INFO_DESCRIPTION );
- }
-
- //display modified time formatted into locale representation.
- if (
iso8601_date_to_local_date(meta_info_accessor.getTagData(META_INFO_MODIFIED
)).length() > 0)
- {
+ msg += L"\n";
+ msg += GetResString( IDS_COMMENTS_COLON ) + CONST_SPACE;
+ msg += meta_info_accessor.getTagData(
META_INFO_DESCRIPTION );
+ }
+
+ // display modified time formatted into locale representation.
+ if (
iso8601_date_to_local_date(meta_info_accessor.getTagData(META_INFO_MODIFIED
)).length() > 0)
+ {
if ( msg != EMPTY_STRING )
- msg += L"\n";
+ msg += L"\n";
msg += GetResString( IDS_MODIFIED_COLON ) + CONST_SPACE;
msg +=
iso8601_date_to_local_date(meta_info_accessor.getTagData(META_INFO_MODIFIED ));
}
- }
+ }
- catch (const std::exception&)
- {
- //return E_FAIL;
- }
+ catch (const std::exception&)
+ {
+ //return E_FAIL;
+ }
- //display file size, no matter other information is loaded successfully or
not.
- std::wstring tmpSizeStr = getFileSizeInfo( m_szFileName );
- if ( tmpSizeStr != EMPTY_STRING )
- {
- msg += L"\n";
- msg += GetResString( IDS_SIZE_COLON ) + CONST_SPACE;
- msg += tmpSizeStr;
- }
+ // display file size, no matter other information is loaded
successfully or not.
+ std::wstring tmpSizeStr = getFileSizeInfo( m_szFileName );
+ if ( tmpSizeStr != EMPTY_STRING )
+ {
+ msg += L"\n";
+ msg += GetResString( IDS_SIZE_COLON ) + CONST_SPACE;
+ msg += tmpSizeStr;
+ }
- //finalize and assign the string.
- LPMALLOC lpMalloc;
- HRESULT hr = SHGetMalloc(&lpMalloc);
+ // finalize and assign the string.
+ LPMALLOC lpMalloc;
+ HRESULT hr = SHGetMalloc(&lpMalloc);
- if (SUCCEEDED(hr))
- {
- size_t len = sizeof(wchar_t) * msg.length() + sizeof(wchar_t);
- wchar_t* pMem = reinterpret_cast<wchar_t*>(lpMalloc->Alloc(len));
+ if (SUCCEEDED(hr))
+ {
+ size_t len = sizeof(wchar_t) * msg.length() + sizeof(wchar_t);
+ wchar_t* pMem =
reinterpret_cast<wchar_t*>(lpMalloc->Alloc(len));
- ZeroMemory(pMem, len);
+ ZeroMemory(pMem, len);
- msg.copy(pMem,msg.length());
+ msg.copy(pMem,msg.length() + 1);
- *ppwszTip = pMem;
- lpMalloc->Release();
+ *ppwszTip = pMem;
+ lpMalloc->Release();
- return S_OK;
- }
+ return S_OK;
+ }
- return E_FAIL;
+ return E_FAIL;
}
//----------------------------
@@ -322,7 +322,7 @@ HRESULT STDMETHODCALLTYPE CInfoTip::GetInfoTip(DWORD
/*dwFlags*/, wchar_t** ppws
HRESULT STDMETHODCALLTYPE CInfoTip::GetInfoFlags(DWORD * /*pdwFlags*/ )
{
- return E_NOTIMPL;
+ return E_NOTIMPL;
}
//----------------------------
@@ -331,8 +331,8 @@ HRESULT STDMETHODCALLTYPE CInfoTip::GetInfoFlags(DWORD *
/*pdwFlags*/ )
HRESULT STDMETHODCALLTYPE CInfoTip::GetClassID(CLSID* pClassID)
{
- pClassID = const_cast<CLSID*>(&CLSID_INFOTIP_HANDLER);
- return S_OK;
+ pClassID = const_cast<CLSID*>(&CLSID_INFOTIP_HANDLER);
+ return S_OK;
}
//----------------------------
@@ -341,27 +341,27 @@ HRESULT STDMETHODCALLTYPE CInfoTip::GetClassID(CLSID*
pClassID)
HRESULT STDMETHODCALLTYPE CInfoTip::Load(LPCOLESTR pszFileName, DWORD
/*dwMode*/)
{
- std::wstring fname = pszFileName;
+ std::wstring fname = pszFileName;
- // there must be a '\' and there must even be an
- // extension, else we would not have been called
- std::wstring::iterator begin = fname.begin() + fname.find_last_of(L"\\") +
1;
- std::wstring::iterator end = fname.end();
+ // there must be a '\' and there must even be an
+ // extension, else we would not have been called
+ std::wstring::iterator begin = fname.begin() +
fname.find_last_of(L"\\") + 1;
+ std::wstring::iterator end = fname.end();
- m_FileNameOnly = std::wstring(begin, end);
+ m_FileNameOnly = std::wstring(begin, end);
- fname = getShortPathName( fname );
+ fname = getShortPathName( fname );
- std::string fnameA = WStringToString(fname);
+ std::string fnameA = WStringToString(fname);
- // #115531#
- // ZeroMemory because strncpy doesn't '\0'-terminate the destination
- // string; reserve the last place in the buffer for the final '\0'
- // that's why '(sizeof(m_szFileName) - 1)'
- ZeroMemory(m_szFileName, sizeof(m_szFileName));
- strncpy(m_szFileName, fnameA.c_str(), (sizeof(m_szFileName) - 1));
+ // #115531#
+ // ZeroMemory because strncpy doesn't '\0'-terminate the destination
+ // string; reserve the last place in the buffer for the final '\0'
+ // that's why '(sizeof(m_szFileName) - 1)'
+ ZeroMemory(m_szFileName, sizeof(m_szFileName));
+ strncpy(m_szFileName, fnameA.c_str(), (sizeof(m_szFileName) - 1));
- return S_OK;
+ return S_OK;
}
//----------------------------
@@ -370,7 +370,7 @@ HRESULT STDMETHODCALLTYPE CInfoTip::Load(LPCOLESTR
pszFileName, DWORD /*dwMode*/
HRESULT STDMETHODCALLTYPE CInfoTip::IsDirty(void)
{
- return E_NOTIMPL;
+ return E_NOTIMPL;
}
//----------------------------
@@ -379,7 +379,7 @@ HRESULT STDMETHODCALLTYPE CInfoTip::IsDirty(void)
HRESULT STDMETHODCALLTYPE CInfoTip::Save(LPCOLESTR /*pszFileName*/, BOOL
/*fRemember*/)
{
- return E_NOTIMPL;
+ return E_NOTIMPL;
}
//----------------------------
@@ -388,7 +388,7 @@ HRESULT STDMETHODCALLTYPE CInfoTip::Save(LPCOLESTR
/*pszFileName*/, BOOL /*fReme
HRESULT STDMETHODCALLTYPE CInfoTip::SaveCompleted(LPCOLESTR /*pszFileName*/)
{
- return E_NOTIMPL;
+ return E_NOTIMPL;
}
//----------------------------
@@ -397,5 +397,5 @@ HRESULT STDMETHODCALLTYPE CInfoTip::SaveCompleted(LPCOLESTR
/*pszFileName*/)
HRESULT STDMETHODCALLTYPE CInfoTip::GetCurFile(LPOLESTR __RPC_FAR *
/*ppszFileName*/)
{
- return E_NOTIMPL;
+ return E_NOTIMPL;
}
diff --git a/main/shell/source/win32/shlxthandler/infotips/makefile.mk
b/main/shell/source/win32/shlxthandler/infotips/makefile.mk
index d3ca36ff31..c26f00dab8 100644
--- a/main/shell/source/win32/shlxthandler/infotips/makefile.mk
+++ b/main/shell/source/win32/shlxthandler/infotips/makefile.mk
@@ -1,5 +1,5 @@
#**************************************************************
-#
+#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -7,16 +7,16 @@
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-#
+#
#**************************************************************
@@ -26,11 +26,11 @@ PRJNAME=shell
TARGET=infotips
LIBTARGET=NO
ENABLE_EXCEPTIONS=TRUE
-EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
+EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
# --- Settings -----------------------------------------------------
-.INCLUDE : settings.mk
+.INCLUDE : settings.mk
CFLAGS+=-DISOLATION_AWARE_ENABLED -DWIN32_LEAN_AND_MEAN -DXML_UNICODE -D_NTSDK
-DUNICODE -D_UNICODE -D_WIN32_WINNT=0x0501
CFLAGS+=-wd4710 -wd4711 -wd4514 -wd4619 -wd4217 -wd4820
@@ -52,5 +52,5 @@ SLOFILES_X64=$(SLO_X64)$/$(TARGET).obj
.INCLUDE : set_wntx64.mk
.INCLUDE : target.mk
INCLUDE!:=$(subst,/stl, $(INCLUDE))
-
+
.INCLUDE : tg_wntx64.mk