Skip to content

Commit

Permalink
fix log/sym folder creation failure, clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
xwlan committed Sep 22, 2015
1 parent 97cd909 commit f416b81
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 33 deletions.
12 changes: 8 additions & 4 deletions apspf/aps.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,10 @@ ApsInitialize(

StringCchPrintf(ApsLogPath, MAX_PATH, L"%s\\log", Path);
Status = CreateDirectory(ApsLogPath, NULL);
if (Status != APS_STATUS_OK && Status != ERROR_ALREADY_EXISTS) {
return Status;
if (!Status) {
if (GetLastError() != ERROR_ALREADY_EXISTS) {
return APS_STATUS_ERROR;
}
}

//
Expand All @@ -231,8 +233,10 @@ ApsInitialize(

StringCchPrintf(ApsLocalSymPath, MAX_PATH, L"%s\\sym", Path);
Status = CreateDirectory(ApsLocalSymPath, NULL);
if (Status != APS_STATUS_OK && Status != ERROR_ALREADY_EXISTS) {
return Status;
if (!Status) {
if (GetLastError() != ERROR_ALREADY_EXISTS) {
return APS_STATUS_ERROR;
}
}

Status = ApsInitializeLog(APS_FLAG_LOGGING);
Expand Down
2 changes: 0 additions & 2 deletions dprofiler/cpuflame.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,6 @@ CpuFlameInsertData(
PBTR_STACK_RECORD Record;
ULONG Count;
PCALL_GRAPH Graph;
PCPU_THREAD_TABLE ThreadTable;
PCPU_THREAD Thread;

Object = (PDIALOG_OBJECT)SdkGetObject(hWnd);
Context = (PCPU_FORM_CONTEXT)Object->Context;
Expand Down
2 changes: 1 addition & 1 deletion dprofiler/cpuhistory.c
Original file line number Diff line number Diff line change
Expand Up @@ -2304,7 +2304,7 @@ CpuHistoryInsertBackTrace(
lvi.iSubItem = 2;
lvi.mask = LVIF_TEXT;

if (Text->LineId != -1) {
if (Text != NULL && Text->LineId != -1) {
ASSERT(Line != NULL);
LineEntry = Line + Text->LineId;
StringCchPrintf(Buffer, MAX_PATH, L"%S:%u", LineEntry->File, LineEntry->Line);
Expand Down
18 changes: 0 additions & 18 deletions dprofiler/cputhread.c
Original file line number Diff line number Diff line change
Expand Up @@ -728,24 +728,6 @@ CpuThreadGetTable(
return (PCPU_THREAD_TABLE)Context->Context;
}

PCPU_THREAD
CpuThreadGetMostBusyThread(
__in HWND hWnd
)
{
PDIALOG_OBJECT Object;
PCPU_FORM_CONTEXT Context;
PCPU_THREAD_TABLE Table;

Object = (PDIALOG_OBJECT)SdkGetObject(hWnd);
Context = (PCPU_FORM_CONTEXT)Object->Context;
Table = (PCPU_THREAD_TABLE)Context->Context;

ASSERT(Table != NULL);


}

VOID
CpuThreadInsertThreads(
__in HWND hWnd,
Expand Down
2 changes: 0 additions & 2 deletions dprofiler/cputree.c
Original file line number Diff line number Diff line change
Expand Up @@ -534,8 +534,6 @@ CpuTreeInsertData(
PBTR_STACK_RECORD Record;
ULONG Count;
PCALL_GRAPH Graph;
PCPU_THREAD Thread;
PCPU_THREAD_TABLE ThreadTable;

Object = (PDIALOG_OBJECT)SdkGetObject(hWnd);
Context = (PCPU_FORM_CONTEXT)Object->Context;
Expand Down
2 changes: 0 additions & 2 deletions dprofiler/find.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ FindIsComplete(
__in ULONG Current
)
{
ULONG Count;

if (Context->FindForward) {
return TRUE;
}
Expand Down
4 changes: 1 addition & 3 deletions dprofiler/fullstack.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ FullStackInsertBackTrace(
PBTR_TEXT_TABLE Table;
PPF_REPORT_HEAD Report;
PBTR_TEXT_ENTRY Text;
PBTR_DLL_ENTRY DllEntry;
ULONG Length;
PWCHAR Symbol;
ULONG i;
Expand Down Expand Up @@ -507,7 +506,6 @@ FullStackOnTreeListSort(
PDIALOG_OBJECT Object;
PFULLSTACK_CONTEXT Context;
PTREELIST_OBJECT TreeList;
ULONG Column;
TVSORTCB Tsc = {0};
CPU_SORT_CONTEXT SortContext;
TVITEM tvi = {0};
Expand All @@ -518,7 +516,7 @@ FullStackOnTreeListSort(
ASSERT(TreeList != NULL);

SortContext.Column = wp;
SortContext.Context = NULL;
SortContext.Context = (LPARAM)NULL;
SortContext.Order = TreeList->SortOrder;

Tsc.hParent = TVI_ROOT;
Expand Down
1 change: 0 additions & 1 deletion dprofiler/rebar.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ RebarInsertBands(
HWND hWndCombo;
HWND hWndBar;
HWND hWndRebar;
HWND hWndEdit;
PREBAR_BAND Band;
HIMAGELIST Normal;
HIMAGELIST Grayed;
Expand Down

0 comments on commit f416b81

Please sign in to comment.