Changeset 1321 for trunk/dll/assoc.c
- Timestamp:
- Dec 7, 2008, 2:48:06 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/assoc.c
r1220 r1321 234 234 PrfWriteProfileString(fmprof, FM3Str, temp->pszCmdLine, szEnviroment); 235 235 pszDisplayStr = xmallocz((CCHMAXPATH * 2) + MaxComLineStrg + 6, 236 236 pszSrcFile, __LINE__); 237 237 if (pszDisplayStr) { 238 238 sprintf(pszDisplayStr, "%-12s \x1a %-24s %s%s%s", temp->mask, 239 240 241 239 temp->pszCmdLine, (*temp->sig) ? 240 "[" : NullStr, (*temp->sig) ? temp->sig : NullStr, 241 (*temp->sig) ? "]" : NullStr); 242 242 x = (SHORT) WinSendDlgItemMsg(hwnd, 243 244 245 243 ASS_LISTBOX, 244 LM_INSERTITEM, 245 MPFROM2SHORT(LIT_END, 0), MPFROMP(pszDisplayStr)); 246 246 if (x >= 0) { 247 247 WinSendDlgItemMsg(hwnd, 248 249 250 248 ASS_LISTBOX, 249 LM_SETITEMHANDLE, 250 MPFROMSHORT(x), MPFROMP(info)); 251 251 WinSendDlgItemMsg(hwnd, 252 253 254 252 ASS_LISTBOX, 253 LM_SELECTITEM, 254 MPFROMSHORT(x), MPFROMSHORT(TRUE)); 255 255 } 256 256 free(pszDisplayStr); … … 297 297 ";\n%0.*s\n%0.*s\n%0.*s\n%lu\n%lu\n", 298 298 CCHMAXPATH, 299 300 299 info->mask, 300 MaxComLineStrg, 301 301 info->pszCmdLine, 302 302 CCHMAXPATH, … … 422 422 } 423 423 else 424 425 426 424 exclude = FALSE; 425 didmatch = wildcard((strchr(p, '\\') || 426 strchr(p, ':')) ? datafile : file, p, FALSE); 427 427 if (exclude && didmatch) 428 428 didmatch = FALSE; … … 480 480 info->pszCmdLine, 481 481 flags, 482 483 482 NULL, list, GetPString(IDS_EXECASSOCTITLETEXT), 483 pszSrcFile, __LINE__); 484 484 if (rc != -1 && dieafter) 485 485 PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID); … … 534 534 535 535 pszDisplayStr = xmallocz((CCHMAXPATH * 2) + MaxComLineStrg + 6, 536 536 pszSrcFile, __LINE__); 537 537 if (pszDisplayStr) { 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 538 WinSendDlgItemMsg(hwnd, ASS_LISTBOX, LM_DELETEALL, MPVOID, MPVOID); 539 info = asshead; 540 while (info) { 541 sprintf(pszDisplayStr, 542 "%-12s \x1a %-24s %s%s%s", 543 info->mask, 544 info->pszCmdLine, 545 (info->sig && *info->sig) ? 546 "[" : NullStr, 547 (info->sig && *info->sig) ? info->sig : NullStr, 548 (info->sig && *info->sig) ? "]" : NullStr); 549 x = (SHORT) WinSendDlgItemMsg(hwnd, 550 ASS_LISTBOX, 551 LM_INSERTITEM, 552 MPFROM2SHORT(LIT_END, 0), MPFROMP(pszDisplayStr)); 553 if (x >= 0) 554 WinSendDlgItemMsg(hwnd, 555 ASS_LISTBOX, 556 LM_SETITEMHANDLE, MPFROMSHORT(x), MPFROMP(info)); 557 info = info->next; 558 } 559 WinSendDlgItemMsg(hwnd, 560 ASS_LISTBOX, 561 LM_SELECTITEM, MPFROMSHORT(0), MPFROMSHORT(TRUE)); 562 xfree(pszDisplayStr, pszSrcFile, __LINE__); 563 563 } 564 564 } … … 683 683 684 684 *filename = 0; 685 686 685 if (insert_filename(hwnd, filename, 2, FALSE) && *filename) { 686 BldQuotedFileName(szfilename, filename); 687 687 strcat(szfilename, " %a"); 688 688 WinSetDlgItemText(hwnd, ASS_CL, szfilename); … … 694 694 { 695 695 ASSOC temp; 696 697 698 699 700 701 702 703 696 CHAR dummy[34]; 697 PSZ pszWorkBuf; 698 replace = FALSE; 699 700 memset(&temp, 0, sizeof(ASSOC)); 701 temp.pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 702 if (!temp.pszCmdLine) 703 break; //already complained 704 704 705 705 { … … 712 712 LM_SELECTITEM, 713 713 MPFROMSHORT(0), MPFROMSHORT(TRUE)); 714 715 716 717 718 719 714 } 715 pszWorkBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__); 716 if (!pszWorkBuf) { 717 free(temp.pszCmdLine); 718 break; //already complained 719 } 720 720 WinQueryDlgItemText(hwnd, ASS_MASK, sizeof(temp.mask), temp.mask); 721 722 723 724 725 726 721 WinQueryDlgItemText(hwnd, ASS_CL, MaxComLineStrg, temp.pszCmdLine); 722 if (strcmp(temp.pszCmdLine, "<>")) { 723 NormalizeCmdLine(pszWorkBuf, temp.pszCmdLine); 724 memcpy(temp.pszCmdLine, pszWorkBuf, strlen(pszWorkBuf) + 1); 725 } 726 free(pszWorkBuf); 727 727 WinQueryDlgItemText(hwnd, ASS_SIG, sizeof(temp.sig), temp.sig); 728 728 rstrip(temp.sig); … … 748 748 temp.flags |= DIEAFTER; 749 749 if (WinQueryButtonCheckstate(hwnd, ASS_PROMPT)) 750 751 752 753 754 755 756 750 temp.flags |= PROMPT; 751 if (fCancelAction){ 752 fCancelAction = FALSE; 753 free(temp.pszCmdLine); 754 break; 755 } 756 else 757 757 info = add_association(&temp); 758 758 if (!info) 759 759 WinDismissDlg(hwnd, 1); /* Runtime_Error(pszSrcFile, __LINE__, "add_association"); */ 760 761 760 else { 761 display_associations(hwnd, &temp, info); 762 762 save_associations(); 763 764 763 } 764 free(temp.pszCmdLine); 765 765 } 766 766 WinDismissDlg(hwnd, 1); … … 780 780 { 781 781 ASSOC temp; 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 782 CHAR dummy[34]; 783 PSZ pszWorkBuf; 784 replace = FALSE; 785 786 memset(&temp, 0, sizeof(ASSOC)); 787 temp.pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 788 if (!temp.pszCmdLine) 789 break; //already complained 790 pszWorkBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__); 791 if (!pszWorkBuf) { 792 free(temp.pszCmdLine); 793 break; //already complained 794 } 795 WinQueryDlgItemText(hwnd, ASS_MASK, sizeof(temp.mask), temp.mask); 796 WinQueryDlgItemText(hwnd, ASS_CL, MaxComLineStrg, temp.pszCmdLine); 797 if (strcmp(temp.pszCmdLine, "<>")) { 798 NormalizeCmdLine(pszWorkBuf, temp.pszCmdLine); 799 memcpy(temp.pszCmdLine, pszWorkBuf, strlen(pszWorkBuf) + 1); 800 } 801 free(pszWorkBuf); 802 802 WinQueryDlgItemText(hwnd, ASS_SIG, sizeof(temp.sig), temp.sig); 803 803 rstrip(temp.sig); … … 823 823 temp.flags |= DIEAFTER; 824 824 if (WinQueryButtonCheckstate(hwnd, ASS_PROMPT)) 825 826 827 828 829 830 831 832 825 temp.flags |= PROMPT; 826 if (fCancelAction){ 827 fCancelAction = FALSE; 828 free(temp.pszCmdLine); 829 break; 830 } 831 else 832 info = add_association(&temp); 833 833 //Add will fail if mask is not changed 834 834 if (info) { 835 835 display_associations(hwnd, &temp, info); 836 836 save_associations(); 837 837 } 838 838 free(temp.pszCmdLine); 839 839 } 840 840 break; … … 843 843 { 844 844 ASSOC temp; 845 846 847 848 849 850 845 CHAR dummy[34]; 846 847 memset(&temp, 0, sizeof(ASSOC)); 848 temp.pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 849 if (!temp.pszCmdLine) 850 break; //already complained 851 851 WinQueryDlgItemText(hwnd, ASS_MASK, sizeof(temp.mask), temp.mask); 852 852 WinQueryDlgItemText(hwnd, ASS_SIG, sizeof(temp.sig), temp.sig); … … 871 871 } 872 872 save_associations(); 873 874 873 } 874 free(temp.pszCmdLine); 875 875 } 876 876 … … 880 880 { 881 881 ASSOC temp; 882 883 884 885 886 887 888 889 882 CHAR dummy[34]; 883 PSZ pszWorkBuf; 884 replace = TRUE; 885 886 memset(&temp, 0, sizeof(ASSOC)); 887 temp.pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 888 if (!temp.pszCmdLine) 889 break; //already complained 890 890 y = (SHORT) WinSendDlgItemMsg(hwnd, 891 891 ASS_LISTBOX, 892 892 LM_QUERYSELECTION, 893 894 895 896 897 898 893 MPFROMSHORT(LIT_CURSOR), MPVOID); 894 pszWorkBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__); 895 if (!pszWorkBuf) { 896 free(temp.pszCmdLine); 897 break; //already complained 898 } 899 899 WinQueryDlgItemText(hwnd, ASS_MASK, sizeof(temp.mask), temp.mask); 900 901 902 903 904 905 900 WinQueryDlgItemText(hwnd, ASS_CL, MaxComLineStrg, temp.pszCmdLine); 901 if (strcmp(temp.pszCmdLine, "<>")) { 902 NormalizeCmdLine(pszWorkBuf, temp.pszCmdLine); 903 memcpy(temp.pszCmdLine, pszWorkBuf, strlen(pszWorkBuf) + 1); 904 } 905 free(pszWorkBuf); 906 906 WinQueryDlgItemText(hwnd, ASS_SIG, sizeof(temp.sig), temp.sig); 907 907 rstrip(temp.sig); … … 927 927 temp.flags |= DIEAFTER; 928 928 if (WinQueryButtonCheckstate(hwnd, ASS_PROMPT)) 929 930 931 932 933 934 935 929 temp.flags |= PROMPT; 930 if (fCancelAction){ 931 fCancelAction = FALSE; 932 free(temp.pszCmdLine); 933 break; 934 } 935 else 936 936 info = add_association(&temp); 937 937 if (info) { 938 938 display_associations(hwnd, &temp, info); 939 939 save_associations(); 940 941 940 } 941 free(temp.pszCmdLine); 942 942 } 943 943 { 944 944 ASSOC temp; 945 946 947 948 949 945 CHAR dummy[34]; 946 947 temp.pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 948 if (!temp.pszCmdLine) 949 break; //already complained 950 950 WinSendDlgItemMsg(hwnd, 951 951 ASS_LISTBOX, 952 952 LM_SELECTITEM, MPFROMSHORT(y), MPFROMSHORT(TRUE)); 953 954 955 953 memset(temp.sig, 0, sizeof(temp.sig)); 954 memset(temp.mask, 0, sizeof(temp.mask)); 955 temp.offset = 0; 956 956 WinQueryDlgItemText(hwnd, ASS_MASK, sizeof(temp.mask), temp.mask); 957 957 WinQueryDlgItemText(hwnd, ASS_SIG, sizeof(temp.sig), temp.sig); … … 975 975 } 976 976 save_associations(); 977 978 977 } 978 free(temp.pszCmdLine); 979 979 } 980 980 break;
Note:
See TracChangeset
for help on using the changeset viewer.