Changeset 34450 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Nov 29, 2010 11:00:13 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/checksum/manifest2.cpp
r34449 r34450 105 105 #define RTMANIFEST_MAGIC UINT32_C(0x99998866) 106 106 107 /** 108 * Argument package passed to rtManifestWriteStdAttr by rtManifestWriteStdEntry 109 * and RTManifestWriteStandard. 110 */ 111 typedef struct RTMANIFESTWRITESTDATTR 112 { 113 /** The entry name. */ 114 const char *pszEntry; 115 /** The output I/O stream. */ 116 RTVFSIOSTREAM hVfsIos; 117 } RTMANIFESTWRITESTDATTR; 118 107 119 108 120 /** … … 742 754 RTDECL(int) RTManifestReadStandardEx(RTMANIFEST hManifest, RTVFSIOSTREAM hVfsIos, char *pszErr, size_t cbErr) 743 755 { 756 /* 757 * Validate input. 758 */ 759 AssertPtrNull(pszErr); 744 760 if (pszErr && cbErr) 745 761 *pszErr = '\0'; 746 762 RTMANIFESTINT *pThis = hManifest; 763 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 764 AssertReturn(pThis->u32Magic == RTMANIFEST_MAGIC, VERR_INVALID_HANDLE); 765 766 /* 767 * Process the stream line by line. 768 */ 747 769 uint32_t iLine = 0; 748 770 for (;;) … … 901 923 902 924 925 /** 926 * @callback_method_impl{FNRTSTRSPACECALLBACK, Writes RTMANIFESTATTR.} 927 */ 928 static DECLCALLBACK(int) rtManifestWriteStdAttr(PRTSTRSPACECORE pStr, void *pvUser) 929 { 930 PRTMANIFESTATTR pAttr = RT_FROM_MEMBER(pStr, RTMANIFESTATTR, StrCore); 931 RTMANIFESTWRITESTDATTR *pArgs = (RTMANIFESTWRITESTDATTR *)pvUser; 932 char szLine[RTPATH_MAX + RTSHA512_DIGEST_LEN + 32]; 933 size_t cchLine = RTStrPrintf(szLine, sizeof(szLine), "%s (%s) = %s\n", pAttr->szName, pArgs->pszEntry, pAttr->pszValue); 934 if (cchLine >= sizeof(szLine) - 1) 935 return VERR_BUFFER_OVERFLOW; 936 return RTVfsIoStrmWrite(pArgs->hVfsIos, szLine, cchLine, true /*fBlocking*/, NULL); 937 } 938 939 940 /** 941 * @callback_method_impl{FNRTSTRSPACECALLBACK, Writes RTMANIFESTENTRY.} 942 */ 943 static DECLCALLBACK(int) rtManifestWriteStdEntry(PRTSTRSPACECORE pStr, void *pvUser) 944 { 945 PRTMANIFESTENTRY pEntry = RT_FROM_MEMBER(pStr, RTMANIFESTENTRY, StrCore); 946 947 RTMANIFESTWRITESTDATTR Args; 948 Args.hVfsIos = (RTVFSIOSTREAM)pvUser; 949 Args.pszEntry = pStr->pszString; 950 return RTStrSpaceEnumerate(&pEntry->Attributes, rtManifestWriteStdAttr, &Args); 951 } 952 953 903 954 RTDECL(int) RTManifestWriteStandard(RTMANIFEST hManifest, RTVFSIOSTREAM hVfsIos) 904 955 { 905 return VERR_NOT_IMPLEMENTED; 906 } 907 956 RTMANIFESTINT *pThis = hManifest; 957 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 958 AssertReturn(pThis->u32Magic == RTMANIFEST_MAGIC, VERR_INVALID_HANDLE); 959 960 RTMANIFESTWRITESTDATTR Args; 961 Args.hVfsIos = hVfsIos; 962 Args.pszEntry = "main"; 963 int rc = RTStrSpaceEnumerate(&pThis->Attributes, rtManifestWriteStdAttr, &Args); 964 if (RT_SUCCESS(rc)) 965 rc = RTStrSpaceEnumerate(&pThis->Entries, rtManifestWriteStdEntry, hVfsIos); 966 return rc; 967 } 968
Note:
See TracChangeset
for help on using the changeset viewer.