Changeset 104487 in vbox
- Timestamp:
- May 2, 2024 4:32:36 PM (7 months ago)
- Location:
- trunk/src/libs/xpcom18a4/xpcom/reflect
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/xpcom/reflect/xptcall/tests/TestXPTCInvoke.cpp
r103458 r104487 1066 1066 /***************************/ 1067 1067 1068 FooImpl::FooImpl() : Name("FooImpl") 1068 FooImpl::FooImpl() : Name("FooImpl"), SomeData1(0), SomeData2(0) 1069 1069 { 1070 1070 } … … 1086 1086 /***************************/ 1087 1087 1088 BarImpl::BarImpl() : Name("BarImpl") 1088 BarImpl::BarImpl() : Name("BarImpl"), SomeData1(0), SomeData2(0) 1089 1089 { 1090 1090 } -
trunk/src/libs/xpcom18a4/xpcom/reflect/xptinfo/src/xptiInterfaceInfoManager.cpp
r103458 r104487 356 356 XPTState *state = nsnull; 357 357 XPTCursor cursor; 358 PRInt32 flen; 359 PRInt64 fileSize; 360 361 PRBool saveFollowLinks; 362 aFile->GetFollowLinks(&saveFollowLinks); 363 aFile->SetFollowLinks(PR_TRUE); 364 365 if(NS_FAILED(aFile->GetFileSize(&fileSize)) || !(flen = nsInt64(fileSize))) 366 { 367 aFile->SetFollowLinks(saveFollowLinks); 368 return nsnull; 369 } 370 371 whole = new char[flen]; 372 if (!whole) 373 { 374 aFile->SetFollowLinks(saveFollowLinks); 375 return nsnull; 376 } 377 378 // all exits from on here should be via 'goto out' 379 int vrc = VINF_SUCCESS; 380 size_t cbRead = 0; 381 RTFILE hFile = NIL_RTFILE; 358 382 359 nsCAutoString pathName; 383 360 if (NS_FAILED(aFile->GetNativePath(pathName))) 361 return nsnull; 362 363 364 // all exits from on here should be via 'goto out' 365 RTFILE hFile = NIL_RTFILE; 366 367 int vrc = RTFileOpen(&hFile, pathName.get(), 368 RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_NONE); 369 if (RT_FAILURE(vrc)) 370 return nsnull; 371 372 uint64_t cbFile = 0; 373 vrc = RTFileQuerySize(hFile, &cbFile); 374 if (RT_FAILURE(vrc) || cbFile >= 128 * _1M) 375 { 376 RTFileClose(hFile); 377 return nsnull; 378 } 379 380 whole = new char[cbFile]; 381 if (!whole) 382 { 383 RTFileClose(hFile); 384 return nsnull; 385 } 386 387 size_t cbRead = 0; 388 vrc = RTFileRead(hFile, whole, cbFile, &cbRead); 389 if(RT_FAILURE(vrc) || cbRead < cbFile) 384 390 goto out; 385 391 386 vrc = RTFileOpen(&hFile, pathName.get(), 387 RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_NONE); 388 if (RT_FAILURE(vrc)) 389 goto out; 390 391 vrc = RTFileRead(hFile, whole, flen, &cbRead); 392 if(RT_FAILURE(vrc) || cbRead < flen) 393 goto out; 394 395 if(!(state = XPT_NewXDRState(XPT_DECODE, whole, flen))) 392 if(!(state = XPT_NewXDRState(XPT_DECODE, whole, cbFile))) 396 393 { 397 394 goto out; … … 409 406 } 410 407 411 412 if(hFile != NIL_RTFILE)413 RTFileClose(hFile); 408 out: 409 RTFileClose(hFile); 410 414 411 if(state) 415 412 XPT_DestroyXDRState(state); 416 if(whole) 417 delete [] whole; 418 aFile->SetFollowLinks(saveFollowLinks); 413 414 delete [] whole; 419 415 return header; 420 416 } -
trunk/src/libs/xpcom18a4/xpcom/reflect/xptinfo/src/xptiManifest.cpp
r102457 r104487 307 307 PRUint32* pLength) 308 308 { 309 PRInt32 flen;310 PRInt64 fileSize;311 309 char* whole = nsnull; 312 310 PRBool success = PR_FALSE; … … 316 314 return nsnull; 317 315 316 nsCAutoString pathName; 317 if (NS_FAILED(aFile->GetNativePath(pathName))) 318 return nsnull; 319 318 320 #ifdef DEBUG 319 321 { 320 322 static PRBool shown = PR_FALSE; 321 323 322 nsCAutoString path; 323 if(!shown && NS_SUCCEEDED(aFile->GetNativePath(path)) && !path.IsEmpty()) 324 if(!shown && !pathName.IsEmpty()) 324 325 { 325 fprintf(stderr, "Type Manifest File: %s\n", path .get());326 fprintf(stderr, "Type Manifest File: %s\n", pathName.get()); 326 327 shown = PR_TRUE; 327 328 } … … 329 330 #endif 330 331 331 if(NS_FAILED(aFile->GetFileSize(&fileSize)) || !(flen = nsInt64(fileSize))) 332 RTFILE hFile = NIL_RTFILE; 333 int vrc = RTFileOpen(&hFile, pathName.get(), 334 RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_NONE); 335 if (RT_FAILURE(vrc)) 332 336 return nsnull; 333 337 334 whole = new char[flen]; 338 uint64_t cbFile = 0; 339 vrc = RTFileQuerySize(hFile, &cbFile); 340 if (RT_FAILURE(vrc) || cbFile >= 128 * _1M) 341 { 342 RTFileClose(hFile); 343 return nsnull; 344 } 345 346 whole = new char[cbFile]; 335 347 if (!whole) 348 { 349 RTFileClose(hFile); 336 350 return nsnull; 337 338 // All exits from on here should be via 'goto out' 339 int vrc = VINF_SUCCESS; 351 } 352 340 353 size_t cbRead = 0; 341 RTFILE hFile = NIL_RTFILE; 342 nsCAutoString pathName; 343 if (NS_FAILED(aFile->GetNativePath(pathName))) 344 goto out; 345 346 vrc = RTFileOpen(&hFile, pathName.get(), 347 RTFILE_O_OPEN | RTFILE_O_READ | RTFILE_O_DENY_NONE); 348 if (RT_FAILURE(vrc)) 349 goto out; 350 351 vrc = RTFileRead(hFile, whole, flen, &cbRead); 352 if(RT_FAILURE(vrc) || cbRead < flen) 354 vrc = RTFileRead(hFile, whole, cbFile, &cbRead); 355 if(RT_FAILURE(vrc) || cbRead < cbFile) 353 356 goto out; 354 357 … … 365 368 } 366 369 367 *pLength = flen;370 *pLength = (uint32_t)cbFile; 368 371 return whole; 369 372 } … … 705 708 706 709 out: 707 if(whole) 708 delete [] whole; 710 delete [] whole; 709 711 710 712 if(!succeeded) -
trunk/src/libs/xpcom18a4/xpcom/reflect/xptinfo/src/xptiZipLoader.cpp
r1 r104487 107 107 if(state) 108 108 XPT_DestroyXDRState(state); 109 if(whole) 110 109 110 delete [] whole; 111 111 return header; 112 112 }
Note:
See TracChangeset
for help on using the changeset viewer.