4.60 beta

This commit is contained in:
Igor Pavlov
2008-08-19 00:00:00 +00:00
committed by Kornel Lesiński
parent 173c07e166
commit c10e6b16f6
107 changed files with 490 additions and 503 deletions

View File

@@ -26,7 +26,7 @@ public:
~CStgMedium() { Free(); }
void Free()
{
if(_mustBeReleased)
if (_mustBeReleased)
ReleaseStgMedium(&_object);
_mustBeReleased = false;
}

View File

@@ -16,7 +16,7 @@ public:
CImageList(): m_Object(NULL) {}
bool Attach(HIMAGELIST imageList)
{
if(imageList == NULL)
if (imageList == NULL)
return false;
m_Object = imageList;
return true;
@@ -33,7 +33,7 @@ public:
{
HIMAGELIST a = ImageList_Create(width, height, flags,
initialNumber, grow);
if(a == NULL)
if (a == NULL)
return false;
return Attach(a);
}

View File

@@ -49,7 +49,7 @@ bool CWindow2::CreateEx(DWORD exStyle, LPCTSTR className,
HINSTANCE instance)
{
WNDCLASS windowClass;
if(!::GetClassInfo(instance, className, &windowClass))
if (!::GetClassInfo(instance, className, &windowClass))
{
// windowClass.style = CS_HREDRAW | CS_VREDRAW;
windowClass.style = 0;
@@ -80,7 +80,7 @@ bool CWindow2::CreateEx(DWORD exStyle, LPCWSTR className,
HINSTANCE instance)
{
bool needRegister;
if(g_IsNT)
if (g_IsNT)
{
WNDCLASSW windowClass;
needRegister = ::GetClassInfoW(instance, className, &windowClass) == 0;

View File

@@ -36,7 +36,7 @@ bool CLibrary::LoadOperations(HMODULE newModule)
{
if (newModule == NULL)
return false;
if(!Free())
if (!Free())
return false;
_module = newModule;
return true;

View File

@@ -17,7 +17,7 @@ namespace NError {
bool MyFormatMessage(DWORD messageID, CSysString &message)
{
LPVOID msgBuf;
if(::FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
if (::FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,messageID, 0, (LPTSTR) &msgBuf,0, NULL) == 0)
return false;
@@ -32,7 +32,7 @@ bool MyFormatMessage(DWORD messageID, UString &message)
if (g_IsNT)
{
LPVOID msgBuf;
if(::FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER |
if (::FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, messageID, 0, (LPWSTR) &msgBuf, 0, NULL) == 0)
return false;

View File

@@ -250,12 +250,12 @@ bool CreateComplexDirectory(LPCTSTR pathName)
path.ParsePath(pathName);
CSysString fullPath = path.Prefix;
DWORD errorCode = ERROR_SUCCESS;
for(int i = 0; i < path.PathParts.Size(); i++)
for (int i = 0; i < path.PathParts.Size(); i++)
{
const CSysString &string = path.PathParts[i];
if(string.IsEmpty())
if (string.IsEmpty())
{
if(i != path.PathParts.Size() - 1)
if (i != path.PathParts.Size() - 1)
return false;
return true;
}
@@ -263,7 +263,7 @@ bool CreateComplexDirectory(LPCTSTR pathName)
if (!MyCreateDirectory(fullPath))
{
DWORD errorCode = GetLastError();
if(errorCode != ERROR_ALREADY_EXISTS)
if (errorCode != ERROR_ALREADY_EXISTS)
return false;
}
fullPath += NName::kDirDelimiter;
@@ -286,7 +286,7 @@ bool CreateComplexDirectory(LPCTSTR _aPathName)
pos = pathName.Length();
for (;;)
{
if(MyCreateDirectory(pathName))
if (MyCreateDirectory(pathName))
break;
if (::GetLastError() == ERROR_ALREADY_EXISTS)
{
@@ -305,7 +305,7 @@ bool CreateComplexDirectory(LPCTSTR _aPathName)
pathName = pathName.Left(pos);
}
pathName = pathName2;
while(pos < pathName.Length())
while (pos < pathName.Length())
{
pos = pathName.Find(TEXT(CHAR_PATH_SEPARATOR), pos + 1);
if (pos < 0)
@@ -332,7 +332,7 @@ bool CreateComplexDirectory(LPCWSTR _aPathName)
pos = pathName.Length();
for (;;)
{
if(MyCreateDirectory(pathName))
if (MyCreateDirectory(pathName))
break;
if (::GetLastError() == ERROR_ALREADY_EXISTS)
{
@@ -351,7 +351,7 @@ bool CreateComplexDirectory(LPCWSTR _aPathName)
pathName = pathName.Left(pos);
}
pathName = pathName2;
while(pos < pathName.Length())
while (pos < pathName.Length())
{
pos = pathName.Find(WCHAR_PATH_SEPARATOR, pos + 1);
if (pos < 0)
@@ -398,7 +398,7 @@ bool DeleteFileAlways(LPCWSTR name)
static bool RemoveDirectorySubItems2(const CSysString pathPrefix, const NFind::CFileInfo &fileInfo)
{
if(fileInfo.IsDir())
if (fileInfo.IsDir())
return RemoveDirectoryWithSubItems(pathPrefix + fileInfo.Name);
return DeleteFileAlways(pathPrefix + fileInfo.Name);
}
@@ -409,7 +409,7 @@ bool RemoveDirectoryWithSubItems(const CSysString &path)
CSysString pathPrefix = path + NName::kDirDelimiter;
{
NFind::CEnumerator enumerator(pathPrefix + TCHAR(NName::kAnyStringWildcard));
while(enumerator.Next(fileInfo))
while (enumerator.Next(fileInfo))
if (!RemoveDirectorySubItems2(pathPrefix, fileInfo))
return false;
}
@@ -421,7 +421,7 @@ bool RemoveDirectoryWithSubItems(const CSysString &path)
#ifndef _UNICODE
static bool RemoveDirectorySubItems2(const UString pathPrefix, const NFind::CFileInfoW &fileInfo)
{
if(fileInfo.IsDir())
if (fileInfo.IsDir())
return RemoveDirectoryWithSubItems(pathPrefix + fileInfo.Name);
return DeleteFileAlways(pathPrefix + fileInfo.Name);
}
@@ -431,7 +431,7 @@ bool RemoveDirectoryWithSubItems(const UString &path)
UString pathPrefix = path + UString(NName::kDirDelimiter);
{
NFind::CEnumeratorW enumerator(pathPrefix + UString(NName::kAnyStringWildcard));
while(enumerator.Next(fileInfo))
while (enumerator.Next(fileInfo))
if (!RemoveDirectorySubItems2(pathPrefix, fileInfo))
return false;
}
@@ -700,7 +700,7 @@ UINT CTempFile::Create(LPCTSTR dirPath, LPCTSTR prefix, CSysString &resultPath)
{
Remove();
UINT number = MyGetTempFileName(dirPath, prefix, resultPath);
if(number != 0)
if (number != 0)
{
_fileName = resultPath;
_mustBeDeleted = true;
@@ -734,7 +734,7 @@ UINT CTempFileW::Create(LPCWSTR dirPath, LPCWSTR prefix, UString &resultPath)
{
Remove();
UINT number = MyGetTempFileName(dirPath, prefix, resultPath);
if(number != 0)
if (number != 0)
{
_fileName = resultPath;
_mustBeDeleted = true;
@@ -784,7 +784,7 @@ bool CreateTempDirectory(LPCTSTR prefix, CSysString &dirName)
_stprintf(randomNumberString, _T("%04X"), randomNumber);
dirName = prefix + randomNumberString;
*/
if(NFind::DoesFileExist(dirName))
if (NFind::DoesFileExist(dirName))
continue;
if (MyCreateDirectory(dirName))
return true;
@@ -821,7 +821,7 @@ bool CreateTempDirectory(LPCWSTR prefix, UString &dirName)
_stprintf(randomNumberString, _T("%04X"), randomNumber);
dirName = prefix + randomNumberString;
*/
if(NFind::DoesFileExist(dirName))
if (NFind::DoesFileExist(dirName))
continue;
if (MyCreateDirectory(dirName))
return true;

View File

@@ -344,7 +344,7 @@ bool MyGetLogicalDriveStrings(CSysStringVector &driveStrings)
if (newSize > size)
return false;
CSysString string;
for(UINT32 i = 0; i < newSize; i++)
for (UINT32 i = 0; i < newSize; i++)
{
TCHAR c = buffer[i];
if (c == TEXT('\0'))
@@ -376,7 +376,7 @@ bool MyGetLogicalDriveStrings(UStringVector &driveStrings)
if (newSize > size)
return false;
UString string;
for(UINT32 i = 0; i < newSize; i++)
for (UINT32 i = 0; i < newSize; i++)
{
WCHAR c = buffer[i];
if (c == L'\0')

View File

@@ -126,8 +126,8 @@ bool CFileBase::GetLength(UInt64 &length) const
{
DWORD sizeHigh;
DWORD sizeLow = ::GetFileSize(_handle, &sizeHigh);
if(sizeLow == 0xFFFFFFFF)
if(::GetLastError() != NO_ERROR)
if (sizeLow == 0xFFFFFFFF)
if (::GetLastError() != NO_ERROR)
return false;
length = (((UInt64)sizeHigh) << 32) + sizeLow;
return true;
@@ -139,7 +139,7 @@ bool CFileBase::Seek(Int64 distanceToMove, DWORD moveMethod, UInt64 &newPosition
value.QuadPart = distanceToMove;
value.LowPart = ::SetFilePointer(_handle, value.LowPart, &value.HighPart, moveMethod);
if (value.LowPart == 0xFFFFFFFF)
if(::GetLastError() != NO_ERROR)
if (::GetLastError() != NO_ERROR)
return false;
newPosition = value.QuadPart;
return true;
@@ -307,9 +307,9 @@ bool COutFile::SetEndOfFile() { return BOOLToBool(::SetEndOfFile(_handle)); }
bool COutFile::SetLength(UInt64 length)
{
UInt64 newPosition;
if(!Seek(length, newPosition))
if (!Seek(length, newPosition))
return false;
if(newPosition != length)
if (newPosition != length)
return false;
return SetEndOfFile();
}

View File

@@ -27,8 +27,6 @@ void NormalizeDirPathPrefix(UString &dirPath)
}
#endif
#ifdef _WIN32
const wchar_t kExtensionDelimiter = L'.';
void SplitNameToPureNameAndExtension(const UString &fullName,
@@ -49,6 +47,4 @@ void SplitNameToPureNameAndExtension(const UString &fullName,
}
}
#endif
}}}

View File

@@ -17,10 +17,8 @@ void NormalizeDirPathPrefix(CSysString &dirPath); // ensures that it ended with
void NormalizeDirPathPrefix(UString &dirPath); // ensures that it ended with '\\'
#endif
#ifdef _WIN32
void SplitNameToPureNameAndExtension(const UString &fullName,
UString &pureName, UString &extensionDelimiter, UString &extension);
#endif
}}}

View File

@@ -35,7 +35,7 @@ public:
};
~CGlobalLock()
{
if(m_Pointer != NULL)
if (m_Pointer != NULL)
::GlobalUnlock(m_Global);
}
};

View File

@@ -67,7 +67,7 @@ bool enable)
bool EnableLockMemoryPrivilege(bool enable)
{
HMODULE hModule = LoadLibrary(TEXT("Advapi32.dll"));
if(hModule == NULL)
if (hModule == NULL)
return false;
bool res = EnableLockMemoryPrivilege2(hModule, enable);
::FreeLibrary(hModule);

View File

@@ -83,7 +83,7 @@ bool CMenu::GetItem(UINT itemIndex, bool byPosition, CMenuItem &item)
si.cch = kMaxSize;
si.dwTypeData = s;
}
if(GetItemInfo(itemIndex, byPosition, &si))
if (GetItemInfo(itemIndex, byPosition, &si))
{
ConvertItemToMyForm(si, item);
if (item.IsString())
@@ -102,7 +102,7 @@ bool CMenu::GetItem(UINT itemIndex, bool byPosition, CMenuItem &item)
si.cch = kMaxSize;
si.dwTypeData = s;
}
if(GetItemInfo(itemIndex, byPosition, &si))
if (GetItemInfo(itemIndex, byPosition, &si))
{
ConvertItemToMyForm(si, item);
if (item.IsString())

View File

@@ -13,7 +13,7 @@ bool MyGetTimeFormat(LCID locale, DWORD flags, CONST SYSTEMTIME *time,
{
resultString.Empty();
int numChars = ::GetTimeFormat(locale, flags, time, format, NULL, 0);
if(numChars == 0)
if (numChars == 0)
return false;
numChars = ::GetTimeFormat(locale, flags, time, format,
resultString.GetBuffer(numChars), numChars + 1);
@@ -26,7 +26,7 @@ bool MyGetDateFormat(LCID locale, DWORD flags, CONST SYSTEMTIME *time,
{
resultString.Empty();
int numChars = ::GetDateFormat(locale, flags, time, format, NULL, 0);
if(numChars == 0)
if (numChars == 0)
return false;
numChars = ::GetDateFormat(locale, flags, time, format,
resultString.GetBuffer(numChars), numChars + 1);

View File

@@ -181,7 +181,7 @@ DWORD CEnum::Open(DWORD scope, DWORD type, DWORD usage, const CResourceW *resour
DWORD CEnum::Close()
{
if(!_handleAllocated)
if (!_handleAllocated)
return NO_ERROR;
DWORD result = ::WNetCloseEnum(_handle);
_handleAllocated = (result != NO_ERROR);

View File

@@ -259,7 +259,7 @@ void CPropVariant::InternalCopy(const PROPVARIANT* pSrc)
int CPropVariant::Compare(const CPropVariant &a)
{
if(vt != a.vt)
if (vt != a.vt)
return 0; // it's mean some bug
switch (vt)
{

View File

@@ -2,8 +2,6 @@
#include "StdAfx.h"
// #include <stdio.h>
#include "PropVariantConversions.h"
#include "Windows/Defs.h"
@@ -51,7 +49,7 @@ bool ConvertFileTimeToString(const FILETIME &ft, char *s, bool includeTime, bool
{
s[0] = '\0';
SYSTEMTIME st;
if(!BOOLToBool(FileTimeToSystemTime(&ft, &st)))
if (!BOOLToBool(FileTimeToSystemTime(&ft, &st)))
return false;
s = UIntToStringSpec(0, st.wYear, s, 4);
s = UIntToStringSpec('-', st.wMonth, s, 2);
@@ -63,15 +61,6 @@ bool ConvertFileTimeToString(const FILETIME &ft, char *s, bool includeTime, bool
if (includeSeconds)
UIntToStringSpec(':', st.wSecond, s, 2);
}
/*
sprintf(s, "%04d-%02d-%02d", st.wYear, st.wMonth, st.wDay);
if (includeTime)
{
sprintf(s + strlen(s), " %02d:%02d", st.wHour, st.wMinute);
if (includeSeconds)
sprintf(s + strlen(s), ":%02d", st.wSecond);
}
*/
return true;
}

View File

@@ -304,7 +304,7 @@ LONG CKey::EnumKeys(CSysStringVector &keyNames)
{
keyNames.Clear();
CSysString keyName;
for(UInt32 index = 0; ; index++)
for (UInt32 index = 0; ; index++)
{
const UInt32 kBufferSize = MAX_PATH + 1; // 256 in ATL
FILETIME lastWriteTime;
@@ -312,9 +312,9 @@ LONG CKey::EnumKeys(CSysStringVector &keyNames)
LONG result = ::RegEnumKeyEx(_object, index, keyName.GetBuffer(kBufferSize),
(DWORD *)&nameSize, NULL, NULL, NULL, &lastWriteTime);
keyName.ReleaseBuffer();
if(result == ERROR_NO_MORE_ITEMS)
if (result == ERROR_NO_MORE_ITEMS)
break;
if(result != ERROR_SUCCESS)
if (result != ERROR_SUCCESS)
return result;
keyNames.Add(keyName);
}

View File

@@ -10,8 +10,6 @@
namespace NWindows {
namespace NRegistry {
const TCHAR kKeyNameDelimiter = TEXT('\\');
LONG SetValue(HKEY parentKey, LPCTSTR keyName, LPCTSTR valueName, LPCTSTR value);
class CKey

View File

@@ -86,7 +86,7 @@ static PSID GetSid(LPWSTR accountName)
#endif
(NULL, accountName, NULL, &sidLen, NULL, &domainLen, &sidNameUse))
{
if(::GetLastError() == ERROR_INSUFFICIENT_BUFFER)
if (::GetLastError() == ERROR_INSUFFICIENT_BUFFER)
{
PSID pSid = ::HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sidLen);
LPWSTR domainName = (LPWSTR)::HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (domainLen + 1) * sizeof(WCHAR));

View File

@@ -21,10 +21,10 @@ namespace NShell {
void CItemIDList::Free()
{
if(m_Object == NULL)
if (m_Object == NULL)
return;
CMyComPtr<IMalloc> shellMalloc;
if(::SHGetMalloc(&shellMalloc) != NOERROR)
if (::SHGetMalloc(&shellMalloc) != NOERROR)
throw 41099;
shellMalloc->Free(m_Object);
m_Object = NULL;
@@ -43,7 +43,7 @@ CItemIDList& CItemIDList::operator=(LPCITEMIDLIST object)
{
UINT32 size = GetSize(object);
m_Object = (LPITEMIDLIST)CoTaskMemAlloc(size);
if(m_Object != NULL)
if (m_Object != NULL)
MoveMemory(m_Object, object, size);
}
return *this;
@@ -52,11 +52,11 @@ CItemIDList& CItemIDList::operator=(LPCITEMIDLIST object)
CItemIDList& CItemIDList::operator=(const CItemIDList &object)
{
Free();
if(object.m_Object != NULL)
if (object.m_Object != NULL)
{
UINT32 size = GetSize(object.m_Object);
m_Object = (LPITEMIDLIST)CoTaskMemAlloc(size);
if(m_Object != NULL)
if (m_Object != NULL)
MoveMemory(m_Object, object.m_Object, size);
}
return *this;
@@ -74,7 +74,7 @@ void CDrop::Attach(HDROP object)
void CDrop::Free()
{
if(m_MustBeFinished && m_Assigned)
if (m_MustBeFinished && m_Assigned)
Finish();
m_Assigned = false;
}
@@ -116,7 +116,7 @@ void CDrop::QueryFileNames(UStringVector &fileNames)
fileNames.Clear();
UINT numFiles = QueryCountOfFiles();
fileNames.Reserve(numFiles);
for(UINT i = 0; i < numFiles; i++)
for (UINT i = 0; i < numFiles; i++)
fileNames.Add(QueryFileName(i));
}

View File

@@ -94,7 +94,7 @@ public:
if (_window == NULL)
return true;
bool result = BOOLToBool(::DestroyWindow(_window));
if(result)
if (result)
_window = NULL;
return result;
}