X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=folly%2Fio%2FRecordIO-inl.h;h=09f90c57eaeb44c3afb58a18989b6eabccf70b97;hb=e4c892c71e25bf81abcb5a4e0412990623cf6105;hp=32d615ef8ab35a404745233c42c18b6f934e30d3;hpb=6cee46136f0825424e442831c2d844ac94e23f7b;p=folly.git diff --git a/folly/io/RecordIO-inl.h b/folly/io/RecordIO-inl.h index 32d615ef..09f90c57 100644 --- a/folly/io/RecordIO-inl.h +++ b/folly/io/RecordIO-inl.h @@ -1,5 +1,5 @@ /* - * Copyright 2013 Facebook, Inc. + * Copyright 2017 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +20,7 @@ #include -#include "folly/SpookyHashV2.h" +#include namespace folly { @@ -37,7 +37,7 @@ class RecordIOReader::Iterator : public boost::iterator_facade< bool equal(const Iterator& other) const { return range_ == other.range_; } void increment() { size_t skip = recordio_helpers::headerSize() + recordAndPos_.first.size(); - recordAndPos_.second += skip; + recordAndPos_.second += off_t(skip); range_.advance(skip); advanceToValid(); } @@ -61,6 +61,7 @@ namespace recordio_helpers { namespace detail { +FOLLY_PACK_PUSH struct Header { // First 4 bytes of SHA1("zuck"), big-endian // Any values will do, except that the sequence must not have a @@ -75,12 +76,13 @@ struct Header { uint32_t dataLength; uint64_t dataHash; uint32_t headerHash; // must be last -} __attribute__((packed)); +} FOLLY_PACK_ATTR; +FOLLY_PACK_POP static_assert(offsetof(Header, headerHash) + sizeof(Header::headerHash) == sizeof(Header), "invalid header layout"); -} // namespace detail +} // namespace detail constexpr size_t headerSize() { return sizeof(detail::Header); } @@ -88,7 +90,6 @@ inline RecordInfo findRecord(ByteRange range, uint32_t fileId) { return findRecord(range, range, fileId); } -} // namespace recordio_helpers - -} // namespaces +} // namespace recordio_helpers +} // namespace folly