diff options
author | René Schümann <white06tiger@gmail.com> | 2014-12-27 05:56:38 +0000 |
---|---|---|
committer | René Schümann <white06tiger@gmail.com> | 2014-12-27 05:56:38 +0000 |
commit | 6d6b16c8591d375a4a4a2db1ebfb307116df3fd0 (patch) | |
tree | 0570f547e024d1992847e11616086b8fff7b6156 /plugins/SendScreenshotPlus/src | |
parent | 6ffc309d05545fe59bdca2b061b605e1dd63c664 (diff) |
SendSS:
- cleaned up our mir_string stuff and removed lots of custom implementations as we use those of NG core now (couldn't get rid of mir_string though.. we still use some custom stuff)
git-svn-id: http://svn.miranda-ng.org/main/trunk@11650 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SendScreenshotPlus/src')
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSend.cpp | 8 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp | 4 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/UAboutForm.cpp | 6 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/UMainForm.cpp | 40 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/Utils.cpp | 8 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/dlg_msgbox.cpp | 4 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/mir_string.cpp | 20 | ||||
-rw-r--r-- | plugins/SendScreenshotPlus/src/mir_string.h | 20 |
8 files changed, 39 insertions, 71 deletions
diff --git a/plugins/SendScreenshotPlus/src/CSend.cpp b/plugins/SendScreenshotPlus/src/CSend.cpp index aa15b08785..dfd4256137 100644 --- a/plugins/SendScreenshotPlus/src/CSend.cpp +++ b/plugins/SendScreenshotPlus/src/CSend.cpp @@ -90,7 +90,7 @@ INT_PTR CALLBACK CSend::ResultDialogProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LP SendMessage(hwndDlg,WM_SETICON,ICON_BIG,(LPARAM)GetIcon(ICO_MAIN)); CSend* self=(CSend*)lParam; TCHAR* tmp=mir_tstrdup(TranslateT("Resulting URL from\n")); - mir_tcsadd(tmp,self->m_pszSendTyp); + mir_tstradd(tmp,self->m_pszSendTyp); SetDlgItemText(hwndDlg,IDC_HEADERBAR,tmp); mir_free(tmp); SendDlgItemMessage(hwndDlg,IDC_HEADERBAR,WM_SETICON,ICON_BIG,(LPARAM)GetIconBtn(ICO_BTN_ARROWR)); @@ -176,7 +176,7 @@ INT_PTR CALLBACK CSend::ResultDialogProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LP EmptyClipboard(); HGLOBAL clipbuffer=GlobalAlloc(GMEM_MOVEABLE, len*sizeof(TCHAR)+sizeof(TCHAR)); TCHAR* tmp2=(TCHAR*)GlobalLock(clipbuffer); - mir_tcsncpy(tmp2,tmp,len+1); tmp2[len]='\0'; + mir_tstrncpy(tmp2,tmp,len+1); tmp2[len]='\0'; GlobalUnlock(clipbuffer); SetClipboardData(CF_UNICODETEXT,clipbuffer); CloseClipboard(); @@ -204,8 +204,8 @@ void CSend::svcSendMsgExit(const char* szMessage) { if(m_ChatRoom){ TCHAR* tmp = mir_a2t(szMessage); if (m_pszFileDesc) { - mir_tcsadd(tmp, _T("\r\n")); - mir_tcsadd(tmp, m_pszFileDesc); + mir_tstradd(tmp, _T("\r\n")); + mir_tstradd(tmp, m_pszFileDesc); } GC_INFO gci = {0}; int res = GC_RESULT_NOSESSION; diff --git a/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp b/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp index 5bb28a8da2..69614160bc 100644 --- a/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp +++ b/plugins/SendScreenshotPlus/src/CSendHTTPServer.cpp @@ -63,8 +63,8 @@ int CSendHTTPServer::Send() m_pszFileName = GetFileNameA(m_pszFile); } mir_freeAndNil(m_fsi_pszSrvPath); - mir_tcsadd(m_fsi_pszSrvPath, _T("/")); - mir_tcsadd(m_fsi_pszSrvPath, _A2T(m_pszFileName)); + mir_tstradd(m_fsi_pszSrvPath, _T("/")); + mir_tstradd(m_fsi_pszSrvPath, _A2T(m_pszFileName)); replaceStrT(m_fsi_pszRealPath, m_pszFile); diff --git a/plugins/SendScreenshotPlus/src/UAboutForm.cpp b/plugins/SendScreenshotPlus/src/UAboutForm.cpp index ddb97052ac..9131f69080 100644 --- a/plugins/SendScreenshotPlus/src/UAboutForm.cpp +++ b/plugins/SendScreenshotPlus/src/UAboutForm.cpp @@ -93,8 +93,8 @@ LRESULT TfrmAbout::wmInitdialog(WPARAM wParam, LPARAM lParam) { //License { TCHAR* pszText = NULL; - mir_tcsadd(pszText, _T(__COPYRIGHT)); - mir_tcsadd(pszText, _T("\r\n\r\n")); + mir_tstradd(pszText, _T(__COPYRIGHT)); + mir_tstradd(pszText, _T("\r\n\r\n")); HRSRC hRes = FindResource(g_hSendSS,MAKEINTRESOURCE(IDR_LICENSE),_T("TEXT")); DWORD size = SizeofResource(g_hSendSS,hRes); @@ -103,7 +103,7 @@ LRESULT TfrmAbout::wmInitdialog(WPARAM wParam, LPARAM lParam) { data[size] = '\0'; TCHAR* pszCopyright = mir_a2t(data); mir_free(data); - mir_tcsadd(pszText, pszCopyright); + mir_tstradd(pszText, pszCopyright); mir_free(pszCopyright); SetDlgItemText(m_hWnd,IDC_LICENSE, pszText); mir_free(pszText); diff --git a/plugins/SendScreenshotPlus/src/UMainForm.cpp b/plugins/SendScreenshotPlus/src/UMainForm.cpp index 9be05d660e..fa3761ec10 100644 --- a/plugins/SendScreenshotPlus/src/UMainForm.cpp +++ b/plugins/SendScreenshotPlus/src/UMainForm.cpp @@ -178,8 +178,8 @@ void TfrmMain::wmInitdialog(WPARAM wParam, LPARAM lParam) { pt = mir_tstrdup((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)m_hContact, (LPARAM)GCDNF_TCHAR)); if (pt && (m_hContact != 0)) { TCHAR* lptString = NULL; - mir_tcsadd(lptString , TranslateT("Send screenshot to\n")); - mir_tcsadd(lptString , pt); + mir_tstradd(lptString , TranslateT("Send screenshot to\n")); + mir_tstradd(lptString , pt); SetDlgItemText(m_hWnd, IDC_HEADERBAR, lptString); mir_free(lptString); } @@ -916,8 +916,8 @@ void TfrmMain::edtSizeUpdate(HWND hWnd, BOOL ClientArea, HWND hTarget, UINT Ctrl _itot(rect.right - rect.left, B, 10); // _itot_s(rect.bottom - rect.top, H, 16, 10); _itot(rect.bottom - rect.top, H, 10); - mir_tcsncat(B, _T("x"), 33); - mir_tcsncat(B, H, 33); + mir_tstrncat(B, _T("x"), 33); + mir_tstrncat(B, H, 33); SetDlgItemText(hTarget, Ctrl, B); } @@ -927,8 +927,8 @@ void TfrmMain::edtSizeUpdate(RECT rect, HWND hTarget, UINT Ctrl) { _itot(ABS(rect.right - rect.left), B, 10); // _itot_s(ABS(rect.bottom - rect.top), H, 16, 10); _itot(ABS(rect.bottom - rect.top), H, 10); - mir_tcsncat(B, _T("x"), 33); - mir_tcsncat(B, H, 33); + mir_tstrncat(B, _T("x"), 33); + mir_tstrncat(B, H, 33); SetDlgItemText(hTarget, Ctrl, B); } @@ -944,27 +944,27 @@ INT_PTR TfrmMain::SaveScreenshot(FIBITMAP* dib) { unsigned FileNumber=db_get_dw(NULL,SZ_SENDSS,"FileNumber",0)+1; if(FileNumber>99999) FileNumber=1; //Generate FileName - mir_tcsadd(path, m_FDestFolder); - if (path[_tcslen(path)-1] != _T('\\')) mir_tcsadd(path, _T("\\")); - mir_tcsadd(path, _T("shot%.5u"));//on format change, adapt "len" below - size_t len=_tcslen(path)+2; + mir_tstradd(path, m_FDestFolder); + if (path[mir_tstrlen(path)-1] != _T('\\')) mir_tstradd(path, _T("\\")); + mir_tstradd(path, _T("shot%.5u"));//on format change, adapt "len" below + size_t len=mir_tstrlen(path)+2; pszFilename = (TCHAR*)mir_alloc(sizeof(TCHAR)*(len)); mir_sntprintf(pszFilename,len,path,FileNumber); mir_free(path); //Generate a description according to the screenshot TCHAR winText[1024]; - mir_tcsadd(pszFileDesc, TranslateT("Screenshot ")); + mir_tstradd(pszFileDesc, TranslateT("Screenshot ")); if (m_opt_tabCapture == 0 && m_opt_chkClientArea) { - mir_tcsadd(pszFileDesc, TranslateT("for Client area ")); + mir_tstradd(pszFileDesc, TranslateT("for Client area ")); } - mir_tcsadd(pszFileDesc, TranslateT("of \"")); + mir_tstradd(pszFileDesc, TranslateT("of \"")); GetDlgItemText(m_hwndTabPage, ID_edtCaption, winText, SIZEOF(winText)); - mir_tcsadd(pszFileDesc, winText); + mir_tstradd(pszFileDesc, winText); if(m_opt_tabCapture==1) - mir_tcsadd(pszFileDesc, _T("\"")); + mir_tstradd(pszFileDesc, _T("\"")); else - mir_tcsadd(pszFileDesc, TranslateT("\" Window")); + mir_tstradd(pszFileDesc, TranslateT("\" Window")); // convert to 32Bits (make shure it is 32bit) FIBITMAP *dib_new = FIP->FI_ConvertTo32Bits(dib); @@ -1029,8 +1029,8 @@ INT_PTR TfrmMain::SaveScreenshot(FIBITMAP* dib) { case 3: //TIFF (miranda freeimage interface do not support save tiff, we udse GDI+) { TCHAR* pszFile = NULL; - mir_tcsadd(pszFile, pszFilename); - mir_tcsadd(pszFile, _T(".tif")); + mir_tstradd(pszFile, pszFilename); + mir_tstradd(pszFile, _T(".tif")); dib32 = FIP->FI_Composite(dib_new,FALSE,&m_AlphaColor,NULL); dib24 = FIP->FI_ConvertTo24Bits(dib32); @@ -1050,8 +1050,8 @@ INT_PTR TfrmMain::SaveScreenshot(FIBITMAP* dib) { //ret = SaveImage(FIF_GIF,dib24, pszFilename, _T("gif")); //FIP->FI_Unload(dib24); TCHAR* pszFile = NULL; - mir_tcsadd(pszFile, pszFilename); - mir_tcsadd(pszFile, _T(".gif")); + mir_tstradd(pszFile, pszFilename); + mir_tstradd(pszFile, _T(".gif")); HBITMAP hBmp = FIP->FI_CreateHBITMAPFromDIB(dib_new); SaveGIF(hBmp, pszFile); ret=pszFile; diff --git a/plugins/SendScreenshotPlus/src/Utils.cpp b/plugins/SendScreenshotPlus/src/Utils.cpp index 02dcbca2eb..ca1acea221 100644 --- a/plugins/SendScreenshotPlus/src/Utils.cpp +++ b/plugins/SendScreenshotPlus/src/Utils.cpp @@ -300,12 +300,12 @@ TCHAR* SaveImage(FREE_IMAGE_FORMAT fif, FIBITMAP* dib, const TCHAR* pszFilename, TCHAR* FileExt = GetFileExt(pszFilename); if(!FileExt) { if(!pszExt) return NULL; - mir_tcsadd(pszFile, pszFilename); - mir_tcsadd(pszFile, _T(".")); - mir_tcsadd(pszFile, pszExt); + mir_tstradd(pszFile, pszFilename); + mir_tstradd(pszFile, _T(".")); + mir_tstradd(pszFile, pszExt); } else { - mir_tcsadd(pszFile, pszFilename); + mir_tstradd(pszFile, pszFilename); } if(fif==FIF_UNKNOWN) { diff --git a/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp b/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp index 5cc042b225..38883a6632 100644 --- a/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp +++ b/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp @@ -495,8 +495,8 @@ static INT_PTR CALLBACK MsgBoxPop(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lP pd.lchContact = NULL; //(HANDLE)wParam; // icon pd.lchIcon = MsgLoadIcon(pMsgBox); - mir_tcsncpy(pd.lptzContactName, pMsgBox->ptszTitle, SIZEOF(pd.lptzContactName)); - mir_tcsncpy(pd.lptzText, pMsgBox->ptszMsg, SIZEOF(pd.lptzText)); + mir_tstrncpy(pd.lptzContactName, pMsgBox->ptszTitle, SIZEOF(pd.lptzContactName)); + mir_tstrncpy(pd.lptzText, pMsgBox->ptszMsg, SIZEOF(pd.lptzText)); // CALLBAC Proc pd.PluginWindowProc = PopupProc; diff --git a/plugins/SendScreenshotPlus/src/mir_string.cpp b/plugins/SendScreenshotPlus/src/mir_string.cpp index e2e6c87f38..a66f234f12 100644 --- a/plugins/SendScreenshotPlus/src/mir_string.cpp +++ b/plugins/SendScreenshotPlus/src/mir_string.cpp @@ -27,24 +27,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "global.h"
-wchar_t* mir_wcsncpy(wchar_t* pszDest, const wchar_t* pszSrc, const size_t cchDest)
-{
- if (!pszDest || !pszSrc || !cchDest)
- return NULL;
- pszDest = wcsncpy(pszDest, pszSrc, cchDest-1);
- pszDest[cchDest-1] = 0;
- return pszDest;
-}
-
-wchar_t* mir_wcsncat(wchar_t* pszDest, const wchar_t* pszSrc, const size_t cchDest)
-{
- if (!pszDest || !pszSrc || !cchDest)
- return NULL;
- pszDest = wcsncat(pszDest, pszSrc, cchDest-1);
- pszDest[cchDest-1] = 0;
- return pszDest;
-}
-
//---------------------------------------------------------------------------
void mir_stradd(char* &pszDest, const char* pszSrc)
{
@@ -64,7 +46,7 @@ void mir_stradd(char* &pszDest, const char* pszSrc) }
}
-void mir_wcsadd(wchar_t* &pszDest, const wchar_t* pszSrc)
+void mir_wstradd(wchar_t* &pszDest, const wchar_t* pszSrc)
{
if(!pszSrc)
return;
diff --git a/plugins/SendScreenshotPlus/src/mir_string.h b/plugins/SendScreenshotPlus/src/mir_string.h index d5c33fe1a3..d813c79a49 100644 --- a/plugins/SendScreenshotPlus/src/mir_string.h +++ b/plugins/SendScreenshotPlus/src/mir_string.h @@ -28,23 +28,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef _MIR_STRING_H_INCLUDED_ #define _MIR_STRING_H_INCLUDED_ -#define mir_tcslen mir_wcslen -#define mir_tcsadd mir_wcsadd -#define mir_tcsncpy mir_wcsncpy -#define mir_tcsncat mir_wcsncat -#define mir_tstrdup mir_wstrdup - -#define mir_strlen(s) (((s)!=0)?strlen(s):0) -#define mir_strcpy(d,s) (((s)!=0&&(d)!=0)?strcpy(d,s):0) - -#define mir_wcslen(s) (((s)!=0)?wcslen(s):0) - #define mir_freeAndNil(ptr) mir_free(ptr),ptr=NULL - -wchar_t* mir_wcsncpy(wchar_t* pszDest, const wchar_t* pszSrc, const size_t cchDest); -wchar_t* mir_wcsncat(wchar_t* pszDest, const wchar_t* pszSrc, const size_t cchDest); - -void mir_stradd(char* &pszDest, const char* pszSrc); -void mir_wcsadd(wchar_t* &pszDest, const wchar_t* pszSrc); +void mir_stradd(char* &pszDest, const char* pszSrc); +void mir_wstradd(wchar_t* &pszDest, const wchar_t* pszSrc); +#define mir_tstradd mir_wstradd #endif /* _MIR_STRING_H_INCLUDED_ */ |