Changeset 329 for trunk/dll/tools.c
- Timestamp:
- Jul 25, 2006, 8:39:11 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/tools.c
r130 r329 4 4 $Id$ 5 5 6 Toolbar support routines for FM/26 Toolbar support routines 7 7 8 8 Copyright (c) 1994-97 M. Kimes 9 Copyright (c) 2004, 200 5Steven H.Levine9 Copyright (c) 2004, 2006 Steven H.Levine 10 10 11 11 01 Aug 04 SHL Rework lstrip/rstrip usage 12 12 23 May 05 SHL Use QWL_USER 13 22 Jul 06 SHL Check more run time errors 13 14 14 15 ***********************************************************************/ … … 16 17 #define INCL_DOS 17 18 #define INCL_WIN 18 19 19 #include <os2.h> 20 20 21 #include <stdio.h> 21 22 #include <stdlib.h> 22 23 #include <string.h> 23 24 #include <share.h> 25 24 26 #include "fm3dll.h" 25 27 #include "fm3dlg.h" … … 28 30 29 31 #pragma data_seg(DATA1) 32 33 static PSZ pszSrcFile = __FILE__; 34 30 35 #pragma alloc_text(TOOLS,load_tools,save_tools,add_tool,insert_tool,del_tool,free_tools,swap_tools,load_quicktools,save_quicktools) 31 36 #pragma alloc_text(TOOLS1,ReOrderToolsProc,PickToolProc,AddToolProc,ToolIODlgProc) … … 56 61 strcat(s,"QUICKTLS.DAT"); 57 62 fp = _fsopen(s,"r",SH_DENYWR); 58 if (fp) {63 if (fp) { 59 64 while(x < 50 && !feof(fp)) { 60 65 if(!fgets(s,CCHMAXPATH + 2,fp)) … … 63 68 bstripcr(s); 64 69 if(*s && *s != ';') { 65 quicktool[x] = strdup(s);70 quicktool[x] = xstrdup(s,pszSrcFile,__LINE__); 66 71 if(quicktool[x]) 67 72 x++; … … 85 90 strcat(s,"\\"); 86 91 strcat(s,"QUICKTLS.DAT"); 87 fp = fopen(s,"w");88 if (fp) {92 fp = xfopen(s,"w",pszSrcFile,__LINE__); 93 if (fp) { 89 94 for(x = 0;quicktool[x] && x < 50;x++) 90 95 fprintf(fp,"%s\n",quicktool[x]); … … 117 122 strcpy(lasttoolbox,filename); 118 123 fp = _fsopen(filename,"r",SH_DENYWR); 119 if (fp) {124 if (fp) { 120 125 toolhead = free_tools(); 121 126 while(!feof(fp)) { … … 134 139 if(!(USHORT)atoi(idstr)) 135 140 continue; 136 info = malloc(sizeof(TOOL)); 137 if(info) { 138 memset(info,0,sizeof(TOOL)); 141 info = xmallocz(sizeof(TOOL),pszSrcFile,__LINE__); 142 if (info) { 139 143 if(*help) { 140 144 literal(help); 141 145 if(*help) 142 info->help = strdup(help);146 info->help = xstrdup(help,pszSrcFile,__LINE__); 143 147 } 144 148 if(*text) 145 info->text = strdup(text);149 info->text = xstrdup(text,pszSrcFile,__LINE__); 146 150 info->flags = (atoi(flagstr) & (~(T_TEXT | T_EMPHASIZED))); 147 151 info->id = (USHORT)atoi(idstr); … … 193 197 return; 194 198 } 195 fp = fopen(filename,"w");196 if (fp) {199 fp = xfopen(filename,"w",pszSrcFile,__LINE__); 200 if (fp) { 197 201 fprintf(fp,GetPString(IDS_TOOLFILETEXT),filename); 198 202 info = toolhead; … … 777 781 tool->text = NULL; 778 782 if(*help) 779 tool->help = strdup(help);783 tool->help = xstrdup(help,pszSrcFile,__LINE__); 780 784 if(*text) 781 tool->text = strdup(text);785 tool->text = xstrdup(text,pszSrcFile,__LINE__); 782 786 tool->flags = (((dropable) ? T_DROPABLE : 0) | 783 787 ((invisible) ? T_INVISIBLE : 0) | … … 811 815 tool = tool->next; 812 816 } 813 tool = malloc(sizeof(TOOL)); 814 if(tool) { 815 memset(tool,0,sizeof(TOOL)); 817 tool = xmallocz(sizeof(TOOL),pszSrcFile,__LINE__); 818 if (tool) { 816 819 if(*help) 817 tool->help = strdup(help);820 tool->help = xstrdup(help,pszSrcFile,__LINE__); 818 821 if(*text) 819 tool->text = strdup(text);822 tool->text = xstrdup(text,pszSrcFile,__LINE__); 820 823 tool->id = (USHORT)atoi(idstr); 821 824 tool->flags = (((dropable) ? T_DROPABLE : 0) |
Note:
See TracChangeset
for help on using the changeset viewer.