mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 12:23:31 +00:00
[WHOAMI]
[ARP] [TRACERT] - Incorrect to compare the variable of BOOL type with TRUE. Any non-zero value is considered to be "true". [FREELDR] - Variable is assigned values twice - The 'strlen' function was called multiple times inside the body of a loop - It is inefficient to identify an empty string by using 'strlen(str) > 0' construct. A more efficient way is to check: str[0] != 0 [NTOBJSHEX] [SLAYER] [CMICONTROL] - It is inefficient to identify an empty string by using 'strlen(str) > 0' construct. A more efficient way is to check: str[0] != 0 [SHELL32] - There is no sense in testing the pointer against null, as the memory was allocated using the 'new' operator. The exception will be generated in the case of memory allocation error - Verifying that a pointer value is not NULL is not required. The 'if (ptr != NULL)' check can be removed - Fix copy-paste error in CMenuFocusManager::PlaceHooks() [SRCLIENT] - Remove unneeded check. A part of conditional expression is always false. [DISK] [ATAPI] - Variable is assigned values twice * All bugs found by PVS-Studio svn path=/trunk/; revision=72059
This commit is contained in:
@@ -753,7 +753,7 @@ int wmain(int argc, WCHAR* argv[])
|
||||
{
|
||||
NoHeaderArgCount++;
|
||||
|
||||
if (NoHeader != TRUE)
|
||||
if (NoHeader == FALSE)
|
||||
{
|
||||
NoHeader = TRUE;
|
||||
// wprintf(L"Headers disabled!\n");
|
||||
@@ -788,7 +788,7 @@ int wmain(int argc, WCHAR* argv[])
|
||||
|
||||
/* looks like you can't use the "/fo list /nh" options together
|
||||
for some stupid reason */
|
||||
if (PrintFormat == list && NoHeader == TRUE)
|
||||
if (PrintFormat == list && NoHeader != FALSE)
|
||||
{
|
||||
wprintf(WhoamiLoadRcString(IDS_ERROR_NH_LIST));
|
||||
return 1;
|
||||
|
||||
@@ -464,7 +464,7 @@ INT Deletehost(PTCHAR pszInetAddr, PTCHAR pszIfAddr)
|
||||
pDelHost->dwIndex = pIpNetTable->table[0].dwIndex;
|
||||
}
|
||||
|
||||
if (bFlushTable == TRUE)
|
||||
if (bFlushTable != FALSE)
|
||||
{
|
||||
/* delete arp cache */
|
||||
if (FlushIpNetTable(pDelHost->dwIndex) != NO_ERROR)
|
||||
|
||||
@@ -450,7 +450,7 @@ Driver(PAPPINFO pInfo)
|
||||
|
||||
/* run until we hit either max hops, or find the target */
|
||||
while ((iHopCount <= pInfo->iMaxHops) &&
|
||||
(bFoundTarget != TRUE))
|
||||
(bFoundTarget == FALSE))
|
||||
{
|
||||
USHORT iSeqNum = 0;
|
||||
INT i;
|
||||
@@ -460,7 +460,7 @@ Driver(PAPPINFO pInfo)
|
||||
/* run 3 pings for each hop */
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
if (SetTTL(pInfo->icmpSock, iTTL) != TRUE)
|
||||
if (SetTTL(pInfo->icmpSock, iTTL) == FALSE)
|
||||
{
|
||||
DebugPrint(_T("error in Setup()\n"));
|
||||
return ret;
|
||||
|
||||
@@ -607,7 +607,6 @@ ScsiPortGetPhysicalAddress(
|
||||
else
|
||||
{
|
||||
/* Nothing */
|
||||
*Length = 0;
|
||||
PhysicalAddress.QuadPart = (LONGLONG)(SP_UNINITIALIZED_VALUE);
|
||||
}
|
||||
|
||||
|
||||
@@ -385,9 +385,12 @@ VOID FsSetFilePointer(PFILE FileHandle, ULONG NewFilePointer)
|
||||
ULONG FsGetNumPathParts(PCSTR Path)
|
||||
{
|
||||
size_t i;
|
||||
size_t len;
|
||||
ULONG num;
|
||||
|
||||
len = strlen(Path);
|
||||
|
||||
for (i = 0, num = 0; i < strlen(Path); i++)
|
||||
for (i = 0, num = 0; i < len; i++)
|
||||
{
|
||||
if ((Path[i] == '\\') || (Path[i] == '/'))
|
||||
{
|
||||
@@ -410,11 +413,14 @@ ULONG FsGetNumPathParts(PCSTR Path)
|
||||
VOID FsGetFirstNameFromPath(PCHAR Buffer, PCSTR Path)
|
||||
{
|
||||
size_t i;
|
||||
size_t len;
|
||||
|
||||
len = strlen(Path);
|
||||
|
||||
// Copy all the characters up to the end of the
|
||||
// string or until we hit a '\' character
|
||||
// and put them in Buffer
|
||||
for (i = 0; i < strlen(Path); i++)
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
if ((Path[i] == '\\') || (Path[i] == '/'))
|
||||
{
|
||||
|
||||
@@ -650,7 +650,7 @@ LoadAndBootWindows(IN OperatingSystemItem* OperatingSystem,
|
||||
}
|
||||
|
||||
/* Append a backslash if needed */
|
||||
if ((strlen(BootPath) == 0) || BootPath[strlen(BootPath) - 1] != '\\')
|
||||
if ((BootPath[0] == 0) || BootPath[strlen(BootPath) - 1] != '\\')
|
||||
strcat(BootPath, "\\");
|
||||
|
||||
/* Read booting options */
|
||||
|
||||
@@ -705,7 +705,7 @@ WinLdrAddDriverToList(LIST_ENTRY *BootDriverListHead,
|
||||
|
||||
// Check - if we have a valid ImagePath, if not - we need to build it
|
||||
// like "System32\\Drivers\\blah.sys"
|
||||
if (ImagePath && (wcslen(ImagePath) > 0))
|
||||
if (ImagePath && (ImagePath[0] != 0))
|
||||
{
|
||||
// Just copy ImagePath to the corresponding field in the structure
|
||||
PathLength = (USHORT)wcslen(ImagePath) * sizeof(WCHAR) + sizeof(UNICODE_NULL);
|
||||
|
||||
@@ -471,7 +471,7 @@ HRESULT STDMETHODCALLTYPE CRegistryFolder::EnumObjects(
|
||||
SHCONTF grfFlags,
|
||||
IEnumIDList **ppenumIDList)
|
||||
{
|
||||
if (wcslen(m_NtPath) == 0 && m_hRoot == NULL)
|
||||
if (m_NtPath[0] == 0 && m_hRoot == NULL)
|
||||
{
|
||||
return GetEnumRegistryRoot(ppenumIDList);
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ LoadAndParseAppCompatibilityFlags(LPCOMPATIBILITYPAGE info,
|
||||
}
|
||||
|
||||
info->CSelectedItem = NULL;
|
||||
if (_tcslen(szStr) > 0)
|
||||
if (szStr[0] != 0)
|
||||
{
|
||||
PCITEM item;
|
||||
|
||||
|
||||
@@ -172,8 +172,7 @@ static CDesktopBrowser *SHDESK_Create(HWND hWnd, LPCREATESTRUCT lpCreateStruct)
|
||||
}
|
||||
|
||||
pThis = new CComObject<CDesktopBrowser>;
|
||||
if (pThis == NULL)
|
||||
return NULL;
|
||||
|
||||
pThis->AddRef();
|
||||
|
||||
hRet = pThis->Initialize(hWnd, ShellDesk);
|
||||
|
||||
@@ -67,11 +67,8 @@ CMenuBand::~CMenuBand()
|
||||
{
|
||||
CMenuFocusManager::ReleaseManager(m_focusManager);
|
||||
|
||||
if (m_staticToolbar)
|
||||
delete m_staticToolbar;
|
||||
|
||||
if (m_SFToolbar)
|
||||
delete m_SFToolbar;
|
||||
delete m_staticToolbar;
|
||||
delete m_SFToolbar;
|
||||
|
||||
if (m_hmenu)
|
||||
DestroyMenu(m_hmenu);
|
||||
|
||||
@@ -680,7 +680,7 @@ LRESULT CMenuFocusManager::GetMsgHook(INT nCode, WPARAM hookWParam, LPARAM hookL
|
||||
|
||||
HRESULT CMenuFocusManager::PlaceHooks()
|
||||
{
|
||||
if (m_hMsgFilterHook)
|
||||
if (m_hGetMsgHook)
|
||||
{
|
||||
WARN("GETMESSAGE hook already placed!\n");
|
||||
return S_OK;
|
||||
|
||||
@@ -35,7 +35,7 @@ SRSetRestorePointA(PRESTOREPOINTINFOA pRestorePtSpec, PSTATEMGRSTATUS pStateMgrS
|
||||
|
||||
DPRINT1("SRSetRestorePointA is unimplemented\n");
|
||||
|
||||
if (!pRestorePtSpec || !pRestorePtSpec->szDescription)
|
||||
if (!pRestorePtSpec)
|
||||
return FALSE;
|
||||
|
||||
RPInfoW.dwEventType = pRestorePtSpec->dwEventType;
|
||||
|
||||
@@ -505,7 +505,6 @@ Return Value:
|
||||
// SRB zone elements to allocate.
|
||||
//
|
||||
|
||||
adapterDisk = 0;
|
||||
adapterInfo = (PVOID) buffer;
|
||||
|
||||
adapterDisk = ScsiClassFindUnclaimedDevices(InitializationData, adapterInfo);
|
||||
|
||||
@@ -5483,7 +5483,6 @@ Return Value:
|
||||
//
|
||||
|
||||
deviceExtension->ExpectingInterrupt = FALSE;
|
||||
status = SRB_STATUS_SUCCESS;
|
||||
|
||||
} else {
|
||||
|
||||
@@ -5495,7 +5494,6 @@ Return Value:
|
||||
|
||||
GetBaseStatus(baseIoAddress1, statusByte);
|
||||
deviceExtension->ExpectingInterrupt = FALSE;
|
||||
status = SRB_STATUS_SUCCESS;
|
||||
|
||||
if (errorByte & IDE_ERROR_DATA_ERROR) {
|
||||
|
||||
|
||||
@@ -943,12 +943,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine,
|
||||
ZeroMemory(&cmiTopologyDev, sizeof(CMIDEV));
|
||||
hWave = NULL;
|
||||
|
||||
if (szCmdLine) {
|
||||
if (strlen(szCmdLine) > 0) {
|
||||
int result = parseArguments(szCmdLine);
|
||||
cleanUp();
|
||||
return result;
|
||||
}
|
||||
if (szCmdLine && szCmdLine[0] != 0) {
|
||||
int result = parseArguments(szCmdLine);
|
||||
cleanUp();
|
||||
return result;
|
||||
}
|
||||
|
||||
if ((hWndMain = FindWindow("cmiControlPanel", NULL))) {
|
||||
|
||||
Reference in New Issue
Block a user