Add wxRESERVED_PARAM symbolic constant and use it instead of 0
This is more readable than just using "0" or "NULL" and shorter than writing a comment every time. No real changes.
This commit is contained in:
@@ -34,6 +34,10 @@ class WXDLLIMPEXP_FWD_CORE wxWindowBase;
|
||||
#define MAX_PATH 260
|
||||
#endif
|
||||
|
||||
// Many MSW functions have parameters which are "reserved". Passing them this
|
||||
// constant is more clear than just using "0" or "NULL".
|
||||
#define wxRESERVED_PARAM 0
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// standard icons from the resources
|
||||
// ---------------------------------------------------------------------------
|
||||
|
@@ -665,7 +665,7 @@ size_t wxDialUpManagerMSW::GetISPNames(wxArrayString& names) const
|
||||
{
|
||||
dwRet = ms_pfnRasEnumEntries
|
||||
(
|
||||
NULL, // reserved
|
||||
wxRESERVED_PARAM,
|
||||
NULL, // default phone book (or all)
|
||||
rasEntries, // [out] buffer for the entries
|
||||
&size, // [in/out] size of the buffer
|
||||
@@ -963,7 +963,7 @@ bool wxDialUpManagerMSW::IsAlwaysOnline() const
|
||||
if ( pfnInternetGetConnectedState )
|
||||
{
|
||||
DWORD flags = 0;
|
||||
if ( pfnInternetGetConnectedState(&flags, 0 /* reserved */) )
|
||||
if ( pfnInternetGetConnectedState(&flags, wxRESERVED_PARAM) )
|
||||
{
|
||||
// there is some connection to the net, see of which type
|
||||
isAlwaysOnline = (flags & (INTERNET_CONNECTION_LAN |
|
||||
|
@@ -454,7 +454,7 @@ bool wxDisplayMSW::ChangeMode(const wxVideoMode& mode)
|
||||
(
|
||||
GetName().t_str(), // display name
|
||||
pDevMode, // dev mode or NULL to reset
|
||||
NULL, // reserved
|
||||
wxRESERVED_PARAM,
|
||||
flags,
|
||||
NULL // pointer to video parameters (not used)
|
||||
) )
|
||||
|
@@ -147,7 +147,7 @@ void wxFontEnumeratorHelper::DoEnumerate()
|
||||
wxStrlcpy(lf.lfFaceName, m_facename.c_str(), WXSIZEOF(lf.lfFaceName));
|
||||
lf.lfPitchAndFamily = 0;
|
||||
::EnumFontFamiliesEx(hDC, &lf, (FONTENUMPROC)wxFontEnumeratorProc,
|
||||
(LPARAM)this, 0 /* reserved */) ;
|
||||
(LPARAM)this, wxRESERVED_PARAM) ;
|
||||
|
||||
::ReleaseDC(NULL, hDC);
|
||||
}
|
||||
|
@@ -76,10 +76,6 @@ aStdKeys[] =
|
||||
// the registry name separator (perhaps one day MS will change it to '/' ;-)
|
||||
#define REG_SEPARATOR wxT('\\')
|
||||
|
||||
// useful for Windows programmers: makes somewhat more clear all these zeroes
|
||||
// being passed to Windows APIs
|
||||
#define RESERVED (0)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// macros
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -383,7 +379,7 @@ bool wxRegKey::GetKeyInfo(size_t *pnSubKeys,
|
||||
(HKEY) m_hKey,
|
||||
NULL, // class name
|
||||
NULL, // (ptr to) size of class name buffer
|
||||
RESERVED,
|
||||
wxRESERVED_PARAM,
|
||||
REG_PARAM(SubKeys), // [out] number of subkeys
|
||||
REG_PARAM(MaxKeyLen), // [out] max length of a subkey name
|
||||
NULL, // longest subkey class name
|
||||
@@ -437,7 +433,7 @@ bool wxRegKey::Open(AccessMode mode)
|
||||
(
|
||||
(HKEY) m_hRootKey,
|
||||
m_strKey.t_str(),
|
||||
RESERVED,
|
||||
wxRESERVED_PARAM,
|
||||
GetMSWAccessFlags(mode, m_viewMode),
|
||||
&tmpKey
|
||||
);
|
||||
@@ -468,7 +464,7 @@ bool wxRegKey::Create(bool bOkIfExists)
|
||||
HKEY tmpKey;
|
||||
DWORD disposition;
|
||||
m_dwLastError = RegCreateKeyEx((HKEY) m_hRootKey, m_strKey.t_str(),
|
||||
0, // reserved and must be 0
|
||||
wxRESERVED_PARAM,
|
||||
NULL, // The user-defined class type of this key.
|
||||
REG_OPTION_NON_VOLATILE, // supports other values as well; see MS docs
|
||||
GetMSWAccessFlags(wxRegKey::Write, m_viewMode),
|
||||
@@ -756,7 +752,7 @@ bool wxRegKey::DeleteSelf()
|
||||
{
|
||||
m_dwLastError = (*pfnRegDeleteKeyEx)((HKEY) m_hRootKey, m_strKey.t_str(),
|
||||
GetMSWViewFlags(m_viewMode),
|
||||
0); // This parameter is reserved and must be zero.
|
||||
wxRESERVED_PARAM);
|
||||
}
|
||||
else
|
||||
#endif // wxUSE_DYNLIB_CLASS
|
||||
@@ -817,7 +813,7 @@ bool wxRegKey::HasValue(const wxString& szValue) const
|
||||
|
||||
LONG dwRet = ::RegQueryValueEx((HKEY) m_hKey,
|
||||
RegValueStr(szValue),
|
||||
RESERVED,
|
||||
wxRESERVED_PARAM,
|
||||
NULL, NULL, NULL);
|
||||
return dwRet == ERROR_SUCCESS;
|
||||
}
|
||||
@@ -864,7 +860,7 @@ wxRegKey::ValueType wxRegKey::GetValueType(const wxString& szValue) const
|
||||
return Type_None;
|
||||
|
||||
DWORD dwType;
|
||||
m_dwLastError = RegQueryValueEx((HKEY) m_hKey, RegValueStr(szValue), RESERVED,
|
||||
m_dwLastError = RegQueryValueEx((HKEY) m_hKey, RegValueStr(szValue), wxRESERVED_PARAM,
|
||||
&dwType, NULL, NULL);
|
||||
if ( m_dwLastError != ERROR_SUCCESS ) {
|
||||
wxLogSysError(m_dwLastError, _("Can't read value of key '%s'"),
|
||||
@@ -879,7 +875,7 @@ bool wxRegKey::SetValue(const wxString& szValue, long lValue)
|
||||
{
|
||||
if ( CONST_CAST Open() ) {
|
||||
m_dwLastError = RegSetValueEx((HKEY) m_hKey, RegValueStr(szValue),
|
||||
(DWORD) RESERVED, REG_DWORD,
|
||||
wxRESERVED_PARAM, REG_DWORD,
|
||||
(RegString)&lValue, sizeof(lValue));
|
||||
if ( m_dwLastError == ERROR_SUCCESS )
|
||||
return true;
|
||||
@@ -896,7 +892,7 @@ bool wxRegKey::QueryValue(const wxString& szValue, long *plValue) const
|
||||
DWORD dwType, dwSize = sizeof(DWORD);
|
||||
RegString pBuf = (RegString)plValue;
|
||||
m_dwLastError = RegQueryValueEx((HKEY) m_hKey, RegValueStr(szValue),
|
||||
RESERVED,
|
||||
wxRESERVED_PARAM,
|
||||
&dwType, pBuf, &dwSize);
|
||||
if ( m_dwLastError != ERROR_SUCCESS ) {
|
||||
wxLogSysError(m_dwLastError, _("Can't read value of key '%s'"),
|
||||
@@ -921,7 +917,7 @@ bool wxRegKey::SetValue(const wxString& szValue, const wxMemoryBuffer& buffer)
|
||||
{
|
||||
if ( CONST_CAST Open() ) {
|
||||
m_dwLastError = RegSetValueEx((HKEY) m_hKey, RegValueStr(szValue),
|
||||
(DWORD) RESERVED, REG_BINARY,
|
||||
wxRESERVED_PARAM, REG_BINARY,
|
||||
(RegBinary)buffer.GetData(),buffer.GetDataLen());
|
||||
if ( m_dwLastError == ERROR_SUCCESS )
|
||||
return true;
|
||||
@@ -938,7 +934,7 @@ bool wxRegKey::QueryValue(const wxString& szValue, wxMemoryBuffer& buffer) const
|
||||
// first get the type and size of the data
|
||||
DWORD dwType, dwSize;
|
||||
m_dwLastError = RegQueryValueEx((HKEY) m_hKey, RegValueStr(szValue),
|
||||
RESERVED,
|
||||
wxRESERVED_PARAM,
|
||||
&dwType, NULL, &dwSize);
|
||||
|
||||
if ( m_dwLastError == ERROR_SUCCESS ) {
|
||||
@@ -952,7 +948,7 @@ bool wxRegKey::QueryValue(const wxString& szValue, wxMemoryBuffer& buffer) const
|
||||
const RegBinary pBuf = (RegBinary)buffer.GetWriteBuf(dwSize);
|
||||
m_dwLastError = RegQueryValueEx((HKEY) m_hKey,
|
||||
RegValueStr(szValue),
|
||||
RESERVED,
|
||||
wxRESERVED_PARAM,
|
||||
&dwType,
|
||||
pBuf,
|
||||
&dwSize);
|
||||
@@ -986,7 +982,7 @@ bool wxRegKey::QueryValue(const wxString& szValue,
|
||||
DWORD dwType=REG_NONE, dwSize=0;
|
||||
m_dwLastError = RegQueryValueEx((HKEY) m_hKey,
|
||||
RegValueStr(szValue),
|
||||
RESERVED,
|
||||
wxRESERVED_PARAM,
|
||||
&dwType, NULL, &dwSize);
|
||||
if ( m_dwLastError == ERROR_SUCCESS )
|
||||
{
|
||||
@@ -1012,7 +1008,7 @@ bool wxRegKey::QueryValue(const wxString& szValue,
|
||||
wxStringBufferLength strBuf(strValue, chars);
|
||||
m_dwLastError = RegQueryValueEx((HKEY) m_hKey,
|
||||
RegValueStr(szValue),
|
||||
RESERVED,
|
||||
wxRESERVED_PARAM,
|
||||
&dwType,
|
||||
(RegString)(wxChar*)strBuf,
|
||||
&dwSize);
|
||||
@@ -1063,7 +1059,7 @@ bool wxRegKey::SetValue(const wxString& szValue, const wxString& strValue)
|
||||
if ( CONST_CAST Open() ) {
|
||||
m_dwLastError = RegSetValueEx((HKEY) m_hKey,
|
||||
RegValueStr(szValue),
|
||||
(DWORD) RESERVED, REG_SZ,
|
||||
wxRESERVED_PARAM, REG_SZ,
|
||||
reinterpret_cast<const BYTE*>(wxMSW_CONV_LPCTSTR(strValue)),
|
||||
(strValue.Len() + 1)*sizeof(wxChar));
|
||||
if ( m_dwLastError == ERROR_SUCCESS )
|
||||
@@ -1110,7 +1106,7 @@ bool wxRegKey::GetNextValue(wxString& strValueName, long& lIndex) const
|
||||
|
||||
m_dwLastError = RegEnumValue((HKEY) m_hKey, lIndex++,
|
||||
szValueName, &dwValueLen,
|
||||
RESERVED,
|
||||
wxRESERVED_PARAM,
|
||||
NULL, // [out] type
|
||||
NULL, // [out] buffer for value
|
||||
NULL); // [i/o] it's length
|
||||
@@ -1484,7 +1480,7 @@ bool KeyExists(WXHKEY hRootKey,
|
||||
(
|
||||
(HKEY)hRootKey,
|
||||
szKey.t_str(),
|
||||
RESERVED,
|
||||
wxRESERVED_PARAM,
|
||||
// we might not have enough rights for rw access
|
||||
GetMSWAccessFlags(wxRegKey::Read, viewMode),
|
||||
&hkeyDummy
|
||||
|
@@ -2218,7 +2218,7 @@ void wxTreeCtrl::SortChildren(const wxTreeItemId& item)
|
||||
tvSort.hParent = HITEM(item);
|
||||
tvSort.lpfnCompare = wxTreeSortHelper::Compare;
|
||||
tvSort.lParam = (LPARAM)this;
|
||||
if ( !TreeView_SortChildrenCB(GetHwnd(), &tvSort, 0 /* reserved */) )
|
||||
if ( !TreeView_SortChildrenCB(GetHwnd(), &tvSort, wxRESERVED_PARAM) )
|
||||
wxLogLastError(wxS("TreeView_SortChildrenCB()"));
|
||||
}
|
||||
}
|
||||
|
@@ -257,7 +257,7 @@ void wxWebRequestWinHTTP::Start()
|
||||
m_sessionWinHTTP.GetHandle(),
|
||||
wxString(urlComps.lpszHostName, urlComps.dwHostNameLength),
|
||||
urlComps.nPort,
|
||||
0 // reserved
|
||||
wxRESERVED_PARAM
|
||||
);
|
||||
if ( m_connect == NULL )
|
||||
{
|
||||
@@ -296,7 +296,7 @@ void wxWebRequestWinHTTP::Start()
|
||||
WINHTTP_CALLBACK_FLAG_WRITE_COMPLETE |
|
||||
WINHTTP_CALLBACK_FLAG_SENDREQUEST_COMPLETE |
|
||||
WINHTTP_CALLBACK_FLAG_REQUEST_ERROR,
|
||||
0) == WINHTTP_INVALID_STATUS_CALLBACK )
|
||||
wxRESERVED_PARAM) == WINHTTP_INVALID_STATUS_CALLBACK )
|
||||
{
|
||||
SetFailedWithLastError();
|
||||
return;
|
||||
|
@@ -997,7 +997,7 @@ bool wxWindowMSW::EnableTouchEvents(int eventsMask)
|
||||
if ( !GestureFuncs::SetGestureConfig()
|
||||
(
|
||||
m_hWnd,
|
||||
0, // Reserved, must be always 0.
|
||||
wxRESERVED_PARAM,
|
||||
numConfigs, // Number of gesture configurations.
|
||||
ptrConfigs, // Pointer to the first one.
|
||||
sizeof(GESTURECONFIG) // Size of each configuration.
|
||||
|
Reference in New Issue
Block a user