summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-05-18 14:57:07 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-05-18 14:57:07 +0300
commitc532dd787e249378642546173de437bac5a6eed6 (patch)
treef559de8901c703a6005679511004ec01fecc90e5
parent5ba7647062ed142af980f9f06349c1e27d52fd9b (diff)
parent05e766ad3cabf6bb637e647a6396b9637a8c4cb2 (diff)
Merge branch 'master' of https://github.com/miranda-ng/miranda-ng
-rw-r--r--codelite/Miranda.workspace4
-rw-r--r--include/m_contacts.h6
-rw-r--r--include/m_gui.h70
-rw-r--r--include/m_icolib.h14
-rw-r--r--include/m_types.h10
-rw-r--r--include/newpluginapi.h10
-rw-r--r--libs/sqlite3/src/sqlite3.c144
-rw-r--r--libs/sqlite3/src/sqlite3.h6
-rw-r--r--plugins/TabSRMM/src/resource.h1
-rw-r--r--src/mir_app/mir_app.mk25
-rw-r--r--src/mir_app/mir_app.project2
-rw-r--r--src/mir_app/src/CMPluginBase.cpp2
-rw-r--r--src/mir_app/src/addcontact.cpp2
-rw-r--r--src/mir_app/src/auth.cpp102
-rw-r--r--src/mir_app/src/db_ini.cpp94
-rw-r--r--src/mir_app/src/miranda.cpp139
-rw-r--r--src/mir_app/src/miranda.h3
-rw-r--r--src/mir_app/src/stdafx.h2
-rw-r--r--src/mir_core/src/Linux/CCtrlBase.cpp2
-rw-r--r--src/mir_core/src/Linux/CCtrlButton.cpp2
-rw-r--r--src/mir_core/src/Linux/CCtrlCheck.cpp2
-rw-r--r--src/mir_core/src/Linux/CCtrlCombo.cpp2
-rw-r--r--src/mir_core/src/Linux/CCtrlEdit.cpp2
-rw-r--r--src/mir_core/src/Linux/CDlgBase.cpp8
-rw-r--r--tools/build_scripts/redist/x32/bass/basswma.dllbin17733 -> 18257 bytes
-rw-r--r--tools/build_scripts/redist/x64/bass/basswma.dllbin36352 -> 36352 bytes
26 files changed, 398 insertions, 256 deletions
diff --git a/codelite/Miranda.workspace b/codelite/Miranda.workspace
index 699277bb96..21d0a563e7 100644
--- a/codelite/Miranda.workspace
+++ b/codelite/Miranda.workspace
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<CodeLite_Workspace Name="Miranda" Database="" Version="10000">
<VirtualDirectory Name="Core">
- <Project Name="mir_core" Path="../src/mir_core/mir_core.project" Active="Yes"/>
- <Project Name="mir_app" Path="../src/mir_app/mir_app.project"/>
+ <Project Name="mir_core" Path="../src/mir_core/mir_core.project" Active="No"/>
+ <Project Name="mir_app" Path="../src/mir_app/mir_app.project" Active="Yes"/>
</VirtualDirectory>
<BuildMatrix>
<WorkspaceConfiguration Name="Debug">
diff --git a/include/m_contacts.h b/include/m_contacts.h
index 276d27c0ed..77797143a7 100644
--- a/include/m_contacts.h
+++ b/include/m_contacts.h
@@ -101,8 +101,8 @@ EXTERN_C MIR_APP_DLL(void) Contact_RemoveFromList(MCONTACT hContact);
// passing hWnd == NULL will result in a dialog that is created modeless
-EXTERN_C MIR_APP_DLL(void) Contact_Add(MCONTACT hContact, HWND hwndParent = nullptr);
-EXTERN_C MIR_APP_DLL(void) Contact_AddByEvent(MEVENT hEvent, HWND hwndParent = nullptr);
-EXTERN_C MIR_APP_DLL(void) Contact_AddBySearch(const char *szProto, struct PROTOSEARCHRESULT *psr, HWND hwndParent = nullptr);
+EXTERN_C MIR_APP_DLL(void) Contact_Add(MCONTACT hContact, MWindow hwndParent = nullptr);
+EXTERN_C MIR_APP_DLL(void) Contact_AddByEvent(MEVENT hEvent, MWindow hwndParent = nullptr);
+EXTERN_C MIR_APP_DLL(void) Contact_AddBySearch(const char *szProto, struct PROTOSEARCHRESULT *psr, MWindow hwndParent = nullptr);
#endif // M_CONTACTS_H__
diff --git a/include/m_gui.h b/include/m_gui.h
index e8a04b861e..4533d26391 100644
--- a/include/m_gui.h
+++ b/include/m_gui.h
@@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define __M_GUI_H
#ifdef _MSC_VER
-#include <CommCtrl.h>
+ #include <CommCtrl.h>
#endif // _WINDOWS
#include <m_system.h>
@@ -348,7 +348,7 @@ public:
CCtrlBase(CDlgBase *wnd, int idCtrl);
virtual ~CCtrlBase();
- __forceinline HWND GetHwnd() const { return m_hwnd; }
+ __forceinline MWindow GetHwnd() const { return m_hwnd; }
__forceinline int GetCtrlId() const { return m_idCtrl; }
__forceinline CDlgBase *GetParent() const { return m_parentWnd; }
__forceinline bool IsChanged() const { return m_bChanged; }
@@ -381,7 +381,7 @@ public:
int GetInt() const;
- virtual BOOL OnCommand(HWND /*hwndCtrl*/, uint16_t /*idCtrl*/, uint16_t /*idCode*/) { return FALSE; }
+ virtual BOOL OnCommand(MWindow /*hwndCtrl*/, uint16_t /*idCtrl*/, uint16_t /*idCode*/) { return FALSE; }
virtual BOOL OnNotify(int /*idCtrl*/, NMHDR* /*pnmh*/) { return FALSE; }
virtual BOOL OnMeasureItem(MEASUREITEMSTRUCT*) { return FALSE; }
@@ -395,10 +395,10 @@ public:
virtual void OnReset();
protected:
- HWND m_hwnd = nullptr; // must be the first data item
int m_idCtrl;
- CDlgBase* m_parentWnd;
bool m_bChanged = false, m_bSilent = false, m_bUseSystemColors = false, m_bNotifiable = false;
+ MWindow m_hwnd = nullptr; // must be the first data item
+ CDlgBase *m_parentWnd;
public:
CCallback<CCtrlBase> OnChange;
@@ -412,7 +412,7 @@ protected:
void Unsubclass();
private:
- static LRESULT CALLBACK GlobalSubclassWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+ static LRESULT CALLBACK GlobalSubclassWndProc(MWindow hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
};
/////////////////////////////////////////////////////////////////////////////////////////
@@ -464,7 +464,7 @@ public:
void EndModal(INT_PTR nResult);
class CCtrlBase* FindControl(int idCtrl);
- class CCtrlBase* FindControl(HWND hwnd);
+ class CCtrlBase* FindControl(MWindow hwnd);
void SetCaption(const wchar_t *ptszCaption);
void SetDraw(bool bEnable);
@@ -472,19 +472,19 @@ public:
HINSTANCE GetInst() const;
- __forceinline HWND GetHwnd() const { return m_hwnd; }
+ __forceinline MWindow GetHwnd() const { return m_hwnd; }
__forceinline void Hide() { Show(SW_HIDE); }
__forceinline bool IsInitialized() const { return m_bInitialized; }
__forceinline void SetMinSize(int x, int y) { m_iMinWidth = x, m_iMinHeight = y; }
- __forceinline void SetParent(HWND hwnd) { m_hwndParent = hwnd; }
+ __forceinline void SetParent(MWindow hwnd) { m_hwndParent = hwnd; }
__forceinline CCtrlBase* operator[](int iControlId) { return FindControl(iControlId); }
- static CDlgBase* Find(HWND hwnd);
+ static CDlgBase* Find(MWindow hwnd);
protected:
- HWND m_hwnd = nullptr; // must be the first data item
- HWND m_hwndParent = nullptr;
+ MWindow m_hwnd = nullptr; // must be the first data item
+ MWindow m_hwndParent = nullptr;
int m_idDialog;
bool m_isModal = false;
@@ -548,9 +548,9 @@ private:
CTimer* FindTimer(int idEvent);
int m_iMinWidth = -1, m_iMinHeight = -1;
- static BOOL CALLBACK GlobalFieldEnum(HWND hwnd, LPARAM lParam);
- static INT_PTR CALLBACK GlobalDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
- static int GlobalDlgResizer(HWND hwnd, LPARAM lParam, UTILRESIZECONTROL *urc);
+ static BOOL CALLBACK GlobalFieldEnum(MWindow hwnd, LPARAM lParam);
+ static INT_PTR CALLBACK GlobalDlgProc(MWindow hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+ static int GlobalDlgResizer(MWindow hwnd, LPARAM lParam, UTILRESIZECONTROL *urc);
};
/////////////////////////////////////////////////////////////////////////////////////////
@@ -565,7 +565,7 @@ public:
~CTimer();
__forceinline UINT_PTR GetEventId() const { return m_idEvent; }
- __forceinline HWND GetHwnd() const { return m_wnd->GetHwnd(); }
+ __forceinline MWindow GetHwnd() const { return m_wnd->GetHwnd(); }
virtual BOOL OnTimer();
@@ -603,7 +603,7 @@ class MIR_CORE_EXPORT CCtrlButton : public CCtrlBase
public:
CCtrlButton(CDlgBase *dlg, int ctrlId);
- BOOL OnCommand(HWND hwndCtrl, uint16_t idCtrl, uint16_t idCode) override;
+ BOOL OnCommand(MWindow hwndCtrl, uint16_t idCtrl, uint16_t idCode) override;
CCallback<CCtrlButton> OnClick;
@@ -663,7 +663,7 @@ class MIR_CORE_EXPORT CCtrlHyperlink : public CCtrlBase
public:
CCtrlHyperlink(CDlgBase *dlg, int ctrlId, const char* url = nullptr);
- BOOL OnCommand(HWND hwndCtrl, uint16_t idCtrl, uint16_t idCode) override;
+ BOOL OnCommand(MWindow hwndCtrl, uint16_t idCtrl, uint16_t idCode) override;
CCallback<CCtrlHyperlink> OnClick;
@@ -718,7 +718,7 @@ public:
COLORREF GetBkColor() const;
bool GetCheck(HANDLE hItem) const;
int GetCount() const;
- HWND GetEditControl() const;
+ MWindow GetEditControl() const;
uint32_t GetExStyle() const;
uint32_t GetExpand(HANDLE hItem) const;
int GetExtraColumns() const;
@@ -776,7 +776,7 @@ class MIR_CORE_EXPORT CCtrlCheck : public CCtrlData
public:
CCtrlCheck(CDlgBase *dlg, int ctrlId);
- BOOL OnCommand(HWND /*hwndCtrl*/, uint16_t /*idCtrl*/, uint16_t /*idCode*/) override;
+ BOOL OnCommand(MWindow /*hwndCtrl*/, uint16_t /*idCtrl*/, uint16_t /*idCode*/) override;
bool OnApply() override;
void OnReset() override;
@@ -796,7 +796,7 @@ class MIR_CORE_EXPORT CCtrlColor : public CCtrlData
public:
CCtrlColor(CDlgBase *dlg, int ctrlId);
- BOOL OnCommand(HWND /*hwndCtrl*/, uint16_t /*idCtrl*/, uint16_t /*idCode*/) override;
+ BOOL OnCommand(MWindow /*hwndCtrl*/, uint16_t /*idCtrl*/, uint16_t /*idCode*/) override;
bool OnApply() override;
void OnReset() override;
@@ -830,7 +830,7 @@ class MIR_CORE_EXPORT CCtrlEdit : public CCtrlData
public:
CCtrlEdit(CDlgBase *dlg, int ctrlId);
- BOOL OnCommand(HWND /*hwndCtrl*/, uint16_t /*idCtrl*/, uint16_t idCode) override;
+ BOOL OnCommand(MWindow /*hwndCtrl*/, uint16_t /*idCtrl*/, uint16_t idCode) override;
bool OnApply() override;
void OnReset() override;
@@ -873,7 +873,7 @@ class MIR_CORE_EXPORT CCtrlSlider : public CCtrlData
int m_wMin, m_wMax;
protected:
- BOOL OnCommand(HWND hwndCtrl, uint16_t idCtrl, uint16_t idCode) override;
+ BOOL OnCommand(MWindow hwndCtrl, uint16_t idCtrl, uint16_t idCode) override;
public:
CCtrlSlider(CDlgBase *dlg, int ctrlId, int max = 100, int min = 0);
@@ -943,7 +943,7 @@ public:
CCallback<CCtrlListBox> OnSelChange;
protected:
- BOOL OnCommand(HWND hwndCtrl, uint16_t idCtrl, uint16_t idCode) override;
+ BOOL OnCommand(MWindow hwndCtrl, uint16_t idCtrl, uint16_t idCode) override;
void GetCaretPos(CContextMenuPos&) const override;
};
@@ -957,7 +957,7 @@ class MIR_CORE_EXPORT CCtrlCombo : public CCtrlData
public:
CCtrlCombo(CDlgBase *dlg, int ctrlId);
- BOOL OnCommand(HWND /*hwndCtrl*/, uint16_t /*idCtrl*/, uint16_t idCode) override;
+ BOOL OnCommand(MWindow /*hwndCtrl*/, uint16_t /*idCtrl*/, uint16_t idCode) override;
void OnInit() override;
bool OnApply() override;
void OnReset() override;
@@ -1017,7 +1017,7 @@ public:
void DeleteAllItems();
void DeleteColumn(int iCol);
void DeleteItem(int iItem);
- HWND EditLabel(int iItem);
+ MWindow EditLabel(int iItem);
int EnableGroupView(BOOL fEnable);
BOOL EnsureVisible(int i, BOOL fPartialOK);
int FindItem(int iStart, const LVFINDINFO *plvfi);
@@ -1029,7 +1029,7 @@ public:
void GetColumnOrderArray(int iCount, int *lpiArray) const;
int GetColumnWidth(int iCol) const;
int GetCountPerPage() const;
- HWND GetEditControl() const;
+ MWindow GetEditControl() const;
uint32_t GetExtendedListViewStyle() const;
int GetFocusedGroup() const;
int GetGroupCount() const;
@@ -1037,7 +1037,7 @@ public:
void GetGroupInfoByIndex(int iIndex, LVGROUP *pgrp) const;
void GetGroupMetrics(LVGROUPMETRICS *pGroupMetrics) const;
UINT GetGroupState(UINT dwGroupId, UINT dwMask) const;
- HWND GetHeader() const;
+ MWindow GetHeader() const;
HCURSOR GetHotCursor() const;
int GetHotItem() const;
uint32_t GetHoverTime() const;
@@ -1066,7 +1066,7 @@ public:
COLORREF GetTextColor() const;
void GetTileInfo(LVTILEINFO *plvtinfo) const;
void GetTileViewInfo(LVTILEVIEWINFO *plvtvinfo) const;
- HWND GetToolTips() const;
+ MWindow GetToolTips() const;
int GetTopIndex() const;
BOOL GetUnicodeFormat() const;
uint32_t GetView() const;
@@ -1122,7 +1122,7 @@ public:
BOOL SetTextColor(COLORREF clrText);
BOOL SetTileInfo(LVTILEINFO *plvtinfo);
BOOL SetTileViewInfo(LVTILEVIEWINFO *plvtvinfo);
- HWND SetToolTips(HWND ToolTip);
+ MWindow SetToolTips(MWindow ToolTip);
BOOL SetUnicodeFormat(BOOL fUnicode);
int SetView(uint32_t iView);
void SetWorkAreas(int nWorkAreas, RECT *lprc);
@@ -1214,7 +1214,7 @@ public:
HIMAGELIST CreateDragImage(HTREEITEM hItem);
void DeleteAllItems();
void DeleteItem(HTREEITEM hItem);
- HWND EditLabel(HTREEITEM hItem);
+ MWindow EditLabel(HTREEITEM hItem);
void EndEditLabelNow(BOOL cancel);
void EnsureVisible(HTREEITEM hItem);
void Expand(HTREEITEM hItem, uint32_t flag);
@@ -1223,7 +1223,7 @@ public:
HTREEITEM GetChild(HTREEITEM hItem) const;
int GetCount() const;
HTREEITEM GetDropHilight() const;
- HWND GetEditControl() const;
+ MWindow GetEditControl() const;
HTREEITEM GetFirstVisible() const;
HIMAGELIST GetImageList(int iImage) const;
int GetIndent() const;
@@ -1244,7 +1244,7 @@ public:
uint32_t GetScrollTime() const;
HTREEITEM GetSelection() const;
COLORREF GetTextColor() const;
- HWND GetToolTips() const;
+ MWindow GetToolTips() const;
BOOL GetUnicodeFormat() const;
unsigned GetVisibleCount() const;
HTREEITEM HitTest(TVHITTESTINFO *hti) const;
@@ -1265,7 +1265,7 @@ public:
COLORREF SetLineColor(COLORREF clLine);
void SetScrollTime(UINT uMaxScrollTime);
COLORREF SetTextColor(COLORREF clText);
- HWND SetToolTips(HWND hwndToolTips);
+ MWindow SetToolTips(MWindow hwndToolTips);
BOOL SetUnicodeFormat(BOOL fUnicode);
void SortChildren(HTREEITEM hItem, BOOL fRecurse);
void SortChildrenCB(TVSORTCB *cb, BOOL fRecurse);
@@ -1483,7 +1483,7 @@ public:
protected:
PROTO_INTERFACE *m_proto_interface;
- HWND m_hwndStatus = nullptr;
+ MWindow m_hwndStatus = nullptr;
INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
diff --git a/include/m_icolib.h b/include/m_icolib.h
index b04a3a9d07..a732a8a320 100644
--- a/include/m_icolib.h
+++ b/include/m_icolib.h
@@ -99,17 +99,17 @@ MIR_APP_DLL(HANDLE) IcoLib_IsManaged(HICON hIcon);
///////////////////////////////////////////////////////////////////////////////
// Helper to apply an icolib's icon to a button
-MIR_APP_DLL(void) Button_SetIcon_IcoLib(HWND hDlg, int itemId, HANDLE hIcolib, const char *tooltip = nullptr);
-MIR_APP_DLL(void) Button_SetSkin_IcoLib(HWND hDlg, int itemId, int skinIconId, const char *tooltip = nullptr);
-MIR_APP_DLL(void) Button_FreeIcon_IcoLib(HWND hDlg, int itemId);
+MIR_APP_DLL(void) Button_SetIcon_IcoLib(MWindow hDlg, int itemId, HANDLE hIcolib, const char *tooltip = nullptr);
+MIR_APP_DLL(void) Button_SetSkin_IcoLib(MWindow hDlg, int itemId, int skinIconId, const char *tooltip = nullptr);
+MIR_APP_DLL(void) Button_FreeIcon_IcoLib(MWindow hDlg, int itemId);
///////////////////////////////////////////////////////////////////////////////
// Helper to apply an icolib's icon to a window
-MIR_APP_DLL(void) Window_SetIcon_IcoLib(HWND hWnd, HANDLE hIcolib);
-MIR_APP_DLL(void) Window_SetSkinIcon_IcoLib(HWND hWnd, int iconId);
-MIR_APP_DLL(void) Window_SetProtoIcon_IcoLib(HWND hWnd, const char *szProto, int iconId);
-MIR_APP_DLL(void) Window_FreeIcon_IcoLib(HWND hWnd);
+MIR_APP_DLL(void) Window_SetIcon_IcoLib(MWindow hWnd, HANDLE hIcolib);
+MIR_APP_DLL(void) Window_SetSkinIcon_IcoLib(MWindow hWnd, int iconId);
+MIR_APP_DLL(void) Window_SetProtoIcon_IcoLib(MWindow hWnd, const char *szProto, int iconId);
+MIR_APP_DLL(void) Window_FreeIcon_IcoLib(MWindow hWnd);
///////////////////////////////////////////////////////////////////////////////
// Helper to add an icolib's icon to a HIMAGELIST
diff --git a/include/m_types.h b/include/m_types.h
index f07427c1b3..1b0bdeb3bf 100644
--- a/include/m_types.h
+++ b/include/m_types.h
@@ -95,6 +95,8 @@ struct LOGFONTA;
struct LOGFONTW;
struct WIN32_FIND_DATA;
+#define GetCurrentThreadId pthread_self
+
#define MIR_EXPORT __attribute__((__visibility__("default")))
#define MIR_IMPORT
#define MIR_SYSCALL
@@ -183,6 +185,12 @@ struct TVINSERTSTRUCT;
struct TVSORTCB;
struct _TREEITEM;
+#ifdef ELEMENTARY_H
+ typedef Evas_Object* MWindow;
+#else
+ typedef void *MWindow;
+#endif
+
#else
///////////////////////////////////////////////////////////////////////////////
// Windows
@@ -195,6 +203,8 @@ struct _TREEITEM;
#define MIR_SYSCALL __stdcall
#define MIR_CDECL __cdecl
+typedef HWND MWindow;
+
#endif
#endif // M_TYPES_H__
diff --git a/include/newpluginapi.h b/include/newpluginapi.h
index 7081bd4f73..7b852b7af4 100644
--- a/include/newpluginapi.h
+++ b/include/newpluginapi.h
@@ -100,12 +100,12 @@ MIR_APP_DLL(void) SetPluginOnWhiteList(const char *szPluginName, bool bAllow);
struct PLUGININFOEX
{
int cbSize;
- char *shortName;
+ const char *shortName;
uint32_t version;
- char *description;
- char *author;
- char *copyright;
- char *homepage;
+ const char *description;
+ const char *author;
+ const char *copyright;
+ const char *homepage;
uint8_t flags; // right now the only flag, UNICODE_AWARE, is recognized here
MUUID uuid; // plugin's unique identifier
};
diff --git a/libs/sqlite3/src/sqlite3.c b/libs/sqlite3/src/sqlite3.c
index 0b227f0e60..eb8d7d5cd4 100644
--- a/libs/sqlite3/src/sqlite3.c
+++ b/libs/sqlite3/src/sqlite3.c
@@ -1,6 +1,6 @@
/******************************************************************************
** This file is an amalgamation of many separate C source files from SQLite
-** version 3.38.2. By combining all the individual C code files into this
+** version 3.38.5. By combining all the individual C code files into this
** single large file, the entire code can be compiled as a single translation
** unit. This allows many compilers to do optimizations that would not be
** possible if the files were compiled separately. Performance improvements
@@ -452,9 +452,9 @@ extern "C" {
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
*/
-#define SQLITE_VERSION "3.38.2"
-#define SQLITE_VERSION_NUMBER 3038002
-#define SQLITE_SOURCE_ID "2022-03-26 13:51:10 d33c709cc0af66bc5b6dc6216eba9f1f0b40960b9ae83694c986fbf4c1d6f08f"
+#define SQLITE_VERSION "3.38.5"
+#define SQLITE_VERSION_NUMBER 3038005
+#define SQLITE_SOURCE_ID "2022-05-06 15:25:27 78d9c993d404cdfaa7fdd2973fa1052e3da9f66215cff9c5540ebe55c407d9fe"
/*
** CAPI3REF: Run-Time Library Version Numbers
@@ -19929,6 +19929,7 @@ SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr*);
SQLITE_PRIVATE int sqlite3ExprIsConstantOrFunction(Expr*, u8);
SQLITE_PRIVATE int sqlite3ExprIsConstantOrGroupBy(Parse*, Expr*, ExprList*);
SQLITE_PRIVATE int sqlite3ExprIsTableConstant(Expr*,int);
+SQLITE_PRIVATE int sqlite3ExprIsTableConstraint(Expr*,const SrcItem*);
#ifdef SQLITE_ENABLE_CURSOR_HINTS
SQLITE_PRIVATE int sqlite3ExprContainsSubquery(Expr*);
#endif
@@ -29337,8 +29338,9 @@ SQLITE_PRIVATE char *sqlite3DbSpanDup(sqlite3 *db, const char *zStart, const cha
** Free any prior content in *pz and replace it with a copy of zNew.
*/
SQLITE_PRIVATE void sqlite3SetString(char **pz, sqlite3 *db, const char *zNew){
+ char *z = sqlite3DbStrDup(db, zNew);
sqlite3DbFree(db, *pz);
- *pz = sqlite3DbStrDup(db, zNew);
+ *pz = z;
}
/*
@@ -67764,6 +67766,8 @@ static u8 *pageFindSlot(MemPage *pPg, int nByte, int *pRc){
** fragmented bytes within the page. */
memcpy(&aData[iAddr], &aData[pc], 2);
aData[hdr+7] += (u8)x;
+ testcase( pc+x>maxPC );
+ return &aData[pc];
}else if( x+pc > maxPC ){
/* This slot extends off the end of the usable part of the page */
*pRc = SQLITE_CORRUPT_PAGE(pPg);
@@ -71963,7 +71967,7 @@ SQLITE_PRIVATE int sqlite3BtreeIndexMoveto(
assert( lwr==upr+1 || (pPage->intKey && !pPage->leaf) );
assert( pPage->isInit );
if( pPage->leaf ){
- assert( pCur->ix<pCur->pPage->nCell );
+ assert( pCur->ix<pCur->pPage->nCell || CORRUPT_DB );
pCur->ix = (u16)idx;
*pRes = c;
rc = SQLITE_OK;
@@ -74487,7 +74491,7 @@ static int balance_nonroot(
iOvflSpace += sz;
assert( sz<=pBt->maxLocal+23 );
assert( iOvflSpace <= (int)pBt->pageSize );
- for(k=0; b.ixNx[k]<=i && ALWAYS(k<NB*2); k++){}
+ for(k=0; b.ixNx[k]<=j && ALWAYS(k<NB*2); k++){}
pSrcEnd = b.apEnd[k];
if( SQLITE_WITHIN(pSrcEnd, pCell, pCell+sz) ){
rc = SQLITE_CORRUPT_BKPT;
@@ -78052,7 +78056,11 @@ SQLITE_PRIVATE int sqlite3VdbeChangeEncoding(Mem *pMem, int desiredEnc){
assert( !sqlite3VdbeMemIsRowSet(pMem) );
assert( desiredEnc==SQLITE_UTF8 || desiredEnc==SQLITE_UTF16LE
|| desiredEnc==SQLITE_UTF16BE );
- if( !(pMem->flags&MEM_Str) || pMem->enc==desiredEnc ){
+ if( !(pMem->flags&MEM_Str) ){
+ pMem->enc = desiredEnc;
+ return SQLITE_OK;
+ }
+ if( pMem->enc==desiredEnc ){
return SQLITE_OK;
}
assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
@@ -88379,6 +88387,8 @@ case OP_Gosub: { /* jump */
/* Most jump operations do a goto to this spot in order to update
** the pOp pointer. */
jump_to_p2:
+ assert( pOp->p2>0 ); /* There are never any jumps to instruction 0 */
+ assert( pOp->p2<p->nOp ); /* Jumps must be in range */
pOp = &aOp[pOp->p2 - 1];
break;
}
@@ -104759,6 +104769,38 @@ SQLITE_PRIVATE int sqlite3ExprIsTableConstant(Expr *p, int iCur){
return exprIsConst(p, 3, iCur);
}
+/*
+** Check pExpr to see if it is an invariant constraint on data source pSrc.
+** This is an optimization. False negatives will perhaps cause slower
+** queries, but false positives will yield incorrect answers. So when in
+** double, return 0.
+**
+** To be an invariant constraint, the following must be true:
+**
+** (1) pExpr cannot refer to any table other than pSrc->iCursor.
+**
+** (2) pExpr cannot use subqueries or non-deterministic functions.
+**
+** (*) ** Not applicable to this branch **
+**
+** (4) If pSrc is the right operand of a LEFT JOIN, then...
+** (4a) pExpr must come from an ON clause..
+** (4b) and specifically the ON clause associated with the LEFT JOIN.
+**
+** (5) If pSrc is not the right operand of a LEFT JOIN or the left
+** operand of a RIGHT JOIN, then pExpr must be from the WHERE
+** clause, not an ON clause.
+*/
+SQLITE_PRIVATE int sqlite3ExprIsTableConstraint(Expr *pExpr, const SrcItem *pSrc){
+ if( pSrc->fg.jointype & JT_LEFT ){
+ if( !ExprHasProperty(pExpr, EP_FromJoin) ) return 0; /* rule (4a) */
+ if( pExpr->w.iRightJoinTable!=pSrc->iCursor ) return 0; /* rule (4b) */
+ }else{
+ if( ExprHasProperty(pExpr, EP_FromJoin) ) return 0; /* rule (5) */
+ }
+ return sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor); /* rules (1), (2) */
+}
+
/*
** sqlite3WalkExpr() callback used by sqlite3ExprIsConstantOrGroupBy().
@@ -133827,6 +133869,14 @@ SQLITE_PRIVATE void sqlite3ParseObjectInit(Parse *pParse, sqlite3 *db){
}
/*
+** Maximum number of times that we will try again to prepare a statement
+** that returns SQLITE_ERROR_RETRY.
+*/
+#ifndef SQLITE_MAX_PREPARE_RETRY
+# define SQLITE_MAX_PREPARE_RETRY 25
+#endif
+
+/*
** Compile the UTF-8 encoded SQL statement zSql into a statement handle.
*/
static int sqlite3Prepare(
@@ -134000,7 +134050,7 @@ static int sqlite3LockAndPrepare(
rc = sqlite3Prepare(db, zSql, nBytes, prepFlags, pOld, ppStmt, pzTail);
assert( rc==SQLITE_OK || *ppStmt==0 );
if( rc==SQLITE_OK || db->mallocFailed ) break;
- }while( rc==SQLITE_ERROR_RETRY
+ }while( (rc==SQLITE_ERROR_RETRY && (cnt++)<SQLITE_MAX_PREPARE_RETRY)
|| (rc==SQLITE_SCHEMA && (sqlite3ResetOneSchema(db,-1), cnt++)==0) );
sqlite3BtreeLeaveAll(db);
rc = sqlite3ApiExit(db, rc);
@@ -139042,8 +139092,7 @@ static int pushDownWhereTerms(
Parse *pParse, /* Parse context (for malloc() and error reporting) */
Select *pSubq, /* The subquery whose WHERE clause is to be augmented */
Expr *pWhere, /* The WHERE clause of the outer query */
- int iCursor, /* Cursor number of the subquery */
- int isLeftJoin /* True if pSubq is the right term of a LEFT JOIN */
+ SrcItem *pSrc /* The subquery term of the outer FROM clause */
){
Expr *pNew;
int nChng = 0;
@@ -139078,10 +139127,11 @@ static int pushDownWhereTerms(
return 0; /* restriction (3) */
}
while( pWhere->op==TK_AND ){
- nChng += pushDownWhereTerms(pParse, pSubq, pWhere->pRight,
- iCursor, isLeftJoin);
+ nChng += pushDownWhereTerms(pParse, pSubq, pWhere->pRight, pSrc);
pWhere = pWhere->pLeft;
}
+
+#if 0 /* Legacy code. Checks now done by sqlite3ExprIsTableConstraint() */
if( isLeftJoin
&& (ExprHasProperty(pWhere,EP_FromJoin)==0
|| pWhere->w.iRightJoinTable!=iCursor)
@@ -139093,7 +139143,9 @@ static int pushDownWhereTerms(
){
return 0; /* restriction (5) */
}
- if( sqlite3ExprIsTableConstant(pWhere, iCursor) ){
+#endif
+
+ if( sqlite3ExprIsTableConstraint(pWhere, pSrc) ){
nChng++;
pSubq->selFlags |= SF_PushDown;
while( pSubq ){
@@ -139101,8 +139153,8 @@ static int pushDownWhereTerms(
pNew = sqlite3ExprDup(pParse->db, pWhere, 0);
unsetJoinExpr(pNew, -1);
x.pParse = pParse;
- x.iTable = iCursor;
- x.iNewTable = iCursor;
+ x.iTable = pSrc->iCursor;
+ x.iNewTable = pSrc->iCursor;
x.isLeftJoin = 0;
x.pEList = pSubq->pEList;
pNew = substExpr(&x, pNew);
@@ -140884,8 +140936,7 @@ SQLITE_PRIVATE int sqlite3Select(
if( OptimizationEnabled(db, SQLITE_PushDown)
&& (pItem->fg.isCte==0
|| (pItem->u2.pCteUse->eM10d!=M10d_Yes && pItem->u2.pCteUse->nUse<2))
- && pushDownWhereTerms(pParse, pSub, p->pWhere, pItem->iCursor,
- (pItem->fg.jointype & JT_OUTER)!=0)
+ && pushDownWhereTerms(pParse, pSub, p->pWhere, pItem)
){
#if SELECTTRACE_ENABLED
if( sqlite3SelectTrace & 0x100 ){
@@ -148677,6 +148728,7 @@ static void preserveExpr(IdxExprTrans *pTrans, Expr *pExpr){
static int whereIndexExprTransNode(Walker *p, Expr *pExpr){
IdxExprTrans *pX = p->u.pIdxTrans;
if( sqlite3ExprCompare(0, pExpr, pX->pIdxExpr, pX->iTabCur)==0 ){
+ pExpr = sqlite3ExprSkipCollate(pExpr);
preserveExpr(pX, pExpr);
pExpr->affExpr = sqlite3ExprAffinity(pExpr);
pExpr->op = TK_COLUMN;
@@ -148836,6 +148888,8 @@ static SQLITE_NOINLINE void filterPullDown(
/* ,--- Because sqlite3ConstructBloomFilter() has will not have set
** vvvvv--' pLevel->regFilter if this were true. */
if( NEVER(pLoop->prereq & notReady) ) continue;
+ assert( pLevel->addrBrk==0 );
+ pLevel->addrBrk = addrNxt;
if( pLoop->wsFlags & WHERE_IPK ){
WhereTerm *pTerm = pLoop->aLTerm[0];
int regRowid;
@@ -148862,6 +148916,7 @@ static SQLITE_NOINLINE void filterPullDown(
VdbeCoverage(pParse->pVdbe);
}
pLevel->regFilter = 0;
+ pLevel->addrBrk = 0;
}
}
@@ -152810,8 +152865,7 @@ static SQLITE_NOINLINE void constructAutomaticIndex(
** WHERE clause (or the ON clause of a LEFT join) that constrain which
** rows of the target table (pSrc) that can be used. */
if( (pTerm->wtFlags & TERM_VIRTUAL)==0
- && ((pSrc->fg.jointype&JT_LEFT)==0 || ExprHasProperty(pExpr,EP_FromJoin))
- && sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor)
+ && sqlite3ExprIsTableConstraint(pExpr, pSrc)
){
pPartial = sqlite3ExprAnd(pParse, pPartial,
sqlite3ExprDup(pParse->db, pExpr, 0));
@@ -153050,7 +153104,7 @@ static SQLITE_NOINLINE void sqlite3ConstructBloomFilter(
for(pTerm=pWInfo->sWC.a; pTerm<pWCEnd; pTerm++){
Expr *pExpr = pTerm->pExpr;
if( (pTerm->wtFlags & TERM_VIRTUAL)==0
- && sqlite3ExprIsTableConstant(pExpr, iCur)
+ && sqlite3ExprIsTableConstraint(pExpr, pItem)
){
sqlite3ExprIfFalse(pParse, pTerm->pExpr, addrCont, SQLITE_JUMPIFNULL);
}
@@ -159970,7 +160024,7 @@ static void windowAggStep(
for(iEnd=sqlite3VdbeCurrentAddr(v); iOp<iEnd; iOp++){
VdbeOp *pOp = sqlite3VdbeGetOp(v, iOp);
- if( pOp->opcode==OP_Column && pOp->p1==pWin->iEphCsr ){
+ if( pOp->opcode==OP_Column && pOp->p1==pMWin->iEphCsr ){
pOp->p1 = csr;
}
}
@@ -194288,14 +194342,15 @@ static JsonNode *jsonLookupStep(
*pzErr = zPath;
return 0;
}
+ testcase( nKey==0 );
}else{
zKey = zPath;
for(i=0; zPath[i] && zPath[i]!='.' && zPath[i]!='['; i++){}
nKey = i;
- }
- if( nKey==0 ){
- *pzErr = zPath;
- return 0;
+ if( nKey==0 ){
+ *pzErr = zPath;
+ return 0;
+ }
}
j = 1;
for(;;){
@@ -195443,6 +195498,33 @@ static int jsonEachNext(sqlite3_vtab_cursor *cur){
return SQLITE_OK;
}
+/* Append an object label to the JSON Path being constructed
+** in pStr.
+*/
+static void jsonAppendObjectPathElement(
+ JsonString *pStr,
+ JsonNode *pNode
+){
+ int jj, nn;
+ const char *z;
+ assert( pNode->eType==JSON_STRING );
+ assert( pNode->jnFlags & JNODE_LABEL );
+ assert( pNode->eU==1 );
+ z = pNode->u.zJContent;
+ nn = pNode->n;
+ assert( nn>=2 );
+ assert( z[0]=='"' );
+ assert( z[nn-1]=='"' );
+ if( nn>2 && sqlite3Isalpha(z[1]) ){
+ for(jj=2; jj<nn-1 && sqlite3Isalnum(z[jj]); jj++){}
+ if( jj==nn-1 ){
+ z++;
+ nn -= 2;
+ }
+ }
+ jsonPrintf(nn+2, pStr, ".%.*s", nn, z);
+}
+
/* Append the name of the path for element i to pStr
*/
static void jsonEachComputePath(
@@ -195467,10 +195549,7 @@ static void jsonEachComputePath(
}else{
assert( pUp->eType==JSON_OBJECT );
if( (pNode->jnFlags & JNODE_LABEL)==0 ) pNode--;
- assert( pNode->eType==JSON_STRING );
- assert( pNode->jnFlags & JNODE_LABEL );
- assert( pNode->eU==1 );
- jsonPrintf(pNode->n+1, pStr, ".%.*s", pNode->n-2, pNode->u.zJContent+1);
+ jsonAppendObjectPathElement(pStr, pNode);
}
}
@@ -195541,8 +195620,7 @@ static int jsonEachColumn(
if( p->eType==JSON_ARRAY ){
jsonPrintf(30, &x, "[%d]", p->iRowid);
}else if( p->eType==JSON_OBJECT ){
- assert( pThis->eU==1 );
- jsonPrintf(pThis->n, &x, ".%.*s", pThis->n-2, pThis->u.zJContent+1);
+ jsonAppendObjectPathElement(&x, pThis);
}
}
jsonResult(&x);
@@ -234433,7 +234511,7 @@ static void fts5SourceIdFunc(
){
assert( nArg==0 );
UNUSED_PARAM2(nArg, apUnused);
- sqlite3_result_text(pCtx, "fts5: 2022-03-26 13:51:10 d33c709cc0af66bc5b6dc6216eba9f1f0b40960b9ae83694c986fbf4c1d6f08f", -1, SQLITE_TRANSIENT);
+ sqlite3_result_text(pCtx, "fts5: 2022-05-06 15:25:27 78d9c993d404cdfaa7fdd2973fa1052e3da9f66215cff9c5540ebe55c407d9fe", -1, SQLITE_TRANSIENT);
}
/*
diff --git a/libs/sqlite3/src/sqlite3.h b/libs/sqlite3/src/sqlite3.h
index 33dbec2c09..de393da9dc 100644
--- a/libs/sqlite3/src/sqlite3.h
+++ b/libs/sqlite3/src/sqlite3.h
@@ -146,9 +146,9 @@ extern "C" {
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
*/
-#define SQLITE_VERSION "3.38.2"
-#define SQLITE_VERSION_NUMBER 3038002
-#define SQLITE_SOURCE_ID "2022-03-26 13:51:10 d33c709cc0af66bc5b6dc6216eba9f1f0b40960b9ae83694c986fbf4c1d6f08f"
+#define SQLITE_VERSION "3.38.5"
+#define SQLITE_VERSION_NUMBER 3038005
+#define SQLITE_SOURCE_ID "2022-05-06 15:25:27 78d9c993d404cdfaa7fdd2973fa1052e3da9f66215cff9c5540ebe55c407d9fe"
/*
** CAPI3REF: Run-Time Library Version Numbers
diff --git a/plugins/TabSRMM/src/resource.h b/plugins/TabSRMM/src/resource.h
index 56973c5a32..d3eac2f639 100644
--- a/plugins/TabSRMM/src/resource.h
+++ b/plugins/TabSRMM/src/resource.h
@@ -173,7 +173,6 @@
#define IDC_CHKINFINITE_FILE 1084
#define IDC_LOADCOUNT 1085
#define IDC_STATIC112 1085
-#define IDC_SENDONDBLENTER 1086
#define IDC_CHKINFINITE_OTHERS 1087
#define IDC_LOADTIMEN 1088
#define IDC_LOADTIMESPIN 1089
diff --git a/src/mir_app/mir_app.mk b/src/mir_app/mir_app.mk
index 5163e32169..e46fe270da 100644
--- a/src/mir_app/mir_app.mk
+++ b/src/mir_app/mir_app.mk
@@ -14,7 +14,7 @@ CurrentFileName :=
CurrentFilePath :=
CurrentFileFullPath :=
User :=George Hazan
-Date :=10/05/22
+Date :=17/05/22
CodeLitePath :=/home/ghazan/.codelite
MakeDirCommand :=mkdir -p
LinkerName :=g++
@@ -62,7 +62,8 @@ AS := as
## User defined environment variables
##
CodeLiteDir:=/usr/share/codelite
-Objects0=$(IntermediateDirectory)/src_miranda.cpp$(ObjectSuffix) $(IntermediateDirectory)/src_database.cpp$(ObjectSuffix) $(IntermediateDirectory)/src_db_intf.cpp$(ObjectSuffix) $(IntermediateDirectory)/src_db_events.cpp$(ObjectSuffix) $(IntermediateDirectory)/src_contact.cpp$(ObjectSuffix) $(IntermediateDirectory)/src_CMPluginBase.cpp$(ObjectSuffix) $(IntermediateDirectory)/src_addcontact.cpp$(ObjectSuffix) $(IntermediateDirectory)/src_stdafx.cxx$(ObjectSuffix)
+Objects0=$(IntermediateDirectory)/src_db_ini.cpp$(ObjectSuffix) $(IntermediateDirectory)/src_auth.cpp$(ObjectSuffix) $(IntermediateDirectory)/src_miranda.cpp$(ObjectSuffix) $(IntermediateDirectory)/src_db_intf.cpp$(ObjectSuffix) $(IntermediateDirectory)/src_db_events.cpp$(ObjectSuffix) $(IntermediateDirectory)/src_database.cpp$(ObjectSuffix) $(IntermediateDirectory)/src_contact.cpp$(ObjectSuffix) $(IntermediateDirectory)/src_CMPluginBase.cpp$(ObjectSuffix) $(IntermediateDirectory)/src_addcontact.cpp$(ObjectSuffix) $(IntermediateDirectory)/src_stdafx.cxx$(ObjectSuffix) \
+
@@ -94,16 +95,21 @@ PreBuild:
##
## Objects
##
+$(IntermediateDirectory)/src_db_ini.cpp$(ObjectSuffix): src/db_ini.cpp
+ $(CXX) $(IncludePCH) $(SourceSwitch) "/home/ghazan/miranda-ng/src/mir_app/src/db_ini.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/src_db_ini.cpp$(ObjectSuffix) $(IncludePath)
+$(IntermediateDirectory)/src_db_ini.cpp$(PreprocessSuffix): src/db_ini.cpp
+ $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/src_db_ini.cpp$(PreprocessSuffix) src/db_ini.cpp
+
+$(IntermediateDirectory)/src_auth.cpp$(ObjectSuffix): src/auth.cpp
+ $(CXX) $(IncludePCH) $(SourceSwitch) "/home/ghazan/miranda-ng/src/mir_app/src/auth.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/src_auth.cpp$(ObjectSuffix) $(IncludePath)
+$(IntermediateDirectory)/src_auth.cpp$(PreprocessSuffix): src/auth.cpp
+ $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/src_auth.cpp$(PreprocessSuffix) src/auth.cpp
+
$(IntermediateDirectory)/src_miranda.cpp$(ObjectSuffix): src/miranda.cpp
$(CXX) $(IncludePCH) $(SourceSwitch) "/home/ghazan/miranda-ng/src/mir_app/src/miranda.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/src_miranda.cpp$(ObjectSuffix) $(IncludePath)
$(IntermediateDirectory)/src_miranda.cpp$(PreprocessSuffix): src/miranda.cpp
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/src_miranda.cpp$(PreprocessSuffix) src/miranda.cpp
-$(IntermediateDirectory)/src_database.cpp$(ObjectSuffix): src/database.cpp
- $(CXX) $(IncludePCH) $(SourceSwitch) "/home/ghazan/miranda-ng/src/mir_app/src/database.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/src_database.cpp$(ObjectSuffix) $(IncludePath)
-$(IntermediateDirectory)/src_database.cpp$(PreprocessSuffix): src/database.cpp
- $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/src_database.cpp$(PreprocessSuffix) src/database.cpp
-
$(IntermediateDirectory)/src_db_intf.cpp$(ObjectSuffix): src/db_intf.cpp
$(CXX) $(IncludePCH) $(SourceSwitch) "/home/ghazan/miranda-ng/src/mir_app/src/db_intf.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/src_db_intf.cpp$(ObjectSuffix) $(IncludePath)
$(IntermediateDirectory)/src_db_intf.cpp$(PreprocessSuffix): src/db_intf.cpp
@@ -114,6 +120,11 @@ $(IntermediateDirectory)/src_db_events.cpp$(ObjectSuffix): src/db_events.cpp
$(IntermediateDirectory)/src_db_events.cpp$(PreprocessSuffix): src/db_events.cpp
$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/src_db_events.cpp$(PreprocessSuffix) src/db_events.cpp
+$(IntermediateDirectory)/src_database.cpp$(ObjectSuffix): src/database.cpp
+ $(CXX) $(IncludePCH) $(SourceSwitch) "/home/ghazan/miranda-ng/src/mir_app/src/database.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/src_database.cpp$(ObjectSuffix) $(IncludePath)
+$(IntermediateDirectory)/src_database.cpp$(PreprocessSuffix): src/database.cpp
+ $(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/src_database.cpp$(PreprocessSuffix) src/database.cpp
+
$(IntermediateDirectory)/src_contact.cpp$(ObjectSuffix): src/contact.cpp
$(CXX) $(IncludePCH) $(SourceSwitch) "/home/ghazan/miranda-ng/src/mir_app/src/contact.cpp" $(CXXFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/src_contact.cpp$(ObjectSuffix) $(IncludePath)
$(IntermediateDirectory)/src_contact.cpp$(PreprocessSuffix): src/contact.cpp
diff --git a/src/mir_app/mir_app.project b/src/mir_app/mir_app.project
index 121dc016a2..74517f991d 100644
--- a/src/mir_app/mir_app.project
+++ b/src/mir_app/mir_app.project
@@ -3,6 +3,8 @@
<Description/>
<Dependencies/>
<VirtualDirectory Name="src">
+ <File Name="src/db_ini.cpp"/>
+ <File Name="src/auth.cpp"/>
<File Name="src/miranda.cpp"/>
<File Name="src/database.cpp"/>
<File Name="src/db_intf.cpp"/>
diff --git a/src/mir_app/src/CMPluginBase.cpp b/src/mir_app/src/CMPluginBase.cpp
index d22d410f41..3561132c44 100644
--- a/src/mir_app/src/CMPluginBase.cpp
+++ b/src/mir_app/src/CMPluginBase.cpp
@@ -82,7 +82,7 @@ MIR_APP_DLL(int) IsPluginLoaded(const MUUID &uuid)
return false;
}
-char* GetPluginNameByInstance(HINSTANCE hInst)
+const char* GetPluginNameByInstance(HINSTANCE hInst)
{
HINSTANCE boo[2] = { 0, hInst };
CMPluginBase *pPlugin = g_arPlugins.find((CMPluginBase*)&boo);
diff --git a/src/mir_app/src/addcontact.cpp b/src/mir_app/src/addcontact.cpp
index 0e97ec518d..afefeda2b4 100644
--- a/src/mir_app/src/addcontact.cpp
+++ b/src/mir_app/src/addcontact.cpp
@@ -182,7 +182,7 @@ MIR_APP_DLL(void) Contact_Add(MCONTACT hContact, HWND hwndParent)
else (new CAddByContact(hContact))->Show();
}
-MIR_APP_DLL(void) Contact_AddByEvent(MEVENT hEvent, HWND hwndParent)
+MIR_APP_DLL(void) Contact_AddByEvent(MEVENT hEvent, MWindow hwndParent)
{
struct CAddByEvent : public CAddContactDlg
{
diff --git a/src/mir_app/src/auth.cpp b/src/mir_app/src/auth.cpp
index 8c12b475ff..8518bc1a63 100644
--- a/src/mir_app/src/auth.cpp
+++ b/src/mir_app/src/auth.cpp
@@ -33,13 +33,19 @@ class CAuthReqDlg : public CDlgBase
MCONTACT m_hContact;
const char *m_szProto;
+ CCtrlBase fldHeader, fldReason;
+ CCtrlEdit edtReason;
CCtrlCheck chkAdd;
- CCtrlButton btnDetails, btnLater;
+ CCtrlButton btnAdd, btnDetails, btnLater;
public:
CAuthReqDlg(MEVENT hEvent) :
CDlgBase(g_plugin, IDD_AUTHREQ),
m_hDbEvent(hEvent),
+ fldHeader(this, IDC_HEADERBAR),
+ fldReason(this, IDC_REASON),
+ edtReason(this, IDC_DENYREASON),
+ btnAdd(this, IDC_ADD),
btnLater(this, IDC_DECIDELATER),
btnDetails(this, IDC_DETAILS),
chkAdd(this, IDC_ADDCHECK)
@@ -60,6 +66,7 @@ public:
return false;
m_szProto = dbei.szModule;
+ PROTOACCOUNT *acc = Proto_GetAccount(dbei.szModule);
uint32_t uin = *(uint32_t*)dbei.pBlob;
m_hContact = DbGetAuthEventContact(&dbei);
@@ -69,8 +76,10 @@ public:
char *email = last + mir_strlen(last) + 1;
char *reason = email + mir_strlen(email) + 1;
- SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, CallProtoService(dbei.szModule, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0));
- SendMessage(m_hwnd, WM_SETICON, ICON_BIG, CallProtoService(dbei.szModule, PS_LOADICON, PLI_PROTOCOL | PLIF_LARGE, 0));
+ #ifdef _WINDOWS
+ SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, CallProtoService(dbei.szModule, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0));
+ SendMessage(m_hwnd, WM_SETICON, ICON_BIG, CallProtoService(dbei.szModule, PS_LOADICON, PLI_PROTOCOL | PLIF_LARGE, 0));
+ #endif
ptrW lastT(dbei.flags & DBEF_UTF ? mir_utf8decodeW(last) : mir_a2u(last));
ptrW firstT(dbei.flags & DBEF_UTF ? mir_utf8decodeW(first) : mir_a2u(first));
@@ -78,43 +87,40 @@ public:
ptrW emailT(dbei.flags & DBEF_UTF ? mir_utf8decodeW(email) : mir_a2u(email));
ptrW reasonT(dbei.flags & DBEF_UTF ? mir_utf8decodeW(reason) : mir_a2u(reason));
- wchar_t name[128] = L"";
- int off = 0;
+ CMStringW wszHeader;
if (firstT[0] && lastT[0])
- off = mir_snwprintf(name, L"%s %s", (wchar_t*)firstT, (wchar_t*)lastT);
+ wszHeader.Format(L"%s %s", (wchar_t*)firstT, (wchar_t*)lastT);
else if (firstT[0])
- off = mir_snwprintf(name, L"%s", (wchar_t*)firstT);
+ wszHeader = firstT.get();
else if (lastT[0])
- off = mir_snwprintf(name, L"%s", (wchar_t*)lastT);
+ wszHeader = lastT.get();
+
if (mir_wstrlen(nickT)) {
- if (off)
- mir_snwprintf(name + off, _countof(name) - off, L" (%s)", (wchar_t*)nickT);
+ if (wszHeader.IsEmpty())
+ wszHeader = nickT.get();
else
- wcsncpy_s(name, nickT, _TRUNCATE);
+ wszHeader.AppendFormat(L" %s", nickT.get());
}
- if (!name[0])
- wcsncpy_s(name, TranslateT("<Unknown>"), _TRUNCATE);
+ if (wszHeader.IsEmpty())
+ wszHeader = TranslateT("<Unknown>");
- PROTOACCOUNT *acc = Proto_GetAccount(dbei.szModule);
-
- wchar_t hdr[256];
if (uin && emailT[0])
- mir_snwprintf(hdr, TranslateT("%s requested authorization\n%u (%s) on %s"), name, uin, (wchar_t*)emailT, acc->tszAccountName);
+ wszHeader.AppendFormat(TranslateT(" requested authorization\n%u (%s) on %s"), uin, emailT.get(), acc->tszAccountName);
else if (uin)
- mir_snwprintf(hdr, TranslateT("%s requested authorization\n%u on %s"), name, uin, acc->tszAccountName);
+ wszHeader.AppendFormat(TranslateT(" requested authorization\n%u on %s"), uin, acc->tszAccountName);
else
- mir_snwprintf(hdr, TranslateT("%s requested authorization\n%s on %s"), name, emailT[0] ? (wchar_t*)emailT : TranslateT("(Unknown)"), acc->tszAccountName);
+ wszHeader.AppendFormat(TranslateT(" requested authorization\n%s on %s"), emailT[0] ? emailT.get() : TranslateT("(Unknown)"), acc->tszAccountName);
+ fldHeader.SetText(wszHeader);
- SetDlgItemText(m_hwnd, IDC_HEADERBAR, hdr);
- SetDlgItemText(m_hwnd, IDC_REASON, reasonT);
+ fldReason.SetText(reasonT);
if (m_hContact == INVALID_CONTACT_ID || Contact_OnList(m_hContact))
- ShowWindow(GetDlgItem(m_hwnd, IDC_ADD), FALSE);
+ btnAdd.Hide();
- SendDlgItemMessage(m_hwnd, IDC_DENYREASON, EM_LIMITTEXT, 255, 0);
+ edtReason.SetMaxLength(255);
if (CallProtoService(dbei.szModule, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_NOAUTHDENYREASON) {
- EnableWindow(GetDlgItem(m_hwnd, IDC_DENYREASON), FALSE);
- SetDlgItemText(m_hwnd, IDC_DENYREASON, TranslateT("Feature is not supported by protocol"));
+ edtReason.Disable();
+ edtReason.SetText(TranslateT("Feature is not supported by protocol"));
}
if (Contact_OnList(m_hContact)) {
@@ -137,18 +143,19 @@ public:
void OnDestroy() override
{
if (!m_bSucceeded) {
- if (IsWindowEnabled(GetDlgItem(m_hwnd, IDC_DENYREASON))) {
- wchar_t tszReason[256];
- GetDlgItemText(m_hwnd, IDC_DENYREASON, tszReason, _countof(tszReason));
- CallProtoService(m_szProto, PS_AUTHDENY, m_hDbEvent, (LPARAM)tszReason);
- }
- else CallProtoService(m_szProto, PS_AUTHDENY, m_hDbEvent, 0);
+ if (edtReason.Enabled())
+ CallProtoService(m_szProto, PS_AUTHDENY, m_hDbEvent, (LPARAM)ptrW(edtReason.GetText()));
+ else
+ CallProtoService(m_szProto, PS_AUTHDENY, m_hDbEvent, 0);
}
Button_FreeIcon_IcoLib(m_hwnd, IDC_ADD);
Button_FreeIcon_IcoLib(m_hwnd, IDC_DETAILS);
- DestroyIcon((HICON)SendMessage(m_hwnd, WM_SETICON, ICON_BIG, 0));
- DestroyIcon((HICON)SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, 0));
+
+ #ifdef _WINDOWS
+ DestroyIcon((HICON)SendMessage(m_hwnd, WM_SETICON, ICON_BIG, 0));
+ DestroyIcon((HICON)SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, 0));
+ #endif
}
void onClick_Later(CCtrlButton*)
@@ -176,6 +183,7 @@ class CAddedDlg : public CDlgBase
MEVENT m_hDbEvent;
MCONTACT m_hContact;
+ CCtrlBase fldHeader;
CCtrlButton btnDetails, btnAdd;
public:
@@ -183,7 +191,8 @@ public:
CDlgBase(g_plugin, IDD_ADDED),
m_hDbEvent(hEvent),
btnAdd(this, IDC_ADD),
- btnDetails(this, IDC_DETAILS)
+ btnDetails(this, IDC_DETAILS),
+ fldHeader(this, IDC_HEADERBAR)
{
btnAdd.OnClick = Callback(this, &CAddedDlg::onClick_Add);
btnDetails.OnClick = Callback(this, &CAddedDlg::onClick_Details);
@@ -201,14 +210,16 @@ public:
m_hContact = DbGetAuthEventContact(&dbei);
- uint32_t uin = *(PDWORD)dbei.pBlob;
+ uint32_t uin = *(uint32_t*)dbei.pBlob;
char* nick = (char*)dbei.pBlob + sizeof(uint32_t) * 2;
char* first = nick + mir_strlen(nick) + 1;
char* last = first + mir_strlen(first) + 1;
char* email = last + mir_strlen(last) + 1;
- SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, CallProtoService(dbei.szModule, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0));
- SendMessage(m_hwnd, WM_SETICON, ICON_BIG, CallProtoService(dbei.szModule, PS_LOADICON, PLI_PROTOCOL | PLIF_LARGE, 0));
+ #ifdef _WINDOWS
+ SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, CallProtoService(dbei.szModule, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0));
+ SendMessage(m_hwnd, WM_SETICON, ICON_BIG, CallProtoService(dbei.szModule, PS_LOADICON, PLI_PROTOCOL | PLIF_LARGE, 0));
+ #endif
PROTOACCOUNT* acc = Proto_GetAccount(dbei.szModule);
@@ -241,10 +252,10 @@ public:
mir_snwprintf(hdr, TranslateT("%s added you to the contact list\n%u on %s"), name, uin, acc->tszAccountName);
else
mir_snwprintf(hdr, TranslateT("%s added you to the contact list\n%s on %s"), name, emailT[0] ? emailT.get() : TranslateT("(Unknown)"), acc->tszAccountName);
- SetDlgItemText(m_hwnd, IDC_HEADERBAR, hdr);
+ fldHeader.SetText(hdr);
if (m_hContact == INVALID_CONTACT_ID || Contact_OnList(m_hContact))
- ShowWindow(GetDlgItem(m_hwnd, IDC_ADD), FALSE);
+ btnAdd.Hide();
return true;
}
@@ -258,8 +269,11 @@ public:
{
Button_FreeIcon_IcoLib(m_hwnd, IDC_ADD);
Button_FreeIcon_IcoLib(m_hwnd, IDC_DETAILS);
- DestroyIcon((HICON)SendMessage(m_hwnd, WM_SETICON, ICON_BIG, 0));
- DestroyIcon((HICON)SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, 0));
+
+ #ifdef _WINDOWS
+ DestroyIcon((HICON)SendMessage(m_hwnd, WM_SETICON, ICON_BIG, 0));
+ DestroyIcon((HICON)SendMessage(m_hwnd, WM_SETICON, ICON_SMALL, 0));
+ #endif
}
void onClick_Add(CCtrlButton*)
@@ -267,7 +281,7 @@ public:
Contact_AddByEvent(m_hDbEvent, m_hwnd);
if (m_hContact == INVALID_CONTACT_ID || Contact_OnList(m_hContact))
- ShowWindow(GetDlgItem(m_hwnd, IDC_ADD), FALSE);
+ btnAdd.Hide();
}
void onClick_Details(CCtrlButton*)
@@ -316,7 +330,7 @@ static int AuthEventAdded(WPARAM, LPARAM lParam)
if (szUid)
mir_snwprintf(szTooltip, TranslateT("%s requests authorization"), szUid.get());
else
- mir_snwprintf(szTooltip, TranslateT("%u requests authorization"), *(PDWORD)dbei.pBlob);
+ mir_snwprintf(szTooltip, TranslateT("%u requests authorization"), *(uint32_t*)dbei.pBlob);
cle.hIcon = Skin_LoadIcon(SKINICON_AUTH_REQUEST);
cle.pszService = MS_AUTH_SHOWREQUEST;
@@ -327,7 +341,7 @@ static int AuthEventAdded(WPARAM, LPARAM lParam)
if (szUid)
mir_snwprintf(szTooltip, TranslateT("%s added you to their contact list"), szUid.get());
else
- mir_snwprintf(szTooltip, TranslateT("%u added you to their contact list"), *(PDWORD)dbei.pBlob);
+ mir_snwprintf(szTooltip, TranslateT("%u added you to their contact list"), *(uint32_t*)dbei.pBlob);
cle.hIcon = Skin_LoadIcon(SKINICON_AUTH_ADD);
cle.pszService = MS_AUTH_SHOWADDED;
diff --git a/src/mir_app/src/db_ini.cpp b/src/mir_app/src/db_ini.cpp
index 910f0732f6..a51e4858b9 100644
--- a/src/mir_app/src/db_ini.cpp
+++ b/src/mir_app/src/db_ini.cpp
@@ -130,11 +130,11 @@ static bool IsInSpaceSeparatedList(const char *szWord, const char *szList)
struct warnSettingChangeInfo_t
{
wchar_t *szIniPath;
- char *szSection;
- char *szSafeSections;
- char *szUnsafeSections;
- char *szName;
- char *szValue;
+ const char *szSection;
+ const char *szSafeSections;
+ const char *szUnsafeSections;
+ const char *szName;
+ const char *szValue;
int warnNoMore, cancel;
};
@@ -230,12 +230,14 @@ public:
m_iniPath.SetText(m_path);
m_newPath.SetText(m_path);
- if (!PU::IsMirandaFolderWritable()) {
- bool bIsElevated = PU::IsProcessElevated();
- Button_SetElevationRequiredState(btnMove.GetHwnd(), !bIsElevated);
- Button_SetElevationRequiredState(btnDelete.GetHwnd(), !bIsElevated);
- Button_SetElevationRequiredState(btnRecycle.GetHwnd(), !bIsElevated);
- }
+ #ifdef _WINDOWS
+ if (!PU::IsMirandaFolderWritable()) {
+ bool bIsElevated = PU::IsProcessElevated();
+ Button_SetElevationRequiredState(btnMove.GetHwnd(), !bIsElevated);
+ Button_SetElevationRequiredState(btnDelete.GetHwnd(), !bIsElevated);
+ Button_SetElevationRequiredState(btnRecycle.GetHwnd(), !bIsElevated);
+ }
+ #endif
return true;
}
@@ -244,7 +246,7 @@ public:
{
ptrW wszOldFile(m_iniPath.GetText()), wszNewFile(ptrW(m_newPath.GetText()));
if (!wcsicmp(wszOldFile, wszNewFile)) {
- MessageBoxW(m_hwnd, TranslateT("File names must be different"), TranslateT("Error"), MB_ICONERROR | MB_OK);
+ // MessageBoxW(m_hwnd, TranslateT("File names must be different"), TranslateT("Error"), MB_ICONERROR | MB_OK);
return;
}
@@ -283,22 +285,6 @@ int SettingsEnumProc(const char *szSetting, void *)
return 0;
}
-static void ConvertBackslashes(char *str, UINT fileCp)
-{
- char *pstr;
- for (pstr = str; *pstr; pstr = CharNextExA(fileCp, pstr, 0)) {
- if (*pstr == '\\') {
- switch (pstr[1]) {
- case 'n': *pstr = '\n'; break;
- case 't': *pstr = '\t'; break;
- case 'r': *pstr = '\r'; break;
- default: *pstr = pstr[1]; break;
- }
- memmove(pstr + 1, pstr + 2, mir_strlen(pstr + 2) + 1);
- }
- }
-}
-
struct ESFDParam
{
LIST<char> *pList;
@@ -313,7 +299,7 @@ static int EnumSettingsForDeletion(const char *szSetting, void *param)
return 0;
}
-static void ProcessIniFile(wchar_t* szIniPath, char *szSafeSections, char *szUnsafeSections, int secur, bool secFN)
+static void ProcessIniFile(wchar_t* szIniPath, const char *szSafeSections, const char *szUnsafeSections, int secur, bool secFN)
{
FILE *fp = _wfopen(szIniPath, L"rt");
if (fp == nullptr)
@@ -362,6 +348,7 @@ LBL_NewLine:
}
if (secFN) warnThisSection = 0;
}
+
if (szLine[1] == '?' || szLine[1] == '-') {
mir_strncpy(szSection, szLine + 2, min(sizeof(szSection), (size_t)(szEnd - szLine - 1)));
db_enum_settings(0, SettingsEnumProc, szSection);
@@ -437,7 +424,15 @@ LBL_NewLine:
break;
case 'e':
case 'E':
- ConvertBackslashes(szValue + 1, Langpack_GetDefaultCodePage());
+ {
+ CMStringA str(szValue + 1);
+ str.Replace("\\n", "\n");
+ str.Replace("\\t", "\t");
+ str.Replace("\\r", "\r");
+ str.Replace("\\\\", "\\");
+ db_set_s(0, szSection, szName, str);
+ }
+ break;
case 's':
case 'S':
db_set_s(0, szSection, szName, szValue + 1);
@@ -541,21 +536,17 @@ static void DoAutoExec(void)
PathToAbsoluteW(VARSW(szFindPath), szFindPath);
- WIN32_FIND_DATA fd;
- HANDLE hFind = FindFirstFile(szFindPath, &fd);
- if (hFind == INVALID_HANDLE_VALUE)
- return;
-
+ MFilePath path(szFindPath);
wchar_t *str2 = wcsrchr(szFindPath, '\\');
if (str2 == nullptr)
szFindPath[0] = 0;
else
str2[1] = 0;
- do {
- bool secFN = mir_wstrcmpi(fd.cFileName, szOverrideSecurityFilename) == 0;
+ for (auto &it: path.search()) {
+ bool secFN = mir_wstrcmpi(it.getPath(), szOverrideSecurityFilename) == 0;
- mir_snwprintf(szIniPath, L"%s%s", szFindPath, fd.cFileName);
+ mir_snwprintf(szIniPath, L"%s%s", szFindPath, it.getPath());
if (!mir_wstrcmpi(szUse, L"prompt") && !secFN) {
CInstallIniDlg dlg(szIniPath);
int result = dlg.DoModal();
@@ -578,7 +569,7 @@ static void DoAutoExec(void)
else if (!mir_wstrcmpi(szOnCompletion, L"rename")) {
wchar_t wszRenamePrefix[MAX_PATH], wszNewPath[MAX_PATH];
Profile_GetSetting(L"AutoExec/RenamePrefix", wszRenamePrefix, L"done_");
- mir_snwprintf(wszNewPath, L"%s%s%s", szFindPath, wszRenamePrefix, fd.cFileName);
+ mir_snwprintf(wszNewPath, L"%s%s%s", szFindPath, wszRenamePrefix, it.getPath());
MyMoveFile(szIniPath, wszNewPath);
}
else if (!mir_wstrcmpi(szOnCompletion, L"ask")) {
@@ -586,15 +577,16 @@ static void DoAutoExec(void)
dlg.DoModal();
}
}
- } while (FindNextFile(hFind, &fd));
-
- FindClose(hFind);
+ }
}
static void CALLBACK CheckIniImportNow()
{
DoAutoExec();
- FindNextChangeNotification(hIniChangeNotification);
+
+ #ifdef _WINDOWS
+ FindNextChangeNotification(hIniChangeNotification);
+ #endif
}
static INT_PTR ImportINI(WPARAM wParam, LPARAM)
@@ -610,11 +602,13 @@ int InitIni(void)
CreateServiceFunction("DB/Ini/ImportFile", ImportINI);
DoAutoExec();
- wchar_t szMirandaDir[MAX_PATH];
- PathToAbsoluteW(L".", szMirandaDir);
- hIniChangeNotification = FindFirstChangeNotification(szMirandaDir, 0, FILE_NOTIFY_CHANGE_FILE_NAME);
- if (hIniChangeNotification != INVALID_HANDLE_VALUE)
- Miranda_WaitOnHandle(CheckIniImportNow, hIniChangeNotification);
+ #ifdef _WINDOWS
+ wchar_t szMirandaDir[MAX_PATH];
+ PathToAbsoluteW(L".", szMirandaDir);
+ hIniChangeNotification = FindFirstChangeNotification(szMirandaDir, 0, FILE_NOTIFY_CHANGE_FILE_NAME);
+ if (hIniChangeNotification != INVALID_HANDLE_VALUE)
+ Miranda_WaitOnHandle(CheckIniImportNow, hIniChangeNotification);
+ #endif
return 0;
}
@@ -624,5 +618,7 @@ void UninitIni(void)
if (!bModuleInitialized)
return;
- FindCloseChangeNotification(hIniChangeNotification);
+ #ifdef _WINDOWS
+ FindCloseChangeNotification(hIniChangeNotification);
+ #endif
}
diff --git a/src/mir_app/src/miranda.cpp b/src/mir_app/src/miranda.cpp
index 12c4d64c69..4f6e7b1beb 100644
--- a/src/mir_app/src/miranda.cpp
+++ b/src/mir_app/src/miranda.cpp
@@ -61,6 +61,8 @@ CMPlugin::CMPlugin() :
PLUGIN<CMPlugin>(nullptr, pluginInfoEx)
{}
+#ifdef _WINDOWS
+
/////////////////////////////////////////////////////////////////////////////////////////
// dll entry point
@@ -83,6 +85,8 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, uint32_t dwReason, LPVOID)
return TRUE;
}
+#endif
+
/////////////////////////////////////////////////////////////////////////////////////////
static int SystemShutdownProc(WPARAM, LPARAM)
@@ -117,10 +121,13 @@ protected:
{
if (m_progress.Move() == MIRANDA_PROCESS_WAIT_STEPS)
EndModal(0);
- if (WaitForSingleObject(m_hProcess, 1) != WAIT_TIMEOUT) {
- m_progress.SetPosition(MIRANDA_PROCESS_WAIT_STEPS);
- EndModal(0);
- }
+
+ #ifdef _WINDOWS
+ if (WaitForSingleObject(m_hProcess, 1) != WAIT_TIMEOUT) {
+ m_progress.SetPosition(MIRANDA_PROCESS_WAIT_STEPS);
+ EndModal(0);
+ }
+ #endif
}
void Cancel_OnClick(CCtrlBase*)
@@ -145,12 +152,14 @@ INT_PTR CheckRestart()
{
LPCTSTR tszPID = CmdLine_GetOption(L"restart");
if (tszPID) {
- HANDLE hProcess = OpenProcess(SYNCHRONIZE, FALSE, _wtol(tszPID));
- if (hProcess) {
- INT_PTR result = CWaitRestartDlg(hProcess).DoModal();
- CloseHandle(hProcess);
- return result;
- }
+ #ifdef _WINDOWS
+ HANDLE hProcess = OpenProcess(SYNCHRONIZE, FALSE, _wtol(tszPID));
+ if (hProcess) {
+ INT_PTR result = CWaitRestartDlg(hProcess).DoModal();
+ CloseHandle(hProcess);
+ return result;
+ }
+ #endif
}
return 0;
}
@@ -171,7 +180,7 @@ static MSystemWindow *g_pSystemWindow;
/////////////////////////////////////////////////////////////////////////////////////////
-int WINAPI mir_main(LPTSTR cmdLine)
+int CALLBACK mir_main(LPTSTR cmdLine)
{
hMainThreadId = GetCurrentThreadId();
@@ -227,15 +236,19 @@ MIR_APP_DLL(bool) Miranda_OkToExit()
MIR_APP_DLL(void) Miranda_Close()
{
while (!Miranda_OkToExit()) {
- MSG msg;
- while (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- Sleep(0);
+ #ifdef _WINDOWS
+ MSG msg;
+ while (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) {
+ TranslateMessage(&msg);
+ DispatchMessage(&msg);
+ }
+ Sleep(0);
+ #endif
}
- DestroyWindow(g_clistApi.hwndContactList);
+ #ifdef _WINDOWS
+ DestroyWindow(g_clistApi.hwndContactList);
+ #endif
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -243,53 +256,67 @@ MIR_APP_DLL(void) Miranda_Close()
MIR_APP_DLL(uint32_t) Miranda_GetVersion()
{
- wchar_t filename[MAX_PATH];
- GetModuleFileName(g_plugin.getInst(), filename, _countof(filename));
-
- DWORD unused, verInfoSize = GetFileVersionInfoSize(filename, &unused);
- PVOID pVerInfo = _alloca(verInfoSize);
- GetFileVersionInfo(filename, 0, verInfoSize, pVerInfo);
-
- UINT blockSize;
- VS_FIXEDFILEINFO *vsffi;
- VerQueryValue(pVerInfo, L"\\", (PVOID*)&vsffi, &blockSize);
- return (((vsffi->dwProductVersionMS >> 16) & 0xFF) << 24) |
- ((vsffi->dwProductVersionMS & 0xFF) << 16) |
- (((vsffi->dwProductVersionLS >> 16) & 0xFF) << 8) |
- (vsffi->dwProductVersionLS & 0xFF);
+ #ifdef _WINDOWS
+ wchar_t filename[MAX_PATH];
+ GetModuleFileName(g_plugin.getInst(), filename, _countof(filename));
+
+ DWORD unused, verInfoSize = GetFileVersionInfoSize(filename, &unused);
+ PVOID pVerInfo = _alloca(verInfoSize);
+ GetFileVersionInfo(filename, 0, verInfoSize, pVerInfo);
+
+ UINT blockSize;
+ VS_FIXEDFILEINFO *vsffi;
+ VerQueryValue(pVerInfo, L"\\", (PVOID*)&vsffi, &blockSize);
+ return (((vsffi->dwProductVersionMS >> 16) & 0xFF) << 24) |
+ ((vsffi->dwProductVersionMS & 0xFF) << 16) |
+ (((vsffi->dwProductVersionLS >> 16) & 0xFF) << 8) |
+ (vsffi->dwProductVersionLS & 0xFF);
+ #else
+ return MIRANDA_VERSION_DWORD;
+ #endif
}
MIR_APP_DLL(void) Miranda_GetFileVersion(MFileVersion *pVer)
{
- wchar_t filename[MAX_PATH];
- GetModuleFileName(g_plugin.getInst(), filename, _countof(filename));
-
- DWORD unused, verInfoSize = GetFileVersionInfoSize(filename, &unused);
- PVOID pVerInfo = _alloca(verInfoSize);
- GetFileVersionInfo(filename, 0, verInfoSize, pVerInfo);
-
- UINT blockSize;
- VS_FIXEDFILEINFO *vsffi;
- VerQueryValue(pVerInfo, L"\\", (PVOID*)&vsffi, &blockSize);
-
- (*pVer)[0] = HIWORD(vsffi->dwProductVersionMS);
- (*pVer)[1] = LOWORD(vsffi->dwProductVersionMS);
- (*pVer)[2] = HIWORD(vsffi->dwProductVersionLS);
- (*pVer)[3] = LOWORD(vsffi->dwProductVersionLS);
+ #ifdef _WINDOWS
+ wchar_t filename[MAX_PATH];
+ GetModuleFileName(g_plugin.getInst(), filename, _countof(filename));
+
+ DWORD unused, verInfoSize = GetFileVersionInfoSize(filename, &unused);
+ PVOID pVerInfo = _alloca(verInfoSize);
+ GetFileVersionInfo(filename, 0, verInfoSize, pVerInfo);
+
+ UINT blockSize;
+ VS_FIXEDFILEINFO *vsffi;
+ VerQueryValue(pVerInfo, L"\\", (PVOID*)&vsffi, &blockSize);
+
+ (*pVer)[0] = HIWORD(vsffi->dwProductVersionMS);
+ (*pVer)[1] = LOWORD(vsffi->dwProductVersionMS);
+ (*pVer)[2] = HIWORD(vsffi->dwProductVersionLS);
+ (*pVer)[3] = LOWORD(vsffi->dwProductVersionLS);
+ #else
+ uint16_t tmp[4] = { MIRANDA_VERSION_FILEVERSION };
+ memcpy(pVer, tmp, sizeof(tmp));
+ #endif
}
MIR_APP_DLL(void) Miranda_GetVersionText(char *pDest, size_t cbSize)
{
- wchar_t filename[MAX_PATH], *productVersion;
- GetModuleFileName(g_plugin.getInst(), filename, _countof(filename));
-
- DWORD unused, verInfoSize = GetFileVersionInfoSize(filename, &unused);
- PVOID pVerInfo = _alloca(verInfoSize);
- GetFileVersionInfo(filename, 0, verInfoSize, pVerInfo);
+ #ifdef _WINDOWS
+ wchar_t filename[MAX_PATH], *productVersion;
+ GetModuleFileName(g_plugin.getInst(), filename, _countof(filename));
+
+ DWORD unused, verInfoSize = GetFileVersionInfoSize(filename, &unused);
+ PVOID pVerInfo = _alloca(verInfoSize);
+ GetFileVersionInfo(filename, 0, verInfoSize, pVerInfo);
+
+ UINT blockSize;
+ VerQueryValue(pVerInfo, L"\\StringFileInfo\\000004b0\\ProductVersion", (LPVOID*)&productVersion, &blockSize);
+ strncpy_s(pDest, cbSize, _T2A(productVersion), _TRUNCATE);
+ #else
+ strncpy_s(pDest, cbSize, "Miranda NG " MIRANDA_VERSION_DISPLAY, _TRUNCATE);
+ #endif
- UINT blockSize;
- VerQueryValue(pVerInfo, L"\\StringFileInfo\\000004b0\\ProductVersion", (LPVOID*)&productVersion, &blockSize);
- strncpy_s(pDest, cbSize, _T2A(productVersion), _TRUNCATE);
#if defined(_WIN64)
strcat_s(pDest, cbSize, " x64");
#endif
diff --git a/src/mir_app/src/miranda.h b/src/mir_app/src/miranda.h
index c3f476c21a..97aee60c7b 100644
--- a/src/mir_app/src/miranda.h
+++ b/src/mir_app/src/miranda.h
@@ -54,7 +54,8 @@ extern bool g_bModulesLoadedFired;
/**** newplugins.cpp *******************************************************************/
-char* GetPluginNameByInstance(HINSTANCE hInstance);
+const char* GetPluginNameByInstance(HINSTANCE hInstance);
+
int LoadStdPlugins(void);
int LaunchServicePlugin(pluginEntry *p);
diff --git a/src/mir_app/src/stdafx.h b/src/mir_app/src/stdafx.h
index d6770083fa..9e8bb456c8 100644
--- a/src/mir_app/src/stdafx.h
+++ b/src/mir_app/src/stdafx.h
@@ -41,6 +41,8 @@ typedef struct SslHandle *HSSL;
#include <io.h>
#include <direct.h>
#include <process.h>
+#else
+ #include <pthread.h>
#endif
#include <assert.h>
diff --git a/src/mir_core/src/Linux/CCtrlBase.cpp b/src/mir_core/src/Linux/CCtrlBase.cpp
index 61d03c99af..cba8567e52 100644
--- a/src/mir_core/src/Linux/CCtrlBase.cpp
+++ b/src/mir_core/src/Linux/CCtrlBase.cpp
@@ -28,6 +28,7 @@ static int CompareControls(const CCtrlBase *p1, const CCtrlBase *p2)
{
return (INT_PTR)p1->GetHwnd() - (INT_PTR)p2->GetHwnd();
}
+
static LIST<CCtrlBase> arControls(10, CompareControls);
/////////////////////////////////////////////////////////////////////////////////////////
@@ -60,6 +61,7 @@ void CCtrlBase::OnDestroy()
arControls.remove(pCtrl);
}
+ evas_object_del(m_hwnd);
m_hwnd = nullptr;
}
diff --git a/src/mir_core/src/Linux/CCtrlButton.cpp b/src/mir_core/src/Linux/CCtrlButton.cpp
index 1fb547bef8..e8c107b888 100644
--- a/src/mir_core/src/Linux/CCtrlButton.cpp
+++ b/src/mir_core/src/Linux/CCtrlButton.cpp
@@ -29,7 +29,7 @@ CCtrlButton::CCtrlButton(CDlgBase* wnd, int idCtrl)
: CCtrlBase(wnd, idCtrl)
{}
-BOOL CCtrlButton::OnCommand(HWND, uint16_t, uint16_t idCode)
+BOOL CCtrlButton::OnCommand(MWindow, uint16_t, uint16_t idCode)
{
// if (idCode == BN_CLICKED)
// OnClick(this);
diff --git a/src/mir_core/src/Linux/CCtrlCheck.cpp b/src/mir_core/src/Linux/CCtrlCheck.cpp
index 15c9ab0f1b..7c821f0329 100644
--- a/src/mir_core/src/Linux/CCtrlCheck.cpp
+++ b/src/mir_core/src/Linux/CCtrlCheck.cpp
@@ -31,7 +31,7 @@ CCtrlCheck::CCtrlCheck(CDlgBase *dlg, int ctrlId)
m_bNotifiable = true;
}
-BOOL CCtrlCheck::OnCommand(HWND, uint16_t, uint16_t)
+BOOL CCtrlCheck::OnCommand(MWindow, uint16_t, uint16_t)
{
NotifyChange();
return TRUE;
diff --git a/src/mir_core/src/Linux/CCtrlCombo.cpp b/src/mir_core/src/Linux/CCtrlCombo.cpp
index 905ebc7a24..063588e39e 100644
--- a/src/mir_core/src/Linux/CCtrlCombo.cpp
+++ b/src/mir_core/src/Linux/CCtrlCombo.cpp
@@ -29,7 +29,7 @@ CCtrlCombo::CCtrlCombo(CDlgBase *dlg, int ctrlId)
: CCtrlData(dlg, ctrlId)
{}
-BOOL CCtrlCombo::OnCommand(HWND, uint16_t, uint16_t idCode)
+BOOL CCtrlCombo::OnCommand(MWindow, uint16_t, uint16_t idCode)
{
switch (idCode) {
// case CBN_CLOSEUP: OnCloseup(this); break;
diff --git a/src/mir_core/src/Linux/CCtrlEdit.cpp b/src/mir_core/src/Linux/CCtrlEdit.cpp
index b2b5e14d46..7f1ac14cc2 100644
--- a/src/mir_core/src/Linux/CCtrlEdit.cpp
+++ b/src/mir_core/src/Linux/CCtrlEdit.cpp
@@ -29,7 +29,7 @@ CCtrlEdit::CCtrlEdit(CDlgBase *dlg, int ctrlId)
: CCtrlData(dlg, ctrlId)
{}
-BOOL CCtrlEdit::OnCommand(HWND, uint16_t, uint16_t idCode)
+BOOL CCtrlEdit::OnCommand(MWindow, uint16_t, uint16_t idCode)
{
// if (idCode == EN_CHANGE)
// NotifyChange();
diff --git a/src/mir_core/src/Linux/CDlgBase.cpp b/src/mir_core/src/Linux/CDlgBase.cpp
index 425e71ee31..3504a7e74c 100644
--- a/src/mir_core/src/Linux/CDlgBase.cpp
+++ b/src/mir_core/src/Linux/CDlgBase.cpp
@@ -175,7 +175,7 @@ int CDlgBase::Resizer(UTILRESIZECONTROL*)
return RD_ANCHORX_LEFT | RD_ANCHORY_TOP;
}
-BOOL CALLBACK CDlgBase::GlobalFieldEnum(HWND hwnd, LPARAM lParam)
+BOOL CALLBACK CDlgBase::GlobalFieldEnum(MWindow hwnd, LPARAM lParam)
{
return TRUE;
}
@@ -185,7 +185,7 @@ INT_PTR CDlgBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
return FALSE;
}
-int CDlgBase::GlobalDlgResizer(HWND hwnd, LPARAM, UTILRESIZECONTROL *urc)
+int CDlgBase::GlobalDlgResizer(MWindow hwnd, LPARAM, UTILRESIZECONTROL *urc)
{
CDlgBase *wnd = CDlgBase::Find(hwnd);
return (wnd == nullptr) ? 0 : wnd->Resizer(urc);
@@ -226,7 +226,7 @@ CCtrlBase* CDlgBase::FindControl(int idCtrl)
return m_controls.find(&search);
}
-CCtrlBase* CDlgBase::FindControl(HWND hwnd)
+CCtrlBase* CDlgBase::FindControl(MWindow hwnd)
{
for (auto &it : m_controls)
if (it->GetHwnd() == hwnd)
@@ -252,7 +252,7 @@ CTimer* CDlgBase::FindTimer(int idEvent)
return m_timers.find(&search);
}
-CDlgBase* CDlgBase::Find(HWND hwnd)
+CDlgBase* CDlgBase::Find(MWindow hwnd)
{
void *bullshit[2]; // vfptr + hwnd
bullshit[1] = hwnd;
diff --git a/tools/build_scripts/redist/x32/bass/basswma.dll b/tools/build_scripts/redist/x32/bass/basswma.dll
index d4a1914235..2e1bb2f703 100644
--- a/tools/build_scripts/redist/x32/bass/basswma.dll
+++ b/tools/build_scripts/redist/x32/bass/basswma.dll
Binary files differ
diff --git a/tools/build_scripts/redist/x64/bass/basswma.dll b/tools/build_scripts/redist/x64/bass/basswma.dll
index 13c24cd50b..4ab075ed11 100644
--- a/tools/build_scripts/redist/x64/bass/basswma.dll
+++ b/tools/build_scripts/redist/x64/bass/basswma.dll
Binary files differ