Changeset 985
- Timestamp:
- Mar 1, 2008, 2:37:14 AM (17 years ago)
- Location:
- trunk
- Files:
-
- 61 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/HISTORY
r961 r985 37 37 o Restore SaveDirCnrState internal state save logic - accidentally removed 38 38 o Move save shutdown state name to strings (IDS_SHUTDOWNSTATE, ShutdownState) 39 o Add unhide menu option (Gregg) 40 o Enable user settable command line length (Gregg) 41 o Add presparams & update appearence of "Sizes" dialog (Gregg) 39 42 40 43 3.09 -
trunk/dll/arccnrs.c
r959 r985 52 52 10 Feb 08 GKY Implement bubble help for bitmap menu items 53 53 15 Feb 08 SHL Sync with settings menu rework 54 29 Feb 08 GKY Use xfree where appropriate 54 55 55 56 ***********************************************************************/ … … 1437 1438 if (!dcd->info->extract) { 1438 1439 Runtime_Error(pszSrcFile, __LINE__, "no extract"); 1439 free(s);1440 xfree(s); 1440 1441 return 0; 1441 1442 } … … 1467 1468 } 1468 1469 // printf("%s %d UM_ENTER %s %s\n",__FILE__, __LINE__,filename, s); fflush(stdout); // 10 Mar 07 SHL hang 1469 free(s);1470 xfree(s); 1470 1471 if (IsFile(filename) == 1) { 1471 1472 #if 1 // 06 Oct 07 SHL fixme to be gone - set to 0 for ticket #58 testing … … 1746 1747 strcat(p, temp); 1747 1748 li->list[x] = p; 1748 free(temp);1749 xfree(temp); 1749 1750 } 1750 1751 } … … 1993 1994 FreeList(dcd->lastselection); 1994 1995 WinSendMsg(dcd->hwndCnr, UM_CLOSE, MPVOID, MPVOID); 1995 free(dcd);1996 xfree(dcd); 1996 1997 WinSetWindowPtr(dcd->hwndCnr, QWL_USER, NULL); 1997 1998 } … … 2540 2541 ret = StartMLEEditor(dcd->hwndParent, 2541 2542 (INT) mp1, (CHAR *) mp2, dcd->hwndFrame); 2542 free((CHAR *) mp2);2543 xfree((CHAR *) mp2); 2543 2544 return MRFROMLONG(ret); 2544 2545 } … … 2907 2908 BldFullPathName(s, dcd->workdir, li->list[x]); 2908 2909 if (IsFile(s) != 1) { 2909 free(li->list[x]);2910 xfree(li->list[x]); 2910 2911 li->list[x] = NULL; 2911 2912 for (y = x; li->list[y]; y++) … … 2919 2920 p = xstrdup(s, pszSrcFile, __LINE__); 2920 2921 if (p) { 2921 free(li->list[x]);2922 xfree(li->list[x]); 2922 2923 li->list[x] = p; 2923 2924 } … … 2967 2968 } 2968 2969 else 2969 free(li);2970 xfree(li); 2970 2971 } 2971 2972 } … … 3228 3229 if (!PostMsg(dcd->hwndObject, UM_ENTER, MPFROMP(s), MPVOID)) { 3229 3230 Runtime_Error(pszSrcFile, __LINE__, "post"); 3230 free(s);3231 xfree(s); 3231 3232 } 3232 3233 } … … 3521 3522 IDS_WINCREATEWINDOW); 3522 3523 PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID); 3523 free(dcd);3524 xfree(dcd); 3524 3525 hwndFrame = (HWND) 0; 3525 3526 } -
trunk/dll/assoc.c
r959 r985 16 16 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat 17 17 06 Jan 08 GKY Use NormalizeCmdLine to check program strings on entry 18 29 Feb 08 GKY Changes to enable user settable command line length 19 29 Feb 08 GKY Use xfree where appropriate 18 20 19 21 **************************************************************************************/ … … 40 42 typedef struct 41 43 { 42 CHAR mask[CCHMAXPATH];43 CHAR cl[MAXCOMLINESTRG];44 CHAR sig[CCHMAXPATH];45 44 LONG offset; 46 45 ULONG flags; 46 PSZ pszCmdLine; 47 CHAR mask[CCHMAXPATH]; 48 CHAR sig[CCHMAXPATH]; 47 49 } 48 50 ASSOC; … … 51 53 { 52 54 CHAR *mask; 53 CHAR *cl;55 PSZ pszCmdLine; 54 56 CHAR *sig; 55 57 LONG offset; … … 118 120 next = info->next; 119 121 xfree(info->mask); 120 xfree(info-> cl);122 xfree(info->pszCmdLine); 121 123 xfree(info->sig); 122 124 xfree(info); … … 130 132 FILE *fp; 131 133 LINKASSOC *info; 132 CHAR cl[1024];134 PSZ pszCmdLine; 133 135 CHAR mask[CCHMAXPATH + 24]; 134 136 CHAR sig[CCHMAXPATH + 24]; … … 144 146 strcat(mask, "ASSOC.DAT"); 145 147 fp = _fsopen(mask, "r", SH_DENYWR); 148 pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 149 if (!pszCmdLine) { 150 if (fp) 151 fclose(fp); //already complained 152 } 146 153 if (fp) { 147 154 while (!feof(fp)) { … … 152 159 if (!*mask || *mask == ';') 153 160 continue; 154 if (!xfgets( cl, sizeof(cl), fp, pszSrcFile, __LINE__) ||161 if (!xfgets(pszCmdLine, MaxComLineStrg, fp, pszSrcFile, __LINE__) || 155 162 !xfgets(sig, CCHMAXPATH + 24, fp, pszSrcFile, __LINE__) || 156 163 !xfgets(offset, sizeof(offset), fp, pszSrcFile, __LINE__) || 157 164 !xfgets(flags, sizeof(flags), fp, pszSrcFile, __LINE__)) 158 165 break; /* error! */ 159 cl[1000] = 0;160 bstripcr( cl);166 pszCmdLine[MaxComLineStrg - 1] = 0; 167 bstripcr(pszCmdLine); 161 168 sig[CCHMAXPATH] = 0; 162 169 bstripcr(sig); … … 165 172 flags[34] = 0; 166 173 bstripcr(flags); 167 if (!* cl)174 if (!*pszCmdLine) 168 175 continue; 169 176 info = xmallocz(sizeof(LINKASSOC), pszSrcFile, __LINE__); 170 177 if (info) { 171 info-> cl = xstrdup(cl, pszSrcFile, __LINE__);178 info->pszCmdLine = xstrdup(pszCmdLine, pszSrcFile, __LINE__); 172 179 info->mask = xstrdup(mask, pszSrcFile, __LINE__); 173 180 if (*sig) … … 175 182 info->offset = atol(offset); 176 183 info->flags = atol(flags); 177 if (!info-> cl|| !info->mask) {178 xfree(info-> cl);184 if (!info->pszCmdLine || !info->mask) { 185 xfree(info->pszCmdLine); 179 186 xfree(info->mask); 180 187 xfree(info); … … 191 198 } 192 199 fclose(fp); 200 } 201 } 202 203 VOID display_associations(HWND hwnd, ASSOC *temp, LINKASSOC *info) 204 { 205 CHAR szEnviroment[2048]; 206 PSZ pszDisplayStr; 207 SHORT x; 208 209 *szEnviroment = 0; 210 WinQueryDlgItemText(hwnd, ASS_ENVIRON, 2048, szEnviroment); 211 bstripcr(szEnviroment); 212 if (*szEnviroment) 213 PrfWriteProfileString(fmprof, FM3Str, temp->pszCmdLine, szEnviroment); 214 pszDisplayStr = xmallocz((CCHMAXPATH * 2) + MaxComLineStrg + 6, 215 pszSrcFile, __LINE__); 216 if (pszDisplayStr) { 217 sprintf(pszDisplayStr, "%-12s \x1a %-24s %s%s%s", temp->mask, 218 temp->pszCmdLine, (*temp->sig) ? 219 "[" : NullStr, (*temp->sig) ? temp->sig : NullStr, 220 (*temp->sig) ? "]" : NullStr); 221 x = (SHORT) WinSendDlgItemMsg(hwnd, 222 ASS_LISTBOX, 223 LM_INSERTITEM, 224 MPFROM2SHORT(LIT_END, 0), MPFROMP(pszDisplayStr)); 225 if (x >= 0) { 226 WinSendDlgItemMsg(hwnd, 227 ASS_LISTBOX, 228 LM_SETITEMHANDLE, 229 MPFROMSHORT(x), MPFROMP(info)); 230 WinSendDlgItemMsg(hwnd, 231 ASS_LISTBOX, 232 LM_SELECTITEM, 233 MPFROMSHORT(x), MPFROMSHORT(TRUE)); 234 } 235 xfree(pszDisplayStr); 193 236 } 194 237 } … … 232 275 while (info) { 233 276 fprintf(fp, 234 ";\n%0.*s\n%0. 1000s\n%0.*s\n%lu\n%lu\n",277 ";\n%0.*s\n%0.4096s\n%0.*s\n%lu\n%lu\n", 235 278 CCHMAXPATH, 236 279 info->mask, 237 info-> cl,280 info->pszCmdLine, 238 281 CCHMAXPATH, 239 282 (info->sig) ? info->sig : NullStr, info->offset, info->flags); … … 248 291 LINKASSOC *info; 249 292 250 if (addme && *addme-> cl&& *addme->mask) {293 if (addme && *addme->pszCmdLine && *addme->mask) { 251 294 info = asshead; 252 295 while (info) { … … 260 303 info = xmallocz(sizeof(LINKASSOC), pszSrcFile, __LINE__); 261 304 if (info) { 262 info-> cl = xstrdup(addme->cl, pszSrcFile, __LINE__);305 info->pszCmdLine = xstrdup(addme->pszCmdLine, pszSrcFile, __LINE__); 263 306 info->mask = xstrdup(addme->mask, pszSrcFile, __LINE__); 264 307 if (*addme->sig) … … 268 311 if (addme->flags) 269 312 info->flags = addme->flags; 270 if (!info-> cl|| !info->mask) {271 xfree(info-> cl);313 if (!info->pszCmdLine || !info->mask) { 314 xfree(info->pszCmdLine); 272 315 xfree(info->mask); 273 316 xfree(info); … … 315 358 asstail = info->prev; 316 359 } 317 xfree(info-> cl);360 xfree(info->pszCmdLine); 318 361 xfree(info->mask); 319 362 xfree(info->sig); … … 392 435 393 436 if (fAmAV2) { 394 if (stristr(info-> cl, "AV2.EXE") ||395 stristr(info-> cl, "AV2.CMD") || stristr(info->cl, "<>"))437 if (stristr(info->pszCmdLine, "AV2.EXE") || 438 stristr(info->pszCmdLine, "AV2.CMD") || stristr(info->pszCmdLine, "<>")) 396 439 return -1; 397 440 } 398 if (!strcmp(info-> cl, "<>")) {441 if (!strcmp(info->pszCmdLine, "<>")) { 399 442 OpenObject(datafile, Default, hwnd); 400 443 return 0; … … 414 457 flags &= (~DIEAFTER); 415 458 rc = ExecOnList(hwnd, 416 info-> cl,459 info->pszCmdLine, 417 460 flags, 418 461 NULL, list, GetPString(IDS_EXECASSOCTITLETEXT), … … 467 510 case UM_UNDO: 468 511 { 469 CHAR s[ 1002 + CCHMAXPATH +6];512 CHAR s[4096]; 470 513 471 514 WinSendDlgItemMsg(hwnd, ASS_LISTBOX, LM_DELETEALL, MPVOID, MPVOID); … … 475 518 "%-12s \x1a %-24s %s%s%s", 476 519 info->mask, 477 info-> cl,520 info->pszCmdLine, 478 521 (info->sig && *info->sig) ? 479 522 "[" : NullStr, … … 518 561 } 519 562 WinSetDlgItemText(hwnd, ASS_MASK, info->mask); 520 WinSetDlgItemText(hwnd, ASS_CL, info-> cl);563 WinSetDlgItemText(hwnd, ASS_CL, info->pszCmdLine); 521 564 WinSetDlgItemText(hwnd, ASS_SIG, 522 565 (info->sig && *info->sig) ? info->sig : NullStr); … … 545 588 size = sizeof(env) - 1; 546 589 if (PrfQueryProfileData(fmprof, 547 FM3Str, info-> cl, env, &size) && *env)590 FM3Str, info->pszCmdLine, env, &size) && *env) 548 591 WinSetDlgItemText(hwnd, ASS_ENVIRON, env); 549 592 else … … 629 672 replace = FALSE; 630 673 674 memset(&temp, 0, sizeof(ASSOC)); 675 temp.pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 676 if (!temp.pszCmdLine) 677 break; //already complained 678 631 679 { 632 680 x = (SHORT) WinSendDlgItemMsg(hwnd, … … 639 687 MPFROMSHORT(0), MPFROMSHORT(TRUE)); 640 688 } 641 pszWorkBuf = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__); 642 if (!pszWorkBuf) 689 pszWorkBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__); 690 if (!pszWorkBuf) { 691 xfree(temp.pszCmdLine); 643 692 break; //already complained 644 memset(&temp, 0, sizeof(ASSOC)); 693 } 645 694 WinQueryDlgItemText(hwnd, ASS_MASK, sizeof(temp.mask), temp.mask); 646 WinQueryDlgItemText(hwnd, ASS_CL, sizeof(temp.cl), temp.cl); 647 NormalizeCmdLine(pszWorkBuf, temp.cl); 648 memcpy(temp.cl, pszWorkBuf, strlen(pszWorkBuf) + 1); 695 WinQueryDlgItemText(hwnd, ASS_CL, MaxComLineStrg, temp.pszCmdLine); 696 if (strcmp(temp.pszCmdLine, "<>")) { 697 NormalizeCmdLine(pszWorkBuf, temp.pszCmdLine); 698 memcpy(temp.pszCmdLine, pszWorkBuf, strlen(pszWorkBuf) + 1); 699 } 649 700 xfree(pszWorkBuf); 650 701 WinQueryDlgItemText(hwnd, ASS_SIG, sizeof(temp.sig), temp.sig); … … 655 706 } 656 707 bstrip(temp.mask); 657 bstrip(temp. cl);708 bstrip(temp.pszCmdLine); 658 709 if (WinQueryButtonCheckstate(hwnd, ASS_DEFAULT)) 659 710 temp.flags = 0; … … 674 725 if (fCancelAction){ 675 726 fCancelAction = FALSE; 727 xfree(temp.pszCmdLine); 676 728 break; 677 729 } … … 680 732 if (!info) 681 733 WinDismissDlg(hwnd, 1); /* Runtime_Error(pszSrcFile, __LINE__, "add_association"); */ 682 else { 683 684 CHAR s[1002 + CCHMAXPATH + 6]; 685 686 *s = 0; 687 WinQueryDlgItemText(hwnd, ASS_ENVIRON, 1000, s); 688 bstripcr(s); 689 if (*s) 690 PrfWriteProfileString(fmprof, FM3Str, temp.cl, s); 691 sprintf(s, "%-12s \x1a %-24s %s%s%s", temp.mask, 692 temp.cl, (*temp.sig) ? 693 "[" : NullStr, (*temp.sig) ? temp.sig : NullStr, 694 (*temp.sig) ? "]" : NullStr); 695 x = (SHORT) WinSendDlgItemMsg(hwnd, 696 ASS_LISTBOX, 697 LM_INSERTITEM, 698 MPFROM2SHORT(LIT_END, 0), MPFROMP(s)); 699 if (x >= 0) { 700 WinSendDlgItemMsg(hwnd, 701 ASS_LISTBOX, 702 LM_SETITEMHANDLE, 703 MPFROMSHORT(x), MPFROMP(info)); 704 WinSendDlgItemMsg(hwnd, 705 ASS_LISTBOX, 706 LM_SELECTITEM, 707 MPFROMSHORT(x), MPFROMSHORT(TRUE)); 708 } 734 else { 735 display_associations(hwnd, &temp, info); 709 736 save_associations(); 710 } 737 } 738 xfree(temp.pszCmdLine); 711 739 } 712 740 WinDismissDlg(hwnd, 1); … … 728 756 CHAR dummy[34]; 729 757 PSZ pszWorkBuf; 730 replace = FALSE; 731 732 pszWorkBuf = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__); 733 if (!pszWorkBuf) 758 replace = FALSE; 759 760 memset(&temp, 0, sizeof(ASSOC)); 761 temp.pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 762 if (!temp.pszCmdLine) 734 763 break; //already complained 735 memset(&temp, 0, sizeof(ASSOC)); 736 WinQueryDlgItemText(hwnd, ASS_MASK, sizeof(temp.mask), temp.mask); 737 WinQueryDlgItemText(hwnd, ASS_CL, sizeof(temp.cl), temp.cl); 738 NormalizeCmdLine(pszWorkBuf, temp.cl); 739 memcpy(temp.cl, pszWorkBuf, strlen(pszWorkBuf) + 1); 764 pszWorkBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__); 765 if (!pszWorkBuf) { 766 xfree(temp.pszCmdLine); 767 break; //already complained 768 } 769 WinQueryDlgItemText(hwnd, ASS_MASK, sizeof(temp.mask), temp.mask); 770 WinQueryDlgItemText(hwnd, ASS_CL, MaxComLineStrg, temp.pszCmdLine); 771 if (strcmp(temp.pszCmdLine, "<>")) { 772 NormalizeCmdLine(pszWorkBuf, temp.pszCmdLine); 773 memcpy(temp.pszCmdLine, pszWorkBuf, strlen(pszWorkBuf) + 1); 774 } 740 775 xfree(pszWorkBuf); 741 776 WinQueryDlgItemText(hwnd, ASS_SIG, sizeof(temp.sig), temp.sig); … … 746 781 } 747 782 bstrip(temp.mask); 748 bstrip(temp. cl);783 bstrip(temp.pszCmdLine); 749 784 if (WinQueryButtonCheckstate(hwnd, ASS_DEFAULT)) 750 785 temp.flags = 0; … … 765 800 if (fCancelAction){ 766 801 fCancelAction = FALSE; 802 xfree(temp.pszCmdLine); 767 803 break; 768 804 } … … 771 807 //Add will fail if mask is not changed 772 808 if (info) { 773 774 CHAR s[1002 + CCHMAXPATH + 6]; 775 776 *s = 0; 777 WinQueryDlgItemText(hwnd, ASS_ENVIRON, 1000, s); 778 bstripcr(s); 779 if (*s) 780 PrfWriteProfileString(fmprof, FM3Str, temp.cl, s); 781 sprintf(s, "%-12s \x1a %-24s %s%s%s", temp.mask, 782 temp.cl, (*temp.sig) ? 783 "[" : NullStr, (*temp.sig) ? temp.sig : NullStr, 784 (*temp.sig) ? "]" : NullStr); 785 x = (SHORT) WinSendDlgItemMsg(hwnd, 786 ASS_LISTBOX, 787 LM_INSERTITEM, 788 MPFROM2SHORT(LIT_END, 0), MPFROMP(s)); 789 if (x >= 0) { 790 WinSendDlgItemMsg(hwnd, 791 ASS_LISTBOX, 792 LM_SETITEMHANDLE, 793 MPFROMSHORT(x), MPFROMP(info)); 794 WinSendDlgItemMsg(hwnd, 795 ASS_LISTBOX, 796 LM_SELECTITEM, 797 MPFROMSHORT(x), MPFROMSHORT(TRUE)); 798 } 809 display_associations(hwnd, &temp, info); 799 810 save_associations(); 800 811 } 812 xfree(temp.pszCmdLine); 801 813 } 802 814 break; … … 805 817 { 806 818 ASSOC temp; 807 CHAR dummy[34]; 808 809 memset(&temp, 0, sizeof(ASSOC)); 819 CHAR dummy[34]; 820 821 memset(&temp, 0, sizeof(ASSOC)); 822 temp.pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 823 if (!temp.pszCmdLine) 824 break; //already complained 810 825 WinQueryDlgItemText(hwnd, ASS_MASK, sizeof(temp.mask), temp.mask); 811 826 WinQueryDlgItemText(hwnd, ASS_SIG, sizeof(temp.sig), temp.sig); … … 817 832 bstrip(temp.mask); 818 833 PrfWriteProfileData(fmprof, FM3Str, temp.mask, NULL, 0L); 819 if (kill_association(&temp)) 820 /* Runtime_Error(pszSrcFile, __LINE__, "kill_association"); 821 else */{ 834 if (kill_association(&temp)) { 822 835 x = (SHORT) WinSendDlgItemMsg(hwnd, 823 836 ASS_LISTBOX, … … 832 845 } 833 846 save_associations(); 834 } 835 } 847 } 848 xfree(temp.pszCmdLine); 849 } 850 836 851 break; 837 852 case ASS_REPLACE: … … 841 856 CHAR dummy[34]; 842 857 PSZ pszWorkBuf; 843 replace = TRUE; 844 858 replace = TRUE; 859 860 memset(&temp, 0, sizeof(ASSOC)); 861 temp.pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 862 if (!temp.pszCmdLine) 863 break; //already complained 845 864 y = (SHORT) WinSendDlgItemMsg(hwnd, 846 865 ASS_LISTBOX, 847 866 LM_QUERYSELECTION, 848 867 MPFROMSHORT(LIT_CURSOR), MPVOID); 849 pszWorkBuf = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__); 850 if (!pszWorkBuf) 868 pszWorkBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__); 869 if (!pszWorkBuf) { 870 xfree(temp.pszCmdLine); 851 871 break; //already complained 852 memset(&temp, 0, sizeof(ASSOC)); 872 } 853 873 WinQueryDlgItemText(hwnd, ASS_MASK, sizeof(temp.mask), temp.mask); 854 WinQueryDlgItemText(hwnd, ASS_CL, sizeof(temp.cl), temp.cl); 855 NormalizeCmdLine(pszWorkBuf, temp.cl); 856 memcpy(temp.cl, pszWorkBuf, strlen(pszWorkBuf) + 1); 874 WinQueryDlgItemText(hwnd, ASS_CL, MaxComLineStrg, temp.pszCmdLine); 875 if (strcmp(temp.pszCmdLine, "<>")) { 876 NormalizeCmdLine(pszWorkBuf, temp.pszCmdLine); 877 memcpy(temp.pszCmdLine, pszWorkBuf, strlen(pszWorkBuf) + 1); 878 } 857 879 xfree(pszWorkBuf); 858 880 WinQueryDlgItemText(hwnd, ASS_SIG, sizeof(temp.sig), temp.sig); … … 863 885 } 864 886 bstrip(temp.mask); 865 bstrip(temp. cl);887 bstrip(temp.pszCmdLine); 866 888 if (WinQueryButtonCheckstate(hwnd, ASS_DEFAULT)) 867 889 temp.flags = 0; … … 882 904 if (fCancelAction){ 883 905 fCancelAction = FALSE; 906 xfree(temp.pszCmdLine); 884 907 break; 885 908 } 886 909 else 887 910 info = add_association(&temp); 888 //Add will fail if mask is not changed889 911 if (info) { 890 891 CHAR s[1002 + CCHMAXPATH + 6]; 892 893 *s = 0; 894 WinQueryDlgItemText(hwnd, ASS_ENVIRON, 1000, s); 895 bstripcr(s); 896 if (*s) 897 PrfWriteProfileString(fmprof, FM3Str, temp.cl, s); 898 sprintf(s, "%-12s \x1a %-24s %s%s%s", temp.mask, 899 temp.cl, (*temp.sig) ? 900 "[" : NullStr, (*temp.sig) ? temp.sig : NullStr, 901 (*temp.sig) ? "]" : NullStr); 902 x = (SHORT) WinSendDlgItemMsg(hwnd, 903 ASS_LISTBOX, 904 LM_INSERTITEM, 905 MPFROM2SHORT(LIT_END, 0), MPFROMP(s)); 906 if (x >= 0) { 907 WinSendDlgItemMsg(hwnd, 908 ASS_LISTBOX, 909 LM_SETITEMHANDLE, 910 MPFROMSHORT(x), MPFROMP(info)); 911 WinSendDlgItemMsg(hwnd, 912 ASS_LISTBOX, 913 LM_SELECTITEM, 914 MPFROMSHORT(x), MPFROMSHORT(TRUE)); 915 } 912 display_associations(hwnd, &temp, info); 916 913 save_associations(); 917 } 914 } 915 xfree(temp.pszCmdLine); 918 916 } 919 917 { 920 918 ASSOC temp; 921 CHAR dummy[34]; 922 919 CHAR dummy[34]; 920 921 temp.pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 922 if (!temp.pszCmdLine) 923 break; //already complained 923 924 WinSendDlgItemMsg(hwnd, 924 925 ASS_LISTBOX, 925 926 LM_SELECTITEM, MPFROMSHORT(y), MPFROMSHORT(TRUE)); 926 memset(&temp, 0, sizeof(ASSOC)); 927 memset(temp.sig, 0, sizeof(temp.sig)); 928 memset(temp.mask, 0, sizeof(temp.mask)); 929 temp.offset = 0; 927 930 WinQueryDlgItemText(hwnd, ASS_MASK, sizeof(temp.mask), temp.mask); 928 931 WinQueryDlgItemText(hwnd, ASS_SIG, sizeof(temp.sig), temp.sig); … … 946 949 } 947 950 save_associations(); 948 } 951 } 952 xfree(temp.pszCmdLine); 949 953 } 950 954 break; … … 968 972 } 969 973 970 #pragma alloc_text(ASSOC2,free_commands,load_associations,save_associations )974 #pragma alloc_text(ASSOC2,free_commands,load_associations,save_associations,display_associations) 971 975 #pragma alloc_text(ASSOC2,ExecAssociation,AssocTextProc) 972 976 #pragma alloc_text(ASSOC,add_association,kill_association,AssocDlgProc,EditAssociations) -
trunk/dll/autoview.c
r959 r985 23 23 22 Nov 07 GKY Use CopyPresParams to fix presparam inconsistencies in menus 24 24 30 Dec 07 GKY Use CommaFmtULL 25 29 Feb 08 GKY Use xfree where appropriate 25 26 26 27 ***********************************************************************/ … … 412 413 WinSetWindowText(hwndAutoview, obuff); 413 414 } 414 free(obuff);415 xfree(obuff); 415 416 } 416 free(ibuff);417 xfree(ibuff); 417 418 } 418 419 DosClose(handle); … … 507 508 if (*pszBuf) 508 509 WinSetWindowText(hwndAutoview, pszBuf); 509 free(pszBuf);510 xfree(pszBuf); 510 511 } 511 512 } … … 541 542 rc = DosQueryPathInfo((CHAR *) mp1, FIL_QUERYEASFROMLIST, 542 543 (PVOID) & eaop, (ULONG) sizeof(EAOP2)); 543 free(pgealist);544 xfree(pgealist); 544 545 if (!rc) { 545 546 pfea = &eaop.fpFEA2List->list[0]; … … 591 592 } 592 593 WinSetWindowText(hwndAutoMLE, pszBuf); 593 free(pszBuf);594 xfree(pszBuf); 594 595 } 595 596 } … … 605 606 MLEsetreadonly(hwndAutoMLE, FALSE); 606 607 } 607 free(pfealist);608 xfree(pfealist); 608 609 } 609 610 } 610 611 } 611 612 } 612 free((CHAR *) mp1);613 xfree((CHAR *) mp1); 613 614 } 614 615 return 0; … … 786 787 PutComments(hwnd, currfile, ea); 787 788 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(IDM_RESCAN, 0), MPVOID); 788 free(ea);789 xfree(ea); 789 790 } 790 791 } … … 836 837 stopflag++; 837 838 if (!PostMsg(hwndAutoObj, UM_LOADFILE, MPFROMP(cf), MPVOID)) 838 free(cf);839 xfree(cf); 839 840 } 840 841 } -
trunk/dll/avl.c
r907 r985 30 30 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat 31 31 25 Aug 07 SHL load_archivers: add missing close on error path 32 29 Feb 08 GKY Use xfree where appropriate 32 33 33 34 ***********************************************************************/ … … 236 237 xfree(pat->createwdirs); 237 238 xfree(pat->movewdirs); 238 free(pat);239 xfree(pat); 239 240 } 240 241 } … … 822 823 ArcReviewDlgProc, 823 824 FM3ModHandle, AD_FRAME, MPFROMP(&ad))) { 824 free(ad.info);825 xfree(ad.info); 825 826 } 826 827 else { -
trunk/dll/avv.c
r959 r985 24 24 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat 25 25 06 Jan 08 GKY Use NormalizeCmdLine to check program strings on entry 26 29 Feb 08 GKY Changes to enable user settable command line length 26 27 27 28 ***********************************************************************/ … … 93 94 static PSZ free_and_strdup_quoted_from_window(HWND hwnd, USHORT id, PSZ pszDest) 94 95 { // fixme for command line limit 95 CHAR szCmdLine[MAXCOMLINESTRG]; 96 96 CHAR *szCmdLine; 97 98 szCmdLine = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__); 99 if (!szCmdLine) 100 return NULL; //already complained 97 101 xfree(pszDest); 98 102 WinQueryDlgItemText(hwnd, id, sizeof(szCmdLine), szCmdLine); 99 103 if (*szCmdLine){ 100 104 PSZ pszWorkBuf; 101 pszWorkBuf = xmalloc(M AXCOMLINESTRG, pszSrcFile, __LINE__);105 pszWorkBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__); 102 106 if (pszWorkBuf) { 103 107 NormalizeCmdLine(pszWorkBuf, szCmdLine); … … 110 114 else 111 115 pszDest = NULL; 116 xfree(szCmdLine); 112 117 return pszDest; 113 118 } -
trunk/dll/cmdline.c
r907 r985 16 16 16 Jun 07 SHL Update for OpenWatcom 17 17 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat 18 29 Feb 08 GKY Use xfree where appropriate 18 19 19 20 ***********************************************************************/ … … 78 79 info->cl = xstrdup(s, pszSrcFile, __LINE__); 79 80 if (!info->cl) 80 free(info);81 xfree(info); 81 82 else { 82 83 info->next = NULL; … … 155 156 info->cl = xstrdup(cl, pszSrcFile, __LINE__); 156 157 if (!info->cl) 157 free(info);158 xfree(info); 158 159 else { 159 160 info->next = NULL; … … 165 166 info = clhead; 166 167 clhead = clhead->next; 167 free(info);168 xfree(info); 168 169 } 169 170 if (big) … … 193 194 else 194 195 clhead = info->next; 195 free(info->cl);196 free(info);196 xfree(info->cl); 197 xfree(info); 197 198 if (big) 198 199 clbig = clhead; … … 215 216 while (info) { 216 217 next = info->next; 217 free(info->cl);218 free(info);218 xfree(info->cl); 219 xfree(info); 219 220 info = next; 220 221 } -
trunk/dll/collect.c
r958 r985 47 47 15 Feb 08 GKY Fix attempt to free container items that were never inserted 48 48 15 Feb 08 GKY Fix "collect" so it updates recollected files and unhides them if needed 49 29 Feb 08 GKY Use xfree where appropriate 49 50 50 51 ***********************************************************************/ … … 898 899 Runtime_Error(pszSrcFile, __LINE__, 899 900 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 900 free(wk);901 xfree(wk); 901 902 FreeListInfo((LISTINFO *) mp1); 902 903 } … … 926 927 Runtime_Error(pszSrcFile, __LINE__, 927 928 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 928 free(wk);929 xfree(wk); 929 930 FreeListInfo((LISTINFO *) mp1); 930 931 } … … 951 952 WinSendMsg(dcd->hwndCnr, UM_CLOSE, MPVOID, MPVOID); 952 953 FreeList(dcd->lastselection); 953 free(dcd);954 xfree(dcd); 954 955 } 955 956 DosPostEventSem(CompactSem); … … 1446 1447 if (mp1) { 1447 1448 if (!dcd) { 1448 free(mp1);1449 xfree(mp1); 1449 1450 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 1450 1451 } … … 1452 1453 if (!PostMsg(dcd->hwndObject, UM_COLLECTFROMFILE, mp1, mp2)) { 1453 1454 Runtime_Error(pszSrcFile, __LINE__, "PostMsg"); 1454 free(mp1);1455 xfree(mp1); 1455 1456 } 1456 1457 } … … 1578 1579 if (p) { 1579 1580 if (!PostMsg(hwnd, UM_COLLECTFROMFILE, MPFROMP(p), MPVOID)) 1580 free(p);1581 xfree(p); 1581 1582 } 1582 1583 } … … 2088 2089 } 2089 2090 else 2090 free(li);2091 xfree(li); 2091 2092 } 2092 2093 } … … 2837 2838 IDS_WINCREATEWINDOW); 2838 2839 PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID); 2839 free(dcd);2840 xfree(dcd); 2840 2841 hwndFrame = (HWND) 0; 2841 2842 } -
trunk/dll/command.c
r959 r985 22 22 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat 23 23 06 Jan 08 GKY Use NormalizeCmdLine to check program strings on entry 24 29 Feb 08 GKY Changes to enable user settable command line length 25 29 Feb 08 GKY Use xfree where appropriate 24 26 25 27 ***********************************************************************/ … … 44 46 typedef struct 45 47 { 46 CHAR cl[MAXCOMLINESTRG];48 PSZ pszCmdLine; 47 49 INT flags; 48 50 CHAR title[34]; … … 307 309 xfree(info->title); 308 310 xfree(info->cl); 309 free(info);311 xfree(info); 310 312 info = next; 311 313 } … … 355 357 xfree(info->cl); 356 358 xfree(info->title); 357 free(info);359 xfree(info); 358 360 break; 359 361 } … … 404 406 LINKCMDS *info; 405 407 406 if (!addme || !*addme-> cl|| !*addme->title)408 if (!addme || !*addme->pszCmdLine || !*addme->title) 407 409 return NULL; // No data 408 410 info = cmdhead; … … 415 417 if (!info) 416 418 return NULL; 417 info->cl = xstrdup(addme-> cl, pszSrcFile, __LINE__);419 info->cl = xstrdup(addme->pszCmdLine, pszSrcFile, __LINE__); 418 420 info->title = xstrdup(addme->title, pszSrcFile, __LINE__); 419 421 if (addme->flags) … … 422 424 xfree(info->cl); 423 425 xfree(info->title); 424 free(info);426 xfree(info); 425 427 return NULL; 426 428 } … … 459 461 xfree(info->cl); 460 462 xfree(info->title); 461 free(info);463 xfree(info); 462 464 return TRUE; 463 465 } … … 622 624 APIRET ret; 623 625 624 pszWorkBuf = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__); 625 if (!pszWorkBuf) 626 memset(&temp, 0, sizeof(COMMAND)); 627 temp.pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 628 if (!temp.pszCmdLine) 626 629 break; //already complained 627 memset(&temp, 0, sizeof(COMMAND)); 628 WinQueryDlgItemText(hwnd, CMD_CL, sizeof(temp.cl), temp.cl); 629 NormalizeCmdLine(pszWorkBuf, temp.cl); 630 memcpy(temp.cl, pszWorkBuf, strlen(pszWorkBuf) + 1); 630 pszWorkBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__); 631 if (!pszWorkBuf) { 632 xfree(temp.pszCmdLine); 633 break; //already complained 634 } 635 WinQueryDlgItemText(hwnd, CMD_CL, MaxComLineStrg, temp.pszCmdLine); 636 NormalizeCmdLine(pszWorkBuf, temp.pszCmdLine); 637 memcpy(temp.pszCmdLine, pszWorkBuf, strlen(pszWorkBuf) + 1); 631 638 xfree(pszWorkBuf); 632 if (!strchr(temp. cl, '%')){639 if (!strchr(temp.pszCmdLine, '%')){ 633 640 ret = saymsg(MB_YESNO, 634 641 HWND_DESKTOP, … … 636 643 GetPString(IDS_TOACTONSELECTEDTEXT)); 637 644 if (ret == MBID_YES) 638 strcat(temp. cl, " %a");645 strcat(temp.pszCmdLine, " %a"); 639 646 } 640 647 WinQueryDlgItemText(hwnd, CMD_TITLE, sizeof(temp.title), temp.title); … … 657 664 if (fCancelAction){ 658 665 fCancelAction = FALSE; 666 xfree(temp.pszCmdLine); 659 667 break; 660 668 } … … 676 684 bstripcr(env); 677 685 if (*env) { 678 PrfWriteProfileString(fmprof, FM3Str, temp. cl, env);686 PrfWriteProfileString(fmprof, FM3Str, temp.pszCmdLine, env); 679 687 } 680 688 x = (SHORT) WinSendDlgItemMsg(hwnd, … … 694 702 save_commands(); 695 703 } 696 } 704 } 705 xfree(temp.pszCmdLine); 697 706 } 698 707 x = (SHORT) WinSendDlgItemMsg(hwnd, 699 708 CMD_LISTBOX, 700 709 LM_QUERYSELECTION, 701 710 MPFROMSHORT(LIT_FIRST), MPVOID); 702 711 WinDismissDlg(hwnd, 0); 703 712 break; … … 720 729 APIRET ret; 721 730 722 pszWorkBuf = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__); 723 if (!pszWorkBuf) 731 memset(&temp, 0, sizeof(COMMAND)); 732 temp.pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 733 if (!temp.pszCmdLine) 724 734 break; //already complained 725 memset(&temp, 0, sizeof(COMMAND)); 726 WinQueryDlgItemText(hwnd, CMD_CL, sizeof(temp.cl), temp.cl); 727 NormalizeCmdLine(pszWorkBuf, temp.cl); 728 memcpy(temp.cl, pszWorkBuf, strlen(pszWorkBuf) + 1); 735 pszWorkBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__); 736 if (!pszWorkBuf) { 737 xfree(temp.pszCmdLine); 738 break; //already complained 739 } 740 WinQueryDlgItemText(hwnd, CMD_CL, MaxComLineStrg, temp.pszCmdLine); 741 NormalizeCmdLine(pszWorkBuf, temp.pszCmdLine); 742 memcpy(temp.pszCmdLine, pszWorkBuf, strlen(pszWorkBuf) + 1); 729 743 xfree(pszWorkBuf); 730 if (!strchr(temp. cl, '%')){744 if (!strchr(temp.pszCmdLine, '%')){ 731 745 ret = saymsg(MB_YESNO, 732 746 HWND_DESKTOP, … … 734 748 GetPString(IDS_TOACTONSELECTEDTEXT)); 735 749 if (ret == MBID_YES) 736 strcat(temp. cl, " %a");750 strcat(temp.pszCmdLine, " %a"); 737 751 } 738 752 WinQueryDlgItemText(hwnd, CMD_TITLE, sizeof(temp.title), temp.title); … … 755 769 if (fCancelAction){ 756 770 fCancelAction = FALSE; 771 xfree(temp.pszCmdLine); 757 772 break; 758 773 } … … 770 785 bstripcr(env); 771 786 if (*env) { 772 PrfWriteProfileString(fmprof, FM3Str, temp. cl, env);787 PrfWriteProfileString(fmprof, FM3Str, temp.pszCmdLine, env); 773 788 } 774 789 x = (SHORT) WinSendDlgItemMsg(hwnd, … … 788 803 save_commands(); 789 804 } 790 } 805 } 806 xfree(temp.pszCmdLine); 791 807 } 792 808 break; … … 818 834 } 819 835 break; 836 820 837 case CMD_REPLACE: 821 838 { //Delete first … … 824 841 APIRET ret; 825 842 826 pszWorkBuf = xmalloc(M AXCOMLINESTRG, pszSrcFile, __LINE__);827 if (!pszWorkBuf) 843 pszWorkBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__); 844 if (!pszWorkBuf) { 828 845 break; //already complained 829 memset(&temp, 0, sizeof(COMMAND)); 830 WinQueryDlgItemText(hwnd, CMD_CL, sizeof(temp.cl), temp.cl); 831 NormalizeCmdLine(pszWorkBuf, temp.cl); 832 memcpy(temp.cl, pszWorkBuf, strlen(pszWorkBuf) + 1); 846 } 847 memset(&temp, 0, sizeof(COMMAND)); 848 temp.pszCmdLine = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 849 if (!temp.pszCmdLine) { 850 xfree(pszWorkBuf); 851 break; //already complained 852 } 853 WinQueryDlgItemText(hwnd, CMD_CL, MaxComLineStrg, temp.pszCmdLine); 854 NormalizeCmdLine(pszWorkBuf, temp.pszCmdLine); 855 memcpy(temp.pszCmdLine, pszWorkBuf, strlen(pszWorkBuf) + 1); 833 856 xfree(pszWorkBuf); 834 857 if (fCancelAction){ 835 858 fCancelAction = FALSE; 859 xfree(temp.pszCmdLine); 836 860 break; 837 861 } 838 if (!strchr(temp. cl, '%')){862 if (!strchr(temp.pszCmdLine, '%')){ 839 863 ret = saymsg(MB_YESNO, 840 864 HWND_DESKTOP, … … 842 866 GetPString(IDS_TOACTONSELECTEDTEXT)); 843 867 if (ret == MBID_YES) 844 strcat(temp. cl, " %a");868 strcat(temp.pszCmdLine, " %a"); 845 869 } 846 870 //remember item location in the list … … 896 920 bstripcr(env); 897 921 if (*env) { 898 PrfWriteProfileString(fmprof, FM3Str, temp. cl, env);922 PrfWriteProfileString(fmprof, FM3Str, temp.pszCmdLine, env); 899 923 } //put item back in original place 900 924 x = (SHORT) WinSendDlgItemMsg(hwnd, … … 947 971 } 948 972 } 973 xfree(temp.pszCmdLine); 949 974 } 950 975 break; -
trunk/dll/common.c
r959 r985 20 20 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat 21 21 26 Aug 07 SHL Change to DosSleep(0) 22 29 Feb 08 GKY Use xfree where appropriate 22 23 23 24 ***********************************************************************/ … … 745 746 Broadcast(WinQueryAnchorBlock(hwnd), 746 747 dcd->hwndParent, UM_UPDATERECORD, mp2, MPVOID); 747 free(mp2);748 xfree(mp2); 748 749 } 749 750 } -
trunk/dll/comp.c
r959 r985 51 51 18 Jan 08 SHL Honor filters in actions 52 52 20 Jan 08 GKY Compare dialog now saves and restores size and position 53 29 Feb 08 GKY Use xfree where appropriate 54 29 Feb 08 GKY Refactor global command line variables to notebook.h 53 55 54 56 ***********************************************************************/ … … 76 78 #include "comp.h" 77 79 #include "fm3dll.h" 80 #include "notebook.h" // External compare/dircompare 78 81 79 82 typedef struct … … 140 143 DosFindClose(hdir); 141 144 } 142 free(mask);145 xfree(mask); 143 146 } 144 free(pffb);147 xfree(pffb); 145 148 } 146 149 } … … 174 177 } 175 178 } 176 free(sf);179 xfree(sf); 177 180 } 178 181 } … … 678 681 WinTerminate(hab); 679 682 } 680 free(cmp);683 xfree(cmp); 681 684 } 682 685 … … 735 738 WinTerminate(hab); 736 739 } 737 free(cmp);740 xfree(cmp); 738 741 } 739 742 … … 780 783 pciSa = xmalloc(sizeof(PCNRITEM) * numS, pszSrcFile, __LINE__); 781 784 if (!pciSa) { 782 free(pciDa);785 xfree(pciDa); 783 786 return; 784 787 } … … 813 816 goto Restart; 814 817 } 815 free(pciDa);816 free(pciSa);818 xfree(pciDa); 819 xfree(pciSa); 817 820 Runtime_Error(pszSrcFile, __LINE__, "numD %u != x %lu", numD, x); 818 821 return; … … 840 843 goto Restart; 841 844 } 842 free(pciSa);843 free(pciDa);845 xfree(pciSa); 846 xfree(pciDa); 844 847 Runtime_Error(pszSrcFile, __LINE__, "numS (%lu) != x (%lu)", numS, x); 845 848 return; … … 1284 1287 } 1285 1288 1286 free(pciSa);1287 free(pciDa);1289 xfree(pciSa); 1290 xfree(pciDa); 1288 1291 1289 1292 if (fUpdateHideButton) { … … 1325 1328 pffbArray = xmalloc(ulBufBytes, pszSrcFile, __LINE__); 1326 1329 if (!pffbArray) { 1327 free(maskstr);1330 xfree(maskstr); 1328 1331 return; 1329 1332 } … … 1393 1396 } 1394 1397 1395 free(maskstr);1396 free(pffbArray);1398 xfree(maskstr); 1399 xfree(pffbArray); 1397 1400 1398 1401 // DbgMsg(pszSrcFile, __LINE__, "FillDirList finish %s", str); … … 1975 1978 } // if insufficient resources 1976 1979 1977 if (filesl) 1978 free(filesl); // Free header - have already freed elements 1980 xfree(filesl); // Free header - have already freed elements 1979 1981 filesl = NULL; 1980 if (filesr) 1981 free(filesr); 1982 xfree(filesr); 1982 1983 filesr = NULL; 1983 1984 … … 2046 2047 WinTerminate(hab); 2047 2048 } 2048 free(cmp);2049 xfree(cmp); 2049 2050 DosPostEventSem(CompactSem); 2050 2051 … … 2607 2608 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 2608 2609 WinDismissDlg(hwnd, 0); 2609 free(forthread);2610 xfree(forthread); 2610 2611 } 2611 2612 else { … … 2887 2888 Runtime_Error(pszSrcFile, __LINE__, 2888 2889 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 2889 free(sf);2890 xfree(sf); 2890 2891 } 2891 2892 } … … 2939 2940 Runtime_Error(pszSrcFile, __LINE__, 2940 2941 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 2941 free(forthread);2942 xfree(forthread); 2942 2943 } 2943 2944 else { … … 3062 3063 Runtime_Error(pszSrcFile, __LINE__, 3063 3064 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 3064 free(forthread);3065 xfree(forthread); 3065 3066 } 3066 3067 else { … … 3218 3219 WinSendMsg(cmp->dcd.hwndObject, WM_CLOSE, MPVOID, MPVOID); 3219 3220 } 3220 free(cmp);3221 xfree(cmp); 3221 3222 } 3222 3223 EmptyCnr(hwndLeft); -
trunk/dll/copyf.c
r959 r985 18 18 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat 19 19 01 Sep 07 GKY Use xDosSetPathInfo to fix case where FS3 buffer crosses 64k boundry 20 29 Feb 08 GKY Use xfree where appropriate 20 21 21 22 ***********************************************************************/ … … 236 237 longname[CCHMAXPATH - 1] = 0; 237 238 } 238 free(pfealist);239 } 240 free(pgealist);239 xfree(pfealist); 240 } 241 xfree(pgealist); 241 242 } 242 243 } … … 711 712 /* under no circumstances! */ 712 713 Runtime_Error(pszSrcFile, __LINE__, "bad name %s", str); 713 free(str);714 xfree(str); 714 715 return -1; 715 716 } … … 738 739 xfree(ss); 739 740 xfree(f); 740 free(str);741 xfree(str); 741 742 return -1; 742 743 } … … 785 786 xfree(f); 786 787 xfree(ss); 787 free(str);788 xfree(str); 788 789 return 0; 789 790 } … … 832 833 xfree(ss); 833 834 xfree(f); 834 free(str);835 xfree(str); 835 836 return -1; 836 837 } … … 858 859 xfree(f); 859 860 xfree(ss); 860 free(str);861 xfree(str); 861 862 return 0; 862 863 } -
trunk/dll/defview.c
r907 r985 17 17 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat 18 18 20 Dec 07 GKY Open jpg files with OS2 object default since image.exe fails 19 29 Feb 08 GKY Refactor global command line variables to notebook.h 19 20 20 21 ***********************************************************************/ … … 34 35 #include "arccnrs.h" // StartArcCnr 35 36 #include "errutil.h" // Dos_Error... 37 #include "notebook.h" // external viewers 36 38 #include "fm3dll.h" 37 39 -
trunk/dll/dirsize.c
r959 r985 31 31 13 Aug 07 SHL Move #pragma alloc_text to end for OpenWatcom compat 32 32 26 Aug 07 GKY DosSleep(1) in loops changed to (0) 33 29 Feb 08 GKY Use xfree where appropriate 34 29 Feb 08 GKY Add presparams & update appearence of "Sizes" dialog 33 35 34 36 ***********************************************************************/ … … 150 152 strlen(pszFileName) < 4) { 151 153 if (*pchStopFlag) { 152 free(pffbArray);154 xfree(pffbArray); 153 155 return FALSE; 154 156 } … … 157 159 if (!pci) { 158 160 Win_Error(hwndCnr, HWND_DESKTOP, pszSrcFile, __LINE__, "CM_ALLOCRECORD"); 159 free(pffbArray);161 xfree(pffbArray); 160 162 return FALSE; 161 163 } … … 173 175 else { 174 176 // No match 175 free(pffbArray);177 xfree(pffbArray); 176 178 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, 177 179 GetPString(IDS_CANTFINDDIRTEXT), pszFileName); … … 216 218 ri.fInvalidateRecord = TRUE; 217 219 if (!WinSendMsg(hwndCnr, CM_INSERTRECORD, MPFROMP(pci), MPFROMP(&ri))) { 218 free(pffbArray);220 xfree(pffbArray); 219 221 return FALSE; 220 222 } … … 278 280 } 279 281 280 free(pffbArray);282 xfree(pffbArray); 281 283 282 284 pci->cbFile = ullCurDirBytes; … … 456 458 PostMsg(WinQueryWindow(hwndCnr, QW_PARENT), 457 459 UM_CONTAINER_FILLED, MPVOID, MPVOID); 458 free(dirsize);460 xfree(dirsize); 459 461 } 460 462 … … 483 485 { 484 486 CHAR s[CCHMAXPATH + 81]; 485 487 RestorePresParams(hwnd, "DirSizes"); 486 488 sprintf(s, GetPString(IDS_DIRSIZETITLETEXT), pState->szDirName); 487 489 WinSetWindowText(hwnd, s); 490 } 491 { 492 SWP swp; 493 ULONG size = sizeof(SWP); 494 495 PrfQueryProfileData(fmprof, FM3Str, "DirSizes.Position", (PVOID) &swp, &size); 496 WinSetWindowPos(hwnd, 497 HWND_TOP, 498 swp.x, 499 swp.y, 500 swp.cx, 501 swp.cy, 502 swp.fl); 488 503 } 489 504 { … … 502 517 Runtime_Error(pszSrcFile, __LINE__, 503 518 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 504 free(dirsize);519 xfree(dirsize); 505 520 WinDismissDlg(hwnd, 0); 506 521 break; … … 614 629 return 0; 615 630 631 case WM_PRESPARAMCHANGED: 632 PresParamChanged(hwnd, "DirSizes", mp1, mp2); 633 break; 634 616 635 case WM_DRAWITEM: 617 636 if (mp2) { … … 638 657 p = strchr(pci->pszFileName, '\r'); 639 658 if (p) { 640 // draw text 641 if (!pci->cbFile) // no size 659 // draw text 660 if (*(pci->pszLongName + 1) == 1) // is root record 661 GpiSetColor(oi->hps, CLR_DARKRED); 662 else if (!pci->cbFile) // no size 642 663 GpiSetColor(oi->hps, CLR_DARKGRAY); 643 664 else if (!pci->easize) // no size below … … 654 675 pci->pszFileName, TXTBOX_COUNT, aptl); 655 676 boxHeight = aptl[TXTBOX_TOPRIGHT].y - aptl[TXTBOX_BOTTOMRIGHT].y; 656 boxHeight -= 6;677 boxHeight -= 4; 657 678 658 679 // Calculate nominal baseline of graph box … … 662 683 // Place text above graph box with a bit of whitespace between 663 684 ptl.x = oi->rclItem.xLeft; 664 ptl.y = yBottom + boxHeight + 8; // 03 Aug 07 SHL685 ptl.y = yBottom + boxHeight + 6; // 03 Aug 07 SHL 665 686 // GpiMove(oi->hps, &ptl); 666 687 GpiCharStringAt(oi->hps, &ptl, strlen(pci->pszFileName), … … 676 697 ptl.y = yBottom + 2; 677 698 GpiMove(oi->hps, &ptl); 678 ptl.x = oi->rclItem.xLeft + 101;699 ptl.x = oi->rclItem.xLeft + 201; 679 700 ptl.y = yBottom + boxHeight; 680 701 GpiBox(oi->hps, DRO_OUTLINE, &ptl, 0, 0); … … 684 705 ptl.y = yBottom + 3; 685 706 GpiMove(oi->hps, &ptl); 686 ptl.x = oi->rclItem.xLeft + 100;707 ptl.x = oi->rclItem.xLeft + 200; 687 708 ptl.y = yBottom + boxHeight - 1; 688 709 GpiBox(oi->hps, DRO_OUTLINEFILL, &ptl, 0, 0); … … 693 714 ptl.y = yBottom + 3; 694 715 GpiMove(oi->hps, &ptl); 695 ptl.x = oi->rclItem.xLeft + 100;716 ptl.x = oi->rclItem.xLeft + 200; 696 717 GpiLine(oi->hps, &ptl); 697 718 ptl.y = yBottom + boxHeight - 1; … … 710 731 ptl.y = yBottom + boxHeight; 711 732 GpiMove(oi->hps, &ptl); 712 ptl.x = oi->rclItem.xLeft + 103;733 ptl.x = oi->rclItem.xLeft + 203; 713 734 GpiLine(oi->hps, &ptl); 714 735 ptl.y = yBottom + boxHeight - 2; … … 727 748 else 728 749 GpiSetColor(oi->hps, CLR_RED); 729 ptl.x = oi->rclItem.xLeft + 1;750 ptl.x = oi->rclItem.xLeft + 2; 730 751 ptl.y = yBottom + 3; 731 752 GpiMove(oi->hps, &ptl); 732 ptl.x = oi->rclItem.xLeft + pci->flags ;753 ptl.x = oi->rclItem.xLeft + pci->flags * 2; 733 754 ptl.y = yBottom + boxHeight - 1; 734 755 GpiBox(oi->hps, DRO_OUTLINEFILL, &ptl, 0, 0); … … 750 771 GpiMove(oi->hps, &ptl); 751 772 } 752 ptl.x = oi->rclItem.xLeft + pci->flags ;773 ptl.x = oi->rclItem.xLeft + pci->flags * 2; 753 774 GpiLine(oi->hps, &ptl); 754 775 if (*(pci->pszLongName + 1) != 1) { … … 757 778 ptl.y = yBottom + 3; 758 779 GpiMove(oi->hps, &ptl); 759 ptl.x = oi->rclItem.xLeft + pci->flags ;780 ptl.x = oi->rclItem.xLeft + pci->flags * 2; 760 781 GpiLine(oi->hps, &ptl); 761 782 } … … 765 786 GpiSetColor(oi->hps, CLR_WHITE); 766 787 clr = CLR_WHITE; 767 for (x = 1; x < 10; x++) {768 if (clr == CLR_WHITE && x * 10 > pci->flags ) {788 for (x = 1; x < 20; x++) { 789 if (clr == CLR_WHITE && x * 10 > pci->flags * 2) { 769 790 clr = CLR_BLACK; 770 791 GpiSetColor(oi->hps, CLR_BLACK); … … 775 796 switch (x) { 776 797 case 1: 777 case 3: 798 case 3: 799 case 5: 778 800 case 7: 779 case 9: 801 case 9: 802 case 11: 803 case 13: 804 case 15: 805 case 17: 806 case 19: 780 807 ptl.y -= 1; 781 808 break; 782 case 5:809 case 10: 783 810 ptl.y -= 4; 784 811 break; … … 786 813 case 4: 787 814 case 6: 788 case 8: 815 case 8: 816 case 12: 817 case 14: 818 case 16: 819 case 18: 789 820 ptl.y -= 2; 790 821 break; … … 943 974 case DID_OK: 944 975 case DID_CANCEL: 976 { 977 SWP swp; 978 ULONG size = sizeof(SWP); 979 980 WinQueryWindowPos(hwnd, &swp); 981 PrfWriteProfileData(fmprof, FM3Str, "DirSizes.Position", (PVOID) &swp, 982 size); 983 } 945 984 pState = INSTDATA(hwnd); 946 985 if (!pState) … … 973 1012 WinDestroyPointer(pState->hptr); 974 1013 DosSleep(16); //05 Aug 07 GKY 33 975 free(pState); // Let's hope no one is still looking1014 xfree(pState); // Let's hope no one is still looking 976 1015 } 977 1016 DosPostEventSem(CompactSem); -
trunk/dll/draglist.c
r959 r985 19 19 21 Apr 07 SHL Avoid odd first time drag failure 20 20 12 May 07 SHL Use dcd->ulItemsToUnHilite 21 05 Jul 07 FreeDragInfoData: suppress PMERR_SOURCE_SAME_AS_TARGET notices21 05 Jul 07 SHL FreeDragInfoData: suppress PMERR_SOURCE_SAME_AS_TARGET notices 22 22 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat 23 29 Feb 08 GKY Use xmallocz where appropriate 23 24 24 25 ***********************************************************************/ … … 305 306 ulNumDIAlloc += 4L; 306 307 } 307 pDItem = xmalloc(sizeof(DRAGITEM), pszSrcFile, __LINE__); 308 // Create & Initialize DRAGITEM 309 pDItem = xmallocz(sizeof(DRAGITEM), pszSrcFile, __LINE__); 308 310 if (!pDItem) 309 311 break; // Already complained … … 322 324 pDImg->cyOffset = 0 + (ulNumfiles * 6); 323 325 } 324 // Initialize DRAGITEM325 memset(pDItem, 0, sizeof(DRAGITEM));326 326 pDItem->hwndItem = (hwndObj) ? hwndObj : hwndCnr; 327 327 pDItem->hwndItem = hwndCnr; … … 394 394 ulNumDIAlloc += 5L; 395 395 } 396 pDItem = xmalloc(sizeof(DRAGITEM), pszSrcFile, __LINE__); 396 // Create & Initialize DRAGITEM 397 pDItem = xmallocz(sizeof(DRAGITEM), pszSrcFile, __LINE__); 397 398 if (!pDItem) 398 399 break; 399 400 ppDItem[ulNumfiles] = pDItem; 400 401 dimgFakeIcon.hImage = hptrFile; 401 // Initialize DRAGITEM402 memset(pDItem, 0, sizeof(DRAGITEM));403 402 pDItem->hwndItem = (hwndObj) ? hwndObj : hwndCnr; 404 403 pDItem->hwndItem = hwndCnr; … … 435 434 pDItem->fsSupportedOps = DO_COPYABLE; 436 435 ulNumfiles++; 437 438 pDItem = xmalloc (sizeof(DRAGITEM), pszSrcFile, __LINE__);436 // Create & Initialize DRAGITEM 437 pDItem = xmallocz(sizeof(DRAGITEM), pszSrcFile, __LINE__); 439 438 if (pDItem) { 440 439 ppDItem[ulNumfiles] = pDItem; 441 440 dimgFakeIcon.hImage = hptrFile; 442 // Initialize DRAGITEM443 memset(pDItem, 0, sizeof(DRAGITEM));444 441 pDItem->hwndItem = (hwndObj) ? hwndObj : hwndCnr; 445 442 pDItem->hwndItem = hwndCnr; … … 641 638 ulNumDIAlloc += 4L; 642 639 } 643 pDItem = xmalloc(sizeof(DRAGITEM), pszSrcFile, __LINE__); 640 // Create & Initialize DRAGITEM 641 pDItem = xmallocz(sizeof(DRAGITEM), pszSrcFile, __LINE__); 644 642 if (!pDItem) 645 643 break; … … 656 654 pDImg->cyOffset = 0 + (ulNumfiles * 6); 657 655 } 658 memset(pDItem, 0, sizeof(DRAGITEM));659 656 pDItem->hwndItem = (hwndObj) ? hwndObj : hwnd; 660 // pDItem->hwndItem = hwnd;661 657 pDItem->ulItemID = (ULONG) ulSelect; 662 658 pDItem->hstrType = DrgAddStrHandle(DRT_UNKNOWN); -
trunk/dll/eas.c
r907 r985 21 21 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat 22 22 01 Sep 07 GKY Use xDosSetPathInfo to fix case where FS3 buffer crosses 64k boundry 23 29 Feb 08 GKY Use xfree where appropriate 23 24 24 25 ***********************************************************************/ … … 866 867 memcpy(pfea, pfealist->list, 867 868 pfealist->cbList - sizeof(ULONG)); 868 free(eap->current->pfea);869 xfree(eap->current->pfea); 869 870 eap->current->pfea = pfea; 870 871 eap->current->name = eap->current->pfea->szName; … … 880 881 } 881 882 } 882 free(s);883 xfree(s); 883 884 } 884 885 } … … 911 912 rc = xDosSetPathInfo(eap->filename, FIL_QUERYEASIZE, 912 913 &eaop, sizeof(eaop), DSPI_WRTTHRU); 913 free(pfealist);914 xfree(pfealist); 914 915 if (rc) 915 916 Dos_Error(MB_CANCEL, rc, hwnd, pszSrcFile, __LINE__, … … 919 920 if (eap->current == eap->head) { 920 921 eap->head = eap->head->next; 921 free(eap->current->pfea);922 free(eap->current);922 xfree(eap->current->pfea); 923 xfree(eap->current); 923 924 eap->current = NULL; 924 925 } … … 929 930 sSelect++; 930 931 info->next = eap->current->next; 931 free(eap->current->pfea);932 free(eap->current);932 xfree(eap->current->pfea); 933 xfree(eap->current); 933 934 eap->current = NULL; 934 935 break; … … 986 987 if (eap->head) 987 988 Free_FEAList(eap->head); 988 free(eap);989 xfree(eap); 989 990 if (hptrIcon) 990 991 WinDestroyPointer(hptrIcon); … … 1275 1276 } 1276 1277 } 1277 free(pfealist);1278 xfree(pfealist); 1278 1279 } 1279 free(pgealist);1280 xfree(pgealist); 1280 1281 } 1281 1282 ulEntry += ulCount; 1282 1283 } // while 1283 free(pdena);1284 xfree(pdena); 1284 1285 DosPostEventSem(CompactSem); 1285 1286 } … … 1349 1350 } 1350 1351 else 1351 free(pfealist);1352 xfree(pfealist); 1352 1353 } 1353 1354 else { 1354 free(pfealist);1355 xfree(pfealist); 1355 1356 if (!silentfail) { 1356 1357 if (rc == ERROR_ACCESS_DENIED … … 1362 1363 pdena->szName); 1363 1364 if (rc == MBID_CANCEL) { 1364 free(pgealist);1365 xfree(pgealist); 1365 1366 break; 1366 1367 } … … 1377 1378 } 1378 1379 } 1379 free(pgealist);1380 xfree(pgealist); 1380 1381 } 1381 1382 ulEntry += ulCount; 1382 1383 } // while 1383 free(pdena);1384 xfree(pdena); 1384 1385 DosPostEventSem(CompactSem); 1385 1386 } … … 1398 1399 /* Free linked list */ 1399 1400 next = pFEA->next; 1400 free(pFEA->pfea);1401 free(pFEA);1401 xfree(pFEA->pfea); 1402 xfree(pFEA); 1402 1403 pFEA = next; 1403 1404 } -
trunk/dll/filldir.c
r924 r985 40 40 13 Aug 07 SHL Move #pragma alloc_text to end for OpenWatcom compat 41 41 04 Nov 07 GKY Use commaFmtULL to display large file sizes 42 29 Feb 08 GKY Use xfree where appropriate 42 43 43 44 ***********************************************************************/ … … 306 307 pci->pszSubject = xstrdup(value + (sizeof(USHORT) * 2), pszSrcFile, __LINE__); 307 308 } 308 free(pfealist);309 } 310 free(pgealist);309 xfree(pfealist); 310 } 311 xfree(pgealist); 311 312 } 312 313 } … … 353 354 pci->pszLongName = xstrdup(value + (sizeof(USHORT) * 2), pszSrcFile, __LINE__); 354 355 } 355 free(pfealist);356 } 357 free(pgealist);356 xfree(pfealist); 357 } 358 xfree(pgealist); 358 359 } 359 360 } … … 535 536 pci->pszSubject = xstrdup(value + (sizeof(USHORT) * 2), pszSrcFile, __LINE__); 536 537 } 537 free(pfealist);538 } 539 free(pgealist);538 xfree(pfealist); 539 } 540 xfree(pgealist); 540 541 } 541 542 } … … 583 584 } 584 585 } 585 free(pfealist);586 } 587 free(pgealist);586 xfree(pfealist); 587 } 588 xfree(pgealist); 588 589 } 589 590 } … … 903 904 904 905 DosFindClose(hdir); 905 906 if (paffbFound) { 907 free(paffbFound); 908 paffbFound = NULL; 909 } 910 if (papffbSelected) { 911 free(papffbSelected); 912 papffbSelected = NULL; 913 } 906 xfree(paffbFound); 907 paffbFound = NULL; 908 xfree(papffbSelected); 909 papffbSelected = NULL; 914 910 915 911 if (ulTotal && paffbTotal) { … … 998 994 } 999 995 Abort: 1000 if (paffbTotal) 1001 free(paffbTotal); 1002 if (pszFileSpec) 1003 free(pszFileSpec); 1004 if (paffbFound) 1005 free(paffbFound); 1006 if (papffbSelected) 1007 free(papffbSelected); 996 xfree(paffbTotal); 997 xfree(pszFileSpec); 998 xfree(paffbFound); 999 xfree(papffbSelected); 1008 1000 1009 1001 if (recurse) { -
trunk/dll/filter.c
r907 r985 14 14 22 Mar 07 GKY Use QWL_USER 15 15 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat 16 29 Feb 08 GKY Use xfree where appropriate 16 17 17 18 ***********************************************************************/ … … 153 154 } 154 155 else 155 free(info);156 xfree(info); 156 157 } 157 158 } … … 217 218 } 218 219 else 219 free(info);220 xfree(info); 220 221 } 221 222 } … … 237 238 else 238 239 maskhead = info->next; 239 free(info->mask);240 free(info);240 xfree(info->mask); 241 xfree(info); 241 242 break; 242 243 } -
trunk/dll/flesh.c
r924 r985 19 19 06 Aug 07 GKY Reduce DosSleep times (ticket 148) 20 20 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat 21 29 Feb 08 GKY Use xfree where appropriate 21 22 22 23 ***********************************************************************/ … … 134 135 } 135 136 } 136 if (var) 137 free(var); 137 xfree(var); 138 138 pciL = (PCNRITEM) WinSendMsg(hwndCnr, 139 139 CM_QUERYRECORD, -
trunk/dll/fm3dlg.h
r917 r985 19 19 21 Aug 07 GKY Make Subject column in dircnr sizable and movable from the right to the left pane 20 20 11 Jan 08 SHL Correct all to 3 column tabs since dialog editors assume this 21 29 Feb 08 GKY Changes to enable user settable command line length 21 22 22 23 ***********************************************************************/ … … 635 636 #define CFGG_CONFIRMTARGET 25214 636 637 #define CFGG_TARGETDIR 25215 637 638 #define CFGB_FRAME 25250 638 #define CFGG_CMDLNLNGTH 25216 639 640 #define CFGB_FRAME 25250 639 641 #define CFGB_TOOLBARHELP 25251 640 642 #define CFGB_DRIVEBARHELP 25252 -
trunk/dll/fm3dll.h
r953 r985 78 78 12 Jan 08 SHL Localize SpecialSelect to comp.c 79 79 14 Feb 08 SHL Refactor CfgDlgProc to notebook.h 80 29 Feb 08 GKY Refactor global command line variables to notebook.h 80 81 81 82 ***********************************************************************/ … … 687 688 HAPP Exec(HWND hwndNotify, BOOL child, char *startdir, char *env, 688 689 PROGTYPE * progt, ULONG fl, char *formatstring, ...); 689 #define MAXCOMLINESTRG (2048) /* used to build command line strings */690 690 #define RUNTYPE_MASK 0xf 691 691 #define SYNCHRONOUS 1 … … 1179 1179 *WPProgram, *FM3Folder, *FM3Tools; 1180 1180 DATADEF RGB2 RGBGREY, RGBBLACK; 1181 DATADEF CHAR archiverbb2[CCHMAXPATH], StopPrinting, profile[CCHMAXPATH]; 1181 DATADEF CHAR archiverbb2[CCHMAXPATH], StopPrinting, profile[CCHMAXPATH], extractpath[CCHMAXPATH], 1182 lastextractpath[CCHMAXPATH]; 1182 1183 DATADEF CHAR appname[12], realappname[12]; 1183 DATADEF CHAR editor[MAXCOMLINESTRG], viewer[MAXCOMLINESTRG], virus[MAXCOMLINESTRG], 1184 compare[MAXCOMLINESTRG], extractpath[CCHMAXPATH], 1185 lastextractpath[CCHMAXPATH], lasttoolbox[CCHMAXPATH], 1186 HomePath[CCHMAXPATH], SwapperDat[CCHMAXPATH], 1187 binview[MAXCOMLINESTRG], bined[MAXCOMLINESTRG], printer[CCHMAXPATH], 1188 dircompare[MAXCOMLINESTRG], szDefArc[CCHMAXPATH], 1189 ftprun[MAXCOMLINESTRG], ftprundir[CCHMAXPATH], httprun[MAXCOMLINESTRG], 1190 httprundir[CCHMAXPATH], mailrundir[CCHMAXPATH], 1191 mailrun[MAXCOMLINESTRG], targetdir[CCHMAXPATH]; 1184 DATADEF CHAR lasttoolbox[CCHMAXPATH], HomePath[CCHMAXPATH], 1185 SwapperDat[CCHMAXPATH], printer[CCHMAXPATH], szDefArc[CCHMAXPATH]; 1192 1186 DATADEF HMODULE FM3DllHandle, FM3ModHandle; 1193 1187 DATADEF CHAR *quicktool[50]; -
trunk/dll/fm3res.dlg
r929 r985 31 31 21 Aug 07 GKY Make Subject column in dircnr sizable and movable from the rigth to the left pane 32 32 12 Jan 08 SHL Rework WALK_FRAME 33 29 Feb 08 GKY Changes to enable user settable command line length 34 29 Feb 08 GKY Add presparams & update appearence of "Sizes" dialog 33 35 34 36 ***********************************************************************/ … … 2538 2540 PUSHBUTTON "~Expand", DSZ_EXPAND, 48, 4, 44, 14, 2539 2541 BS_NOPOINTERFOCUS 2540 PUSHBUTTON "~Help", IDM_HELP, 96, 4, 40, 14, BS_NOPOINTERFOCUS2541 PUSHBUTTON "~Collapse", DSZ_COLLAPSE, 140, 4, 44, 14,2542 BS_NOPOINTERFOCUS 2543 PUSHBUTTON "~Save", DSZ_PRINT, 1 88, 4, 44, 14,2542 PUSHBUTTON "~Help", IDM_HELP, 192, 4, 40, 14, BS_NOPOINTERFOCUS 2543 PUSHBUTTON "~Collapse", DSZ_COLLAPSE, 96, 4, 44, 14, 2544 BS_NOPOINTERFOCUS 2545 PUSHBUTTON "~Save", DSZ_PRINT, 144, 4, 44, 14, 2544 2546 BS_NOPOINTERFOCUS 2545 2547 PUSHBUTTON "Cancel", DID_CANCEL, 337, 4, 40, 14, … … 2764 2766 AUTOCHECKBOX "FM/~2 deletes dragged items", CFGG_FM2DELETES, 122, 2765 2767 68, 130, 10 2768 LTEXT "Command line length", -1, 122, 56, 60, 10, NOT WS_GROUP 2769 CONTROL "", CFGG_CMDLNLNGTH, 184, 56, 44, 10, WC_SPINBUTTON, 2770 SPBS_NUMERICONLY | SPBS_MASTER | SPBS_SERVANT | 2771 SPBS_JUSTCENTER | WS_TABSTOP | SPBS_FASTSPIN | 2772 WS_VISIBLE 2766 2773 PUSHBUTTON "~Help", IDM_HELP, 4, 4, 40, 14, BS_NOPOINTERFOCUS | 2767 2774 WS_GROUP -
trunk/dll/grep.c
r948 r985 28 28 21 Sep 07 GKY Fix trap on search that includes filenames that exceed maxpath 29 29 07 Feb 08 SHL Use ITIMER_DESC to control sleeps and reporting 30 29 Feb 08 GKY Use xfree where appropriate 30 31 31 32 ***********************************************************************/ … … 578 579 // Complain if pathnames exceeds max 579 580 DosFindClose(findHandle); 580 free(pffbArray);581 xfree(pffbArray); 581 582 if (!fDone) { 582 583 fDone = TRUE; … … 607 608 else if (!InsertDupe(grep, szFindPath, pffbFile)) { 608 609 DosFindClose(findHandle); 609 free(pffbArray);610 xfree(pffbArray); 610 611 return 1; 611 612 } … … 633 634 } 634 635 635 free(pffbArray);636 xfree(pffbArray); 636 637 return 0; 637 638 } … … 762 763 pszSrcFile, __LINE__); 763 764 if (!grep->dir) { 764 free(grep->insertffb);765 xfree(grep->insertffb); 765 766 return FALSE; 766 767 } … … 775 776 grep->dir[grep->toinsert] = xstrdup(szDirectory, pszSrcFile, __LINE__); 776 777 if (!grep->dir) { 777 free(grep->insertffb[grep->toinsert]);778 xfree(grep->insertffb[grep->toinsert]); 778 779 return FALSE; 779 780 } … … 992 993 fclose(inputFile); 993 994 } 994 free(input);995 xfree(input); 995 996 // DosSleep(1); // 07 Feb 08 SHL 996 997 } … … 1106 1107 // DosSleep(1); // 07 Feb 08 SHL 1107 1108 } 1108 free(buffer);1109 xfree(buffer); 1109 1110 } 1110 1111 return CRC; … … 1124 1125 } 1125 1126 grep->dupehead = grep->dupelast = NULL; 1126 if (grep->dupenames) 1127 free(grep->dupenames); 1128 if (grep->dupesizes) 1129 free(grep->dupesizes); 1127 xfree(grep->dupenames); 1128 xfree(grep->dupesizes); 1130 1129 grep->dupesizes = grep->dupenames = NULL; 1131 1130 } … … 1474 1473 WinSetWindowText(hwndStatus, GetPString(IDS_GREPDUPECOMPARINGTEXT)); 1475 1474 x = y = 0; 1476 if (grep->dupenames) { 1477 free(grep->dupenames); 1478 grep->dupenames = NULL; 1479 } 1480 if (grep->dupesizes) { 1481 free(grep->dupesizes); 1482 grep->dupesizes = NULL; 1483 } 1475 xfree(grep->dupenames); 1476 grep->dupenames = NULL; 1477 xfree(grep->dupesizes); 1478 grep->dupesizes = NULL; 1484 1479 1485 1480 InitITimer(pitdSleep, 0); // Reset rate estimator … … 1595 1590 info->name = xstrdup(dir, pszSrcFile, __LINE__); 1596 1591 if (!info->name) { 1597 free(info);1592 xfree(info); 1598 1593 return FALSE; 1599 1594 } -
trunk/dll/grep2.c
r948 r985 20 20 06 Aug 07 GKY Reduce DosSleep times (ticket 148) 21 21 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat 22 29 Feb 08 GKY Use xfree where appropriate 22 23 23 24 fixme for more excess locals to be gone … … 823 824 DosBeep(50, 100); 824 825 WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, GREP_MASK)); 825 free(p);826 xfree(p); 826 827 break; 827 828 } … … 922 923 Runtime_Error(pszSrcFile, __LINE__, 923 924 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 924 free(p);925 xfree(p); 925 926 WinDismissDlg(hwnd, 0); 926 927 break; 927 928 } 928 929 DosSleep(100); //05 Aug 07 GKY 128 929 free(p);930 xfree(p); 930 931 } 931 932 if (changed) { -
trunk/dll/info.c
r907 r985 24 24 27 Sep 07 SHL Correct ULONGLONG size formatting 25 25 30 Dec 07 GKY Use CommaFmtULL 26 29 Feb 08 GKY Use xfree where appropriate 26 27 27 28 ***********************************************************************/ … … 463 464 if (pis->lasthwndMenu) 464 465 WinDestroyWindow(pis->lasthwndMenu); 465 free(pis);466 xfree(pis); 466 467 return oldproc(hwnd, msg, mp1, mp2); 467 468 } … … 882 883 case WM_DESTROY: 883 884 pfs = WinQueryWindowPtr(hwnd, QWL_USER); 884 if (pfs) 885 free(pfs); 885 xfree(pfs); 886 886 break; 887 887 } -
trunk/dll/inis.c
r914 r985 25 25 09 Jan 08 SHL Standardize PrfOpenProfile return checks 26 26 09 Jan 08 SHL Use CloseProfile to avoid spurious system INI closes 27 29 Feb 08 GKY Use xfree where appropriate 27 28 28 29 ***********************************************************************/ … … 212 213 app2 : inirec->app), 213 214 pCurrentK, pData, ulSize); 214 free(pData); /* free data */215 xfree(pData); /* free data */ 215 216 } 216 217 } … … 220 221 } 221 222 } 222 free(pDataK); /* free keynames */223 xfree(pDataK); /* free keynames */ 223 224 } 224 225 } … … 256 257 inirec->key2 : inirec->key), 257 258 pData, ulSize); 258 free(pData); /* free data */259 xfree(pData); /* free data */ 259 260 } 260 261 } … … 291 292 PostMsg(inirec->hwndSource, WM_COMMAND, MPFROM2SHORT(INI_REFRESH, 0), 292 293 MPVOID); 293 free(inirec);294 xfree(inirec); 294 295 } 295 296 } … … 316 317 WinTerminate(hab2); 317 318 } 318 free(inirec);319 xfree(inirec); 319 320 } 320 321 } … … 402 403 pCurrentK, pData, 403 404 ulSize); 404 free(pData); /* free data */405 xfree(pData); /* free data */ 405 406 } 406 407 } … … 410 411 } 411 412 } 412 free(pDataK); /* free keynames */413 xfree(pDataK); /* free keynames */ 413 414 } 414 415 } … … 418 419 } 419 420 } 420 free(pDataA); /* free applnames */421 xfree(pDataA); /* free applnames */ 421 422 } 422 423 } … … 430 431 WinTerminate(hab2); 431 432 } 432 free(prfp->pszUserName);433 free(prfp->pszSysName);434 free(prfp);433 xfree(prfp->pszUserName); 434 xfree(prfp->pszSysName); 435 xfree(prfp); 435 436 } 436 437 } … … 465 466 WinEnableWindowUpdate(hwndList, TRUE); 466 467 } 467 free(pData);468 xfree(pData); 468 469 } 469 470 } … … 524 525 Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__, 525 526 "PrfQueryProfileString"); 526 free(pData);527 xfree(pData); 527 528 } 528 529 else { … … 1315 1316 fixup(inidata->data, p, l, inidata->datalen); 1316 1317 WinSetDlgItemText(hwnd, IAD_DATA, p); 1317 free(p);1318 xfree(p); 1318 1319 } 1319 1320 } … … 1478 1479 hINI = PrfOpenProfile(useHab, filename); 1479 1480 if (hINI == NULLHANDLE) { 1480 free(filename);1481 xfree(filename); 1481 1482 return (HWND) 0; 1482 1483 } … … 1528 1529 PostMsg(hwndClient, UM_INITIALSIZE, MPVOID, MPVOID); 1529 1530 } 1530 else if (filename)1531 free(filename);1531 else 1532 xfree(filename); 1532 1533 return hwndFrame; 1533 1534 } … … 2026 2027 inidata->hini = PrfOpenProfile(WinQueryAnchorBlock(hwnd), 2027 2028 inidata->ininame); 2028 free(mp1);2029 xfree(mp1); 2029 2030 } 2030 2031 else … … 2156 2157 strcpy(inidata->keyname, keyname); 2157 2158 strcpy(inidata->applname, applname); 2158 if (inidata->data) 2159 free(inidata->data); 2159 xfree(inidata->data); 2160 2160 inidata->data = GetKeyData(WinWindowFromID(hwnd, 2161 2161 INI_DATALIST), … … 2344 2344 Runtime_Error(pszSrcFile, __LINE__, 2345 2345 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 2346 free(inirec);2346 xfree(inirec); 2347 2347 } 2348 2348 } … … 2364 2364 Runtime_Error(pszSrcFile, __LINE__, 2365 2365 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 2366 free(inirec);2366 xfree(inirec); 2367 2367 } 2368 2368 } … … 2404 2404 IntraIniProc, 2405 2405 FM3ModHandle, INII_FRAME, (PVOID) inirec)) { 2406 free(inirec);2406 xfree(inirec); 2407 2407 break; 2408 2408 } … … 2410 2410 Runtime_Error(pszSrcFile, __LINE__, 2411 2411 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 2412 free(inirec);2412 xfree(inirec); 2413 2413 } 2414 2414 } … … 2448 2448 xstrdup(inidata->ininame, pszSrcFile, __LINE__); 2449 2449 if (!prfp->pszUserName) 2450 free(prfp);2450 xfree(prfp); 2451 2451 else { 2452 2452 prfp->cchUserName = strlen(prfp->pszUserName); 2453 2453 prfp->pszSysName = xstrdup(filename, pszSrcFile, __LINE__); 2454 2454 if (!prfp->pszSysName) { 2455 free(prfp->pszUserName);2456 free(prfp);2455 xfree(prfp->pszUserName); 2456 xfree(prfp); 2457 2457 } 2458 2458 else { … … 2462 2462 Runtime_Error(pszSrcFile, __LINE__, 2463 2463 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 2464 free(prfp->pszSysName);2465 free(prfp->pszUserName);2466 free(prfp);2464 xfree(prfp->pszSysName); 2465 xfree(prfp->pszUserName); 2466 xfree(prfp); 2467 2467 } 2468 2468 else … … 2763 2763 if (inidata->hini != NULLHANDLE && *inidata->ininame) 2764 2764 CloseProfile(inidata->hini, FALSE); 2765 if (inidata->data) 2766 free(inidata->data); 2765 xfree(inidata->data); 2767 2766 if (inidata->hwndPopup) 2768 2767 WinDestroyWindow(inidata->hwndPopup); 2769 free(inidata);2768 xfree(inidata); 2770 2769 } 2771 2770 if (!dontclose && -
trunk/dll/init.c
r952 r985 41 41 13 Jan 08 GKY Get Subjectwidth/Subjectleft working in the collector. 42 42 12 Feb 08 SHL Compile OpenWatcom version into binary 43 29 Feb 08 GKY Changes to enable user settable command line length 44 29 Feb 08 GKY Refactor global command line variables to notebook.h 43 45 44 46 ***********************************************************************/ … … 71 73 #include "strutil.h" // GetPString 72 74 #include "fm3dll.h" 75 #include "notebook.h" // command line variables (editor etc) 73 76 74 77 #ifdef __IBMC__ … … 90 93 91 94 static PSZ pszSrcFile = __FILE__; 95 96 BOOL CheckFileHeader(CHAR *filespec, CHAR *signature, LONG offset); 92 97 93 98 VOID FindSwapperDat(VOID) … … 709 714 } 710 715 else { 716 if (!CheckFileHeader(inipath, "\xff\xff\xff\xff\x14\x00\x00\x00", 0L)) 717 saymsg(MB_ENTER,HWND_DESKTOP,DEBUG_STRING, "Check INI header failed"); 711 718 fIniExisted = TRUE; 712 719 if (fs3.attrFile & (FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM)) { … … 951 958 ulCnrType = CCS_EXTENDSEL; 952 959 FilesToGet = FILESTOGET_MIN; 960 MaxComLineStrg = MAXCOMLINESTRGDEFAULT; 953 961 AutoviewHeight = 48; 954 962 strcpy(printer, "PRN"); … … 975 983 976 984 // load preferences from profile (INI) file 985 size = sizeof(ULONG); 986 PrfQueryProfileData(fmprof, appname, "MaxComLineStrg", &MaxComLineStrg, &size); 987 if (MaxComLineStrg < CMDLNLNGTH_MIN) 988 MaxComLineStrg = CMDLNLNGTH_MIN; 989 else if (MaxComLineStrg > CMDLNLNGTH_MAX) 990 MaxComLineStrg = CMDLNLNGTH_MAX; 991 editor = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 992 if (!editor) 993 return 0; //already complained 994 viewer = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 995 if (!viewer) 996 return 0; //already complained 997 virus = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 998 if (!virus) 999 return 0; //already complained 1000 compare = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 1001 if (!compare) 1002 return 0; //already complained 1003 binview = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 1004 if (!binview) 1005 return 0; //already complained 1006 bined = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 1007 if (!bined) 1008 return 0; //already complained 1009 dircompare = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 1010 if (!dircompare) 1011 return 0; //already complained 1012 ftprun = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 1013 if (!ftprun) 1014 return 0; //already complained 1015 httprun = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 1016 if (!httprun) 1017 return 0; //already complained 1018 mailrun = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 1019 if (!mailrun) 1020 return 0; //already complained 977 1021 size = sizeof(BOOL); 978 1022 PrfQueryProfileData(fmprof, appname, "ShowTarget", &fShowTarget, &size); … … 1186 1230 size = sizeof(printer); 1187 1231 PrfQueryProfileData(fmprof, appname, "Printer", printer, &size); 1188 size = sizeof(dircompare);1232 size = MaxComLineStrg; 1189 1233 PrfQueryProfileData(fmprof, appname, "DirCompare", dircompare, 1190 1234 &size); 1191 size = sizeof(viewer);1235 size = MaxComLineStrg; 1192 1236 PrfQueryProfileData(fmprof, appname, "Viewer", viewer, &size); 1193 size = sizeof(editor);1237 size = MaxComLineStrg; 1194 1238 PrfQueryProfileData(fmprof, appname, "Editor", editor, &size); 1195 size = sizeof(binview);1239 size = MaxComLineStrg; 1196 1240 PrfQueryProfileData(fmprof, appname, "BinView", binview, &size); 1197 size = sizeof(bined);1241 size = MaxComLineStrg; 1198 1242 PrfQueryProfileData(fmprof, appname, "BinEd", bined, &size); 1199 size = sizeof(compare);1243 size = MaxComLineStrg; 1200 1244 PrfQueryProfileData(fmprof, appname, "Compare", compare, &size); 1201 size = sizeof(virus);1245 size = MaxComLineStrg; 1202 1246 PrfQueryProfileData(fmprof, appname, "Virus", virus, &size); 1203 1247 size = sizeof(BOOL); 1204 1248 PrfQueryProfileData(fmprof, appname, "FtpRunWPSDefault", &fFtpRunWPSDefault, &size); 1205 size = sizeof(ftprun);1249 size = MaxComLineStrg; 1206 1250 PrfQueryProfileData(fmprof, appname, "FTPRun", ftprun, &size); 1207 1251 if (!*ftprun) … … 1209 1253 size = sizeof(BOOL); 1210 1254 PrfQueryProfileData(fmprof, appname, "HttpRunWPSDefault", &fHttpRunWPSDefault, &size); 1211 size = sizeof(httprun);1255 size = MaxComLineStrg; 1212 1256 PrfQueryProfileData(fmprof, appname, "HTTPRun", httprun, &size); 1213 1257 if (!*httprun) 1214 1258 fHttpRunWPSDefault = TRUE; 1215 size = sizeof(mailrun);1259 size = MaxComLineStrg; 1216 1260 PrfQueryProfileData(fmprof, appname, "MailRun", mailrun, &size); 1217 1261 size = sizeof(ftprundir); … … 1442 1486 } 1443 1487 1488 BOOL CheckFileHeader(CHAR *filespec, CHAR *signature, LONG offset) 1489 { 1490 HFILE handle; 1491 ULONG action; 1492 ULONG len = strlen(signature); 1493 ULONG l; 1494 // CHAR buffer[80]; 1495 CHAR buffer[4096]; // 06 Oct 07 SHL Protect against NTFS defect 1496 BOOL ret = FALSE; 1497 1498 DosError(FERR_DISABLEHARDERR); 1499 if (DosOpen(filespec, 1500 &handle, 1501 &action, 1502 0, 1503 0, 1504 OPEN_ACTION_FAIL_IF_NEW | 1505 OPEN_ACTION_OPEN_IF_EXISTS, 1506 OPEN_FLAGS_FAIL_ON_ERROR | 1507 OPEN_FLAGS_NOINHERIT | 1508 OPEN_FLAGS_RANDOMSEQUENTIAL | 1509 OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY, 0)) 1510 ret = FALSE; 1511 else { 1512 // Try signature match 1513 l = len; 1514 l = min(l, 79); 1515 if (!DosChgFilePtr(handle, 1516 abs(offset), 1517 (offset >= 0) ? 1518 FILE_BEGIN : FILE_END, &len)) { 1519 if (!DosRead(handle, buffer, l, &len) && len == l) { 1520 if (!memcmp(signature, buffer, l)) 1521 ret = TRUE; // Matched 1522 } 1523 } 1524 } 1525 DosClose(handle); /* Either way, we're done for now */ 1526 return ret; /* Return TRUE if matched */ 1527 } 1528 1444 1529 int CheckVersion(int vermajor, int verminor) 1445 1530 { -
trunk/dll/ipf/context.ipf
r555 r985 10 10 .* 01 Sep 06 GKY ADD new partition disks information 11 11 .* 03 Mar 07 GKY Update that file systems other than HPFS support long names 12 .* 29 Feb 08 GKY Document unhide menu item 12 13 .* 13 14 .*********************************************************************** … … 188 189 :hp6.Hide objects:ehp6. hides objects (removes them from view in the 189 190 container) until you rescan, use the :link reftype=hd res=93400.Filter 190 dialog:elink. or switch directories. 191 :artwork runin name='\bitmaps\file.bmp'. :artwork runin name='\bitmaps\fldr.bmp'. :artwork runin name='\bitmaps\drive.bmp'. 191 dialog:elink. or switch directories or use Unhide (see below). 192 :artwork runin name='\bitmaps\file.bmp'. :artwork runin name='\bitmaps\fldr.bmp'. 193 :p. 194 :hp6.Unhide objects:ehp6. unhides objects (restores them from view in the container) 195 Unhide doesn't unhide items that are filtered by the current mask or attribute filters 196 :artwork runin name='\bitmaps\file.bmp'. :artwork runin name='\bitmaps\fldr.bmp'. 192 197 :p. 193 198 :artwork name='..\..\bitmaps\playmm.bmp' align=center. -
trunk/dll/literal.c
r959 r985 17 17 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat 18 18 16 Nov 07 SHL Report fixup buffer overflow 19 29 Feb 08 GKY Use xfree where appropriate 19 20 20 21 ***********************************************************************/ … … 192 193 cBufBytes = pszOut - pszWork; /* Calc string length excluding terminator */ 193 194 memcpy(pszBuf, pszWork, cBufBytes + 1); /* Overwrite including terminator */ 194 free(pszWork);195 xfree(pszWork); 195 196 196 197 return cBufBytes; /* Return string length */ -
trunk/dll/mainwnd.c
r981 r985 54 54 19 Feb 08 JBS Stop deleting "State at last FM/2 Close" from INI file so it be accessed from States combo box. 55 55 22 Feb 08 JBS Ticket 230: Fix/improve various code related to state or presparam values in the INI file. 56 29 Feb 08 GKY Use xfree where appropriate 56 57 57 58 ***********************************************************************/ … … 180 181 WinEnableWindow(WinQueryWindow(hwndMain, QW_PARENT), TRUE); 181 182 fNoTileUpdate = FALSE; 182 if (mp1) 183 free((char *)mp1); 183 xfree((char *)mp1); 184 184 if (fAutoTile) 185 185 TileChildren(hwndMain, TRUE); … … 510 510 WinSetMultWindowPos(WinQueryAnchorBlock(hwnd), &swp[2], numtools); 511 511 } 512 free(swp);512 xfree(swp); 513 513 } 514 514 WinInvalidateRect(hwnd, NULL, TRUE); … … 1004 1004 } 1005 1005 } 1006 free(s);1006 xfree(s); 1007 1007 } 1008 1008 } … … 1606 1606 SEPARATEKEEP : SEPARATE), 1607 1607 directory, list, NULL, pszSrcFile, __LINE__); 1608 if (list) 1609 free(list); 1608 xfree(list); 1610 1609 WinDestroyWindow(hwnd); 1611 1610 break; … … 6234 6233 MPFROMP(pszStateName), 6235 6234 MPVOID)) { 6236 free(pszStateName);6235 xfree(pszStateName); 6237 6236 } 6238 6237 } … … 6308 6307 if (!PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMP(pszDefaultStateName), MPVOID)) 6309 6308 // 05 Feb 08 SHL fixme to complain? 6310 free(pszDefaultStateName);6309 xfree(pszDefaultStateName); 6311 6310 } 6312 6311 } -
trunk/dll/mainwnd2.c
r953 r985 23 23 19 Jan 08 GKY Rework Utilities menu 24 24 14 Feb 08 SHL Rework to support settings menu conditional cascade 25 29 Feb 08 GKY Use xfree where appropriate 25 26 26 27 ***********************************************************************/ … … 1347 1348 hwndMain = (HWND) 0; 1348 1349 pd = WinQueryWindowPtr(hwnd, QWL_USER + 4); 1349 if (pd) 1350 free(pd); 1350 xfree(pd); 1351 1351 if (!PostMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID)) 1352 1352 WinSendMsg((HWND) 0, WM_QUIT, MPVOID, MPVOID); -
trunk/dll/makelist.c
r907 r985 14 14 06 Apr 07 GKY Work around PM DragInfo and DrgFreeDISH limits 15 15 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat 16 29 Feb 08 GKY Use xfree where appropriate 16 17 17 18 ***********************************************************************/ … … 68 69 { 69 70 if (li) { 70 if (li->ulitemID) 71 free(li->ulitemID); 72 if (li->cbFile) 73 free(li->cbFile); 71 xfree(li->ulitemID); 72 xfree(li->cbFile); 74 73 if (li->list) 75 74 FreeList(li->list); 76 free(li);75 xfree(li); 77 76 } 78 77 } … … 92 91 _heap_check(); 93 92 #endif 94 free(list);93 xfree(list); 95 94 } 96 95 DosPostEventSem(CompactSem); -
trunk/dll/menu.c
r907 r985 13 13 29 Jul 06 SHL Use xfgets_bstripcr 14 14 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat 15 29 Feb 08 GKY Use xfree where appropriate 15 16 16 17 ***********************************************************************/ … … 67 68 while (info) { 68 69 next = info->next; 69 if (info->text) 70 free(info->text); 71 free(info); 70 xfree(info->text); 71 xfree(info); 72 72 info = next; 73 73 } … … 107 107 info->text = xstrdup(tokens[2], pszSrcFile, __LINE__); 108 108 if (!info->text) 109 free(info);109 xfree(info); 110 110 else { 111 111 if (!stricmp(tokens[0], "MENUITEM")) … … 115 115 else { 116 116 /* error! */ 117 free(info->text);118 free(info);117 xfree(info->text); 118 xfree(info); 119 119 info = NULL; 120 120 } -
trunk/dll/misc.c
r960 r985 40 40 xx Jan 08 JBS Ticket 150: fix/improve save and restore of dir cnr state at FM/2 close/reopen 41 41 21 Jan 08 GKY Stop reallocating NullStr by direct editing of empty subject and longname strings. 42 29 Feb 08 GKY Use xfree where appropriate 42 43 43 44 ***********************************************************************/ … … 225 226 } 226 227 } 227 free(s);228 xfree(s); 228 229 } 229 230 if (releaseme) … … 844 845 if (!PostMsg(hwnd, 845 846 UM_FIXEDITNAME, MPVOID, MPFROMP(filename))) 846 free(filename);847 xfree(filename); 847 848 } 848 849 if (stricmp(testname, pci->pszFileName)) { … … 852 853 if (!PostMsg(hwnd, 853 854 UM_FIXEDITNAME, MPVOID, MPFROMP(filename))) 854 free(filename);855 xfree(filename); 855 856 } 856 857 } … … 2012 2013 GetPString(IDS_SUBJ) : GetPString(IDS_NAME)); 2013 2014 WinSetWindowText(hwnd, s); 2014 free(s);2015 xfree(s); 2015 2016 } 2016 2017 } … … 2031 2032 !(flWindowAttr & CV_TEXT)) ? GetPString(IDS_MINI) : NullStr); 2032 2033 WinSetWindowText(hwnd, s); 2033 free(s);2034 xfree(s); 2034 2035 } 2035 2036 } … … 2051 2052 sprintf(s, "F:%s", GetPString(IDS_ALLTEXT)); 2052 2053 WinSetWindowText(hwnd, s); 2053 free(s);2054 xfree(s); 2054 2055 } 2055 2056 } … … 2196 2197 } 2197 2198 numswitches = y; 2198 free(pswb);2199 xfree(pswb); 2199 2200 DosPostEventSem(CompactSem); 2200 2201 } -
trunk/dll/mkdir.c
r907 r985 10 10 11 11 01 Aug 04 SHL Baseline 12 29 Feb 08 GKY Refactor global command line variables to notebook.h 12 13 13 14 ***********************************************************************/ … … 24 25 #include "errutil.h" // Dos_Error... 25 26 #include "strutil.h" // GetPString 27 #include "notebook.h" // targetdirectoy 26 28 #include "fm3dll.h" 27 29 -
trunk/dll/mle.c
r907 r985 18 18 26 Aug 07 GKY DosSleep(1) in loops changed to (0) 19 19 17 Dec 07 GKY Make WPURLDEFAULTSETTINGS the fall back for ftp/httprun 20 29 Feb 08 GKY Refactor global command line variables to notebook.h 21 29 Feb 08 GKY Use xfree where appropriate 20 22 21 23 ***********************************************************************/ … … 36 38 #include "errutil.h" // Dos_Error... 37 39 #include "strutil.h" // GetPString 40 #include "notebook.h" // httprun etc 38 41 #include "fm3dll.h" 39 42 … … 247 250 Dos_Error(MB_CANCEL, rc, h, pszSrcFile, __LINE__, 248 251 GetPString(IDS_OUTOFMEMORY)); 249 free(sel);252 xfree(sel); 250 253 DosPostEventSem(CompactSem); 251 254 return FALSE; … … 264 267 if (sellen < 1) { 265 268 Runtime_Error(pszSrcFile, __LINE__, "len < 1"); 266 free(sel);269 xfree(sel); 267 270 DosPostEventSem(CompactSem); 268 271 return FALSE; … … 278 281 SaveToClip(h, sel, TRUE); 279 282 DosFreeMem(temp); 280 free(sel);283 xfree(sel); 281 284 MLEenable(h); 282 285 DosPostEventSem(CompactSem); … … 299 302 #endif 300 303 DosFreeMem(temp); 301 free(sel);304 xfree(sel); 302 305 MLEenable(h); 303 306 DosPostEventSem(CompactSem); … … 372 375 #endif 373 376 DosFreeMem(temp); 374 free(sel);377 xfree(sel); 375 378 DosPostEventSem(CompactSem); 376 379 MLEenable(h); … … 405 408 #endif 406 409 DosFreeMem(temp); 407 free(sel);410 xfree(sel); 408 411 DosPostEventSem(CompactSem); 409 412 return TRUE; … … 571 574 else 572 575 ret = FALSE; 573 free(buffer);576 xfree(buffer); 574 577 } 575 578 DosFreeMem(hexbuff); … … 767 770 _heap_check(); 768 771 #endif 769 free(bkg);772 xfree(bkg); 770 773 WinDestroyMsgQueue(thmq); 771 774 } -
trunk/dll/newview.c
r946 r985 29 29 28 Dec 07 GKY Add mailrun to allow mailto by clicking on an email address in the viewer 30 30 29 Dec 07 GKY Formated email address using "<mailto:" 31 29 Feb 08 GKY Use xfree where appropriate 32 29 Feb 08 GKY Refactor global command line variables to notebook.h 31 33 32 34 ***********************************************************************/ … … 49 51 #include "errutil.h" // Dos_Error... 50 52 #include "strutil.h" // GetPString 53 #include "notebook.h" // httprun etc 51 54 #include "fm3dll.h" 52 55 … … 638 641 if (ad) { 639 642 ad->selected = ad->textsize = ad->numlines = ad->numalloc = 0; 640 if (ad->text) 641 free(ad->text); 642 if (ad->lines) 643 free(ad->lines); 644 if (ad->markedlines) 645 free(ad->markedlines); 643 xfree(ad->text); 644 xfree(ad->lines); 645 xfree(ad->markedlines); 646 646 ad->text = NULL; 647 647 ad->lines = NULL; … … 1202 1202 ad->found = 0; 1203 1203 ad->selected = ad->numlines = ad->numalloc = 0; 1204 if (ad->lines) 1205 free(ad->lines); 1206 if (ad->markedlines) 1207 free(ad->markedlines); 1204 xfree(ad->lines); 1205 xfree(ad->markedlines); 1208 1206 ad->lines = NULL; 1209 1207 ad->markedlines = NULL; … … 1314 1312 } 1315 1313 if (ad->numlines) { 1316 ad->markedlines = xmalloc (ad->numlines, pszSrcFile, __LINE__);1314 ad->markedlines = xmallocz(ad->numlines, pszSrcFile, __LINE__); 1317 1315 if (ad->markedlines) { 1318 memset(ad->markedlines, 0, ad->numlines);1319 1316 ad->selected = 0; 1320 1317 } … … 1372 1369 priority_normal(); 1373 1370 if (*ad->filename) { 1374 if (ad->text) 1375 free(ad->text); 1376 if (ad->lines) 1377 free(ad->lines); 1378 if (ad->markedlines) 1379 free(ad->markedlines); 1371 xfree(ad->text); 1372 xfree(ad->lines); 1373 xfree(ad->markedlines); 1380 1374 ad->text = NULL; 1381 1375 ad->lines = NULL; … … 1426 1420 __LINE__, 1427 1421 GetPString(IDS_ERRORREADINGTEXT), ad->filename); 1428 free(ad->text);1422 xfree(ad->text); 1429 1423 ad->text = NULL; 1430 1424 ad->textsize = 0; … … 2381 2375 switch (ret) { 2382 2376 case 0: 2383 free(urld);2377 xfree(urld); 2384 2378 goto NoAdd; 2385 2379 case 1: … … 2407 2401 "%s %s", httprun, urld->url); 2408 2402 } 2409 free(urld);2403 xfree(urld); 2410 2404 goto NoAdd; 2411 2405 case 2: … … 2433 2427 "%s %s", ftprun, urld->url); 2434 2428 } 2429 xfree(urld); 2430 goto NoAdd; 2435 2431 case 3: 2436 2432 if (*urld->url){ … … 2441 2437 "%s %s", mailrun, urld->url); 2442 2438 } 2443 free(urld);2439 xfree(urld); 2444 2440 goto NoAdd; 2445 2441 default: 2446 2442 break; 2447 2443 } 2448 free(urld);2444 xfree(urld); 2449 2445 } 2450 2446 } … … 2524 2520 MPFROMLONG(whichline)); 2525 2521 } 2526 free(s);2522 xfree(s); 2527 2523 } 2528 2524 } … … 3937 3933 FreeViewerMem(hwnd); 3938 3934 WinSetWindowPtr(hwnd, QWL_USER, NULL); 3939 free(ad);3935 xfree(ad); 3940 3936 } 3941 3937 if (hwndRestore && hwndRestore != HWND_DESKTOP) { -
trunk/dll/notebook.c
r972 r985 29 29 16 Feb 08 SHL Restore SaveDirCnrState internal state save logic - accidentally removed 30 30 22 Feb 08 JBS Ticket 230: Fix/improve various code related to state or presparam values in the INI file. 31 29 Feb 08 GKY Changes to enable user settable command line length 32 29 Feb 08 GKY Use xfree where appropriate 31 33 32 34 ***********************************************************************/ … … 201 203 PrfWriteProfileString(fmprof, appname, "DefArc", szDefArc); 202 204 { 203 CHAR szCLBuf[MAXCOMLINESTRG], szPathBuf[CCHMAXPATH]; 205 CHAR *szCLBuf; 206 CHAR szPathBuf[CCHMAXPATH]; 204 207 PSZ pszWorkBuf; 205 208 206 pszWorkBuf = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__); 207 if (!pszWorkBuf) 209 szCLBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__); 210 if (!szCLBuf) 211 return 0; //already complained 212 pszWorkBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__); 213 if (!pszWorkBuf) { 214 xfree(szCLBuf); 208 215 return 0; //already complained 209 WinQueryDlgItemText(hwnd, CFGA_VIRUS, MAXCOMLINESTRG, szCLBuf); 210 szCLBuf[MAXCOMLINESTRG - 1] = 0; 216 } 217 WinQueryDlgItemText(hwnd, CFGA_VIRUS, MaxComLineStrg, szCLBuf); 218 szCLBuf[MaxComLineStrg - 1] = 0; 211 219 if (strcmp(szCLBuf, virus)){ 212 220 NormalizeCmdLine(pszWorkBuf, szCLBuf); 213 221 memcpy(virus, pszWorkBuf, strlen(pszWorkBuf) + 1); 214 xfree(pszWorkBuf); 222 xfree(pszWorkBuf); 223 xfree(szCLBuf); 215 224 if (!strchr(virus, '%') && strlen(virus) > 3) 216 225 strcat(virus, " %p"); … … 376 385 case WM_INITDLG: 377 386 WinSendDlgItemMsg(hwnd, CFGV_VIEWER, EM_SETTEXTLIMIT, 378 MPFROM2SHORT(M AXCOMLINESTRG, 0), MPVOID);387 MPFROM2SHORT(MaxComLineStrg, 0), MPVOID); 379 388 WinSendDlgItemMsg(hwnd, CFGV_EDITOR, EM_SETTEXTLIMIT, 380 MPFROM2SHORT(M AXCOMLINESTRG, 0), MPVOID);389 MPFROM2SHORT(MaxComLineStrg, 0), MPVOID); 381 390 WinSendDlgItemMsg(hwnd, CFGV_BINVIEW, EM_SETTEXTLIMIT, 382 MPFROM2SHORT(M AXCOMLINESTRG, 0), MPVOID);391 MPFROM2SHORT(MaxComLineStrg, 0), MPVOID); 383 392 WinSendDlgItemMsg(hwnd, CFGV_BINED, EM_SETTEXTLIMIT, 384 MPFROM2SHORT(M AXCOMLINESTRG, 0), MPVOID);393 MPFROM2SHORT(MaxComLineStrg, 0), MPVOID); 385 394 WinEnableWindow(WinWindowFromID(hwnd, CFGV_FIND), FALSE); 386 395 PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID); … … 468 477 case WM_CLOSE: 469 478 { 470 CHAR szCLBuf[MAXCOMLINESTRG];479 CHAR *szCLBuf; 471 480 PSZ pszWorkBuf; 472 481 473 pszWorkBuf = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__); 474 if (!pszWorkBuf) 482 szCLBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__); 483 if (!szCLBuf) 484 return 0; //already complained 485 pszWorkBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__); 486 if (!pszWorkBuf) { 487 xfree(szCLBuf); 475 488 return 0; //already complained 476 WinQueryDlgItemText(hwnd, CFGV_VIEWER, MAXCOMLINESTRG, szCLBuf); 477 szCLBuf[MAXCOMLINESTRG - 1] = 0; 489 } 490 WinQueryDlgItemText(hwnd, CFGV_VIEWER, MaxComLineStrg, szCLBuf); 491 szCLBuf[MaxComLineStrg - 1] = 0; 478 492 if (strcmp(szCLBuf, viewer)){ 479 493 NormalizeCmdLine(pszWorkBuf, szCLBuf); … … 482 496 strcat(viewer, " %a"); 483 497 } 484 WinQueryDlgItemText(hwnd, CFGV_EDITOR, M AXCOMLINESTRG, szCLBuf);485 szCLBuf[M AXCOMLINESTRG- 1] = 0;498 WinQueryDlgItemText(hwnd, CFGV_EDITOR, MaxComLineStrg, szCLBuf); 499 szCLBuf[MaxComLineStrg - 1] = 0; 486 500 if (strcmp(szCLBuf, editor)){ 487 501 NormalizeCmdLine(pszWorkBuf, szCLBuf); … … 490 504 strcat(editor, " %a"); 491 505 } 492 WinQueryDlgItemText(hwnd, CFGV_BINVIEW, M AXCOMLINESTRG, szCLBuf);493 szCLBuf[M AXCOMLINESTRG- 1] = 0;506 WinQueryDlgItemText(hwnd, CFGV_BINVIEW, MaxComLineStrg, szCLBuf); 507 szCLBuf[MaxComLineStrg - 1] = 0; 494 508 if (strcmp(szCLBuf, binview)){ 495 509 NormalizeCmdLine(pszWorkBuf, szCLBuf); … … 498 512 strcat(binview, " %a"); 499 513 } 500 WinQueryDlgItemText(hwnd, CFGV_BINED, M AXCOMLINESTRG, szCLBuf);501 szCLBuf[M AXCOMLINESTRG- 1] = 0;514 WinQueryDlgItemText(hwnd, CFGV_BINED, MaxComLineStrg, szCLBuf); 515 szCLBuf[MaxComLineStrg - 1] = 0; 502 516 if (strcmp(szCLBuf, bined)){ 503 517 NormalizeCmdLine(pszWorkBuf, szCLBuf); … … 507 521 } 508 522 xfree(pszWorkBuf); 523 xfree(szCLBuf); 509 524 PrfWriteProfileString(fmprof, appname, "Viewer", viewer); 510 525 PrfWriteProfileString(fmprof, appname, "Editor", editor); … … 547 562 MPFROM2SHORT(CCHMAXPATH, 0), MPVOID); 548 563 WinSendDlgItemMsg(hwnd, CFGH_FTPRUN, EM_SETTEXTLIMIT, 549 MPFROM2SHORT(M AXCOMLINESTRG, 0), MPVOID);564 MPFROM2SHORT(MaxComLineStrg, 0), MPVOID); 550 565 WinSendDlgItemMsg(hwnd, CFGH_HTTPRUN, EM_SETTEXTLIMIT, 551 MPFROM2SHORT(M AXCOMLINESTRG, 0), MPVOID);566 MPFROM2SHORT(MaxComLineStrg, 0), MPVOID); 552 567 WinSendDlgItemMsg(hwnd, CFGH_MAILRUN, EM_SETTEXTLIMIT, 553 MPFROM2SHORT(M AXCOMLINESTRG, 0), MPVOID);568 MPFROM2SHORT(MaxComLineStrg, 0), MPVOID); 554 569 WinSendDlgItemMsg(hwnd, CFGH_RUNMAILWORKDIR, EM_SETTEXTLIMIT, 555 570 MPFROM2SHORT(CCHMAXPATH, 0), MPVOID); … … 664 679 case WM_CLOSE: 665 680 { 666 CHAR szCLBuf[MAXCOMLINESTRG], szPathBuf[CCHMAXPATH]; 681 CHAR *szCLBuf; 682 CHAR szPathBuf[CCHMAXPATH]; 667 683 PSZ pszWorkBuf; 668 684 669 pszWorkBuf = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__); 670 if (!pszWorkBuf) 685 szCLBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__); 686 if (!szCLBuf) 687 return 0; //already complained 688 pszWorkBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__); 689 if (!pszWorkBuf) { 690 xfree(szCLBuf); 671 691 return 0; //already complained 692 } 672 693 WinQueryDlgItemText(hwnd, CFGH_RUNHTTPWORKDIR, CCHMAXPATH, szPathBuf); 673 694 szPathBuf[CCHMAXPATH - 1] = 0; … … 682 703 bstrip(szPathBuf); 683 704 memcpy(mailrundir, szPathBuf, strlen(szPathBuf) + 1); 684 WinQueryDlgItemText(hwnd, CFGH_FTPRUN, M AXCOMLINESTRG, szCLBuf);685 szCLBuf[M AXCOMLINESTRG- 1] = 0;705 WinQueryDlgItemText(hwnd, CFGH_FTPRUN, MaxComLineStrg, szCLBuf); 706 szCLBuf[MaxComLineStrg - 1] = 0; 686 707 if (strcmp(szCLBuf, ftprun)){ 687 708 NormalizeCmdLine(pszWorkBuf, szCLBuf); 688 709 memcpy(ftprun, pszWorkBuf, strlen(pszWorkBuf) + 1); 689 710 } 690 WinQueryDlgItemText(hwnd, CFGH_HTTPRUN, M AXCOMLINESTRG, szCLBuf);691 szCLBuf[M AXCOMLINESTRG- 1] = 0;711 WinQueryDlgItemText(hwnd, CFGH_HTTPRUN, MaxComLineStrg, szCLBuf); 712 szCLBuf[MaxComLineStrg - 1] = 0; 692 713 if (strcmp(szCLBuf, httprun)){ 693 714 NormalizeCmdLine(pszWorkBuf, szCLBuf); 694 715 memcpy(httprun, pszWorkBuf, strlen(pszWorkBuf) + 1); 695 716 } 696 WinQueryDlgItemText(hwnd, CFGH_MAILRUN, M AXCOMLINESTRG, szCLBuf);697 szCLBuf[M AXCOMLINESTRG- 1] = 0;717 WinQueryDlgItemText(hwnd, CFGH_MAILRUN, MaxComLineStrg, szCLBuf); 718 szCLBuf[MaxComLineStrg - 1] = 0; 698 719 if (strcmp(szCLBuf, mailrun)){ 699 720 NormalizeCmdLine(pszWorkBuf, szCLBuf); … … 701 722 } 702 723 xfree(pszWorkBuf); 724 xfree(szCLBuf); 703 725 PrfWriteProfileString(fmprof, appname, "HttpRunDir", httprundir); 704 726 PrfWriteProfileString(fmprof, appname, "FtpRunDir", ftprundir); … … 1065 1087 switch (msg) { 1066 1088 case WM_INITDLG: 1089 WinSendDlgItemMsg(hwnd, CFGG_CMDLNLNGTH, SPBM_SETTEXTLIMIT, 1090 MPFROMSHORT(8), MPVOID); 1091 WinSendDlgItemMsg(hwnd, CFGG_CMDLNLNGTH, SPBM_OVERRIDESETLIMITS, 1092 MPFROMLONG(CMDLNLNGTH_MAX), MPFROMLONG(CMDLNLNGTH_MIN)); 1067 1093 PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID); 1068 1094 break; … … 1086 1112 WinCheckButton(hwnd, CFGG_CONFIRMTARGET, fConfirmTarget); 1087 1113 WinSetDlgItemText(hwnd, CFGG_TARGETDIR, targetdir); 1114 WinSendDlgItemMsg(hwnd, CFGG_CMDLNLNGTH, SPBM_SETCURRENTVALUE, 1115 MPFROMLONG(MaxComLineStrg), MPVOID); 1088 1116 return 0; 1089 1117 … … 1189 1217 fConfirmTarget = WinQueryButtonCheckstate(hwnd, CFGG_CONFIRMTARGET); 1190 1218 PrfWriteProfileData(fmprof, appname, "ConfirmTarget", 1191 &fConfirmTarget, sizeof(BOOL)); 1219 &fConfirmTarget, sizeof(BOOL)); 1220 { 1221 WinSendDlgItemMsg(hwnd, CFGG_CMDLNLNGTH, SPBM_QUERYVALUE, 1222 MPFROMP(&MaxComLineStrg), MPFROM2SHORT(0, SPBQ_DONOTUPDATE)); 1223 if (MaxComLineStrg < CMDLNLNGTH_MIN) 1224 MaxComLineStrg = CMDLNLNGTH_MIN; 1225 else if (MaxComLineStrg > CMDLNLNGTH_MAX) 1226 MaxComLineStrg = CMDLNLNGTH_MAX; 1227 PrfWriteProfileData(fmprof, 1228 appname, "MaxComLineStrg", &MaxComLineStrg, sizeof(ULONG)); 1229 } 1192 1230 break; 1193 1231 } … … 1200 1238 case WM_INITDLG: 1201 1239 WinSendDlgItemMsg(hwnd, CFGC_COMPARE, EM_SETTEXTLIMIT, 1202 MPFROM2SHORT(M AXCOMLINESTRG, 0), MPVOID);1240 MPFROM2SHORT(MaxComLineStrg, 0), MPVOID); 1203 1241 WinSendDlgItemMsg(hwnd, CFGC_DIRCOMPARE, EM_SETTEXTLIMIT, 1204 MPFROM2SHORT(M AXCOMLINESTRG, 0), MPVOID);1242 MPFROM2SHORT(MaxComLineStrg, 0), MPVOID); 1205 1243 WinEnableWindow(WinWindowFromID(hwnd, CFGC_FIND), FALSE); 1206 1244 PostMsg(hwnd, UM_UNDO, MPVOID, MPVOID); … … 1278 1316 case WM_CLOSE: 1279 1317 { 1280 CHAR szCLBuf[MAXCOMLINESTRG];1318 CHAR *szCLBuf; 1281 1319 PSZ pszWorkBuf; 1282 1320 1283 pszWorkBuf = xmalloc(MAXCOMLINESTRG, pszSrcFile, __LINE__); 1284 if (!pszWorkBuf) 1321 szCLBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__); 1322 if (!szCLBuf) 1323 return 0; //already complained 1324 pszWorkBuf = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__); 1325 if (!pszWorkBuf) { 1326 xfree(szCLBuf); 1285 1327 return 0; //already complained 1286 WinQueryDlgItemText(hwnd, CFGC_DIRCOMPARE, MAXCOMLINESTRG, szCLBuf); 1287 szCLBuf[MAXCOMLINESTRG - 1] = 0; 1328 } 1329 WinQueryDlgItemText(hwnd, CFGC_DIRCOMPARE, MaxComLineStrg, szCLBuf); 1330 szCLBuf[MaxComLineStrg - 1] = 0; 1288 1331 if (strcmp(szCLBuf, dircompare)){ 1289 1332 NormalizeCmdLine(pszWorkBuf, szCLBuf); … … 1293 1336 } 1294 1337 PrfWriteProfileString(fmprof, appname, "DirCompare", dircompare); 1295 WinQueryDlgItemText(hwnd, CFGC_COMPARE, M AXCOMLINESTRG, szCLBuf);1296 szCLBuf[MAXCOMLINESTRG- 1] = 0;1297 1298 1299 1300 1301 1302 1338 WinQueryDlgItemText(hwnd, CFGC_COMPARE, MaxComLineStrg, szCLBuf); 1339 szCLBuf[MaxComLineStrg - 1] = 0; 1340 if (strcmp(szCLBuf, compare)){ 1341 NormalizeCmdLine(pszWorkBuf, szCLBuf); 1342 memcpy(compare, pszWorkBuf, strlen(pszWorkBuf) + 1); 1343 if (!strchr(compare, '%') && strlen(compare) > 3) 1344 strcat(compare, " %a"); 1345 } 1303 1346 xfree(pszWorkBuf); 1347 xfree(szCLBuf); 1304 1348 PrfWriteProfileString(fmprof, appname, "Compare", compare); 1305 1349 break; -
trunk/dll/notebook.h
r953 r985 10 10 11 11 14 Feb 08 SHL Refactor from fm3dll.h 12 29 Feb 08 GKY Refactor global command line variables to notebook.h 12 13 13 14 ***********************************************************************/ … … 29 30 VOID CfgMenuInit(HWND hwndMenu, BOOL fIsLite); 30 31 32 #ifdef DEFINE_GLOBALS 33 #define DATADEF 34 #else 35 #define DATADEF extern 36 #endif 37 38 DATADEF CHAR *editor, *viewer, *virus, *compare, *binview, *bined, 39 *dircompare, *ftprun, *httprun, *mailrun; 40 DATADEF CHAR ftprundir[CCHMAXPATH], httprundir[CCHMAXPATH], 41 mailrundir[CCHMAXPATH], targetdir[CCHMAXPATH]; 42 31 43 #endif // NOTEBOOK_H -
trunk/dll/notify.c
r907 r985 14 14 06 Aug 07 GKY Reduce DosSleep times (ticket 148) 15 15 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat 16 29 Feb 08 GKY Use xfree where appropriate 16 17 17 18 … … 190 191 191 192 if (p != str) 192 free(p);193 xfree(p); 193 194 if (id > NOTE_MAX) 194 195 id = NOTE_FRAME; … … 254 255 LM_INSERTITEM, MPFROM2SHORT(LIT_END, 0), mp2); 255 256 PostMsg(hwndNotify, UM_NOTIFY, MPVOID, MPVOID); 256 free((CHAR *) mp2);257 xfree((CHAR *) mp2); 257 258 } 258 259 WinDismissDlg(hwnd, 0); … … 271 272 NOTE_LISTBOX, 272 273 LM_INSERTITEM, MPFROM2SHORT(LIT_END, 0), mp2); 273 free((CHAR *) mp2);274 xfree((CHAR *) mp2); 274 275 } 275 276 { … … 472 473 } 473 474 } 474 free(s);475 xfree(s); 475 476 } 476 477 } -
trunk/dll/objcnr.c
r907 r985 21 21 13 Aug 07 SHL Move #pragma alloc_text to end for OpenWatcom compat 22 22 14 Aug 07 SHL Revert ProcessDir DosSleep to 0 23 29 Feb 08 GKY Use xfree where appropriate 23 24 24 25 ***********************************************************************/ … … 106 107 if (!pciP) { 107 108 Win_Error(hwndCnr, HWND_DESKTOP, pszSrcFile, __LINE__, "CM_ALLOCRECORD"); 108 free(pffbArray);109 xfree(pffbArray); 109 110 return; 110 111 } … … 131 132 } 132 133 else { 133 free(pffbArray);134 xfree(pffbArray); 134 135 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, 135 136 GetPString(IDS_CANTFINDDIRTEXT), filename); … … 152 153 ri.fInvalidateRecord = TRUE; 153 154 if (!WinSendMsg(hwndCnr, CM_INSERTRECORD, MPFROMP(pciP), MPFROMP(&ri))) { 154 free(pffbArray);155 xfree(pffbArray); 155 156 return; 156 157 } … … 201 202 } 202 203 203 free(pffbArray);204 xfree(pffbArray); 204 205 WinSendMsg(hwndCnr, CM_INVALIDATERECORD, MPFROMP(&pciP), 205 206 MPFROM2SHORT(1, 0)); … … 233 234 PostMsg(WinQueryWindow(dirsize->hwndCnr, QW_PARENT), UM_CONTAINER_FILLED, 234 235 MPVOID, MPVOID); 235 free(dirsize);236 xfree(dirsize); 236 237 } 237 238 … … 279 280 Runtime_Error(pszSrcFile, __LINE__, 280 281 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 281 free(dirsize);282 xfree(dirsize); 282 283 WinDismissDlg(hwnd, 0); 283 284 break; … … 425 426 objcnrwnd = (HWND) 0; 426 427 data = INSTDATA(hwnd); 427 if (data) 428 free(data); 428 xfree(data); 429 429 break; 430 430 } -
trunk/dll/pathutil.c
r928 r985 11 11 05 Jan 08 SHL Move from arccnrs.c and comp.c to here 12 12 06 Jan 08 GKY Add NormalizeCmdLine to check program strings on entry 13 29 Feb 08 GKY Use xfree where appropriate 14 29 Feb 08 GKY Changes to enable user settable command line length 13 15 14 16 ***********************************************************************/ … … 25 27 #include "errutil.h" // Dos_Error... 26 28 #include "strutil.h" // GetPString 29 30 static PSZ pszSrcFile = __FILE__; 27 31 28 32 // #pragma data_seg(DATA1) … … 105 109 * no space between exe and args etc) 106 110 * Command line passed as pszCmdLine_ 107 * A pointer to a buffer of the size M AXCOMLINESTRGshould be supplied in111 * A pointer to a buffer of the size MaxComLineStrg should be supplied in 108 112 * pszWorkBuf. This is where the quoted etc as necessary command 109 113 * line string will be returned. … … 112 116 PCSZ NormalizeCmdLine(PSZ pszWorkBuf, PSZ pszCmdLine_) 113 117 { 114 char szCmdLine[MAXCOMLINESTRG], szArgs[MAXCOMLINESTRG];118 char *szCmdLine, *szArgs; 115 119 char *offset = '\0', *offsetexe, *offsetcom, *offsetcmd, *offsetbtm, *offsetbat; 116 120 APIRET ret; … … 123 127 PSZ pszNewCmdLine = pszWorkBuf; 124 128 129 szCmdLine = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__); 130 if (!szCmdLine) 131 return pszCmdLine_; //already complained 132 szArgs = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__); 133 if (!szArgs) { 134 xfree(szCmdLine); 135 return pszCmdLine_; //already complained 136 } 125 137 bstrip(pszCmdLine_); 126 memset(pszWorkBuf, 0, M AXCOMLINESTRG);138 memset(pszWorkBuf, 0, MaxComLineStrg); 127 139 strcpy(szCmdLine, pszCmdLine_); 128 140 if (szCmdLine[0] != '\0') { … … 317 329 } 318 330 } 331 xfree(szArgs); 332 xfree(szCmdLine); 319 333 return pszWorkBuf; 320 334 } -
trunk/dll/pathutil.h
r920 r985 10 10 11 11 05 Jan 08 SHL Move from fm3dll.h to here 12 29 Feb 08 GKY Changes to enable user settable command line length 12 13 13 14 ***********************************************************************/ … … 27 28 PCSZ NormalizeCmdLine(PSZ pszWorkBuf, PSZ pszCmdLine_); 28 29 30 #define MAXCOMLINESTRGDEFAULT (2048) /* used to build command line strings */ 31 #define CMDLNLNGTH_MIN (299) 32 #define CMDLNLNGTH_MAX (32768) 33 34 #ifdef DEFINE_GLOBALS 35 #define DATADEF 36 #else 37 #define DATADEF extern 38 #endif 39 40 DATADEF ULONG MaxComLineStrg; 41 29 42 #endif // PATHUTIL_H -
trunk/dll/presparm.c
r928 r985 13 13 22 Nov 07 GKY Use CopyPresParams to fix presparam inconsistencies in menus 14 14 10 Dec 07 GKY Updated CopyPresParams to copy all parameter types 15 29 Feb 08 GKY Use xfree where appropriate 15 16 16 17 ***********************************************************************/ … … 307 308 appname, tagname, ppresparams, ppresparams->cb + 4); 308 309 309 free(ppresparams);310 xfree(ppresparams); 310 311 } 311 312 -
trunk/dll/remap.c
r907 r985 13 13 31 Aug 06 SHL Use _fsopen to avoid noise complaints 14 14 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat 15 29 Feb 08 GKY Use xfree where appropriate 15 16 16 17 ***********************************************************************/ … … 83 84 info->res = xstrdup(s, pszSrcFile, __LINE__); 84 85 if (!info->res) 85 free(info);86 xfree(info); 86 87 else { 87 88 x++; … … 151 152 info->res = xstrdup(res, pszSrcFile, __LINE__); 152 153 if (!info->res) 153 free(info);154 xfree(info); 154 155 else { 155 156 info->next = NULL; … … 161 162 info = reshead; 162 163 reshead = reshead->next; 163 free(info);164 xfree(info); 164 165 } 165 166 return TRUE; … … 184 185 else 185 186 reshead = info->next; 186 free(info->res);187 free(info);187 xfree(info->res); 188 xfree(info); 188 189 return TRUE; 189 190 } … … 201 202 while (info) { 202 203 next = info->next; 203 free(info->res);204 free(info);204 xfree(info->res); 205 xfree(info); 205 206 info = next; 206 207 } … … 439 440 "%s", GetPString(IDS_CANTSTARTNETUSETEXT)); 440 441 if (!mp2 || (ULONG) mp2 == 1041 || info->failedonce) 441 free(info);442 xfree(info); 442 443 break; 443 444 } … … 728 729 while (info) { 729 730 next = info->next; 730 free(info);731 xfree(info); 731 732 info = next; 732 733 } -
trunk/dll/saveclip.c
r957 r985 22 22 30 Dec 07 GKY Use CommaFmtULL 23 23 16 Feb 08 GKY Changed _fsopen flag so a new list file can be created 24 29 Feb 08 GKY Use xfree where appropriate 24 25 25 26 ***********************************************************************/ … … 186 187 p = strchr(pp, '\n'); 187 188 } 188 free(text);189 xfree(text); 189 190 } 190 191 } … … 839 840 subject[1023] = 0; 840 841 } 841 free(pfealist);842 xfree(pfealist); 842 843 } 843 free(pgealist);844 xfree(pgealist); 844 845 } 845 846 } … … 882 883 longname[CCHMAXPATHCOMP - 1] = 0; 883 884 } 884 free(pfealist);885 xfree(pfealist); 885 886 } 886 free(pgealist);887 xfree(pgealist); 887 888 } 888 889 } -
trunk/dll/seeall.c
r961 r985 34 34 30 Dec 07 GKY Use TestFDates for comparing by date 35 35 15 Feb 08 GKY Prevent trap on scan of drive containing files that exceed maxpath 36 29 Feb 08 GKY Use xfree where appropriate 37 29 Feb 08 GKY Refactor global command line variables to notebook.h 36 38 37 39 ***********************************************************************/ … … 54 56 #include "errutil.h" // Dos_Error... 55 57 #include "strutil.h" // GetPString 58 #include "notebook.h" // targetdirectory 56 59 #include "fm3dll.h" 57 60 … … 1300 1303 if (ad->afhead && ad->afheadcnt) { 1301 1304 for (x = 0; x < ad->afheadcnt; x++) { 1302 if (ad->afhead[x].fullname) 1303 free(ad->afhead[x].fullname); 1304 } 1305 free(ad->afhead); 1305 xfree(ad->afhead[x].fullname); 1306 } 1307 xfree(ad->afhead); 1306 1308 ad->afhead = NULL; 1307 if (ad->afindex) 1308 free(ad->afindex); 1309 xfree(ad->afindex); 1309 1310 ad->afindex = NULL; 1310 1311 } … … 1860 1861 pAD->ullSelectedBytes -= pAD->afhead[y].cbFile; 1861 1862 } 1862 free(pAD->afhead[y].fullname);1863 xfree(pAD->afhead[y].fullname); 1863 1864 } 1864 1865 memmove(&(pAD->afhead[x]), &(pAD->afhead[y]), … … 1919 1920 pffbArray = xmalloc(ulBufBytes, pszSrcFile, __LINE__); 1920 1921 if (!pffbArray) { 1921 free(filename);1922 xfree(filename); 1922 1923 return; 1923 1924 } … … 1957 1958 // Complain if pathnames exceeds max 1958 1959 DosFindClose(hdir); 1959 free(pffbArray);1960 free(filename);1960 xfree(pffbArray); 1961 xfree(filename); 1961 1962 if (!fDone) { 1962 1963 fDone = TRUE; … … 2025 2026 } 2026 2027 2027 free(pffbArray);2028 free(filename);2028 xfree(pffbArray); 2029 xfree(filename); 2029 2030 } 2030 2031 … … 4266 4267 } 4267 4268 FreeAllFilesList(hwnd); 4268 free(pAD);4269 xfree(pAD); 4269 4270 } 4270 4271 break; … … 4323 4324 #pragma alloc_text(SEEALL,InitWindow,PaintLine,SeeAllWndProc) 4324 4325 #pragma alloc_text(SEEALL,UpdateList,CollectList,ReSort,Mark) 4325 #pragma alloc_text(SEEALL,BuildAList,RemoveDeleted,SeeFrameWndProc,FilterList )4326 #pragma alloc_text(SEEALL,BuildAList,RemoveDeleted,SeeFrameWndProc,FilterList,FilterAll) 4326 4327 #pragma alloc_text(SEEALL2,SeeObjWndProc,MakeSeeObjWinThread,FindDupesThread,DupeDlgProc) 4327 4328 #pragma alloc_text(SEEALL3,FreeAllFilesList,DoADir,FindAllThread,AFDrvsWndProc) -
trunk/dll/select.c
r924 r985 29 29 26 Aug 07 GKY DosSleep(1) in loops changed to (0) 30 30 12 Jan 08 SHL Localize SpecialSelect in comp.c 31 29 Feb 08 GKY Use xfree where appropriate 31 32 32 33 ***********************************************************************/ … … 257 258 fclose(inputFile); 258 259 } 259 free(input);260 xfree(input); 260 261 DosSleep(1); 261 262 } … … 360 361 fclose(inputFile); 361 362 } 362 free(input);363 xfree(input); 363 364 DosSleep(1); 364 365 } … … 611 612 612 613 for (z = 0; z < numw; z++) { 613 if (Cnrs[z].ss) 614 free(Cnrs[z].ss); 615 } 616 free(Cnrs); 614 xfree(Cnrs[z].ss); 615 } 616 xfree(Cnrs); 617 617 DosPostEventSem(CompactSem); 618 618 } -
trunk/dll/seticon.c
r907 r985 12 12 22 Mar 06 GKY Use QWL_USER 13 13 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat 14 29 Feb 08 GKY Use xfree where appropriate 14 15 15 16 ***********************************************************************/ … … 92 93 Win_Error(hwnd, hwnd, pszSrcFile, __LINE__, "WinSetSysPointerData"); 93 94 } 94 if (buff) 95 free(buff); 95 xfree(buff); 96 96 } 97 97 WinDismissDlg(hwnd, 1); -
trunk/dll/shadow.c
r907 r985 13 13 06 Aug 07 SHL Use BldFullPathName 14 14 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat 15 29 Feb 08 GKY Use xfree where appropriate 15 16 16 17 ***********************************************************************/ … … 56 57 (path) ? ";STARTUPDIR=" : "", (path) ? path : "", objtitle); 57 58 WinSetObjectData(obj, s); 58 free(s);59 xfree(s); 59 60 } 60 61 } … … 157 158 objtitle, 158 159 s, (location) ? location : cnr, CO_FAILIFEXISTS); 159 free(s);160 xfree(s); 160 161 } 161 162 return obj; -
trunk/dll/subj.c
r907 r985 14 14 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat 15 15 01 Sep 07 GKY Use xDosSetPathInfo to fix case where FS3 buffer crosses 64k boundry 16 29 Feb 08 GKY Use xfree where appropriate 16 17 17 18 ***********************************************************************/ … … 56 57 pfealist = xmallocz(1024, pszSrcFile, __LINE__); 57 58 if (pfealist) 58 59 xfree(pgealist); 59 60 else { 60 61 pfealist->cbList = 1024; … … 64 65 rc = DosQueryPathInfo(filename, FIL_QUERYEASFROMLIST, 65 66 (PVOID) & eaop, (ULONG) sizeof(EAOP2)); 66 free(pgealist);67 xfree(pgealist); 67 68 if (!rc) { 68 69 pfea = &eaop.fpFEA2List->list[0]; … … 73 74 subject[1023] = 0; 74 75 } 75 free(pfealist);76 xfree(pfealist); 76 77 if (rc == ERROR_SHARING_VIOLATION || rc == ERROR_ACCESS_DENIED) { 77 78 saymsg(MB_CANCEL, -
trunk/dll/systemf.c
r920 r985 20 20 06 Aug 07 GKY Reduce DosSleep times (ticket 148) 21 21 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat 22 29 Feb 08 GKY Use xfree where appropriate 23 29 Feb 08 GKY Changes to enable user settable command line length 24 29 Feb 08 GKY Refactor global command line variables to notebook.h 22 25 23 26 ***********************************************************************/ … … 37 40 #include "errutil.h" // Dos_Error... 38 41 #include "strutil.h" // GetPString 42 #include "notebook.h" //targetdirectory 39 43 #include "pathutil.h" 40 44 #include "fm3dll.h" … … 80 84 /* executes the command once for all files in list */ 81 85 82 char path[CCHMAXPATH], commandline[MAXCOMLINESTRG], modpath[CCHMAXPATH], listfile[CCHMAXPATH],86 char path[CCHMAXPATH], *commandline, modpath[CCHMAXPATH], listfile[CCHMAXPATH], 83 87 *p, *pp, drive, *file, *ext, *dot; 84 88 register int x; … … 89 93 return -1; 90 94 } 95 commandline = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__); 96 if (!commandline) 97 return -1; //already complained 91 98 *listfile = 0; 92 99 bstrip(command); … … 590 597 ret = WinDlgBox(HWND_DESKTOP, hwnd, CmdLineDlgProc, FM3ModHandle, 591 598 EXEC_FRAME, &ex); 592 if (ret != 1) 593 return (ret == 0) ? -1 : -2; 599 if (ret != 1) { 600 xfree(commandline); 601 return (ret == 0) ? -1 : -2; 602 } 594 603 } 595 604 else … … 673 682 674 683 rc = DosAllocMem((PVOID)&pszPgm, 675 M AXCOMLINESTRG,684 MaxComLineStrg, 676 685 PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE); 677 686 if (rc) { … … 718 727 if (temp) { 719 728 rc = DosAllocMem((PVOID)&pszArgs, 720 M AXCOMLINESTRG* 2,729 MaxComLineStrg * 2, 721 730 PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE); 722 731 if (rc) … … 851 860 if (~type & FULLSCREEN) 852 861 type |= WINDOWED; 853 rc = DosAllocMem((PVOID) & pszArgs, M AXCOMLINESTRG* 2,862 rc = DosAllocMem((PVOID) & pszArgs, MaxComLineStrg * 2, 854 863 PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE); 855 864 if (rc) { … … 1234 1243 ulOptions |= SAF_STARTCHILDAPP; 1235 1244 1236 executable = xmallocz(M AXCOMLINESTRG, pszSrcFile, __LINE__);1245 executable = xmallocz(MaxComLineStrg, pszSrcFile, __LINE__); 1237 1246 if (executable) { 1238 1247 va_start(parguments, formatstring); … … 1241 1250 strip_lead_char(" \t", executable); 1242 1251 if (*executable) { 1243 parameters = xmalloc(M AXCOMLINESTRG, pszSrcFile, __LINE__);1252 parameters = xmalloc(MaxComLineStrg, pszSrcFile, __LINE__); 1244 1253 if (parameters) { 1245 1254 p = executable; … … 1293 1302 strcpy(executable, GetCmdSpec(FALSE)); 1294 1303 } 1295 free(temp);1304 xfree(temp); 1296 1305 } 1297 1306 } … … 1307 1316 pgd.swpInitial.hwndInsertBehind = HWND_TOP; 1308 1317 happ = WinStartApp(hwndNotify, &pgd, NULL, NULL, ulOptions); 1309 free(parameters);1318 xfree(parameters); 1310 1319 } 1311 1320 } 1312 free(executable);1321 xfree(executable); 1313 1322 } 1314 1323 return happ; -
trunk/dll/tools.c
r907 r985 17 17 05 Sep 06 SHL Sync with standard source formatting 18 18 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat 19 29 Feb 08 GKY Use xfree where appropriate 19 20 20 21 ***********************************************************************/ … … 51 52 qtloaded = TRUE; 52 53 for (x = 0; x < 50 && quicktool[x]; x++) { 53 free(quicktool[x]);54 xfree(quicktool[x]); 54 55 quicktool[x] = NULL; 55 56 } … … 265 266 if (prev) 266 267 prev->next = info->next; 267 if (info->help) 268 free(info->help); 269 if (info->text) 270 free(info->text); 271 free(info); 268 xfree(info->help); 269 xfree(info->text); 270 xfree(info); 272 271 fToolsChanged = TRUE; 273 272 break; … … 365 364 while (tool) { 366 365 next = tool->next; 367 if (tool->help) 368 free(tool->help); 369 if (tool->text) 370 free(tool->text); 371 free(tool); 366 xfree(tool->help); 367 xfree(tool->text); 368 xfree(tool); 372 369 tool = next; 373 370 } … … 716 713 if (tool) { /* just editing strings... */ 717 714 istext = ((tool->flags & T_TEXT) != 0); 718 if (tool->help) 719 free(tool->help); 715 xfree(tool->help); 720 716 tool->help = NULL; 721 if (tool->text) 722 free(tool->text); 717 xfree(tool->text); 723 718 tool->text = NULL; 724 719 if (*help) -
trunk/dll/treecnr.c
r954 r985 46 46 15 Feb 08 SHL Sync with settings menu rework 47 47 15 Feb 08 SHL Avoid death if tree container 0 width 48 29 Feb 08 GKY Use xfree where appropriate 48 49 49 50 ***********************************************************************/ … … 565 566 fTopDir = temptop; 566 567 } 567 free((CHAR *) mp1);568 xfree((CHAR *) mp1); 568 569 } 569 570 return 0; … … 797 798 Runtime_Error(pszSrcFile, __LINE__, 798 799 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 799 free(wk);800 xfree(wk); 800 801 FreeListInfo((LISTINFO *) mp1); 801 802 } … … 828 829 Runtime_Error(pszSrcFile, __LINE__, 829 830 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 830 free(wk);831 xfree(wk); 831 832 FreeListInfo((LISTINFO *) mp1); 832 833 } … … 846 847 WinSendMsg(dcd->hwndCnr, 847 848 UM_CLOSE, MPFROMLONG(dcd->dontclose != FALSE), MPVOID); 848 free(dcd);849 xfree(dcd); 849 850 } 850 851 DosPostEventSem(CompactSem); … … 1717 1718 if (dir) { 1718 1719 if (!PostMsg(dcd->hwndObject, UM_SHOWME, MPFROMP(dir), MPVOID)) 1719 free(dir);1720 xfree(dir); 1720 1721 } 1721 1722 } … … 2157 2158 ret = StartMLEEditor(dcd->hwndParent, (INT) mp1, (CHAR *) mp2, 2158 2159 dcd->hwndFrame); 2159 if (mp2) 2160 free((CHAR *) mp2); 2160 xfree((CHAR *) mp2); 2161 2161 return MRFROMLONG(ret); 2162 2162 } … … 2227 2227 if (apptail == info) 2228 2228 apptail = info->prev; 2229 free(info);2229 xfree(info); 2230 2230 break; 2231 2231 } … … 2748 2748 li->list = BuildList(hwnd); 2749 2749 if (!li->list || !li->list[0]) { 2750 free(li);2750 xfree(li); 2751 2751 break; 2752 2752 } … … 2916 2916 while (info) { 2917 2917 next = info->next; 2918 free(info);2918 xfree(info); 2919 2919 info = next; 2920 2920 } … … 3054 3054 IDS_WINCREATEWINDOW); 3055 3055 PostMsg(hwndClient, WM_CLOSE, MPVOID, MPVOID); 3056 free(dcd);3056 xfree(dcd); 3057 3057 hwndFrame = (HWND) 0; 3058 3058 } -
trunk/dll/undel.c
r907 r985 14 14 06 Aug 07 GKY Reduce DosSleep times (ticket 148) 15 15 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat 16 29 Feb 08 GKY Use xfree where appropriate 16 17 17 18 ***********************************************************************/ … … 146 147 } 147 148 DosForceDelete("$UDELETE.#$#"); 148 if (undelinfo) 149 free(undelinfo); 149 xfree(undelinfo); 150 150 if (thmq) { 151 151 PostMsg(hwnd, UM_CONTAINER_FILLED, MPVOID, MPVOID); … … 221 221 Runtime_Error(pszSrcFile, __LINE__, 222 222 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 223 free(undelinfo);223 xfree(undelinfo); 224 224 listdone = TRUE; 225 225 WinDismissDlg(hwnd, 0); -
trunk/dll/update.c
r907 r985 19 19 02 Aug 07 SHL Sync with CNRITEM mods 20 20 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat 21 29 Feb 08 GKY Use xfree where appropriate 21 22 22 23 ***********************************************************************/ … … 642 643 PostMsg(hwndCnr, UM_RESCAN, MPVOID, MPVOID); 643 644 if (pciList) { 644 free(pciList);645 xfree(pciList); 645 646 DosPostEventSem(CompactSem); 646 647 } -
trunk/dll/viewer.c
r907 r985 16 16 26 Nov 07 GKY Allow open of readonly files in the editor with warning 17 17 26 Nov 07 GKY Add "Save as" menu option to editor 18 29 Feb 08 GKY Use xfree where appropriate 19 29 Feb 08 GKY Refactor global command line variables to notebook.h 18 20 19 21 ***********************************************************************/ … … 32 34 #include "errutil.h" // Dos_Error... 33 35 #include "strutil.h" // GetPString 36 #include "notebook.h" // External viewers 34 37 #include "fm3dll.h" 35 38 … … 1250 1253 } 1251 1254 } 1252 free(vw);1255 xfree(vw); 1253 1256 } 1254 1257 if (!dontclose && -
trunk/dll/viewinf.c
r907 r985 14 14 03 Nov 06 SHL Count thread usage 15 15 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat 16 29 Feb 08 GKY Use xfree where appropriate 16 17 17 18 ***********************************************************************/ … … 157 158 p = strtok(NULL, ";"); 158 159 } 159 free(holdenv);160 xfree(holdenv); 160 161 NoEnv: 161 162 if (WinIsWindow(hab2, hwnd) && !repeating) { … … 173 174 Win_Error(hwnd, hwnd, pszSrcFile, __LINE__, 174 175 "PrfQueryProfileData"); 175 free(holdenv);176 xfree(holdenv); 176 177 } 177 178 else … … 188 189 WinTerminate(hab2); 189 190 } 190 free(dummy);191 xfree(dummy); 191 192 } 192 193 … … 266 267 Runtime_Error(pszSrcFile, __LINE__, 267 268 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 268 free(d);269 xfree(d); 269 270 WinDismissDlg(hwnd, 0); 270 271 return 0; -
trunk/dll/walkem.c
r966 r985 25 25 20 Jan 08 GKY Walk & walk2 dialogs now save and restore size and position 26 26 19 Feb 08 JBS Add "State at last FM/2 close" to the states combo box 27 29 Feb 08 GKY Use xfree where appropriate 28 29 Feb 08 GKY Refactor global command line variables to notebook.h 27 29 28 30 ***********************************************************************/ … … 43 45 #include "errutil.h" // Dos_Error... 44 46 #include "strutil.h" // GetPString 47 #include "notebook.h" // targetdirectory 45 48 #include "fm3dll.h" 46 49 … … 337 340 info->path = xstrdup(s, pszSrcFile, __LINE__); 338 341 if (!info->path) 339 free(info);342 xfree(info); 340 343 else { 341 344 info->next = NULL; … … 430 433 else 431 434 ldirhead = info->next; 432 free(info->path);433 free(info);435 xfree(info->path); 436 xfree(info); 434 437 break; 435 438 } … … 443 446 info->path = xstrdup(path, pszSrcFile, __LINE__); 444 447 if (!info->path) 445 free(info);448 xfree(info); 446 449 else { 447 450 info->next = NULL; … … 484 487 else 485 488 udirhead = info->next; 486 free(info->path);487 free(info);489 xfree(info->path); 490 xfree(info); 488 491 fUdirsChanged = TRUE; 489 492 return TRUE; … … 501 504 else 502 505 ldirhead = info->next; 503 free(info->path);504 free(info);506 xfree(info->path); 507 xfree(info); 505 508 return TRUE; 506 509 } … … 525 528 else 526 529 ldirhead = info->next; 527 free(info->path);528 free(info);530 xfree(info->path); 531 xfree(info); 529 532 return TRUE; 530 533 } … … 1195 1198 if (wa->changed) 1196 1199 WinSendMsg(hwnd, UM_SETUP3, MPVOID, MPVOID); 1197 free(wa);1200 xfree(wa); 1198 1201 WinDismissDlg(hwnd, 0); 1199 1202 break; -
trunk/dll/winlist.c
r907 r985 12 12 22 Jul 06 SHL Check more run time errors 13 13 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat 14 29 Feb 08 GKY Use xfree where appropriate 14 15 15 16 ***********************************************************************/ … … 119 120 y++; 120 121 } 121 free(pswb);122 xfree(pswb); 122 123 DosPostEventSem(CompactSem); 123 124 } -
trunk/dll/worker.c
r907 r985 24 24 20 Aug 07 GKY Move #pragma alloc_text to end for OpenWatcom compat 25 25 26 Aug 07 SHL Revert to DosSleep(0) 26 29 Feb 08 GKY Use xfree where appropriate 27 29 Feb 08 GKY Refactor global command line variables to notebook.h 26 28 27 29 ***********************************************************************/ … … 47 49 #include "errutil.h" // Dos_Error... 48 50 #include "strutil.h" // GetPString 51 #include "notebook.h" // External viewers 49 52 #include "fm3dll.h" 50 53 … … 95 98 GetPString(IDS_COULDNTSTARTTHREADTEXT)); 96 99 FreeListInfo(wk->li); 97 free(wk);100 xfree(wk); 98 101 } 99 102 } … … 253 256 if (!PostMsg(Collector, 254 257 UM_COLLECTFROMFILE, MPFROMP(temp), MPVOID)) 255 free(temp);258 xfree(temp); 256 259 } 257 260 } … … 961 964 if (wk->li) 962 965 FreeListInfo(wk->li); 963 free(wk);966 xfree(wk); 964 967 DosPostEventSem(CompactSem); 965 968 } … … 1116 1119 for (x = 0; wk->li->list[x]; x++) { 1117 1120 strcpy(p, wk->li->list[x]); 1118 free(wk->li->list[x]);1121 xfree(wk->li->list[x]); 1119 1122 wk->li->list[x] = xstrdup(szBuffer, pszSrcFile, __LINE__); 1120 1123 } … … 1296 1299 UM_LOADFILE, 1297 1300 MPFROMLONG(5 + viewtype), MPFROMP(temp))) 1298 free(temp);1301 xfree(temp); 1299 1302 } 1300 1303 DosSleep(1); … … 1341 1344 UM_LOADFILE, 1342 1345 MPFROMLONG(4 + viewtype), MPFROMP(temp))) 1343 free(temp);1346 xfree(temp); 1344 1347 } 1345 1348 DosSleep(1); … … 1604 1607 if (wk->li) 1605 1608 FreeListInfo(wk->li); 1606 free(wk);1609 xfree(wk); 1607 1610 DosPostEventSem(CompactSem); 1608 1611 }
Note:
See TracChangeset
for help on using the changeset viewer.