Changeset 32717 in vbox for trunk/src/libs/xpcom18a4/xpcom/reflect/xptinfo
- Timestamp:
- Sep 23, 2010 12:52:36 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/xpcom/reflect/xptinfo/src/xptiManifest.cpp
r2384 r32717 59 59 /***************************************************************************/ 60 60 61 static PRBool 61 static PRBool 62 62 GetCurrentAppDirString(xptiInterfaceInfoManager* aMgr, nsACString &aStr) 63 63 { … … 69 69 } 70 70 71 static PRBool 72 CurrentAppDirMatchesPersistentDescriptor(xptiInterfaceInfoManager* aMgr, 71 static PRBool 72 CurrentAppDirMatchesPersistentDescriptor(xptiInterfaceInfoManager* aMgr, 73 73 const char *inStr) 74 74 { … … 84 84 if(NS_FAILED(rv)) 85 85 return PR_FALSE; 86 86 87 87 PRBool matches; 88 88 rv = appDir->Equals(descDir, &matches); … … 108 108 iidStr, 109 109 (int) typelib.GetFileIndex(), 110 (int) (typelib.IsZip() ? 110 (int) (typelib.IsZip() ? 111 111 typelib.GetZipItemIndex() : -1), 112 112 (int) entry->GetScriptableFlag()); … … 129 129 PRIntn interfaceCount = 0; 130 130 nsCAutoString appDirString; 131 131 132 132 nsCOMPtr<nsILocalFile> tempFile; 133 133 if(!aMgr->GetCloneOfManifestLocation(getter_AddRefs(tempFile)) || !tempFile) … … 160 160 goto out; 161 161 162 if(!PR_fprintf(fd, "%d,%s,%d,%d\n", 162 if(!PR_fprintf(fd, "%d,%s,%d,%d\n", 163 163 0, g_TOKEN_Version, g_VERSION_MAJOR, g_VERSION_MINOR)) 164 164 goto out; … … 168 168 goto out; 169 169 170 if(!PR_fprintf(fd, "%d,%s,%s\n", 170 if(!PR_fprintf(fd, "%d,%s,%s\n", 171 171 1, g_TOKEN_AppDir, appDirString.get())) 172 172 goto out; … … 174 174 // write Directories list 175 175 176 if(!PR_fprintf(fd, "\n[%s,%d]\n", 177 g_TOKEN_Directories, 176 if(!PR_fprintf(fd, "\n[%s,%d]\n", 177 g_TOKEN_Directories, 178 178 (int) aWorkingSet->GetDirectoryCount())) 179 179 goto out; … … 181 181 for(i = 0; i < aWorkingSet->GetDirectoryCount(); i++) 182 182 { 183 nsCOMPtr<nsILocalFile> dir; 183 nsCOMPtr<nsILocalFile> dir; 184 184 nsCAutoString str; 185 185 … … 191 191 if(str.IsEmpty()) 192 192 goto out; 193 193 194 194 if(!PR_fprintf(fd, "%d,%s\n", (int) i, str.get())) 195 195 goto out; … … 198 198 // write Files list 199 199 200 if(!PR_fprintf(fd, "\n[%s,%d]\n", 201 g_TOKEN_Files, 200 if(!PR_fprintf(fd, "\n[%s,%d]\n", 201 g_TOKEN_Files, 202 202 (int) aWorkingSet->GetFileCount())) 203 203 goto out; … … 208 208 209 209 LL_L2UI(size32, file.GetSize()); 210 210 211 211 if(!PR_fprintf(fd, "%d,%s,%d,%u,%lld\n", 212 212 (int) i, … … 219 219 // write ArchiveItems list 220 220 221 if(!PR_fprintf(fd, "\n[%s,%d]\n", 222 g_TOKEN_ArchiveItems, 221 if(!PR_fprintf(fd, "\n[%s,%d]\n", 222 g_TOKEN_ArchiveItems, 223 223 (int) aWorkingSet->GetZipItemCount())) 224 224 goto out; … … 236 236 interfaceCount = aWorkingSet->mNameTable->entryCount; 237 237 238 if(!PR_fprintf(fd, "\n[%s,%d]\n", 239 g_TOKEN_Interfaces, 238 if(!PR_fprintf(fd, "\n[%s,%d]\n", 239 g_TOKEN_Interfaces, 240 240 (int) interfaceCount)) 241 241 goto out; 242 242 243 243 if(interfaceCount != (PRIntn) 244 PL_DHashTableEnumerate(aWorkingSet->mNameTable, 244 PL_DHashTableEnumerate(aWorkingSet->mNameTable, 245 245 xpti_InterfaceWriter, fd)) 246 246 goto out; … … 256 256 if(fd) 257 257 PR_Close(fd); 258 258 259 259 if(succeeded) 260 260 { … … 263 263 if(!aMgr->GetCloneOfManifestLocation(getter_AddRefs(mainFile)) || !mainFile) 264 264 return PR_FALSE; 265 265 266 266 PRBool exists; 267 267 if(NS_FAILED(mainFile->Exists(&exists))) … … 270 270 if(exists && NS_FAILED(mainFile->Remove(PR_FALSE))) 271 271 return PR_FALSE; 272 272 273 273 nsCOMPtr<nsIFile> parent; 274 274 mainFile->GetParent(getter_AddRefs(parent)); 275 275 276 276 // MoveTo means rename. 277 277 if(NS_FAILED(tempFile->MoveToNative(parent, originalLeafName))) … … 280 280 281 281 return succeeded; 282 } 282 } 283 283 284 284 /***************************************************************************/ 285 285 /***************************************************************************/ 286 286 287 static char* 287 static char* 288 288 ReadManifestIntoMemory(xptiInterfaceInfoManager* aMgr, 289 289 PRUint32* pLength) … … 302 302 { 303 303 static PRBool shown = PR_FALSE; 304 304 305 305 nsCAutoString path; 306 306 if(!shown && NS_SUCCEEDED(aFile->GetNativePath(path)) && !path.IsEmpty()) 307 307 { 308 printf("Type Manifest File: %s\n", path.get());309 shown = PR_TRUE; 310 } 311 } 308 fprintf(stderr, "Type Manifest File: %s\n", path.get()); 309 shown = PR_TRUE; 310 } 311 } 312 312 #endif 313 313 … … 319 319 return nsnull; 320 320 321 // All exits from on here should be via 'goto out' 321 // All exits from on here should be via 'goto out' 322 322 323 323 if(NS_FAILED(aFile->OpenNSPRFileDesc(PR_RDONLY, 0444, &fd)) || !fd) … … 333 333 PR_Close(fd); 334 334 335 if(!success) 335 if(!success) 336 336 { 337 337 delete [] whole; … … 340 340 341 341 *pLength = flen; 342 return whole; 342 return whole; 343 343 } 344 344 345 345 static 346 PRBool ReadSectionHeader(nsManifestLineReader& reader, 346 PRBool ReadSectionHeader(nsManifestLineReader& reader, 347 347 const char *token, int minCount, int* count) 348 348 { … … 369 369 if((*count = atoi(values[1])) < minCount) 370 370 break; 371 371 372 372 return PR_TRUE; 373 373 } … … 406 406 reader.Init(whole, flen); 407 407 408 // All exits from here on should be via 'goto out' 409 408 // All exits from here on should be via 'goto out' 409 410 410 // Look for "Header" section 411 411 … … 481 481 PRUint32 searchPathCount; 482 482 searchPath->Count(&searchPathCount); 483 483 484 484 if(dirCount != (int) searchPathCount) 485 485 goto out; … … 492 492 if(!reader.NextLine()) 493 493 goto out; 494 494 495 495 // index,directoryname 496 496 if(2 != reader.ParseLine(values, lengths, 2)) … … 503 503 // directoryname 504 504 if(!aWorkingSet->DirectoryAtMatchesPersistentDescriptor(i, values[1])) 505 goto out; 505 goto out; 506 506 } 507 507 … … 514 514 // Alloc room in the WorkingSet for the filearray. 515 515 516 if(!aWorkingSet->NewFileArray(fileCount)) 517 goto out; 516 if(!aWorkingSet->NewFileArray(fileCount)) 517 goto out; 518 518 519 519 // Read the file records … … 551 551 if(LL_IS_ZERO(date)) 552 552 goto out; 553 553 554 554 // Append a new file record to the array. 555 555 … … 566 566 567 567 if(zipItemCount) 568 if(!aWorkingSet->NewZipItemArray(zipItemCount)) 569 goto out; 568 if(!aWorkingSet->NewZipItemArray(zipItemCount)) 569 goto out; 570 570 571 571 // Read the zipItem records … … 587 587 if(!*values[1]) 588 588 goto out; 589 589 590 590 // Append a new zipItem record to the array. 591 591 … … 641 641 if(flags != 0 && flags != 1) 642 642 goto out; 643 643 644 644 // Build an InterfaceInfo and hook it in. 645 645 … … 648 648 else 649 649 typelibRecord.Init(fileIndex, zipItemIndex); 650 650 651 651 entry = xptiInterfaceEntry::NewEntry(values[1], lengths[1], 652 iid, typelibRecord, 652 iid, typelibRecord, 653 653 aWorkingSet); 654 654 if(!entry) 655 goto out; 656 655 goto out; 656 657 657 entry->SetScriptableFlag(flags==1); 658 658 … … 660 660 661 661 hashEntry = (xptiHashEntry*) 662 PL_DHashTableOperate(aWorkingSet->mNameTable, 662 PL_DHashTableOperate(aWorkingSet->mNameTable, 663 663 entry->GetTheName(), PL_DHASH_ADD); 664 664 if(hashEntry) 665 665 hashEntry->value = entry; 666 666 667 667 // Add our entry to the name hashtable. 668 668 669 669 hashEntry = (xptiHashEntry*) 670 PL_DHashTableOperate(aWorkingSet->mIIDTable, 670 PL_DHashTableOperate(aWorkingSet->mIIDTable, 671 671 entry->GetTheIID(), PL_DHASH_ADD); 672 672 if(hashEntry) … … 690 690 } 691 691 return succeeded; 692 } 693 694 // static 692 } 693 694 // static 695 695 PRBool xptiManifest::Delete(xptiInterfaceInfoManager* aMgr) 696 696 { … … 705 705 if(exists && NS_FAILED(aFile->Remove(PR_FALSE))) 706 706 return PR_FALSE; 707 707 708 708 return PR_TRUE; 709 709 }
Note:
See TracChangeset
for help on using the changeset viewer.