- Timestamp:
- Oct 25, 2007 8:03:50 AM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 25684
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
r5391 r5497 3228 3228 if (VBOX_SUCCESS(rc)) 3229 3229 { 3230 RTPrintf("Creating fixed image with size %RU64 Bytes (%RU64MB)...\n", cbFile, (cbFile + _1M - 1) / _1M);3230 RTPrintf("Creating fixed image with size %RU64 bytes (%RU64MB)...\n", cbFile, (cbFile + _1M - 1) / _1M); 3231 3231 char pszComment[256]; 3232 3232 RTStrPrintf(pszComment, sizeof(pszComment), "Converted image from %s", argv[0]); … … 3242 3242 { 3243 3243 /* alloc work buffer. */ 3244 void *pvBuf = RTMemAlloc(VDIDiskGetBufferSize(pVdi)); 3244 size_t cbBuffer = VDIDiskGetBufferSize(pVdi); 3245 void *pvBuf = RTMemAlloc(cbBuffer); 3245 3246 if (pvBuf) 3246 3247 { 3247 uint64_t off = 0;3248 while (off < cbFile)3248 uint64_t offFile = 0; 3249 while (offFile < cbFile) 3249 3250 { 3250 3251 size_t cbRead = 0; 3251 rc = RTFileRead(File, pvBuf, VDIDiskGetBufferSize(pVdi), &cbRead); 3252 size_t cbToRead = cbFile - offFile >= cbBuffer ? cbBuffer : cbFile - offFile; 3253 rc = RTFileRead(File, pvBuf, cbToRead, &cbRead); 3252 3254 if (VBOX_FAILURE(rc) || !cbRead) 3253 3255 break; 3254 rc = VDIDiskWrite(pVdi, off , pvBuf, cbRead);3256 rc = VDIDiskWrite(pVdi, offFile, pvBuf, cbRead); 3255 3257 if (VBOX_FAILURE(rc)) 3256 3258 break; 3257 off += cbRead;3259 offFile += cbRead; 3258 3260 } 3259 3261
Note:
See TracChangeset
for help on using the changeset viewer.