Changeset 68333 in vbox
- Timestamp:
- Aug 8, 2017 8:39:09 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-client/EbmlWriter.cpp
r68332 r68333 57 57 std::stack<EbmlSubElement> m_Elements; 58 58 /** The file's handle. */ 59 RTFILE m_ File;59 RTFILE m_hFile; 60 60 /** The file's name (path). */ 61 61 Utf8Str m_strFile; … … 64 64 65 65 Ebml(void) 66 : m_ File(NIL_RTFILE) { }66 : m_hFile(NIL_RTFILE) { } 67 67 68 68 virtual ~Ebml(void) { close(); } … … 73 73 inline int create(const char *a_pszFilename, uint64_t fOpen) 74 74 { 75 int rc = RTFileOpen(&m_ File, a_pszFilename, fOpen);75 int rc = RTFileOpen(&m_hFile, a_pszFilename, fOpen); 76 76 if (RT_SUCCESS(rc)) 77 77 { … … 91 91 inline uint64_t getFileSize(void) 92 92 { 93 return RTFileTell(m_ File);93 return RTFileTell(m_hFile); 94 94 } 95 95 … … 97 97 inline const RTFILE &getFile(void) 98 98 { 99 return m_ File;99 return m_hFile; 100 100 } 101 101 … … 104 104 { 105 105 RTFOFF pcbFree; 106 int rc = RTFileQueryFsSizes(m_ File, NULL, &pcbFree, 0, 0);106 int rc = RTFileQueryFsSizes(m_hFile, NULL, &pcbFree, 0, 0); 107 107 return (RT_SUCCESS(rc)? (uint64_t)pcbFree : UINT64_MAX); 108 108 } … … 118 118 m_Elements.size(), m_Elements.top().classId)); 119 119 120 RTFileClose(m_ File);121 m_ File = NIL_RTFILE;120 RTFileClose(m_hFile); 121 m_hFile = NIL_RTFILE; 122 122 123 123 m_strFile = ""; … … 131 131 inline bool isOpen(void) 132 132 { 133 return RTFileIsValid(m_ File);133 return RTFileIsValid(m_hFile); 134 134 } 135 135 … … 139 139 writeClassId(classId); 140 140 /* store the current file offset. */ 141 m_Elements.push(EbmlSubElement(RTFileTell(m_ File), classId));141 m_Elements.push(EbmlSubElement(RTFileTell(m_hFile), classId)); 142 142 /* Indicates that size of the element 143 143 * is unkown (as according to EBML specs). … … 161 161 #endif 162 162 163 uint64_t uPos = RTFileTell(m_ File);163 uint64_t uPos = RTFileTell(m_hFile); 164 164 uint64_t uSize = uPos - m_Elements.top().offset - 8; 165 RTFileSeek(m_ File, m_Elements.top().offset, RTFILE_SEEK_BEGIN, NULL);165 RTFileSeek(m_hFile, m_Elements.top().offset, RTFILE_SEEK_BEGIN, NULL); 166 166 167 167 /* Make sure that size will be serialized as uint64_t. */ 168 168 writeUnsignedInteger(uSize | UINT64_C(0x0100000000000000)); 169 RTFileSeek(m_ File, uPos, RTFILE_SEEK_BEGIN, NULL);169 RTFileSeek(m_hFile, uPos, RTFILE_SEEK_BEGIN, NULL); 170 170 m_Elements.pop(); 171 171 return *this; … … 230 230 inline int write(const void *data, size_t size) 231 231 { 232 return RTFileWrite(m_ File, data, size, NULL);232 return RTFileWrite(m_hFile, data, size, NULL); 233 233 } 234 234
Note:
See TracChangeset
for help on using the changeset viewer.