New upstream version 24.0.1+dfsg1

This commit is contained in:
Sebastian Ramacher 2019-09-22 23:19:10 +02:00
parent b14f9eae6d
commit 5a730d6ec3
842 changed files with 42245 additions and 33385 deletions

View file

@ -19,25 +19,29 @@
template<typename T> class CoTaskMemPtr {
T *ptr;
inline void Clear() {if (ptr) CoTaskMemFree(ptr);}
inline void Clear()
{
if (ptr)
CoTaskMemFree(ptr);
}
public:
inline CoTaskMemPtr() : ptr(NULL) {}
inline CoTaskMemPtr() : ptr(NULL) {}
inline CoTaskMemPtr(T *ptr_) : ptr(ptr_) {}
inline ~CoTaskMemPtr() {Clear();}
inline ~CoTaskMemPtr() { Clear(); }
inline operator T*() const {return ptr;}
inline T *operator->() const {return ptr;}
inline operator T *() const { return ptr; }
inline T *operator->() const { return ptr; }
inline const T *Get() const {return ptr;}
inline const T *Get() const { return ptr; }
inline CoTaskMemPtr& operator=(T* val)
inline CoTaskMemPtr &operator=(T *val)
{
Clear();
ptr = val;
}
inline T** operator&()
inline T **operator&()
{
Clear();
ptr = NULL;

View file

@ -33,18 +33,28 @@ protected:
inline void Replace(T *p)
{
if (ptr != p) {
if (p) p->AddRef();
if (ptr) ptr->Release();
if (p)
p->AddRef();
if (ptr)
ptr->Release();
ptr = p;
}
}
public:
inline ComPtr() : ptr(nullptr) {}
inline ComPtr(T *p) : ptr(p) {if (ptr) ptr->AddRef();}
inline ComPtr(const ComPtr<T> &c) : ptr(c.ptr) {if (ptr) ptr->AddRef();}
inline ComPtr(ComPtr<T> &&c) : ptr(c.ptr) {c.ptr = nullptr;}
inline ~ComPtr() {Kill();}
inline ComPtr() : ptr(nullptr) {}
inline ComPtr(T *p) : ptr(p)
{
if (ptr)
ptr->AddRef();
}
inline ComPtr(const ComPtr<T> &c) : ptr(c.ptr)
{
if (ptr)
ptr->AddRef();
}
inline ComPtr(ComPtr<T> &&c) : ptr(c.ptr) { c.ptr = nullptr; }
inline ~ComPtr() { Kill(); }
inline void Clear()
{
@ -87,7 +97,8 @@ public:
inline void CopyTo(T **out)
{
if (out) {
if (ptr) ptr->AddRef();
if (ptr)
ptr->AddRef();
*out = ptr;
}
}
@ -96,26 +107,35 @@ public:
{
ULONG ref;
if (!ptr) return 0;
if (!ptr)
return 0;
ref = ptr->Release();
ptr = nullptr;
return ref;
}
inline T **Assign() {Clear(); return &ptr;}
inline void Set(T *p) {Kill(); ptr = p;}
inline T **Assign()
{
Clear();
return &ptr;
}
inline void Set(T *p)
{
Kill();
ptr = p;
}
inline T *Get() const {return ptr;}
inline T *Get() const { return ptr; }
inline T **operator&() {return Assign();}
inline T **operator&() { return Assign(); }
inline operator T*() const {return ptr;}
inline T *operator->() const {return ptr;}
inline operator T *() const { return ptr; }
inline T *operator->() const { return ptr; }
inline bool operator==(T *p) const {return ptr == p;}
inline bool operator!=(T *p) const {return ptr != p;}
inline bool operator==(T *p) const { return ptr == p; }
inline bool operator!=(T *p) const { return ptr != p; }
inline bool operator!() const {return !ptr;}
inline bool operator!() const { return !ptr; }
};
#ifdef _WIN32
@ -126,13 +146,13 @@ public:
inline ComQIPtr(IUnknown *unk)
{
this->ptr = nullptr;
unk->QueryInterface(__uuidof(T), (void**)&this->ptr);
unk->QueryInterface(__uuidof(T), (void **)&this->ptr);
}
inline ComPtr<T> &operator=(IUnknown *unk)
{
ComPtr<T>::Clear();
unk->QueryInterface(__uuidof(T), (void**)&this->ptr);
unk->QueryInterface(__uuidof(T), (void **)&this->ptr);
return *this;
}
};

View file

@ -20,8 +20,5 @@ struct HRError {
const char *str;
HRESULT hr;
inline HRError(const char *str, HRESULT hr)
: str(str), hr (hr)
{
}
inline HRError(const char *str, HRESULT hr) : str(str), hr(hr) {}
};

View file

@ -26,13 +26,13 @@ class WinHandle {
}
public:
inline WinHandle() {}
inline WinHandle() {}
inline WinHandle(HANDLE handle_) : handle(handle_) {}
inline ~WinHandle() {Clear();}
inline ~WinHandle() { Clear(); }
inline operator HANDLE() const {return handle;}
inline operator HANDLE() const { return handle; }
inline WinHandle& operator=(HANDLE handle_)
inline WinHandle &operator=(HANDLE handle_)
{
if (handle_ != handle) {
Clear();
@ -42,10 +42,7 @@ public:
return *this;
}
inline HANDLE* operator&()
{
return &handle;
}
inline HANDLE *operator&() { return &handle; }
inline bool Valid() const
{

View file

@ -26,12 +26,12 @@ extern "C" {
struct reg_dword {
LSTATUS status;
DWORD size;
DWORD return_value;
DWORD size;
DWORD return_value;
};
EXPORT void get_reg_dword(HKEY hkey, LPCWSTR sub_key, LPCWSTR value_name,
struct reg_dword *info);
struct reg_dword *info);
#ifdef __cplusplus
}