Skip to content

Commit

Permalink
Got rid of compiler warnings, bumped warning level to 4
Browse files Browse the repository at this point in the history
  • Loading branch information
nickgammon committed Sep 16, 2010
1 parent 5a7c795 commit a0d2cd3
Show file tree
Hide file tree
Showing 50 changed files with 269 additions and 181 deletions.
2 changes: 1 addition & 1 deletion Finding.cpp
Expand Up @@ -24,7 +24,7 @@ line, when required.
*/

#pragma warning( disable : 4800 ) // never mind those "bool" warnings
#pragma warning (disable : 4800) // forcing value to bool 'true' or 'false' (performance warning)


static void WrapUpFind (CFindInfo & FindInfo)
Expand Down
1 change: 0 additions & 1 deletion MUSHclient.cpp
Expand Up @@ -263,7 +263,6 @@ BOOL CMUSHclientApp::InitInstance()

// open SQLite database for preferences

char *zErrMsg = 0;
int rc;
CFileStatus status;

Expand Down
37 changes: 22 additions & 15 deletions MUSHclient.dsp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 17 additions & 13 deletions ProcessPreviousLine.cpp
Expand Up @@ -38,7 +38,7 @@ return CFormat ("%c[%dm", ESC, Code);

void CMUSHclientDoc::LogLineInHTMLcolour (POSITION startpos)
{
COLORREF prevcolour = -1;
COLORREF prevcolour = NO_COLOUR;
bool bInSpan = false;
COLORREF lastforecolour = 0;
COLORREF lastbackcolour = 0;
Expand Down Expand Up @@ -324,8 +324,8 @@ assemble the full text of the original line.
bUnderline = false,
bBlink = false,
bInverse = false;
unsigned int iForeground = -1;
unsigned int iBackground = -1;
unsigned int iForeground = NO_COLOUR;
unsigned int iBackground = NO_COLOUR;
CString str;
CString strRun;

Expand Down Expand Up @@ -952,11 +952,12 @@ POSITION pos;

for (iItem = 0; iItem < GetTriggerArray ().GetSize (); iItem++)
{
if (trigger_item = EvaluateTrigger (strCurrentLine,
trigger_item = EvaluateTrigger (strCurrentLine,
strResponse,
iItem,
iStartCol,
iEndCol))
iEndCol);
if (trigger_item)
{


Expand All @@ -969,9 +970,9 @@ POSITION pos;

if (trigger_item->iMatch && !trigger_item->bMultiLine)
{
int iFlags;
COLORREF iForeColour;
COLORREF iBackColour;
int iFlags = 0;
COLORREF iForeColour = NO_COLOUR;
COLORREF iBackColour = NO_COLOUR;
int iCurrentCol = 0;
for (pos = prevpos; pos; ) // scan to end of buffer
{
Expand All @@ -983,7 +984,7 @@ POSITION pos;
if (i < 0)
i = 0;

CStyle * pStyle;
CStyle * pStyle = NULL;
int iStyleCol = 0;

// find style run
Expand All @@ -994,10 +995,13 @@ POSITION pos;
if (iStyleCol > i) // we are at the column
break;
} // end of finding style item

iFlags = pStyle->iFlags & STYLE_BITS; // get style
iForeColour = pStyle->iForeColour;
iBackColour = pStyle->iBackColour;

if (pStyle)
{
iFlags = pStyle->iFlags & STYLE_BITS; // get style
iForeColour = pStyle->iForeColour;
iBackColour = pStyle->iBackColour;
}
break; // done
}
iCurrentCol += pLine->len; // next line starts where this left off
Expand Down
3 changes: 1 addition & 2 deletions TextView.cpp
Expand Up @@ -18,7 +18,7 @@ Copyright (C) 2000 Nick Gammon.
#include "dialogs\GoToLineDlg.h"
#include "dialogs\LuaGsubDlg.h"

#pragma warning (disable:4100)
#pragma warning( disable : 4100) // unreferenced formal parameter

#ifdef _DEBUG
//#define new DEBUG_NEW
Expand Down Expand Up @@ -1186,7 +1186,6 @@ void CTextView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
!m_bInsertMode &&
nStartChar == nEndChar)
{
bool bEndLine = false;
CString strText;
GetEditCtrl().GetWindowText (strText);

Expand Down
7 changes: 4 additions & 3 deletions Utilities.cpp
Expand Up @@ -184,8 +184,10 @@ char * pNew = p;
char c;
int i;

for ( ; c = *p; p++)
for ( ; *p; p++)
{
c = *p;

// look for escape sequences ...
if (c == '\\')
{
Expand Down Expand Up @@ -441,7 +443,6 @@ bool GetClipboardColour (COLORREF & colour)
{
CString strColour;
int i;
bool bEnable = true;
bool bReverse;
CColours * colour_item;

Expand Down Expand Up @@ -534,7 +535,7 @@ static char base64code[64]=
int getBase64Value(char code){

int val= (int)code;
int result;
int result = 0;

if (val >= 'A' && val <= 'Z')
result= val - 65;
Expand Down
2 changes: 1 addition & 1 deletion chatsock.h
Expand Up @@ -52,7 +52,7 @@ class CMUSHclientDoc;
#define CHAT_SEND_COMMAND 105 // extension, however see zChat
#define CHAT_STAMP 106

#define CHAT_END_OF_COMMAND 255
#define CHAT_END_OF_COMMAND '\xFF' // 255

// types of ChatNotes

Expand Down
1 change: 0 additions & 1 deletion dialogs/ColourPickerDlg.cpp
Expand Up @@ -402,7 +402,6 @@ OnSelectColour ();

void CColourPickerDlg::OnItemchangedColourlist(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;

int iSel = m_ctlColourList.GetNextItem(-1, LVNI_SELECTED);

Expand Down
4 changes: 1 addition & 3 deletions dialogs/KeyNameDlg.cpp
Expand Up @@ -58,8 +58,6 @@ void CKeyNameDlg::OnUpdateKeyName(CCmdUI* pCmdUI)

m_ctlHotkeyValue.GetHotKey (wVirtualKeyCode, wModifiers);

DWORD test = m_ctlHotkeyValue.GetHotKey ();

BYTE fVirt = 0;

if (wModifiers & HOTKEYF_ALT)
Expand All @@ -71,5 +69,5 @@ void CKeyNameDlg::OnUpdateKeyName(CCmdUI* pCmdUI)

pCmdUI->SetText (KeyCodeToString (fVirt, wVirtualKeyCode));

} // end of CTriggerDlg::OnUpdateInvocationCount
} // end of CKeyNameDlg::OnUpdateKeyName

3 changes: 0 additions & 3 deletions dialogs/TipDlg.cpp
Expand Up @@ -53,7 +53,6 @@ char * p;

// We need to find out what the startup and file position parameters are
// If startup does not exist, we assume that the Tips on startup is checked TRUE.
CWinApp* pApp = AfxGetApp();
m_bStartup = !App.db_get_int("control", szIntStartup, 0);
UINT iFilePos = App.db_get_int("control", szIntFilePos, 0);

Expand Down Expand Up @@ -101,7 +100,6 @@ CTipDlg::~CTipDlg()
// But make sure the tips file existed in the first place....
if (m_pStream != NULL)
{
CWinApp* pApp = AfxGetApp();
App.db_write_int("control", szIntFilePos, ftell(m_pStream));
fclose(m_pStream);
}
Expand Down Expand Up @@ -178,7 +176,6 @@ void CTipDlg::OnOK()
CDialog::OnOK();

// Update the startup information stored in the INI file
CWinApp* pApp = AfxGetApp();
App.db_write_int ("control", szIntStartup, !m_bStartup);
}

Expand Down
2 changes: 0 additions & 2 deletions dialogs/global_prefs/GlobalPrefs.cpp
Expand Up @@ -1503,8 +1503,6 @@ void CGlobalPrefsP11::OnChooseIconFile()

CheckRadioButton (IDC_MUSHCLIENT_ICON, IDC_CUSTOM_ICON, IDC_CUSTOM_ICON);

DWORD i = GetLastError ();

}
/////////////////////////////////////////////////////////////////////////////
// CGlobalPrefsP12 property page
Expand Down
3 changes: 0 additions & 3 deletions dialogs/plugins/PluginsDlg.cpp
Expand Up @@ -328,10 +328,7 @@ void CPluginsDlg::OnAddPlugin()


if (nResult != IDOK)
{
DWORD reason = CommDlgExtendedError();
return; // cancelled dialog
}

bool bChanged = false;

Expand Down
4 changes: 1 addition & 3 deletions dialogs/world_prefs/TreePropertySheet.cpp
Expand Up @@ -604,7 +604,7 @@ PURPOSE: Hides the default property sheet buttons
--------------------------------------------------------------------*/
bool CTreePropertySheet::HidePpgButtons()
{
int nControls=m_acControlPos.GetSize();
m_acControlPos.GetSize();

CRect rcTemp,rcWindow;
GetDlgItem(IDOK)->GetWindowRect(&rcTemp);
Expand Down Expand Up @@ -956,7 +956,6 @@ void CTreePropertySheet::AssignFillerSpace(
{
int i,nSize=m_acControlPos.GetSize();
int nFillers=CountFillers(nVertArrange,nRow);
int nCount=0;

if(nFillers==0)
return;
Expand Down Expand Up @@ -1047,7 +1046,6 @@ CTreePropertySheet::cControlPos* CTreePropertySheet::GetControl(
int nCol)
{
int i,nSize=m_acControlPos.GetSize();
int nCount=0;

for(i=0;i<nSize;i++) {
cControlPos& cur=m_acControlPos[i];
Expand Down
14 changes: 7 additions & 7 deletions dialogs/world_prefs/prefspropertypages.cpp
Expand Up @@ -36,7 +36,7 @@
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif

#pragma warning( disable: 4800)
#pragma warning (disable : 4800) // forcing value to bool 'true' or 'false' (performance warning)
bool NotFound (CFindInfo & FindInfo);

#define NL "\r\n"
Expand Down Expand Up @@ -3069,7 +3069,7 @@ for (int nItem = -1;
m_doc->SetModifiedFlag (TRUE);

// re-setup list with amended details
int nNewItem = add_item (pItem, pstrObjectName, nItem, FALSE);
add_item (pItem, pstrObjectName, nItem, FALSE);

}

Expand Down Expand Up @@ -3153,7 +3153,7 @@ for (int nItem = -1;
m_doc->SetModifiedFlag (TRUE);

// re-setup list with amended details
int nNewItem = add_item (pItem, pstrObjectName, nItem, FALSE);
add_item (pItem, pstrObjectName, nItem, FALSE);

}

Expand Down Expand Up @@ -4108,7 +4108,7 @@ for (int nItem = -1;
m_doc->SetModifiedFlag (TRUE);

// re-setup list with amended details
int nNewItem = add_item (pItem, pstrObjectName, nItem, FALSE);
add_item (pItem, pstrObjectName, nItem, FALSE);

}

Expand Down Expand Up @@ -4192,7 +4192,7 @@ for (int nItem = -1;
m_doc->SetModifiedFlag (TRUE);

// re-setup list with amended details
int nNewItem = add_item (pItem, pstrObjectName, nItem, FALSE);
add_item (pItem, pstrObjectName, nItem, FALSE);

}

Expand Down Expand Up @@ -6263,7 +6263,7 @@ CTimer * timer1 = (CTimer *) item1,
ASSERT_VALID (timer2);
ASSERT( timer2->IsKindOf( RUNTIME_CLASS( CTimer ) ) );

int iResult;
int iResult = 0;
CmcDateTimeSpan ts1,
ts2;

Expand Down Expand Up @@ -8693,7 +8693,7 @@ void CPrefsP15::CalculateMemoryUsage ()
// count styles and work out how much memory they take too
for (POSITION pos2 = pLine->styleList.GetHeadPosition(); pos2; iStyles++)
{
CStyle * pStyle = pLine->styleList.GetNext (pos2);
pLine->styleList.GetNext (pos2);
nMemory += sizeof CStyle; // length of style class
nMemory += sizeof (void *) * 3; // and the list item
}
Expand Down

0 comments on commit a0d2cd3

Please sign in to comment.