Changeset 16164 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Jan 22, 2009 1:21:40 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/misc/zip.cpp
r14055 r16164 248 248 249 249 #ifdef RTZIP_USE_STORE 250 #include <stdio.h> 250 251 251 252 /** … … 254 255 static DECLCALLBACK(int) rtZipStoreCompress(PRTZIPCOMP pZip, const void *pvBuf, size_t cbBuf) 255 256 { 257 uint8_t *pbDst = pZip->u.Store.pb; 256 258 while (cbBuf) 257 259 { … … 259 261 * Flush. 260 262 */ 261 size_t cb = (uintptr_t)&pZip->abBuffer[sizeof(pZip->abBuffer)] - (uintptr_t)pZip->u.Store.pb;262 if (cb <= 0)263 size_t cb = sizeof(pZip->abBuffer) - (size_t)(pbDst - &pZip->abBuffer[0]); /* careful here, g++ 4.1.2 screws up easily */ 264 if (cb == 0) 263 265 { 264 266 int rc = pZip->pfnOut(pZip->pvUser, &pZip->abBuffer[0], sizeof(pZip->abBuffer)); 265 267 if (RT_FAILURE(rc)) 266 268 return rc; 269 267 270 cb = sizeof(pZip->abBuffer); 268 p Zip->u.Store.pb= &pZip->abBuffer[0];271 pbDst = &pZip->abBuffer[0]; 269 272 } 270 273 … … 274 277 if (cbBuf < cb) 275 278 cb = cbBuf; 276 memcpy(pZip->u.Store.pb, pvBuf, cb); 277 pZip->u.Store.pb += cb; 279 memcpy(pbDst, pvBuf, cb); 280 281 pbDst += cb; 278 282 cbBuf -= cb; 279 283 pvBuf = (uint8_t *)pvBuf + cb; 280 284 } 285 pZip->u.Store.pb = pbDst; 281 286 return VINF_SUCCESS; 282 287 }
Note:
See TracChangeset
for help on using the changeset viewer.