From 4da1269b791dd0d69567d6ac020572901388f6e3 Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Mon, 3 Aug 2015 12:30:23 +0000 Subject: SkypeWeb: pass_ptrA/W inherit from ptrA/W git-svn-id: http://svn.miranda-ng.org/main/trunk@14829 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeWeb/src/skype_db.h | 39 +++++++++++++++--------------------- protocols/SkypeWeb/src/skype_proto.h | 2 +- 2 files changed, 17 insertions(+), 24 deletions(-) (limited to 'protocols') diff --git a/protocols/SkypeWeb/src/skype_db.h b/protocols/SkypeWeb/src/skype_db.h index d410919fbd..bc4e04c8d2 100644 --- a/protocols/SkypeWeb/src/skype_db.h +++ b/protocols/SkypeWeb/src/skype_db.h @@ -33,36 +33,29 @@ enum SKYPE_DB_EVENT_TYPE #define SKYPE_SETTINGS_PASSWORD "Password" #define SKYPE_SETTINGS_GROUP "DefaultGroup" -class pass_ptrA +class pass_ptrA : public mir_ptr { - char* data; - public: - __inline explicit pass_ptrA() : data(NULL) {} - __inline explicit pass_ptrA(char* _p) : data(_p) {} - __inline ~pass_ptrA() { zero(); mir_free(data); } - __inline char* operator = (char * _p) { zero(); mir_free(data); data = _p; return data; } - __inline char* operator->() const { return data; } - __inline char* detach() { char *res = data; data = NULL; return res; } - __inline operator char*() const { return data; } - __inline operator INT_PTR() const { return (INT_PTR)data; } - __inline void zero() { if (data) SecureZeroMemory(data, mir_strlen(data)); } + __inline explicit pass_ptrA() : mir_ptr(){} + __inline explicit pass_ptrA(char* _p) : mir_ptr(_p) {} + __inline ~pass_ptrA() { zero(); mir_ptr::~mir_ptr(); } + __inline void zero() + { char *data = mir_ptr::operator char *(); + if (data) SecureZeroMemory(data, mir_strlen(data)); + } }; -class pass_ptrW +class pass_ptrW : public mir_ptr { - WCHAR* data; public: - __inline explicit pass_ptrW() : data(NULL) {} - __inline explicit pass_ptrW(WCHAR* _p) : data(_p) {} - __inline ~pass_ptrW() { zero(); mir_free(data); } - __inline WCHAR* operator = (WCHAR * _p) { zero(); mir_free(data); data = _p; return data; } - __inline WCHAR* operator->() const { return data; } - __inline WCHAR* detach() { WCHAR *res = data; data = NULL; return res; } - __inline operator WCHAR*() const { return data; } - __inline operator INT_PTR() const { return (INT_PTR)data; } - __inline void zero() { if (data) SecureZeroMemory(data, (mir_wstrlen(data)*sizeof(WCHAR))); } + __inline explicit pass_ptrW() : mir_ptr(){} + __inline explicit pass_ptrW(WCHAR* _p) : mir_ptr(_p) {} + __inline ~pass_ptrW() { zero(); mir_ptr::~mir_ptr(); } + __inline void zero() + { WCHAR *_data = mir_ptr::operator WCHAR *(); + if (_data) SecureZeroMemory(_data, mir_wstrlen(_data)*sizeof(WCHAR)); + } }; typedef pass_ptrW pass_ptrT; diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 4694732ca1..9b28810db1 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -302,7 +302,7 @@ private: void ProcessThreadUpdateRes(const JSONNode &node); // utils - static void CSkypeProto::FreeCharList(const LIST &lst); + static void FreeCharList(const LIST &lst); __forceinline bool IsOnline() { return (m_iStatus > ID_STATUS_OFFLINE && m_hPollingThread); -- cgit v1.2.3