diff options
| -rw-r--r-- | plugins/Scriver/src/msgs.cpp | 12 | ||||
| -rw-r--r-- | plugins/Scriver/src/msgs.h | 2 | ||||
| -rw-r--r-- | plugins/TabSRMM/src/msgs.cpp | 12 | ||||
| -rw-r--r-- | plugins/TabSRMM/src/msgs.h | 2 | ||||
| -rw-r--r-- | src/core/stdchat/src/chat.h | 2 | ||||
| -rw-r--r-- | src/core/stdchat/src/main.cpp | 12 | ||||
| -rw-r--r-- | src/core/stdmsg/src/msglog.cpp | 2 | ||||
| -rw-r--r-- | src/core/stdmsg/src/msgoptions.cpp | 25 | ||||
| -rw-r--r-- | src/core/stdmsg/src/msgs.cpp | 12 | ||||
| -rw-r--r-- | src/core/stdmsg/src/msgs.h | 2 | 
10 files changed, 42 insertions, 41 deletions
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index 910a7ee1dd..9d6724ed1e 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -599,19 +599,19 @@ STDMETHODIMP CREOleCallback::QueryInterface(REFIID riid, LPVOID * ppvObj)  STDMETHODIMP_(ULONG) CREOleCallback::AddRef()
  {
 -	if (refCount == 0) {
 -		if (S_OK != StgCreateDocfile(NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_DELETEONRELEASE, 0, &pictStg))
 -			pictStg = NULL;
 -		nextStgId = 0;
 -	}
 +	if (refCount == 0)
 +		StgCreateDocfile(NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_DELETEONRELEASE, 0, &pictStg);
 +
  	return ++refCount;
  }
  STDMETHODIMP_(ULONG) CREOleCallback::Release()
  {
  	if (--refCount == 0) {
 -		if (pictStg)
 +		if (pictStg) {
  			pictStg->Release();
 +			pictStg = NULL;
 +		}
  	}
  	return refCount;
  }
 diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h index cc991e6c87..cbd32beb0b 100644 --- a/plugins/Scriver/src/msgs.h +++ b/plugins/Scriver/src/msgs.h @@ -193,7 +193,7 @@ struct SrmmWindowData : public CommonWindowData  struct CREOleCallback : public IRichEditOleCallback
  {
 -	CREOleCallback() : refCount(0) {}
 +	CREOleCallback() : refCount(0), nextStgId(0), pictStg(NULL) {}
  	unsigned refCount;
  	IStorage *pictStg;
  	int nextStgId;
 diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index 8fcf781352..4e2248f185 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -1004,19 +1004,19 @@ STDMETHODIMP CREOleCallback::QueryInterface(REFIID riid, LPVOID * ppvObj)  STDMETHODIMP_(ULONG) CREOleCallback::AddRef()
  {
 -	if (refCount == 0) {
 -		if (S_OK != StgCreateDocfile(NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_DELETEONRELEASE, 0, &pictStg))
 -			pictStg = NULL;
 -		nextStgId = 0;
 -	}
 +	if (refCount == 0)
 +		StgCreateDocfile(NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_DELETEONRELEASE, 0, &pictStg);
 +
  	return ++refCount;
  }
  STDMETHODIMP_(ULONG) CREOleCallback::Release()
  {
  	if (--refCount == 0) {
 -		if (pictStg)
 +		if (pictStg) {
  			pictStg->Release();
 +			pictStg = NULL;
 +		}
  	}
  	return refCount;
  }
 diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index c5f3d52032..e1f79b8717 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -607,7 +607,7 @@ struct TNewWindowData  struct CREOleCallback : public IRichEditOleCallback
  {
 -	CREOleCallback() : refCount(0) {}
 +	CREOleCallback() : refCount(0), nextStgId(0), pictStg(NULL) {}
  	unsigned refCount;
  	IStorage *pictStg;
  	int nextStgId;
 diff --git a/src/core/stdchat/src/chat.h b/src/core/stdchat/src/chat.h index 97c5496fd1..6212eb7c73 100644 --- a/src/core/stdchat/src/chat.h +++ b/src/core/stdchat/src/chat.h @@ -113,7 +113,7 @@ extern BOOL SmileyAddInstalled, PopupInstalled;  struct CREOleCallback : public IRichEditOleCallback
  {
 -	CREOleCallback() : refCount(0) {}
 +	CREOleCallback() : refCount(0), nextStgId(0), pictStg(NULL) {}
  	unsigned refCount;
  	IStorage *pictStg;
  	int nextStgId;
 diff --git a/src/core/stdchat/src/main.cpp b/src/core/stdchat/src/main.cpp index 9437b3a034..48b31036a2 100644 --- a/src/core/stdchat/src/main.cpp +++ b/src/core/stdchat/src/main.cpp @@ -420,19 +420,19 @@ STDMETHODIMP CREOleCallback::QueryInterface(REFIID riid, LPVOID * ppvObj)  STDMETHODIMP_(ULONG) CREOleCallback::AddRef()
  {
 -	if (refCount == 0) {
 -		if (S_OK != StgCreateDocfile(NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_DELETEONRELEASE, 0, &pictStg))
 -			pictStg = NULL;
 -		nextStgId = 0;
 -	}
 +	if (refCount == 0)
 +		StgCreateDocfile(NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_DELETEONRELEASE, 0, &pictStg);
 +
  	return ++refCount;
  }
  STDMETHODIMP_(ULONG) CREOleCallback::Release()
  {
  	if (--refCount == 0) {
 -		if (pictStg)
 +		if (pictStg) {
  			pictStg->Release();
 +			pictStg = NULL;
 +		}
  	}
  	return refCount;
  }
 diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp index c25f1bdd2d..9a458701f0 100644 --- a/src/core/stdmsg/src/msglog.cpp +++ b/src/core/stdmsg/src/msglog.cpp @@ -432,7 +432,7 @@ static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG  			*pcb = 0;
  			return 0;
  		}
 -		dat->bufferLen = (int)strlen(dat->buffer);
 +		dat->bufferLen = (int)mir_strlen(dat->buffer);
  	}
  	*pcb = min(cb, dat->bufferLen - dat->bufferOffset);
  	memcpy(pbBuff, dat->buffer + dat->bufferOffset, *pcb);
 diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp index 8582886b1d..74788bd360 100644 --- a/src/core/stdmsg/src/msgoptions.cpp +++ b/src/core/stdmsg/src/msgoptions.cpp @@ -100,11 +100,11 @@ void RegisterSRMMFonts(void)  	FontIDT fontid = { sizeof(fontid) };
  	fontid.flags = FIDF_ALLOWREREGISTER | FIDF_DEFAULTVALID;
  	for (int i = 0; i < SIZEOF(fontOptionsList); i++) {
 -		strcpy(fontid.dbSettingsGroup, SRMMMOD);
 -		_tcscpy(fontid.group, LPGENT("Message log"));
 -		_tcscpy(fontid.name, fontOptionsList[i].szDescr);
 +		strncpy_s(fontid.dbSettingsGroup, SRMMMOD, _TRUNCATE);
 +		_tcsncpy_s(fontid.group, LPGENT("Message log"), _TRUNCATE);
 +		_tcsncpy_s(fontid.name, fontOptionsList[i].szDescr, _TRUNCATE);
  		mir_snprintf(idstr, SIZEOF(idstr), "SRMFont%d", i);
 -		strcpy(fontid.prefix, idstr);
 +		strncpy_s(fontid.prefix, idstr, _TRUNCATE);
  		fontid.order = i;
  		fontid.flags &= ~FIDF_CLASSMASK;
 @@ -113,19 +113,19 @@ void RegisterSRMMFonts(void)  		fontid.deffontsettings.colour = fontOptionsList[i].defColour;
  		fontid.deffontsettings.size = fontOptionsList[i].defSize;
  		fontid.deffontsettings.style = fontOptionsList[i].defStyle;
 -		_tcscpy(fontid.deffontsettings.szFace, fontOptionsList[i].szDefFace);
 +		_tcsncpy_s(fontid.deffontsettings.szFace, fontOptionsList[i].szDefFace, _TRUNCATE);
  		fontid.deffontsettings.charset = MsgDlgGetFontDefaultCharset(fontOptionsList[i].szDefFace);
 -		_tcsncpy(fontid.backgroundGroup, LPGENT("Message log"),SIZEOF(fontid.backgroundGroup));
 -		_tcsncpy(fontid.backgroundName, LPGENT("Background"),SIZEOF(fontid.backgroundName));
 +		_tcsncpy_s(fontid.backgroundGroup, LPGENT("Message log"), _TRUNCATE);
 +		_tcsncpy_s(fontid.backgroundName, LPGENT("Background"), _TRUNCATE);
  		FontRegisterT(&fontid);
  	}
  	ColourIDT colourid = { sizeof(colourid) };
 -	strcpy(colourid.dbSettingsGroup, SRMMMOD);
 -	strcpy(colourid.setting, SRMSGSET_BKGCOLOUR);
 +	strncpy_s(colourid.dbSettingsGroup, SRMMMOD, _TRUNCATE);
 +	strncpy_s(colourid.setting, SRMSGSET_BKGCOLOUR, _TRUNCATE);
  	colourid.defcolour = SRMSGDEFSET_BKGCOLOUR;
 -	_tcscpy(colourid.name, LPGENT("Background"));
 -	_tcscpy(colourid.group, LPGENT("Message log"));
 +	_tcsncpy_s(colourid.name, LPGENT("Background"), _TRUNCATE);
 +	_tcsncpy_s(colourid.group, LPGENT("Message log"), _TRUNCATE);
  	ColourRegisterT(&colourid);
  }
 @@ -135,7 +135,8 @@ struct CheckBoxValues_t  {
  	DWORD  style;
  	TCHAR* szDescr;
 -} statusValues[] =
 +}
 +statusValues[] =
  {
  	{ MODEF_OFFLINE, LPGENT("Offline") },
  	{ PF2_ONLINE, LPGENT("Online") },
 diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 0f3e5e5eb2..6125fbe902 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -465,19 +465,19 @@ STDMETHODIMP CREOleCallback::QueryInterface(REFIID riid, LPVOID * ppvObj)  STDMETHODIMP_(ULONG) CREOleCallback::AddRef()
  {
 -	if (refCount == 0) {
 -		if (S_OK != StgCreateDocfile(NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_DELETEONRELEASE, 0, &pictStg))
 -			pictStg = NULL;
 -		nextStgId = 0;
 -	}
 +	if (refCount == 0)
 +		StgCreateDocfile(NULL, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE | STGM_DELETEONRELEASE, 0, &pictStg);
 +
  	return ++refCount;
  }
  STDMETHODIMP_(ULONG) CREOleCallback::Release()
  {
  	if (--refCount == 0) {
 -		if (pictStg)
 +		if (pictStg) {
  			pictStg->Release();
 +			pictStg = NULL;
 +		}
  	}
  	return refCount;
  }
 diff --git a/src/core/stdmsg/src/msgs.h b/src/core/stdmsg/src/msgs.h index 45d040d7dc..e59175c0d2 100644 --- a/src/core/stdmsg/src/msgs.h +++ b/src/core/stdmsg/src/msgs.h @@ -99,7 +99,7 @@ struct SrmmWindowData : public MZeroedObject  struct CREOleCallback : public IRichEditOleCallback
  {
 -	CREOleCallback() : refCount(0) {}
 +	CREOleCallback() : refCount(0), nextStgId(0), pictStg(NULL) {}
  	unsigned refCount;
  	IStorage *pictStg;
  	int nextStgId;
  | 
