- Timestamp:
- Nov 10, 1999, 1:19:42 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comdlg32/comdlg32.cpp
r1677 r1684 1 /* $Id: comdlg32.cpp,v 1.1 8 1999-11-09 22:38:57phaller Exp $ */1 /* $Id: comdlg32.cpp,v 1.19 1999-11-10 12:18:28 phaller Exp $ */ 2 2 3 3 /* … … 64 64 a->hwndOwner = Win32ToOS2Handle(a->hwndOwner); 65 65 #endif 66 67 68 /***************************************************************************** 69 * Name : iFileDlg_ScanFilterToken 70 * Purpose : scan for valid / invalid filter tokens and 71 * advance array pointer 72 * Parameters: 73 * Variables : 74 * Result : 75 * Remark : 76 * Status : 77 * 78 * Author : 79 *****************************************************************************/ 80 81 // scan filter tokens for validity 82 static BOOL iFileDlg_ScanFilterToken( LPSTR *plpstrPair ) 83 { 84 LPSTR lpstrTemp; 85 LPSTR lpstrNext; 86 BOOL fOK = TRUE; 87 88 lpstrTemp = *plpstrPair; 89 if (lpstrTemp[0] != 0) 90 { 91 // get filter description 92 lpstrTemp = lpstrTemp + strlen(lpstrTemp); 93 lpstrNext = lpstrTemp + 1; 94 if (lpstrNext[0] == 0) 95 fOK = FALSE; 96 else 97 { 98 // get filter mask 99 lpstrTemp = lpstrNext; 100 lpstrTemp = lpstrTemp + strlen(lpstrTemp); 101 lpstrTemp++; 102 } 103 104 if (fOK) 105 *plpstrPair = lpstrTemp; 106 } 107 return fOK; 108 } 109 110 111 /***************************************************************************** 112 * Name : iFileDlg_CleanFilterArray 113 * Purpose : remove erroneous array entries at the end to prevent 114 * Open32 complain about them but open the file dialog 115 * instead. 116 * Parameters: 117 * Variables : 118 * Result : 119 * Remark : 120 * Status : 121 * 122 * Author : 123 *****************************************************************************/ 124 125 static DWORD iFileDlg_CleanFilterArray( LPSTR lpstrFilters) 126 { 127 DWORD dwCount = 0; 128 LPSTR lpstrTemp; 129 130 if (lpstrFilters && *lpstrFilters) 131 { 132 lpstrTemp = lpstrFilters; 133 while (lpstrTemp[0] != 0) 134 { 135 // if an invalid filter token is found, such as found 136 // in NT4's Regedit e. g., return number of proper 137 // filter tokens. 138 // Here however, as were calling Open32, we need 139 // to correct the filter array. 140 if (iFileDlg_ScanFilterToken(&lpstrTemp) == FALSE) 141 { 142 //@@@PH two alternative methods: 143 // - copy array to new, corrected array while scanning tokens 144 // - just overwrite bogus characters at the end of the array 145 *lpstrTemp++ = 0; // try string termination 146 *lpstrTemp = 0; 147 return dwCount; 148 } 149 150 dwCount++; 151 } 152 } 153 return dwCount; 154 } 155 156 66 157 /***************************************************************************** 67 158 * Name : … … 82 173 83 174 if(lpofn->Flags & (OFN_ENABLETEMPLATE|OFN_ENABLETEMPLATEHANDLE)) { 84 175 return GetFileDialog95A(lpofn, SAVE_DIALOG); 85 176 } 86 177 87 178 COMDLG32_CHECKHOOK(lpofn, OFN_ENABLEHOOK, WNDPROC) 88 179 89 //@@@PH 1999/11/09 needs to be fixed 180 //Note: fix IBM's proper error checking for NT's lazy check 181 if (lpofn->lpstrFilter != NULL) 182 iFileDlg_CleanFilterArray((LPSTR)lpofn->lpstrFilter); 183 90 184 return(O32_GetSaveFileName(lpofn)); 91 185 } 186 92 187 93 188 /***************************************************************************** … … 114 209 115 210 if(lpofn->Flags & (OFN_ENABLETEMPLATE|OFN_ENABLETEMPLATEHANDLE)) { 116 211 return GetFileDialog95W(lpofn, SAVE_DIALOG); 117 212 } 118 213 … … 237 332 COMDLG32_CHECKHOOK(lpofn, OFN_ENABLEHOOK, WNDPROC) 238 333 239 //@@@PH 1999/11/09 needs to be fixed 334 //Note: fix IBM's proper error checking for NT's lazy check 335 if (lpofn->lpstrFilter != NULL) 336 iFileDlg_CleanFilterArray((LPSTR)lpofn->lpstrFilter); 337 240 338 return(O32_GetOpenFileName(lpofn)); 241 339 } … … 264 362 265 363 if(lpofn->Flags & (OFN_ENABLETEMPLATE|OFN_ENABLETEMPLATEHANDLE)) { 266 364 return GetFileDialog95W(lpofn, OPEN_DIALOG); 267 365 } 268 366
Note:
See TracChangeset
for help on using the changeset viewer.