OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/utility/safe_browsing/mac/udif.h" | 5 #include "chrome/utility/safe_browsing/mac/udif.h" |
6 | 6 |
7 #include <CoreFoundation/CoreFoundation.h> | 7 #include <CoreFoundation/CoreFoundation.h> |
8 #include <bzlib.h> | 8 #include <bzlib.h> |
9 #include <libkern/OSByteOrder.h> | 9 #include <libkern/OSByteOrder.h> |
10 #include <uuid/uuid.h> | 10 #include <uuid/uuid.h> |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 DLOG(ERROR) << "Failed to parse XML plist: " | 450 DLOG(ERROR) << "Failed to parse XML plist: " |
451 << base::SysCFStringRefToUTF8(error_string); | 451 << base::SysCFStringRefToUTF8(error_string); |
452 return false; | 452 return false; |
453 } | 453 } |
454 | 454 |
455 if (!plist) { | 455 if (!plist) { |
456 DLOG(ERROR) << "Plist is not a dictionary"; | 456 DLOG(ERROR) << "Plist is not a dictionary"; |
457 return false; | 457 return false; |
458 } | 458 } |
459 | 459 |
460 auto resource_fork = base::mac::GetValueFromDictionary<CFDictionaryRef>( | 460 auto* resource_fork = base::mac::GetValueFromDictionary<CFDictionaryRef>( |
461 plist.get(), CFSTR("resource-fork")); | 461 plist.get(), CFSTR("resource-fork")); |
462 if (!resource_fork) { | 462 if (!resource_fork) { |
463 DLOG(ERROR) << "No resource-fork entry in plist"; | 463 DLOG(ERROR) << "No resource-fork entry in plist"; |
464 return false; | 464 return false; |
465 } | 465 } |
466 | 466 |
467 auto blkx = base::mac::GetValueFromDictionary<CFArrayRef>(resource_fork, | 467 auto* blkx = base::mac::GetValueFromDictionary<CFArrayRef>(resource_fork, |
468 CFSTR("blkx")); | 468 CFSTR("blkx")); |
469 if (!blkx) { | 469 if (!blkx) { |
470 DLOG(ERROR) << "No blkx entry in resource-fork"; | 470 DLOG(ERROR) << "No blkx entry in resource-fork"; |
471 return false; | 471 return false; |
472 } | 472 } |
473 | 473 |
474 for (CFIndex i = 0; i < CFArrayGetCount(blkx); ++i) { | 474 for (CFIndex i = 0; i < CFArrayGetCount(blkx); ++i) { |
475 auto block_dictionary = | 475 auto* block_dictionary = |
476 base::mac::CFCast<CFDictionaryRef>(CFArrayGetValueAtIndex(blkx, i)); | 476 base::mac::CFCast<CFDictionaryRef>(CFArrayGetValueAtIndex(blkx, i)); |
477 auto data = base::mac::GetValueFromDictionary<CFDataRef>(block_dictionary, | 477 auto* data = base::mac::GetValueFromDictionary<CFDataRef>(block_dictionary, |
478 CFSTR("Data")); | 478 CFSTR("Data")); |
479 if (!data) { | 479 if (!data) { |
480 DLOG(ERROR) << "Skipping block " << i | 480 DLOG(ERROR) << "Skipping block " << i |
481 << " because it has no Data section"; | 481 << " because it has no Data section"; |
482 continue; | 482 continue; |
483 } | 483 } |
484 | 484 |
485 // Copy the block table out of the plist. | 485 // Copy the block table out of the plist. |
486 std::unique_ptr<UDIFBlock> block(new UDIFBlock()); | 486 std::unique_ptr<UDIFBlock> block(new UDIFBlock()); |
487 if (!block->ParseBlockData( | 487 if (!block->ParseBlockData( |
488 reinterpret_cast<const UDIFBlockData*>(CFDataGetBytePtr(data)), | 488 reinterpret_cast<const UDIFBlockData*>(CFDataGetBytePtr(data)), |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 << chunk_->compressed_offset; | 834 << chunk_->compressed_offset; |
835 return false; | 835 return false; |
836 } | 836 } |
837 return true; | 837 return true; |
838 } | 838 } |
839 | 839 |
840 } // namespace | 840 } // namespace |
841 | 841 |
842 } // namespace dmg | 842 } // namespace dmg |
843 } // namespace safe_browsing | 843 } // namespace safe_browsing |
OLD | NEW |