summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2015-08-03 12:30:23 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2015-08-03 12:30:23 +0000
commit4da1269b791dd0d69567d6ac020572901388f6e3 (patch)
treeb61144393e537a827232f0e38104ac6a3861b5c2 /protocols/SkypeWeb
parent3df2211617c0a9cf78968aeb3f74723b87561a2c (diff)
SkypeWeb: pass_ptrA/W inherit from ptrA/W
git-svn-id: http://svn.miranda-ng.org/main/trunk@14829 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb')
-rw-r--r--protocols/SkypeWeb/src/skype_db.h39
-rw-r--r--protocols/SkypeWeb/src/skype_proto.h2
2 files changed, 17 insertions, 24 deletions
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>
{
- 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>
{
- 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<char> &lst);
+ static void FreeCharList(const LIST<char> &lst);
__forceinline bool IsOnline()
{ return (m_iStatus > ID_STATUS_OFFLINE && m_hPollingThread);