summaryrefslogtreecommitdiff
path: root/protocols/WhatsApp/src/utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/WhatsApp/src/utils.h')
-rw-r--r--protocols/WhatsApp/src/utils.h64
1 files changed, 23 insertions, 41 deletions
diff --git a/protocols/WhatsApp/src/utils.h b/protocols/WhatsApp/src/utils.h
index ece8dafaf3..a5b1e17592 100644
--- a/protocols/WhatsApp/src/utils.h
+++ b/protocols/WhatsApp/src/utils.h
@@ -8,11 +8,11 @@ class ScopedLock
public:
ScopedLock(HANDLE h, int t = INFINITE) : handle_(h), timeout_(t)
{
- WaitForSingleObject(handle_,timeout_);
+ WaitForSingleObject(handle_, timeout_);
}
~ScopedLock()
{
- if(handle_)
+ if (handle_)
ReleaseMutex(handle_);
}
void Unlock()
@@ -28,57 +28,39 @@ private:
class Mutex : public IMutex
{
private:
- HANDLE handle;
+ HANDLE handle;
public:
- Mutex() : handle(NULL) {}
+ Mutex() : handle(NULL) {}
- virtual ~Mutex()
- {
- if (this->handle != NULL)
- {
- ReleaseMutex(this->handle);
- }
- }
+ virtual ~Mutex()
+ {
+ if (this->handle != NULL) {
+ ReleaseMutex(this->handle);
+ }
+ }
- virtual void lock()
- {
- if (this->handle == NULL)
- {
- this->handle = CreateMutex(NULL, FALSE, NULL);
- }
- }
+ virtual void lock()
+ {
+ if (this->handle == NULL) {
+ this->handle = CreateMutex(NULL, FALSE, NULL);
+ }
+ }
- virtual void unlock()
- {
- ReleaseMutex(this->handle);
- this->handle = NULL;
- }
+ virtual void unlock()
+ {
+ ReleaseMutex(this->handle);
+ this->handle = NULL;
+ }
};
std::string getLastErrorMsg();
-void UnixTimeToFileTime(time_t t, LPFILETIME pft);
-
namespace utils
{
- namespace debug
- {
- int log(std::string file_name, std::string text);
- };
-
- namespace conversion
- {
- DWORD to_timestamp( std::string data );
- };
-
- namespace text
- {
- std::string source_get_value(std::string* data, unsigned int argument_count, ...);
- };
-
BYTE* md5string(const BYTE*, int, BYTE* digest);
- __forceinline BYTE* md5string(const std::string& str, BYTE* digest) {
+ __forceinline BYTE* md5string(const std::string &str, BYTE* digest)
+ {
return md5string((BYTE*)str.data(), (int)str.length(), digest);
}
};