summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/UserInfoEx/src/ctrl_contact.cpp13
-rw-r--r--plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp31
-rw-r--r--plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp36
-rw-r--r--plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp13
-rw-r--r--plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp49
-rw-r--r--plugins/UserInfoEx/src/mir_icolib.cpp2
-rw-r--r--plugins/UserInfoEx/src/psp_options.cpp4
-rw-r--r--plugins/UserInfoEx/src/psp_profile.cpp4
8 files changed, 70 insertions, 82 deletions
diff --git a/plugins/UserInfoEx/src/ctrl_contact.cpp b/plugins/UserInfoEx/src/ctrl_contact.cpp
index b8780f5b7b..372e830963 100644
--- a/plugins/UserInfoEx/src/ctrl_contact.cpp
+++ b/plugins/UserInfoEx/src/ctrl_contact.cpp
@@ -341,22 +341,25 @@ INT_PTR CALLBACK DlgProc_Phone(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam
noRecursion = 1;
{
TCHAR szText[MAXDATASIZE], *pText, *pArea, *pNumber;
- int isValid = 1;
+ bool isValid = true;
GetDlgItemText(hDlg, EDIT_PHONE, szText, _countof(szText));
- if (szText[0] != '+') isValid = 0;
+ if (szText[0] != '+')
+ isValid = false;
if (isValid) {
- int i, country = _tcstol(szText + 1, &pText, 10);
+ int country = _tcstol(szText + 1, &pText, 10);
if (pText - szText > 4)
- isValid = 0;
+ isValid = false;
else {
+ int i;
for (i = SendDlgItemMessage(hDlg, EDIT_COUNTRY, CB_GETCOUNT, 0, 0) - 1; i >= 0; i--) {
if (country == SendDlgItemMessage(hDlg, EDIT_COUNTRY, CB_GETITEMDATA, i, 0)) {
SendDlgItemMessage(hDlg, EDIT_COUNTRY, CB_SETCURSEL, i, 0);
break;
}
}
+ if (i < 0)
+ isValid = false;
}
- if (i < 0) isValid = 0;
}
if (isValid) {
pArea = pText + _tcscspn(pText, _T("0123456789"));
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp
index ddee777778..7c3c94c116 100644
--- a/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp
+++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImModules.cpp
@@ -143,14 +143,13 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar
LPEXPORTDATA pDat = (LPEXPORTDATA)GetUserData(hDlg);
switch (uMsg) {
-
case WM_INITDIALOG:
{
- HWND hTree;
BYTE bImagesLoaded = 0;
// get tree handle and set treeview style
- if (!(hTree = GetDlgItem(hDlg, IDC_TREE))) break;
+ HWND hTree = GetDlgItem(hDlg, IDC_TREE);
+ if (!hTree) break;
SetWindowLongPtr(hTree, GWL_STYLE, GetWindowLongPtr(hTree, GWL_STYLE) | TVS_NOHSCROLL | TVS_CHECKBOXES);
// init the datastructure
@@ -162,9 +161,6 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar
// set icons
{
- HICON hIcon;
- HIMAGELIST hImages;
- OSVERSIONINFO osvi;
const ICONCTRL idIcon[] = {
{ ICO_DLG_EXPORT, WM_SETICON, NULL },
{ ICO_DLG_EXPORT, STM_SETIMAGE, ICO_DLGLOGO },
@@ -175,20 +171,19 @@ INT_PTR CALLBACK SelectModulesToExport_DlgProc(HWND hDlg, UINT uMsg, WPARAM wPar
IcoLib_SetCtrlIcons(hDlg, idIcon, numIconsToSet);
// create imagelist for treeview
+ OSVERSIONINFO osvi;
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- GetVersionEx(&osvi);
- if ((hImages = ImageList_Create(
- GetSystemMetrics(SM_CXSMICON),
- GetSystemMetrics(SM_CYSMICON),
- ((osvi.dwPlatformId == VER_PLATFORM_WIN32_NT && osvi.dwMajorVersion >= 5 && osvi.dwMinorVersion >= 1) ? ILC_COLOR32 : ILC_COLOR16)|ILC_MASK,
- 0, 1)
- ) != NULL)
- {
- SendMessage(hTree, TVM_SETIMAGELIST, TVSIL_NORMAL, (LPARAM)hImages);
+ if (GetVersionEx(&osvi)) {
+ HIMAGELIST hImages = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),
+ ((osvi.dwPlatformId == VER_PLATFORM_WIN32_NT && osvi.dwMajorVersion >= 5 && osvi.dwMinorVersion >= 1) ? ILC_COLOR32 : ILC_COLOR16)|ILC_MASK,0, 1);
+ if (hImages != NULL)
+ {
+ SendMessage(hTree, TVM_SETIMAGELIST, TVSIL_NORMAL, (LPARAM)hImages);
- bImagesLoaded
- = ((((hIcon = IcoLib_GetIcon(ICO_LST_MODULES)) != NULL) && 0 == ImageList_AddIcon(hImages, hIcon))
- && (((hIcon = IcoLib_GetIcon(ICO_LST_FOLDER)) != NULL) && 1 == ImageList_AddIcon(hImages, hIcon)));
+ HICON hIcon;
+ bImagesLoaded = ((((hIcon = IcoLib_GetIcon(ICO_LST_MODULES)) != NULL) && 0 == ImageList_AddIcon(hImages, hIcon))
+ && (((hIcon = IcoLib_GetIcon(ICO_LST_FOLDER)) != NULL) && 1 == ImageList_AddIcon(hImages, hIcon)));
+ }
}
}
// do the translation stuff
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp
index e5c76ffa95..de7bfe646e 100644
--- a/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp
+++ b/plugins/UserInfoEx/src/ex_import/svc_ExImINI.cpp
@@ -163,15 +163,13 @@ static BYTE ExportContact(MCONTACT hContact, DB::CEnumList* pModules, FILE* file
**/
int SvcExImINI_Export(lpExImParam ExImContact, LPCSTR pszFileName)
{
- FILE* file;
- errno_t err;
DB::CEnumList Modules;
- SYSTEMTIME now;
- MCONTACT hContact;
if (!DlgExImModules_SelectModulesToExport(ExImContact, &Modules, NULL))
{
- if ((err = fopen_s(&file, pszFileName, "wt")) != NULL)
+ FILE *file;
+ errno_t err = fopen_s(&file, pszFileName, "wt");
+ if (err != NULL)
{
MsgErr(NULL,
LPGENT("The ini-file \"%s\"\nfor saving contact information could not be opened."),
@@ -182,11 +180,10 @@ int SvcExImINI_Export(lpExImParam ExImContact, LPCSTR pszFileName)
SetCursor(LoadCursor(NULL, IDC_WAIT));
// write header
+ SYSTEMTIME now;
GetLocalTime(&now);
- fprintf(file,
- ";DATE = %04d-%02d-%02d %02d:%02d:%02d\n\n",
- now.wYear, now.wMonth, now.wDay, now.wHour, now.wMinute, now.wSecond
- );
+ fprintf(file, ";DATE = %04d-%02d-%02d %02d:%02d:%02d\n\n",
+ now.wYear, now.wMonth, now.wDay, now.wHour, now.wMinute, now.wSecond);
if (Modules.getCount() == 0)
{
@@ -200,7 +197,7 @@ int SvcExImINI_Export(lpExImParam ExImContact, LPCSTR pszFileName)
ExportContact(NULL, &Modules, file);
fprintf(file, "\n\n");
// Contacts
- for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
+ for (MCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
{
ExportContact(hContact, &Modules, file);
fprintf(file, "\n\n");
@@ -208,9 +205,7 @@ int SvcExImINI_Export(lpExImParam ExImContact, LPCSTR pszFileName)
}
// export only one contact
else
- {
ExportContact(ExImContact->hContact, &Modules, file);
- }
fclose(file);
SetCursor(LoadCursor(NULL, IDC_ARROW));
@@ -243,13 +238,13 @@ LPSTR strnrchr(LPSTR string, int ch, DWORD len)
**/
static DWORD ImportreadLine(FILE* file, LPSTR &str)
{
- CHAR c;
DWORD l = 0;
- BYTE bComment = 0;
+ bool bComment = false;
str[0] = 0;
while (!feof(file)) {
- switch (c = fgetc(file)) {
+ int c = fgetc(file);
+ switch (c) {
case EOF:
// reading error
if (ferror(file)) {
@@ -263,25 +258,26 @@ static DWORD ImportreadLine(FILE* file, LPSTR &str)
case '\n':
// ignore empty lines
if (l == 0) {
- bComment = 0;
+ bComment = false;
continue;
}
return l;
case ';':
// found a comment line
- bComment |= l == 0;
+ bComment |= (l == 0);
+ // fall through
case '\t':
case ' ':
// ignore space and tab at the beginning of the line
- if (l == 0) break;
-
+ if (l == 0)
+ break;
+ // fall through
default:
if (!bComment) {
str = mir_strncat_c(str, c);
l++;
}
- break;
}
}
return 0;
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp
index fb0a8ad16e..73322070da 100644
--- a/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp
+++ b/plugins/UserInfoEx/src/ex_import/svc_ExImVCF.cpp
@@ -439,7 +439,7 @@ void CLineBuffer::fputEncoded(FILE *outFile)
**/
int CLineBuffer::fgetEncoded(FILE *inFile)
{
- CHAR c;
+ int c;
CHAR hex[3];
WORD wAdd = 0;
@@ -654,6 +654,7 @@ CVCardFileVCF::CVCardFileVCF()
_pszBaseProto = NULL;
_hasUtf8 = 0;
_useUtf8 = FALSE;
+ _cbRew = 0;
}
/**
@@ -1115,16 +1116,18 @@ BYTE CVCardFileVCF::Export(BYTE bExportUtf)
int CVCardFileVCF::readLine(LPSTR szVCFSetting, WORD cchSetting)
{
LPSTR here;
-
+ int c;
+
// read setting (size is never larger than MAX_SETTING, error otherwise!)
- for (here = szVCFSetting; here - szVCFSetting < cchSetting && EOF != (*here = fgetc(_pFile)); here++) {
+ for (here = szVCFSetting; here - szVCFSetting < cchSetting && EOF != (c = fgetc(_pFile)); here++) {
// end of the setting string
- if (*here == ':') {
+ if (c == ':') {
*here = 0;
break;
}
+ *here = c;
// end of line before value?
- if (*here == '\n')
+ if (c == '\n')
return 0;
}
// ignore line if setting was not read correctly
diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp
index 7301d87175..f92e7c8d0c 100644
--- a/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp
+++ b/plugins/UserInfoEx/src/ex_import/svc_ExImXML.cpp
@@ -88,14 +88,9 @@ INT_PTR CALLBACK DlgProc_DataHistory(HWND hDlg, UINT msg, WPARAM wParam, LPARAM
**/
int CFileXml::Export(lpExImParam ExImContact, LPCSTR pszFileName)
{
- FILE *xmlfile;
DB::CEnumList Modules;
- LONG cbHeader;
- SYSTEMTIME now;
- DWORD result;
- MCONTACT hContact;
- result = (DWORD)DialogBox(ghInst,
+ DWORD result = (DWORD) DialogBox(ghInst,
MAKEINTRESOURCE(IDD_EXPORT_DATAHISTORY),
NULL, DlgProc_DataHistory);
if (LOWORD(result) != IDOK)
@@ -109,13 +104,14 @@ int CFileXml::Export(lpExImParam ExImContact, LPCSTR pszFileName)
!DlgExImModules_SelectModulesToExport(ExImContact, &Modules, NULL))
{
- xmlfile = fopen(pszFileName, "wt");
+ FILE *xmlfile = fopen(pszFileName, "wt");
if (!xmlfile)
{
MsgErr(NULL, LPGENT("Can't create xml file!\n%S"), pszFileName);
return 1;
}
+ SYSTEMTIME now;
GetLocalTime(&now);
// write xml header raw as it is without using the tinyxml api
@@ -125,7 +121,7 @@ int CFileXml::Export(lpExImParam ExImContact, LPCSTR pszFileName)
0xefU, 0xbbU, 0xbfU, now.wYear, now.wMonth, now.wDay, now.wHour, now.wMinute, now.wSecond
);
// remember the header's size
- cbHeader = ftell(xmlfile);
+ LONG cbHeader = ftell(xmlfile);
CExImContactXML vContact(this);
@@ -151,7 +147,7 @@ int CFileXml::Export(lpExImParam ExImContact, LPCSTR pszFileName)
vContact.Export(xmlfile, &Modules);
}
// loop for all other contact
- for (hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
+ for (MCONTACT hContact = db_find_first(); hContact != NULL; hContact = db_find_next(hContact))
{
switch (ExImContact->Typ)
{
@@ -218,6 +214,8 @@ CFileXml::CFileXml()
_numEventsTodo = 0;
_numEventsDone = 0;
_numEventsDuplicated = 0;
+ _hContactToWorkOn = INVALID_CONTACT_ID;
+ _wExport = 0;
}
/**
@@ -249,19 +247,16 @@ int CFileXml::ImportOwner(TiXmlElement* xContact)
**/
int CFileXml::ImportContacts(TiXmlElement* xmlParent)
{
- TiXmlElement *xContact;
CExImContactXML vContact(this);
- int result;
- LPTSTR pszNick;
// import contacts
- for (xContact = xmlParent->FirstChildElement(); xContact != NULL; xContact = xContact->NextSiblingElement()) {
+ for (TiXmlElement *xContact = xmlParent->FirstChildElement(); xContact != NULL; xContact = xContact->NextSiblingElement()) {
if (!mir_strcmpi(xContact->Value(), XKEY_CONTACT)) {
// update progressbar and abort if user clicked cancel
- pszNick = mir_utf8decodeT(xContact->Attribute("nick"));
+ LPTSTR pszNick = mir_utf8decodeT(xContact->Attribute("nick"));
// user clicked abort button
if (_progress.UpdateContact(LPGENT("Contact: %s (%S)"), pszNick, xContact->Attribute("proto"))) {
- result = vContact.LoadXmlElemnt(xContact);
+ int result = vContact.LoadXmlElemnt(xContact);
switch (result) {
case ERROR_OK:
// init contact class and import if matches the user desires
@@ -296,7 +291,7 @@ int CFileXml::ImportContacts(TiXmlElement* xmlParent)
}
// import owner contact
else if (_hContactToWorkOn == INVALID_CONTACT_ID && !mir_strcmpi(xContact->Value(), XKEY_OWNER) && (vContact = xContact)) {
- result = vContact.Import();
+ int result = vContact.Import();
switch (result) {
case ERROR_OK:
_numContactsDone++;
@@ -321,21 +316,18 @@ int CFileXml::ImportContacts(TiXmlElement* xmlParent)
**/
DWORD CFileXml::CountContacts(TiXmlElement* xmlParent)
{
- DWORD dwCount = 0;
- TiXmlNode *xContact;
-
try {
+ DWORD dwCount = 0;
// count contacts in file for progress bar
- for (xContact = xmlParent->FirstChild(); xContact != NULL; xContact = xContact->NextSibling()) {
- if (!mir_strcmpi(xContact->Value(), XKEY_CONTACT) || !mir_strcmpi(xContact->Value(), XKEY_OWNER)) {
+ for (TiXmlNode *xContact = xmlParent->FirstChild(); xContact != NULL; xContact = xContact->NextSibling())
+ if (!mir_strcmpi(xContact->Value(), XKEY_CONTACT) || !mir_strcmpi(xContact->Value(), XKEY_OWNER))
dwCount += CountContacts(xContact->ToElement()) + 1;
- }
- }
+
+ return dwCount;
}
catch(...) {
return 0;
}
- return dwCount;
}
/**
@@ -348,19 +340,18 @@ DWORD CFileXml::CountContacts(TiXmlElement* xmlParent)
**/
int CFileXml::Import(MCONTACT hContact, LPCSTR pszFileName)
{
- TiXmlDocument doc;
- TiXmlElement *xmlCard = NULL;
-
try {
_hContactToWorkOn = hContact;
// load xml file
+ TiXmlDocument doc;
if (!doc.LoadFile(pszFileName)) {
MsgErr(NULL, LPGENT("Parser is unable to load XMLCard \"%s\"\nError: %d\nDescription: %s"),
pszFileName, doc.ErrorId(), doc.ErrorDesc());
return 1;
}
// is xmlfile a XMLCard ?
- if ((xmlCard = doc.FirstChildElement("XMLCard")) == NULL) {
+ TiXmlElement *xmlCard = doc.FirstChildElement("XMLCard");
+ if (xmlCard == NULL) {
MsgErr(NULL, LPGENT("The selected file is no valid XMLCard"));
return 1;
}
@@ -427,10 +418,10 @@ int CFileXml::Import(MCONTACT hContact, LPCSTR pszFileName)
_numEventsDuplicated);
}
+ return 0;
}
catch(...) {
MsgErr(NULL, LPGENT("FATAL: An exception was thrown while importing contacts from xmlCard!"));
return 1;
}
- return 0;
}
diff --git a/plugins/UserInfoEx/src/mir_icolib.cpp b/plugins/UserInfoEx/src/mir_icolib.cpp
index 86941be027..5ab5e1cefc 100644
--- a/plugins/UserInfoEx/src/mir_icolib.cpp
+++ b/plugins/UserInfoEx/src/mir_icolib.cpp
@@ -193,7 +193,7 @@ void IcoLib_SetCtrlIcons(HWND hDlg, const ICONCTRL *pCtrl, BYTE numCtrls)
case STM_SETICON:
case STM_SETIMAGE:
ShowWindow(hCtrl, hIcon ? SW_SHOW : SW_HIDE);
-
+ // fall through
case BM_SETIMAGE:
SendMessage(hCtrl, pCtrl[i].Message, IMAGE_ICON, (LPARAM)hIcon);
}
diff --git a/plugins/UserInfoEx/src/psp_options.cpp b/plugins/UserInfoEx/src/psp_options.cpp
index f904adc813..a87e9ba81a 100644
--- a/plugins/UserInfoEx/src/psp_options.cpp
+++ b/plugins/UserInfoEx/src/psp_options.cpp
@@ -557,7 +557,7 @@ static INT_PTR CALLBACK DlgProc_DetailsDlgOpts(HWND hDlg, UINT uMsg, WPARAM wPar
EnableControls(hDlg, idCtrl, _countof(idCtrl), bChecked);
}
-
+ // fall through
case CHECK_OPT_GROUPS:
case CHECK_OPT_SORTTREE:
case CHECK_OPT_AEROADAPTION:
@@ -710,7 +710,7 @@ static INT_PTR CALLBACK DlgProc_ReminderOpts(HWND hDlg, UINT uMsg, WPARAM wParam
EnableControls(hDlg, idCtrl, _countof(idCtrl), bEnabled);
}
-
+ // fall through
case EDIT_BIRTHMODULE:
if (bInitialized && HIWORD(wParam) == CBN_SELCHANGE)
NotifyParentOfChange(hDlg);
diff --git a/plugins/UserInfoEx/src/psp_profile.cpp b/plugins/UserInfoEx/src/psp_profile.cpp
index 1cf4dfff49..babaa68667 100644
--- a/plugins/UserInfoEx/src/psp_profile.cpp
+++ b/plugins/UserInfoEx/src/psp_profile.cpp
@@ -676,13 +676,13 @@ static LRESULT CALLBACK ProfileList_LabelEditProc(HWND hwnd, UINT msg, WPARAM wP
lvi.stateMask = LVIS_FOCUSED | LVIS_SELECTED;
lvi.iItem = pList->labelEdit.iItem;
- if (wParam == VK_TAB && !pList->labelEdit.iSubItem) {
+ if (!pList->labelEdit.iSubItem) {
lvi.iSubItem = 1;
lvi.state = LVIS_FOCUSED | LVIS_SELECTED;
ProfileList_EndLabelEdit(pList->hList, TRUE);
}
else {
- UINT iSubItem = (wParam == VK_TAB) ? 0 : pList->labelEdit.iSubItem;
+ UINT iSubItem = 0;
lvi.iSubItem = 0;
lvi.state = 0;