| 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 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 auto* blkx = base::mac::GetValueFromDictionary<CFArrayRef>(resource_fork, | 487 auto* blkx = base::mac::GetValueFromDictionary<CFArrayRef>(resource_fork, |
| 488 CFSTR("blkx")); | 488 CFSTR("blkx")); |
| 489 if (!blkx) { | 489 if (!blkx) { |
| 490 DLOG(ERROR) << "No blkx entry in resource-fork"; | 490 DLOG(ERROR) << "No blkx entry in resource-fork"; |
| 491 return false; | 491 return false; |
| 492 } | 492 } |
| 493 | 493 |
| 494 for (CFIndex i = 0; i < CFArrayGetCount(blkx); ++i) { | 494 for (CFIndex i = 0; i < CFArrayGetCount(blkx); ++i) { |
| 495 auto* block_dictionary = | 495 auto* block_dictionary = |
| 496 base::mac::CFCast<CFDictionaryRef>(CFArrayGetValueAtIndex(blkx, i)); | 496 base::mac::CFCast<CFDictionaryRef>(CFArrayGetValueAtIndex(blkx, i)); |
| 497 if (!block_dictionary) { |
| 498 DLOG(ERROR) << "Skipping block " << i |
| 499 << " because it is not a CFDictionary"; |
| 500 continue; |
| 501 } |
| 502 |
| 497 auto* data = base::mac::GetValueFromDictionary<CFDataRef>(block_dictionary, | 503 auto* data = base::mac::GetValueFromDictionary<CFDataRef>(block_dictionary, |
| 498 CFSTR("Data")); | 504 CFSTR("Data")); |
| 499 if (!data) { | 505 if (!data) { |
| 500 DLOG(ERROR) << "Skipping block " << i | 506 DLOG(ERROR) << "Skipping block " << i |
| 501 << " because it has no Data section"; | 507 << " because it has no Data section"; |
| 502 continue; | 508 continue; |
| 503 } | 509 } |
| 504 | 510 |
| 505 // Copy the block table out of the plist. | 511 // Copy the block table out of the plist. |
| 506 std::unique_ptr<UDIFBlock> block(new UDIFBlock()); | 512 std::unique_ptr<UDIFBlock> block(new UDIFBlock()); |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 857 << chunk_->compressed_offset; | 863 << chunk_->compressed_offset; |
| 858 return false; | 864 return false; |
| 859 } | 865 } |
| 860 return true; | 866 return true; |
| 861 } | 867 } |
| 862 | 868 |
| 863 } // namespace | 869 } // namespace |
| 864 | 870 |
| 865 } // namespace dmg | 871 } // namespace dmg |
| 866 } // namespace safe_browsing | 872 } // namespace safe_browsing |
| OLD | NEW |