Changeset 56911 in vbox for trunk/src/VBox/GuestHost/DragAndDrop/DnDURIObject.cpp
- Timestamp:
- Jul 10, 2015 9:21:10 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/DragAndDrop/DnDURIObject.cpp
r56906 r56911 76 76 void DnDURIObject::closeInternal(void) 77 77 { 78 if (m_Type == File) 79 { 80 if (u.m_hFile) 81 { 82 RTFileClose(u.m_hFile); 83 u.m_hFile = NULL; 84 } 85 } 86 } 87 88 void DnDURIObject::Close(void) 89 { 90 switch (m_Type) 91 { 92 case File: 93 { 94 if (u.m_hFile != NULL) 78 switch (m_Type) 79 { 80 case File: 81 { 82 if (u.m_hFile) 95 83 { 96 84 int rc2 = RTFileClose(u.m_hFile); … … 108 96 break; 109 97 } 98 99 LogFlowThisFuncLeave(); 100 } 101 102 void DnDURIObject::Close(void) 103 { 104 closeInternal(); 110 105 } 111 106 … … 191 186 if (!u.m_hFile) 192 187 { 193 /* 188 /* 194 189 * Open files on the source with RTFILE_O_DENY_WRITE to prevent races 195 190 * where the OS writes to the file while the destination side transfers 196 * it over. 197 */ 191 * it over. 192 */ 198 193 rc = RTFileOpen(&u.m_hFile, strPath.c_str(), fOpen); 199 LogFlowFunc(("strPath=%s, enmType=%RU32, enmDest=%RU32, rc=%Rrc\n", strPath.c_str(), enmType, enmDest, rc)); 200 #ifdef DEBUG 194 LogFlowThisFunc(("strPath=%s, fOpen=0x%x, enmType=%RU32, enmDest=%RU32, rc=%Rrc\n", 195 strPath.c_str(), fOpen, enmType, enmDest, rc)); 196 if (RT_SUCCESS(rc)) 197 rc = RTFileGetSize(u.m_hFile, &m_cbSize); 198 201 199 if (RT_SUCCESS(rc)) 202 200 { 203 uint64_t cbSize; 204 rc = RTFileGetSize(u.m_hFile, &cbSize); 205 if ( RT_SUCCESS(rc) 206 && m_cbSize) 201 if ( (fOpen & RTFILE_O_WRITE) /* Only set the file mode on write. */ 202 && fMode /* Some file mode to set specified? */) 207 203 { 208 if (cbSize > m_cbSize) 209 LogFlowFunc(("Estimated file size (%RU64) differs from current size (%RU64)\n", m_cbSize, cbSize)); 204 rc = RTFileSetMode(u.m_hFile, fMode); 205 if (RT_SUCCESS(rc)) 206 m_fMode = fMode; 207 } 208 else if (fOpen & RTFILE_O_READ) 209 { 210 #if 0 /** @todo Enable this as soon as RTFileGetMode is implemented. */ 211 rc = RTFileGetMode(u.m_hFile, &m_fMode); 212 #else 213 RTFSOBJINFO ObjInfo; 214 rc = RTFileQueryInfo(u.m_hFile, &ObjInfo, RTFSOBJATTRADD_NOTHING); 215 if (RT_SUCCESS(rc)) 216 m_fMode = ObjInfo.Attr.fMode; 217 #endif 210 218 } 211 219 } 212 #endif 213 if (RT_SUCCESS(rc) 214 && fMode) 215 { 216 rc = RTFileSetMode(u.m_hFile, fMode); 217 } 220 218 221 if (RT_SUCCESS(rc)) 219 222 { 220 LogFlow Func(("cbSize=%RU64, fMode=%RU32\n", m_cbSize, m_fMode));223 LogFlowThisFunc(("cbSize=%RU64, fMode=0x%x\n", m_cbSize, m_fMode)); 221 224 m_cbProcessed = 0; 222 225 }
Note:
See TracChangeset
for help on using the changeset viewer.