Changeset 194
- Timestamp:
- Jul 28, 2002, 11:48:47 AM (23 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/helpers/dosh.h
r190 r194 903 903 PCSZ pcszName); 904 904 905 BOOL doshMatchCaseNoPath(const char *pcszMask, 906 const char *pcszName); 907 905 908 BOOL doshMatch(PCSZ pcszMask, 906 909 PCSZ pcszName); -
trunk/include/helpers/nls.h
r184 r194 129 129 typedef NLSDATETIME *PNLSDATETIME; 130 130 131 APIRET XWPENTRY nlsUpper(PSZ psz, ULONG ulLength);131 ULONG nlsUpper(PSZ psz); 132 132 133 133 #endif -
trunk/src/helpers/dosh2.c
r170 r194 2046 2046 2047 2047 // skip extra asterisks 2048 /* 2048 2049 do 2049 2050 { 2050 2051 ++pMask; 2051 2052 } while (*pMask == '*'); 2053 */ 2054 2055 while (*(++pMask) == '*') // V0.9.20 (2002-07-25) [umoeller] 2056 ; 2052 2057 2053 2058 // pMask points to after '*'; … … 2089 2094 2090 2095 /* 2091 *@@ doshMatch :2096 *@@ doshMatchCase: 2092 2097 * this matches '*' and '?' wildcards, similar to what 2093 * DosEditName does. It returns TRUE if the given name 2094 * matches the given mask. 2095 * 2096 * However, this does not require a file to be present, but 2097 * works on strings only. 2098 * DosEditName does. However, this does not require a 2099 * file to be present, but works on strings only. 2100 * 2101 * Returns TRUE if the given name matches the given mask. 2098 2102 * 2099 2103 * This accepts both short and fully qualified masks and … … 2106 2110 * wildcards. 2107 2111 * 2108 * -- This compares without respect to case always. 2112 * -- This compares WITH respect to case always. Upper-case 2113 * both the mask and the name before calling this, or 2114 * use doshMatch instead. 2109 2115 * 2110 2116 * -- As opposed to the WPS, this handles multiple dots in … … 2113 2119 * one will. 2114 2120 * 2115 * -- THIS COMPARES WITH RESPECT TO CASE.2116 *2117 2121 * This replaces strhMatchOS2 which has been removed with 2118 2122 * V0.9.16 and is a lot faster than the old code, which has … … 2127 2131 BOOL brc = FALSE; 2128 2132 2129 int iMaskDrive = -1,2130 iNameDrive = -1;2131 2132 2133 PCSZ pLastMaskComponent, 2133 2134 pLastNameComponent; … … 2135 2136 ULONG cbMaskPath = 0, 2136 2137 cbNamePath = 0; 2137 2138 CHAR c;2139 2138 2140 2139 if (pLastMaskComponent = strrchr(pcszMask, '\\')) … … 2176 2175 2177 2176 /* 2177 *@@ doshMatchCaseNoPath: 2178 * like doshMatchCase, but is faster if you are sure that 2179 * neither pcszMask nor pcszName contain path separators 2180 * ("\" characters). In other words, this is for short 2181 * filenames. 2182 * 2183 *@@added V0.9.20 (2002-07-25) [umoeller] 2184 */ 2185 2186 BOOL doshMatchCaseNoPath(const char *pcszMask, // in: mask (e.g. "*.TXT") 2187 const char *pcszName) // in: string to check (e.g. "TEST.TXT") 2188 { 2189 return PerformMatch(pcszMask, 2190 pcszName, 2191 // has dot? 2192 (strchr(pcszName, '.') != NULL)); 2193 } 2194 2195 /* 2178 2196 *@@ doshMatch: 2179 2197 * like doshMatchCase, but compares without respect … … 2192 2210 2193 2211 memcpy(pszMask, pcszMask, cbMask + 1); 2194 nlsUpper(pszMask , cbMask);2212 nlsUpper(pszMask); 2195 2213 memcpy(pszName, pcszName, cbName + 1); 2196 nlsUpper(pszName , cbName);2197 2198 return (doshMatchCase(pszMask,2199 pszName));2200 } 2214 nlsUpper(pszName); 2215 2216 return doshMatchCase(pszMask, 2217 pszName); 2218 } -
trunk/src/helpers/nls.c
r190 r194 752 752 } 753 753 754 CHAR G_szUpperMap[257]; 755 BOOL G_fUpperMapInited = FALSE; 756 757 /* 758 *@@ InitUpperMap: 759 * initializes the case map for nlsUpper. 760 * 761 *@@added V0.9.20 (2002-07-25) [umoeller] 762 */ 763 764 static VOID InitUpperMap(VOID) 765 { 766 ULONG ul; 767 COUNTRYCODE cc; 768 BOOL fDBCS = nlsDBCS(); 769 770 for (ul = 0; 771 ul < sizeof(G_szUpperMap); 772 ++ul) 773 { 774 G_szUpperMap[ul] = (CHAR)ul; 775 776 if ( (fDBCS) 777 && (G_afLeadByte[ul] != TYPE_SBCS) 778 ) 779 G_szUpperMap[ul] = ' '; 780 } 781 782 G_szUpperMap[256] = '\0'; 783 784 cc.country = 0; // use system country code 785 cc.codepage = 0; // use process default codepage 786 DosMapCase(255, 787 &cc, 788 G_szUpperMap + 1); 789 790 G_fUpperMapInited = TRUE; 791 } 754 792 755 793 /* … … 757 795 * quick hack for upper-casing a string. 758 796 * 759 * This uses DosMapCase with the default system country 760 * code and the process's codepage. WARNING: DosMapCase 761 * is a 16-bit API and therefore quite slow. Use this 762 * with care. 797 * This now returns the length of the given string always 798 * (V0.9.20). 799 * 800 * Remarks: 801 * 802 * -- On the first call, we build a case map table by 803 * calling DosMapCase with the default system country 804 * code and the process's codepage. Since DosMapCase 805 * is terribly slow with all the 16-bit thunking 806 * involved, we can then use our table without having 807 * to use the API ever again. 808 * 809 * -- As a result, if the process codepage changes for 810 * any reason, this function will not pick up the 811 * change. 812 * 813 * -- This has provisions for DBCS, which hopefully 814 * work. 763 815 * 764 816 *@@added V0.9.16 (2001-10-25) [umoeller] 765 */ 766 767 APIRET nlsUpper(PSZ psz, // in/out: string 768 ULONG ulLength) // in: string length; if 0, we run strlen(psz) 769 { 770 COUNTRYCODE cc; 817 *@@changed V0.9.20 (2002-07-25) [umoeller]: speedup, changed prototype 818 */ 819 820 ULONG nlsUpper(PSZ psz) // in/out: string 821 { 822 ULONG ul = 0; 823 824 if (!G_fUpperMapInited) 825 InitUpperMap(); 771 826 772 827 if (psz) 773 828 { 774 if (!ulLength) 775 ulLength = strlen(psz); 776 777 if (ulLength) 778 { 779 cc.country = 0; // use system country code 780 cc.codepage = 0; // use process default codepage 781 return DosMapCase(ulLength, 782 &cc, 783 psz); 784 } 785 } 786 787 return ERROR_INVALID_PARAMETER; 788 } 789 790 829 PSZ p = psz; 830 831 while (*p++ = G_szUpperMap[*p]) 832 ++ul; 833 } 834 835 return ul; 836 } 837 838 -
trunk/src/helpers/prfh.c
r167 r194 189 189 */ 190 190 191 PSZ (prfhQueryProfileData)(HINI hIni, // in: INI handle (can be HINI_USER or HINI_SYSTEM)192 const char *pcszApp, 193 const char *pcszKey, 194 PULONG pcbBuf) // out: size of the returned buffer; ptr can be NULL191 PSZ (prfhQueryProfileData)(HINI hIni, // in: INI handle (can be HINI_USER or HINI_SYSTEM) 192 const char *pcszApp, // in: application to query 193 const char *pcszKey, // in: key to query 194 PULONG pcbBuf) // out: size of the returned buffer; ptr can be NULL 195 195 { 196 196 PSZ pData = NULL; 197 ULONG ulSizeOfData = 0;197 ULONG ulSizeOfData; 198 198 199 199 // get size of data for pszApp/pszKey 200 if (PrfQueryProfileSize(hIni, (PSZ)pcszApp, (PSZ)pcszKey, &ulSizeOfData)) 201 { 202 if (ulSizeOfData) 203 { 204 pData = (PSZ)malloc(ulSizeOfData); 205 if (!PrfQueryProfileData(hIni, (PSZ)pcszApp, (PSZ)pcszKey, pData, &ulSizeOfData)) 206 { 207 free(pData); 208 pData = NULL; 209 } 200 if ( (PrfQueryProfileSize(hIni, (PSZ)pcszApp, (PSZ)pcszKey, &ulSizeOfData)) 201 && (ulSizeOfData) 202 && (pData = (PSZ)malloc(ulSizeOfData)) 203 ) 204 { 205 if (!PrfQueryProfileData(hIni, (PSZ)pcszApp, (PSZ)pcszKey, pData, &ulSizeOfData)) 206 { 207 free(pData); 208 pData = NULL; 210 209 } 211 210 } -
trunk/src/helpers/vcard.c
r167 r194 365 365 366 366 *pNextColon = '\0'; 367 nlsUpper(pLineThis, 368 pNextColon - pLineThis); 367 nlsUpper(pLineThis); 369 368 370 369 if (pNextSemicolon = strchr(pLineThis, ';'))
Note:
See TracChangeset
for help on using the changeset viewer.