From 82fc26a0fdbd50cf60b2c93f456cbef33046ac48 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sun, 14 Dec 2014 15:31:37 +0000 Subject: DbEditorPP: changed warning lavel to w4 git-svn-id: http://svn.miranda-ng.org/main/trunk@11414 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/DbEditorPP/src/exportimport.cpp | 437 ++++++++++++++++---------------- 1 file changed, 218 insertions(+), 219 deletions(-) (limited to 'plugins/DbEditorPP/src/exportimport.cpp') diff --git a/plugins/DbEditorPP/src/exportimport.cpp b/plugins/DbEditorPP/src/exportimport.cpp index 4c751a76c0..a2e735783b 100644 --- a/plugins/DbEditorPP/src/exportimport.cpp +++ b/plugins/DbEditorPP/src/exportimport.cpp @@ -5,7 +5,7 @@ HWND hwnd2importWindow; int Openfile(char *outputFile, const char *module) { - OPENFILENAME ofn = {0}; + OPENFILENAME ofn = { 0 }; char filename[MAX_PATH] = ""; char filter[MAX_PATH]; mir_snprintf(filter, SIZEOF(filter), "%s%c*.ini%c%s%c*.*%c", Translate("INI Files"), 0, 0, Translate("All Files"), 0, 0); @@ -16,18 +16,18 @@ int Openfile(char *outputFile, const char *module) int n = 0; mir_strncpy(filename, module, MAX_PATH); - while(filename[n]) + while (filename[n]) { - switch(filename[n]) + switch (filename[n]) { - case '*': - case ':': - case '/': - case '?': - case '|': - case '\\': - filename[n] = '_'; - break; + case '*': + case ':': + case '/': + case '?': + case '|': + case '\\': + filename[n] = '_'; + break; } n++; } @@ -43,11 +43,11 @@ int Openfile(char *outputFile, const char *module) if (!GetSaveFileName(&ofn)) return 0; - mir_tstrcpy(outputFile,filename); + mir_tstrcpy(outputFile, filename); return 1; } -char* StrReplace (char* Search, char* Replace, char* Resource) +char* StrReplace(char* Search, char* Replace, char* Resource) { int i = 0; int SearchLen = (int)_tcslen(Search); @@ -87,64 +87,64 @@ void exportModule(MCONTACT hContact, char* module, FILE* file) ModuleSettingLL settinglist; ModSetLinkLinkItem *setting; - EnumSettings(hContact,module,&settinglist); + EnumSettings(hContact, module, &settinglist); // print the module header.. fprintf(file, "\n[%s]", module); setting = settinglist.first; - while(setting) + while (setting) { DBVARIANT dbv; if (!GetSetting(hContact, module, setting->name, &dbv)) { switch (dbv.type) { - case DBVT_BYTE: - fprintf(file, "\n%s=b%s", setting->name, itoa(dbv.bVal,tmp,10)); - db_free(&dbv); - break; - case DBVT_WORD: - fprintf(file, "\n%s=w%s", setting->name, itoa(dbv.wVal,tmp,10)); - db_free(&dbv); - break; - case DBVT_DWORD: - fprintf(file, "\n%s=d%s", setting->name, itoa(dbv.dVal,tmp,10)); - db_free(&dbv); - break; - case DBVT_ASCIIZ: - case DBVT_UTF8: - if (strchr(dbv.pszVal, '\r')) - { - char *end = StrReplace("\\", "\\\\", dbv.pszVal); - end = StrReplace("\r", "\\r", end); - end = StrReplace("\n", "\\n", end); - fprintf(file, "\n%s=g%s", setting->name, end); - break; - } - if (dbv.type == DBVT_UTF8) - fprintf(file, "\n%s=u%s", setting->name, dbv.pszVal); - else - fprintf(file, "\n%s=s%s", setting->name, dbv.pszVal); - db_free(&dbv); - break; - case DBVT_BLOB: + case DBVT_BYTE: + fprintf(file, "\n%s=b%s", setting->name, itoa(dbv.bVal, tmp, 10)); + db_free(&dbv); + break; + case DBVT_WORD: + fprintf(file, "\n%s=w%s", setting->name, itoa(dbv.wVal, tmp, 10)); + db_free(&dbv); + break; + case DBVT_DWORD: + fprintf(file, "\n%s=d%s", setting->name, itoa(dbv.dVal, tmp, 10)); + db_free(&dbv); + break; + case DBVT_ASCIIZ: + case DBVT_UTF8: + if (strchr(dbv.pszVal, '\r')) { - int j; - char *data = NULL; - if (!(data = (char*)mir_alloc( 3*(dbv.cpbVal+1)*sizeof(char)))) - break; - data[0] = '\0'; - for (j=0; jname , data); - mir_free(data); + char *end = StrReplace("\\", "\\\\", dbv.pszVal); + end = StrReplace("\r", "\\r", end); + end = StrReplace("\n", "\\n", end); + fprintf(file, "\n%s=g%s", setting->name, end); + break; } + if (dbv.type == DBVT_UTF8) + fprintf(file, "\n%s=u%s", setting->name, dbv.pszVal); + else + fprintf(file, "\n%s=s%s", setting->name, dbv.pszVal); db_free(&dbv); break; + case DBVT_BLOB: + { + int j; + char *data = NULL; + if (!(data = (char*)mir_alloc(3 * (dbv.cpbVal + 1)*sizeof(char)))) + break; + data[0] = '\0'; + for (j = 0; j < dbv.cpbVal; j++) + { + char tmp[16]; + mir_snprintf(tmp, SIZEOF(tmp), "%02X ", (BYTE)dbv.pbVal[j]); + strcat(data, tmp); + } + fprintf(file, "\n%s=n%s", setting->name, data); + mir_free(data); + } + db_free(&dbv); + break; } } setting = (ModSetLinkLinkItem *)setting->next; @@ -161,7 +161,7 @@ char *NickFromHContact(MCONTACT hContact) char szProto[256]; int loaded = 0; - if (GetValue(hContact,"Protocol","p",szProto,SIZEOF(szProto))) + if (GetValue(hContact, "Protocol", "p", szProto, SIZEOF(szProto))) loaded = IsProtocolLoaded(szProto); if (!szProto[0] || !loaded) @@ -170,13 +170,13 @@ char *NickFromHContact(MCONTACT hContact) if (szProto[0]) { - if (GetValue(hContact,szProto,"Nick",name,SIZEOF(name))) - mir_snprintf(nick, SIZEOF(nick),"%s (%s)", name, szProto); + if (GetValue(hContact, szProto, "Nick", name, SIZEOF(name))) + mir_snprintf(nick, SIZEOF(nick), "%s (%s)", name, szProto); else - mir_snprintf(nick, SIZEOF(nick),"(UNKNOWN) (%s)", szProto); + mir_snprintf(nick, SIZEOF(nick), "(UNKNOWN) (%s)", szProto); } else - mir_snprintf(nick, SIZEOF(nick),"(UNKNOWN)"); + mir_snprintf(nick, SIZEOF(nick), "(UNKNOWN)"); } else { @@ -184,9 +184,9 @@ char *NickFromHContact(MCONTACT hContact) if ((INT_PTR)uid != CALLSERVICE_NOTFOUND && uid) { char szUID[256]; GetValue(hContact, szProto, uid, szUID, SIZEOF(szUID)); - mir_snprintf(nick, SIZEOF(nick), "%s *(%s)*<%s>*{%s}*", (char*)GetContactName(hContact,szProto,0), szProto, uid, szUID); + mir_snprintf(nick, SIZEOF(nick), "%s *(%s)*<%s>*{%s}*", (char*)GetContactName(hContact, szProto, 0), szProto, uid, szUID); } - else mir_snprintf(nick, SIZEOF(nick), "%s (%s)", (char*)GetContactName(hContact,szProto,0), szProto); + else mir_snprintf(nick, SIZEOF(nick), "%s (%s)", (char*)GetContactName(hContact, szProto, 0), szProto); } } @@ -196,18 +196,17 @@ char *NickFromHContact(MCONTACT hContact) // hContact == -1, module == "" - all contacts void exportDB(MCONTACT hContact, char *module) { - int nullcontactDone = 0; ModSetLinkLinkItem *mod; // enum all the modules ModuleSettingLL modlist; if (!EnumModules(&modlist)) { - msg(Translate("Error loading module list"),modFullname); + msg(Translate("Error loading module list"), modFullname); return; } char fileName[MAX_PATH]; - if (Openfile(fileName, (hContact==INVALID_CONTACT_ID)?NULL:module)) + if (Openfile(fileName, (hContact == INVALID_CONTACT_ID) ? NULL : module)) { FILE *file = fopen(fileName, "wt"); if (!file) { @@ -215,7 +214,7 @@ void exportDB(MCONTACT hContact, char *module) return; } - SetCursor(LoadCursor(NULL,IDC_WAIT)); + SetCursor(LoadCursor(NULL, IDC_WAIT)); // exporting entire db if (hContact == INVALID_CONTACT_ID) @@ -226,7 +225,7 @@ void exportDB(MCONTACT hContact, char *module) { fprintf(file, "SETTINGS:\n"); mod = modlist.first; - while(mod) + while (mod) { if (IsModuleEmpty(hContact, mod->name)) { @@ -259,7 +258,7 @@ void exportDB(MCONTACT hContact, char *module) char szProto[256]; int loaded = 0; - if (GetValue(hContact,"Protocol","p",szProto,SIZEOF(szProto))) + if (GetValue(hContact, "Protocol", "p", szProto, SIZEOF(szProto))) loaded = IsProtocolLoaded(szProto); if ((loaded && Mode == MODE_UNLOADED) || (!loaded && Mode == MODE_LOADED)) @@ -274,7 +273,7 @@ void exportDB(MCONTACT hContact, char *module) if (module == NULL) // export all modules { mod = modlist.first; - while(mod) + while (mod) { if (IsModuleEmpty(hContact, mod->name)) { @@ -305,7 +304,7 @@ void exportDB(MCONTACT hContact, char *module) fprintf(file, "SETTINGS:\n"); mod = modlist.first; - while(mod) + while (mod) { if (IsModuleEmpty(hContact, mod->name)) { @@ -330,7 +329,7 @@ void exportDB(MCONTACT hContact, char *module) } fclose(file); - SetCursor(LoadCursor(NULL,IDC_ARROW)); + SetCursor(LoadCursor(NULL, IDC_ARROW)); } FreeModuleSettingLL(&modlist); @@ -349,60 +348,60 @@ MCONTACT CheckNewContact(char *myProto, char *uid, char *myName) return INVALID_CONTACT_ID; } -void importSettings(MCONTACT hContact, char *importstring ) +void importSettings(MCONTACT hContact, char *importstring) { char module[256] = "", setting[256] = "", *end; - int i=0, value, type; + int i = 0, value, type; importstring = strtok(importstring, "\n"); - SetCursor(LoadCursor(NULL,IDC_WAIT)); + SetCursor(LoadCursor(NULL, IDC_WAIT)); while (importstring != NULL) { - i=0; + i = 0; rtrim(importstring); if (importstring[i] == '\0') { importstring = strtok(NULL, "\n"); continue; } - else if (!strncmp(&importstring[i],"SETTINGS:",strlen("SETTINGS:"))) + else if (!strncmp(&importstring[i], "SETTINGS:", strlen("SETTINGS:"))) { importstring = strtok(NULL, "\n"); continue; } - else if (!strncmp(&importstring[i],"CONTACT:", strlen("CONTACT:"))) + else if (!strncmp(&importstring[i], "CONTACT:", strlen("CONTACT:"))) { - int len, add = 1; + int len; hContact = INVALID_CONTACT_ID; i = i + (int)strlen("CONTACT:"); len = (int)strlen(&importstring[i]); if (len > 10) { - char uid[256]="",szUID[256]="",szProto[512]=""; - char *p1,*p2; + char uid[256] = "", szUID[256] = "", szProto[512] = ""; + char *p1, *p2; p1 = strrchr(&importstring[i], '>*{'); p2 = strrchr(&importstring[i], '}*'); - if (p1 && p2 && p1+3 < p2 && p2-p1 < SIZEOF(szUID)) { - strncpy(szUID, p1+1, p2-p1-2); + if (p1 && p2 && p1 + 3 < p2 && p2 - p1 < SIZEOF(szUID)) { + strncpy(szUID, p1 + 1, p2 - p1 - 2); p1 = strrchr(&importstring[i], ')*<'); p2 = strrchr(&importstring[i], '>*{'); - if (p1 && p2 && p1+3 < p2 && p2-p1 < SIZEOF(uid)) { - strncpy(uid, p1+1, p2-p1-3); + if (p1 && p2 && p1 + 3 < p2 && p2 - p1 < SIZEOF(uid)) { + strncpy(uid, p1 + 1, p2 - p1 - 3); p1 = strrchr(&importstring[i], ' *('); p2 = strrchr(&importstring[i], ')*<'); - if (p1 && p2 && p1+3 < p2 && p2-p1 < SIZEOF(szProto)) { + if (p1 && p2 && p1 + 3 < p2 && p2 - p1 < SIZEOF(szProto)) { char *protouid; - strncpy(szProto, p1+1, p2-p1-3); + strncpy(szProto, p1 + 1, p2 - p1 - 3); - protouid = (char*)CallProtoService(szProto,PS_GETCAPS,PFLAG_UNIQUEIDSETTING,0); + protouid = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0); if ((INT_PTR)protouid != CALLSERVICE_NOTFOUND) { if (!mir_strcmp(protouid, uid)) hContact = CheckNewContact(szProto, uid, szUID); @@ -420,40 +419,40 @@ void importSettings(MCONTACT hContact, char *importstring ) hContact = temp; } } - else if (importstring[i] == '[' && !strchr(&importstring[i+1],'='))// get the module + else if (importstring[i] == '[' && !strchr(&importstring[i + 1], '='))// get the module { - if (end = strpbrk(&importstring[i+1], "]")) { + if (end = strpbrk(&importstring[i + 1], "]")) { *end = '\0'; - strcpy(module, &importstring[i+1]); + strcpy(module, &importstring[i + 1]); } } - else if (importstring[i] == '-' && importstring[i+1] == '[' && - !strchr(&importstring[i+2],'='))// get the module + else if (importstring[i] == '-' && importstring[i + 1] == '[' && + !strchr(&importstring[i + 2], '='))// get the module { - if (end = strpbrk(&importstring[i+2], "]")) { + if (end = strpbrk(&importstring[i + 2], "]")) { *end = '\0'; - strcpy(module, &importstring[i+2]); + strcpy(module, &importstring[i + 2]); deleteModule(module, hContact, 1); } } else if (strstr(&importstring[i], "=") && module[0]) // get the setting { - if (end = strpbrk(&importstring[i+1], "=")) { + if (end = strpbrk(&importstring[i + 1], "=")) { *end = '\0'; strcpy(setting, &importstring[i]); // get the type - type = *(end+1); + type = *(end + 1); if (mir_tstrcmp(module, "CList") == 0 && mir_tstrcmp(setting, "Group") == 0) { - WCHAR* GroupName = mir_a2u(end+2); + WCHAR* GroupName = mir_a2u(end + 2); if (!GroupName) continue; HANDLE GroupHandle = (HANDLE)CallService(MS_CLIST_GROUPEXISTS, 0, LPARAM(GroupName)); - if(GroupHandle == 0) { + if (GroupHandle == 0) { GroupHandle = (HANDLE)CallService(MS_CLIST_GROUPCREATE, 0, (LPARAM)GroupName); - if(GroupHandle) { + if (GroupHandle) { CallService(MS_CLUI_GROUPADDED, (WPARAM)GroupHandle, 0); CallService(MS_CLIST_GROUPSETEXPANDED, (WPARAM)GroupHandle, 1); } @@ -462,146 +461,146 @@ void importSettings(MCONTACT hContact, char *importstring ) } switch (type) { - case 'b': - case 'B': - if (sscanf((end+2), "%d", &value) == 1) - db_set_b(hContact, module, setting, (BYTE)value); - break; - case 'w': - case 'W': - if (sscanf((end+2), "%d", &value) == 1) - db_set_w(hContact, module, setting, (WORD)value); - break; - case 'd': - case 'D': - if (sscanf((end+2), "%d", &value) == 1) - db_set_dw(hContact, module, setting, (DWORD)value); - break; - case 's': - case 'S': - db_set_s(hContact,module, setting, (end+2)); - break; - case 'g': - case 'G': - { - char *pstr; - for(pstr=end+2;*pstr;pstr++) { - 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); - } + case 'b': + case 'B': + if (sscanf((end + 2), "%d", &value) == 1) + db_set_b(hContact, module, setting, (BYTE)value); + break; + case 'w': + case 'W': + if (sscanf((end + 2), "%d", &value) == 1) + db_set_w(hContact, module, setting, (WORD)value); + break; + case 'd': + case 'D': + if (sscanf((end + 2), "%d", &value) == 1) + db_set_dw(hContact, module, setting, (DWORD)value); + break; + case 's': + case 'S': + db_set_s(hContact, module, setting, (end + 2)); + break; + case 'g': + case 'G': + { + char *pstr; + for (pstr = end + 2; *pstr; pstr++) { + 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); } - case 'u': - case 'U': - db_set_utf(hContact,module, setting, (end+2)); - break; - case 'l': - case 'L': - case '-': - db_unset(hContact, module, setting); - break; - case 'n': - case 'N': - WriteBlobFromString(hContact, module, setting, (end+2), (int)strlen((end+2))); - break; + } + } + case 'u': + case 'U': + db_set_utf(hContact, module, setting, (end + 2)); + break; + case 'l': + case 'L': + case '-': + db_unset(hContact, module, setting); + break; + case 'n': + case 'N': + WriteBlobFromString(hContact, module, setting, (end + 2), (int)strlen((end + 2))); + break; } } } importstring = strtok(NULL, "\n"); } - SetCursor(LoadCursor(NULL,IDC_ARROW)); + SetCursor(LoadCursor(NULL, IDC_ARROW)); } INT_PTR CALLBACK ImportDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - switch(msg) + switch (msg) { - case WM_INITDIALOG: - { - hwnd2importWindow = hwnd; - SetWindowLongPtr(hwnd,GWLP_USERDATA,lParam); - TranslateDialogDefault(hwnd); - SendDlgItemMessage(hwnd, IDC_TEXT, EM_LIMITTEXT, (WPARAM)sizeof(TCHAR)*0x7FFFFFFF, 0); - } - break; + case WM_INITDIALOG: + { + hwnd2importWindow = hwnd; + SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam); + TranslateDialogDefault(hwnd); + SendDlgItemMessage(hwnd, IDC_TEXT, EM_LIMITTEXT, (WPARAM)sizeof(TCHAR) * 0x7FFFFFFF, 0); + } + break; - case WM_COMMAND: + case WM_COMMAND: + { + switch (LOWORD(wParam)) { - switch(LOWORD(wParam)) - { - case IDC_CRLF: - { - int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_TEXT)); - char *string = (char*)_alloca(length+3); - int Pos = 2; + case IDC_CRLF: + { + int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_TEXT)); + char *string = (char*)_alloca(length + 3); + int Pos = 2; - if (length) - { - int Range = SendDlgItemMessage(hwnd,IDC_TEXT,EM_GETSEL,0,0); - int Min = LOWORD(Range); - int Max = HIWORD(Range); + if (length) + { + int Range = SendDlgItemMessage(hwnd, IDC_TEXT, EM_GETSEL, 0, 0); + int Min = LOWORD(Range); + int Max = HIWORD(Range); - GetDlgItemText(hwnd, IDC_TEXT, string, length+1); + GetDlgItemText(hwnd, IDC_TEXT, string, length + 1); - if (Min == -1) - memcpy(string, crlf_string, sizeof(crlf_string)); - else - if (Max == -1 || Max >= length) - memcpy(&string[Min], crlf_string, sizeof(crlf_string)); - else - if (Max-Min > 2) + if (Min == -1) + memcpy(string, crlf_string, sizeof(crlf_string)); + else + if (Max == -1 || Max >= length) + memcpy(&string[Min], crlf_string, sizeof(crlf_string)); + else + if (Max - Min > 2) { memcpy(&string[Min], crlf_string, sizeof(crlf_string)); - memmove(&string[Min+2], &string[Max], length - Max + 1); + memmove(&string[Min + 2], &string[Max], length - Max + 1); } else { - memmove(&string[Min+2], &string[Max], length - Max + 1); + memmove(&string[Min + 2], &string[Max], length - Max + 1); memcpy(&string[Min], crlf_string, sizeof(crlf_string)); } - if (Min) Pos += Min; - } - else - memcpy(string, crlf_string, sizeof(crlf_string)); + if (Min) Pos += Min; + } + else + memcpy(string, crlf_string, sizeof(crlf_string)); - SetDlgItemText(hwnd, IDC_TEXT, string); - SendDlgItemMessage(hwnd,IDC_TEXT,EM_SETSEL,Pos,Pos); - SetFocus(GetDlgItem(hwnd, IDC_TEXT)); - } - break; - - case IDOK: - { - MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA); - int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_TEXT)); - if (length) - { - char *string = (char*)_alloca(length+1); - if (!string) { - msg(Translate("Couldn't allocate enough memory!"), modFullname); - DestroyWindow(hwnd); - } - GetDlgItemText(hwnd, IDC_TEXT, string, length+1); - importSettings(hContact, string); - refreshTree(1); - } - } - break; - - case IDCANCEL: + SetDlgItemText(hwnd, IDC_TEXT, string); + SendDlgItemMessage(hwnd, IDC_TEXT, EM_SETSEL, Pos, Pos); + SetFocus(GetDlgItem(hwnd, IDC_TEXT)); + } + break; + + case IDOK: + { + MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA); + int length = GetWindowTextLength(GetDlgItem(hwnd, IDC_TEXT)); + if (length) + { + char *string = (char*)_alloca(length + 1); + if (!string) { + msg(Translate("Couldn't allocate enough memory!"), modFullname); DestroyWindow(hwnd); - hwnd2importWindow = 0; - break; + } + GetDlgItemText(hwnd, IDC_TEXT, string, length + 1); + importSettings(hContact, string); + refreshTree(1); } } break; + + case IDCANCEL: + DestroyWindow(hwnd); + hwnd2importWindow = 0; + break; + } + } + break; } return 0; } @@ -616,7 +615,7 @@ void ImportSettingsMenuItem(MCONTACT hContact) int Openfile2Import(char *outputFiles) { - OPENFILENAME ofn = {0}; + OPENFILENAME ofn = { 0 }; char filter[MAX_PATH]; mir_snprintf(filter, SIZEOF(filter), "%s%c*.ini%c%s%c*.*%c", Translate("INI Files"), 0, 0, Translate("All Files"), 0, 0); char *title = Translate("Import from files"); @@ -625,7 +624,7 @@ int Openfile2Import(char *outputFiles) ofn.lpstrFilter = filter; ofn.hwndOwner = 0; ofn.lpstrFile = outputFiles; - ofn.nMaxFile = MAX_PATH*10; + ofn.nMaxFile = MAX_PATH * 10; ofn.nMaxFileTitle = MAX_PATH; ofn.Flags = OFN_HIDEREADONLY | OFN_SHAREAWARE | OFN_PATHMUSTEXIST | OFN_ALLOWMULTISELECT | OFN_EXPLORER; ofn.lpstrTitle = title; @@ -642,7 +641,7 @@ BOOL Exists(LPCTSTR strName) void ImportSettingsFromFileMenuItem(MCONTACT hContact, char* FilePath) { - char szFileNames[MAX_PATH*10] = {0}; + char szFileNames[MAX_PATH * 10] = { 0 }; char szPath[MAX_PATH] = ""; char szFile[MAX_PATH]; int index = 0; @@ -653,7 +652,7 @@ void ImportSettingsFromFileMenuItem(MCONTACT hContact, char* FilePath) offset = Openfile2Import(szFileNames); else { - if(Exists(FilePath)) + if (Exists(FilePath)) mir_tstrcpy(szFileNames, FilePath); else mir_tstrcpy(szFileNames, ""); @@ -668,21 +667,21 @@ void ImportSettingsFromFileMenuItem(MCONTACT hContact, char* FilePath) strcat(szPath, "\\"); } - while(szFileNames[index]) + while (szFileNames[index]) { strcpy(szFile, szPath); strcat(szFile, &szFileNames[index]); - index += (int)strlen(&szFileNames[index])+1; + index += (int)strlen(&szFileNames[index]) + 1; hFile = CreateFile(szFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); if (hFile != INVALID_HANDLE_VALUE) { - if (GetFileSize(hFile, NULL) > 0) + if (GetFileSize(hFile, NULL) > 0) { hMap = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL); if (hMap) { - pFile = (PBYTE)MapViewOfFile(hMap, FILE_MAP_COPY, 0, 0 ,0); + pFile = (PBYTE)MapViewOfFile(hMap, FILE_MAP_COPY, 0, 0, 0); if (pFile) { importSettings(hContact, (char*)pFile); -- cgit v1.2.3