Skip to content

Commit fdf8af1

Browse files
committed
Fixed warnings, saved 1Mb of executable size by moving something
1 parent b1b2ab6 commit fdf8af1

File tree

8 files changed

+131
-76
lines changed

8 files changed

+131
-76
lines changed

TextView.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,6 @@ END_MESSAGE_MAP()
125125

126126
void CTextView::OnDraw(CDC* pDC)
127127
{
128-
CDocument* pDoc = GetDocument();
129-
ASSERT_VALID(pDoc);
130128
}
131129

132130
/////////////////////////////////////////////////////////////////////////////

Utilities.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,8 +1044,10 @@ void ShutDownSocket (CAsyncSocket & s)
10441044
// stop asynchronous notifications (otherwise IOCtl will fail)
10451045
if (!s.AsyncSelect (0))
10461046
{
1047+
#ifdef _DEBUG
10471048
int iError = s.GetLastError ();
10481049
TRACE1 ("Error on AsyncSelect: %08X\n", iError);
1050+
#endif
10491051
} // end of failure
10501052

10511053
/*

mushview.cpp

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,9 +1312,6 @@ COLORREF iBackColour = BLACK;
13121312

13131313
void CMUSHView::OnInitialUpdate()
13141314
{
1315-
CMUSHclientDoc* pDoc = GetDocument();
1316-
ASSERT_VALID(pDoc);
1317-
13181315
CView::OnInitialUpdate();
13191316

13201317
CSize sizeTotal;
@@ -1473,13 +1470,9 @@ ScrollToPosition (pt, false);
14731470

14741471
void CMUSHView::OnTestStart()
14751472
{
1476-
CMUSHclientDoc* pDoc = GetDocument();
1477-
ASSERT_VALID(pDoc);
1478-
14791473
POINT pt = {0, 0};
14801474

14811475
ScrollToPosition (pt, false);
1482-
14831476
}
14841477

14851478

@@ -2898,10 +2891,6 @@ long startcol,
28982891

28992892
BOOL CMUSHView::OnEraseBkgnd(CDC* pDC)
29002893
{
2901-
CMUSHclientDoc* pDoc = GetDocument();
2902-
ASSERT_VALID(pDoc);
2903-
2904-
29052894
return FALSE;
29062895
}
29072896

@@ -6229,13 +6218,11 @@ DISPID iDispid = pPlugin->m_ScriptEngine->GetDispid (sRoutineName.c_str ());
62296218
// change to this plugin, call function, put current plugin back
62306219
CPlugin * pSavedPlugin = pDoc->m_CurrentPlugin;
62316220
pDoc->m_CurrentPlugin = pPlugin;
6232-
CScriptDispatchID dispid_info;
6233-
dispid_info._dispid = iDispid;
6221+
CScriptDispatchID dispid_info (iDispid);
62346222
CScriptCallInfo callinfo (sRoutineName.c_str (), dispid_info);
62356223
pPlugin->ExecutePluginScript (callinfo,
62366224
Flags, // keyboard flags
6237-
HotspotId.c_str () // which hotspot
6238-
);
6225+
HotspotId.c_str ()); // which hotspot
62396226
pDoc->m_CurrentPlugin = pSavedPlugin;
62406227

62416228

plugins.cpp

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,80 @@
1010
static char BASED_CODE THIS_FILE[] = __FILE__;
1111
#endif
1212

13+
// plugin callback routines - start with OnPlugin so that we can advise
14+
// users not to use that string for their own routines
15+
16+
// install / remove
17+
const string ON_PLUGIN_INSTALL ("OnPluginInstall");
18+
const string ON_PLUGIN_CLOSE ("OnPluginClose");
19+
const string ON_PLUGIN_LIST_CHANGED ("OnPluginListChanged");
20+
21+
// connect / disconnect
22+
const string ON_PLUGIN_CONNECT ("OnPluginConnect");
23+
const string ON_PLUGIN_DISCONNECT ("OnPluginDisconnect");
24+
25+
// saving
26+
const string ON_PLUGIN_SAVE_STATE ("OnPluginSaveState");
27+
const string ON_PLUGIN_WORLD_SAVE ("OnPluginWorldSave");
28+
29+
// enable / disable
30+
const string ON_PLUGIN_ENABLE ("OnPluginEnable");
31+
const string ON_PLUGIN_DISABLE ("OnPluginDisable");
32+
33+
// the focus
34+
const string ON_PLUGIN_GETFOCUS ("OnPluginGetFocus");
35+
const string ON_PLUGIN_LOSEFOCUS ("OnPluginLoseFocus");
36+
37+
// capture stuff
38+
const string ON_PLUGIN_TRACE ("OnPluginTrace");
39+
const string ON_PLUGIN_BROADCAST ("OnPluginBroadcast");
40+
const string ON_PLUGIN_SCREENDRAW ("OnPluginScreendraw");
41+
42+
// sounds
43+
const string ON_PLUGIN_PLAYSOUND ("OnPluginPlaySound");
44+
45+
// stuff received/sent
46+
const string ON_PLUGIN_SEND ("OnPluginSend");
47+
const string ON_PLUGIN_SENT ("OnPluginSent");
48+
const string ON_PLUGIN_PARTIAL_LINE ("OnPluginPartialLine");
49+
const string ON_PLUGIN_LINE_RECEIVED ("OnPluginLineReceived");
50+
const string ON_PLUGIN_PACKET_RECEIVED ("OnPluginPacketReceived");
51+
52+
// telnet negotiation
53+
const string ON_PLUGIN_TELNET_OPTION ("OnPluginTelnetOption");
54+
const string ON_PLUGIN_TELNET_REQUEST ("OnPluginTelnetRequest");
55+
const string ON_PLUGIN_TELNET_SUBNEGOTIATION ("OnPluginTelnetSubnegotiation");
56+
const string ON_PLUGIN_IAC_GA ("OnPlugin_IAC_GA");
57+
58+
// commands
59+
const string ON_PLUGIN_COMMAND ("OnPluginCommand");
60+
const string ON_PLUGIN_COMMAND_ENTERED ("OnPluginCommandEntered");
61+
const string ON_PLUGIN_COMMAND_CHANGED ("OnPluginCommandChanged");
62+
const string ON_PLUGIN_TABCOMPLETE ("OnPluginTabComplete");
63+
64+
// resizing, ticking, moving, rhythm
65+
const string ON_PLUGIN_WORLD_OUTPUT_RESIZED ("OnPluginWorldOutputResized");
66+
const string ON_PLUGIN_TICK ("OnPluginTick");
67+
const string ON_PLUGIN_MOUSE_MOVED ("OnPluginMouseMoved");
68+
69+
// MXP stuff
70+
const string ON_PLUGIN_MXP_START ("OnPluginMXPstart");
71+
const string ON_PLUGIN_MXP_STOP ("OnPluginMXPstop");
72+
const string ON_PLUGIN_MXP_OPENTAG ("OnPluginMXPopenTag");
73+
const string ON_PLUGIN_MXP_CLOSETAG ("OnPluginMXPcloseTag");
74+
const string ON_PLUGIN_MXP_SETVARIABLE ("OnPluginMXPsetVariable");
75+
const string ON_PLUGIN_MXP_SETENTITY ("OnPluginMXPsetEntity");
76+
const string ON_PLUGIN_MXP_ERROR ("OnPluginMXPerror");
77+
78+
// chat stuff
79+
const string ON_PLUGIN_CHAT_ACCEPT ("OnPluginChatAccept");
80+
const string ON_PLUGIN_CHAT_MESSAGE ("OnPluginChatMessage");
81+
const string ON_PLUGIN_CHAT_MESSAGE_OUT ("OnPluginChatMessageOut");
82+
const string ON_PLUGIN_CHAT_DISPLAY ("OnPluginChatDisplay");
83+
const string ON_PLUGIN_CHAT_NEWUSER ("OnPluginChatNewUser");
84+
const string ON_PLUGIN_CHAT_USERDISCONNECT ("OnPluginChatUserDisconnect");
85+
86+
1387
// possible plugin callbacks
1488
string PluginCallbacksNames [] = {
1589

plugins.h

Lines changed: 50 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
class CScriptDispatchID
66
{
77
public:
8+
// constructor
9+
CScriptDispatchID (DISPID dispid) :
10+
_dispid (dispid),
11+
_count (0) {};
12+
813
// default constructor
914
CScriptDispatchID () :
1015
_dispid (DISPID_UNKNOWN),
@@ -125,80 +130,78 @@ class CPlugin :public CObject
125130

126131
typedef CTypedPtrList <CPtrList, CPlugin*> CPluginList;
127132

128-
129-
130133
// plugin callback routines - start with OnPlugin so that we can advise
131134
// users not to use that string for their own routines
132135

133136
// install / remove
134-
const string ON_PLUGIN_INSTALL ("OnPluginInstall");
135-
const string ON_PLUGIN_CLOSE ("OnPluginClose");
136-
const string ON_PLUGIN_LIST_CHANGED ("OnPluginListChanged");
137+
extern const string ON_PLUGIN_INSTALL;
138+
extern const string ON_PLUGIN_CLOSE;
139+
extern const string ON_PLUGIN_LIST_CHANGED;
137140

138141
// connect / disconnect
139-
const string ON_PLUGIN_CONNECT ("OnPluginConnect");
140-
const string ON_PLUGIN_DISCONNECT ("OnPluginDisconnect");
142+
extern const string ON_PLUGIN_CONNECT;
143+
extern const string ON_PLUGIN_DISCONNECT;
141144

142145
// saving
143-
const string ON_PLUGIN_SAVE_STATE ("OnPluginSaveState");
144-
const string ON_PLUGIN_WORLD_SAVE ("OnPluginWorldSave");
146+
extern const string ON_PLUGIN_SAVE_STATE;
147+
extern const string ON_PLUGIN_WORLD_SAVE;
145148

146149
// enable / disable
147-
const string ON_PLUGIN_ENABLE ("OnPluginEnable");
148-
const string ON_PLUGIN_DISABLE ("OnPluginDisable");
150+
extern const string ON_PLUGIN_ENABLE;
151+
extern const string ON_PLUGIN_DISABLE;
149152

150-
// the focus
151-
const string ON_PLUGIN_GETFOCUS ("OnPluginGetFocus");
152-
const string ON_PLUGIN_LOSEFOCUS ("OnPluginLoseFocus");
153+
// the focus
154+
extern const string ON_PLUGIN_GETFOCUS;
155+
extern const string ON_PLUGIN_LOSEFOCUS;
153156

154157
// capture stuff
155-
const string ON_PLUGIN_TRACE ("OnPluginTrace");
156-
const string ON_PLUGIN_BROADCAST ("OnPluginBroadcast");
157-
const string ON_PLUGIN_SCREENDRAW ("OnPluginScreendraw");
158+
extern const string ON_PLUGIN_TRACE;
159+
extern const string ON_PLUGIN_BROADCAST;
160+
extern const string ON_PLUGIN_SCREENDRAW;
158161

159162
// sounds
160-
const string ON_PLUGIN_PLAYSOUND ("OnPluginPlaySound");
163+
extern const string ON_PLUGIN_PLAYSOUND;
161164

162165
// stuff received/sent
163-
const string ON_PLUGIN_SEND ("OnPluginSend");
164-
const string ON_PLUGIN_SENT ("OnPluginSent");
165-
const string ON_PLUGIN_PARTIAL_LINE ("OnPluginPartialLine");
166-
const string ON_PLUGIN_LINE_RECEIVED ("OnPluginLineReceived");
167-
const string ON_PLUGIN_PACKET_RECEIVED ("OnPluginPacketReceived");
166+
extern const string ON_PLUGIN_SEND;
167+
extern const string ON_PLUGIN_SENT;
168+
extern const string ON_PLUGIN_PARTIAL_LINE;
169+
extern const string ON_PLUGIN_LINE_RECEIVED;
170+
extern const string ON_PLUGIN_PACKET_RECEIVED;
168171

169172
// telnet negotiation
170-
const string ON_PLUGIN_TELNET_OPTION ("OnPluginTelnetOption");
171-
const string ON_PLUGIN_TELNET_REQUEST ("OnPluginTelnetRequest");
172-
const string ON_PLUGIN_TELNET_SUBNEGOTIATION ("OnPluginTelnetSubnegotiation");
173-
const string ON_PLUGIN_IAC_GA ("OnPlugin_IAC_GA");
173+
extern const string ON_PLUGIN_TELNET_OPTION;
174+
extern const string ON_PLUGIN_TELNET_REQUEST;
175+
extern const string ON_PLUGIN_TELNET_SUBNEGOTIATION;
176+
extern const string ON_PLUGIN_IAC_GA;
174177

175178
// commands
176-
const string ON_PLUGIN_COMMAND ("OnPluginCommand");
177-
const string ON_PLUGIN_COMMAND_ENTERED ("OnPluginCommandEntered");
178-
const string ON_PLUGIN_COMMAND_CHANGED ("OnPluginCommandChanged");
179-
const string ON_PLUGIN_TABCOMPLETE ("OnPluginTabComplete");
179+
extern const string ON_PLUGIN_COMMAND;
180+
extern const string ON_PLUGIN_COMMAND_ENTERED;
181+
extern const string ON_PLUGIN_COMMAND_CHANGED;
182+
extern const string ON_PLUGIN_TABCOMPLETE;
180183

181184
// resizing, ticking, moving, rhythm
182-
const string ON_PLUGIN_WORLD_OUTPUT_RESIZED ("OnPluginWorldOutputResized");
183-
const string ON_PLUGIN_TICK ("OnPluginTick");
184-
const string ON_PLUGIN_MOUSE_MOVED ("OnPluginMouseMoved");
185+
extern const string ON_PLUGIN_WORLD_OUTPUT_RESIZED;
186+
extern const string ON_PLUGIN_TICK;
187+
extern const string ON_PLUGIN_MOUSE_MOVED;
185188

186189
// MXP stuff
187-
const string ON_PLUGIN_MXP_START ("OnPluginMXPstart");
188-
const string ON_PLUGIN_MXP_STOP ("OnPluginMXPstop");
189-
const string ON_PLUGIN_MXP_OPENTAG ("OnPluginMXPopenTag");
190-
const string ON_PLUGIN_MXP_CLOSETAG ("OnPluginMXPcloseTag");
191-
const string ON_PLUGIN_MXP_SETVARIABLE ("OnPluginMXPsetVariable");
192-
const string ON_PLUGIN_MXP_SETENTITY ("OnPluginMXPsetEntity");
193-
const string ON_PLUGIN_MXP_ERROR ("OnPluginMXPerror");
190+
extern const string ON_PLUGIN_MXP_START;
191+
extern const string ON_PLUGIN_MXP_STOP;
192+
extern const string ON_PLUGIN_MXP_OPENTAG;
193+
extern const string ON_PLUGIN_MXP_CLOSETAG;
194+
extern const string ON_PLUGIN_MXP_SETVARIABLE;
195+
extern const string ON_PLUGIN_MXP_SETENTITY;
196+
extern const string ON_PLUGIN_MXP_ERROR;
194197

195198
// chat stuff
196-
const string ON_PLUGIN_CHAT_ACCEPT ("OnPluginChatAccept");
197-
const string ON_PLUGIN_CHAT_MESSAGE ("OnPluginChatMessage");
198-
const string ON_PLUGIN_CHAT_MESSAGE_OUT ("OnPluginChatMessageOut");
199-
const string ON_PLUGIN_CHAT_DISPLAY ("OnPluginChatDisplay");
200-
const string ON_PLUGIN_CHAT_NEWUSER ("OnPluginChatNewUser");
201-
const string ON_PLUGIN_CHAT_USERDISCONNECT ("OnPluginChatUserDisconnect");
199+
extern const string ON_PLUGIN_CHAT_ACCEPT;
200+
extern const string ON_PLUGIN_CHAT_MESSAGE;
201+
extern const string ON_PLUGIN_CHAT_MESSAGE_OUT;
202+
extern const string ON_PLUGIN_CHAT_DISPLAY;
203+
extern const string ON_PLUGIN_CHAT_NEWUSER;
204+
extern const string ON_PLUGIN_CHAT_USERDISCONNECT;
202205

203206
// table of callbacks
204207
extern string PluginCallbacksNames [];

sendvw.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,9 +1740,6 @@ ASSERT_VALID(pDoc);
17401740

17411741
void CSendView::OnRepeatLastCommand()
17421742
{
1743-
CMUSHclientDoc* pDoc = GetDocument();
1744-
ASSERT_VALID(pDoc);
1745-
17461743
POSITION pos = m_msgList.GetTailPosition (); // if at bottom, get it
17471744
CString strText;
17481745

@@ -1752,7 +1749,7 @@ void CSendView::OnRepeatLastCommand()
17521749
strText = m_msgList.GetAt (pos); // if found, get its text
17531750

17541751
SendCommand (strText, TRUE);
1755-
1752+
17561753
}
17571754

17581755
void CSendView::OnUpdateRepeatLastCommand(CCmdUI* pCmdUI)

stdafx.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
#pragma warning (disable : 4514) // unreferenced inline function has been removed
1919
#pragma warning (disable : 4611) // interaction between '_setjmp' and C++ object destruction is non-portable
2020
#pragma warning (disable : 4663) // C++ language change: to explicitly specialize class template yadda yadda
21+
#pragma warning (disable : 4702) // unreachable code
2122
#pragma warning (disable : 4706) // assignment within conditional expression
23+
#pragma warning (disable : 4710) // function 'x' not inlined
2224
#pragma warning (disable : 4786) // identifier was truncated to 'number' characters in the debug information
2325

2426

winplace.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,6 @@ BOOL CWindowPlacement::Restore(LPCSTR lpKeyName,
8484
// Get window placement from profile.
8585
void CWindowPlacement::GetProfileWP(LPCSTR lpKeyName)
8686
{
87-
CWinApp *pApp = AfxGetApp();
88-
ASSERT_VALID(pApp);
89-
90-
9187
showCmd = App.db_get_int ("worlds", (LPCTSTR) CFormat ("%s:%s", lpKeyName, "wp.showCmd"), showCmd);
9288
flags = App.db_get_int ("worlds", (LPCTSTR) CFormat ("%s:%s", lpKeyName, "wp.flags"), flags);
9389

@@ -121,10 +117,6 @@ void CWindowPlacement::Save(LPCSTR lpKeyName, CWnd* pWnd)
121117
// Write window placement to app profile
122118
void CWindowPlacement::WriteProfileWP(LPCSTR lpKeyName)
123119
{
124-
CWinApp *pApp = AfxGetApp();
125-
ASSERT_VALID(pApp);
126-
127-
128120
int rc = App.db_execute ("BEGIN TRANSACTION", true);
129121

130122
// give it up if we can't get a transaction going - it's no big deal

0 commit comments

Comments
 (0)