Changeset 371 for trunk/src/helpers/xprf.c
- Timestamp:
- Nov 7, 2008, 1:15:15 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/xprf.c
r229 r371 74 74 75 75 /* 76 * Copyright (C) 2000 Ulrich Mller.76 * Copyright (C) 2000-2008 Ulrich Mller. 77 77 * This file is part of the "XWorkplace helpers" source package. 78 78 * This is free software; you can redistribute it and/or modify … … 720 720 */ 721 721 722 APIRET xprfOpenProfile( const char *pcszFilename, // in: profile name723 PXINI *ppxini) 722 APIRET xprfOpenProfile(PCSZ pcszFilename, // in: profile name 723 PXINI *ppxini) // out: profile handle 724 724 { 725 725 APIRET arc = NO_ERROR; … … 814 814 815 815 APIRET xprfQueryProfileSize(PXINI pXIni, // in: profile opened with xprfOpenProfile 816 PCSZ p szAppName,// in: application name or NULL817 PCSZ p szKeyName,// in: key name or NULL816 PCSZ pcszAppName, // in: application name or NULL 817 PCSZ pcszKeyName, // in: key name or NULL 818 818 PULONG pulDataLen) // out: size of requested data 819 819 { … … 821 821 ULONG ulDataLen = 0; 822 822 823 if (!p szAppName)823 if (!pcszAppName) 824 824 { 825 825 PLISTNODE pAppNode = lstQueryFirstNode(&pXIni->llApps); … … 840 840 841 841 if (!(arc = FindApp(pXIni, 842 p szAppName,842 pcszAppName, 843 843 &pAppData))) 844 844 { 845 845 // app exists: 846 846 847 if (!p szKeyName)847 if (!pcszKeyName) 848 848 { 849 849 // app != NULL, but key == NULL: … … 865 865 PXINIKEYDATA pKeyData; 866 866 if (!(arc = FindKey(pAppData, 867 p szKeyName,867 pcszKeyName, 868 868 &pKeyData))) 869 869 ulDataLen = pKeyData->cbData; … … 904 904 905 905 APIRET xprfQueryProfileData(PXINI pXIni, // in: profile opened with xprfOpenProfile 906 PCSZ p szAppName,// in: application name907 PCSZ p szKeyName,// in: key name or NULL906 PCSZ pcszAppName, // in: application name 907 PCSZ pcszKeyName, // in: key name or NULL 908 908 PVOID pBuffer, // in: buffer to receive data 909 909 PULONG pulBufferMax) // in: buffer size, out: size of written data … … 912 912 ULONG ulDataLen = 0; 913 913 914 if (!p szAppName)914 if (!pcszAppName) 915 915 { 916 916 PLISTNODE pAppNode = lstQueryFirstNode(&pXIni->llApps); … … 944 944 945 945 if (!(arc = FindApp(pXIni, 946 p szAppName,946 pcszAppName, 947 947 &pAppData))) 948 948 { 949 949 // app exists: 950 950 951 if (!p szKeyName)951 if (!pcszKeyName) 952 952 { 953 953 // app != NULL, but key == NULL: … … 982 982 PXINIKEYDATA pKeyData; 983 983 if (!(arc = FindKey(pAppData, 984 p szKeyName,984 pcszKeyName, 985 985 &pKeyData))) 986 986 { … … 1002 1002 1003 1003 /* 1004 *@@ xprfQueryProfileInt: 1005 * reads data from the given XINI, similarly to 1006 * what PrfQueryProfileInt does. 1007 * 1008 * You cannot specify HINI_SYSTEM or HINI_USER for 1009 * hINi. 1010 * 1011 *@@added WarpIN V1.0.18 (2008-10-04) [pr] 1012 */ 1013 1014 LONG xprfQueryProfileInt(PXINI pXIni, 1015 PCSZ pcszApp, 1016 PCSZ pcszKey, 1017 LONG lDefault) 1018 { 1019 char szBuffer[20]; 1020 LONG lVal = lDefault; 1021 ULONG ulSize = sizeof(szBuffer) - 1; 1022 1023 if (pcszApp && pcszApp[0] && pcszKey && pcszKey[0] && 1024 !xprfQueryProfileData(pXIni, pcszApp, pcszKey, szBuffer, &ulSize)) 1025 { 1026 szBuffer[ulSize] = '\0'; 1027 lVal = atol(szBuffer); 1028 } 1029 1030 return lVal; 1031 } 1032 1033 /* 1004 1034 *@@ xprfWriteProfileData: 1005 1035 * writes data into an extended profile (XINI). … … 1035 1065 1036 1066 APIRET xprfWriteProfileData(PXINI pXIni, // in: profile opened with xprfOpenProfile 1037 const char *pcszApp,// in: application name1038 const char *pcszKey,// in: key name or NULL1067 PCSZ pcszApp, // in: application name 1068 PCSZ pcszKey, // in: key name or NULL 1039 1069 PVOID pData, // in: data to write or NULL 1040 1070 ULONG ulDataLen) // in: sizeof(*pData) or null … … 1130 1160 1131 1161 /* 1162 *@@ xprfWriteProfileString: 1163 * writes string into an extended profile (XINI). 1164 * This operates similar to PrfWriteProfileString. 1165 * 1166 * You cannot specify HINI_SYSTEM or HINI_USER for 1167 * hINi. 1168 * 1169 *@@added WarpIN V1.0.18 (2008-10-04) [pr] 1170 */ 1171 1172 APIRET xprfWriteProfileString(PXINI pXIni, // in: profile opened with xprfOpenProfile 1173 PCSZ pcszApp, // in: application name 1174 PCSZ pcszKey, // in: key name or NULL 1175 PCSZ pcszString) // in: string to write or NULL 1176 { 1177 ULONG ulDataLen = 0; 1178 1179 if (pcszString) 1180 ulDataLen = strlen(pcszString) + 1; 1181 1182 return xprfWriteProfileData(pXIni, pcszApp, pcszKey, (PVOID) pcszString, ulDataLen); 1183 } 1184 1185 /* 1132 1186 *@@ xprfCloseProfile: 1133 1187 * closes a profile opened with xprfOpenProfile. … … 1177 1231 * 1178 1232 *@@added V1.0.0 (2002-09-17) [umoeller] 1233 *@@changed WarpIN V1.0.18 (2008-10-04) [pr]: fixed inverted logic bugs 1179 1234 */ 1180 1235 … … 1188 1243 1189 1244 // get size of keys list for pszApp 1190 if ( !xprfQueryProfileSize(hIni, pcszApp, NULL, &ulSizeOfKeysList))1245 if (xprfQueryProfileSize(hIni, pcszApp, NULL, &ulSizeOfKeysList)) 1191 1246 arc = PRFERR_KEYSLIST; 1192 1247 else … … 1200 1255 { 1201 1256 *pKeys = 0; 1202 if ( !xprfQueryProfileData(hIni, pcszApp, NULL, pKeys, &ulSizeOfKeysList))1257 if (xprfQueryProfileData(hIni, pcszApp, NULL, pKeys, &ulSizeOfKeysList)) 1203 1258 arc = PRFERR_KEYSLIST; 1204 1259 } … … 1214 1269 } 1215 1270 1271 /* 1272 *@@ xprfhQueryProfileData: 1273 * the equivalent of prfhQueryProfileData for 1274 * XINI files. 1275 * 1276 *@@added WarpIN V1.0.18 (2008-10-04) [pr] 1277 */ 1278 1279 PSZ xprfhQueryProfileData(PXINI pXIni, // in: INI handle 1280 PCSZ pcszApp, // in: application to query 1281 PCSZ pcszKey, // in: key to query 1282 PULONG pcbBuf) // out: size of the returned buffer; ptr can be NULL 1283 { 1284 PSZ pData = NULL; 1285 ULONG ulSizeOfData; 1286 1287 // get size of data for pcszApp/pcszKey 1288 if ( (!xprfQueryProfileSize(pXIni, (PSZ)pcszApp, (PSZ)pcszKey, &ulSizeOfData)) 1289 && (ulSizeOfData) 1290 && (pData = (PSZ)malloc(ulSizeOfData)) 1291 ) 1292 { 1293 if (xprfQueryProfileData(pXIni, (PSZ)pcszApp, (PSZ)pcszKey, pData, &ulSizeOfData)) 1294 { 1295 free(pData); 1296 pData = NULL; 1297 } 1298 } 1299 1300 if (pcbBuf) 1301 *pcbBuf = ulSizeOfData; 1302 1303 return pData; 1304 } 1305
Note:
See TracChangeset
for help on using the changeset viewer.