Home | History | Annotate | Download | only in safe_browsing

Lines Matching refs:fp

124 bool FileRewind(FILE* fp) {
125 int rv = fseek(fp, 0, SEEK_SET);
130 // Read from |fp| into |item|, and fold the input data into the
133 bool ReadItem(T* item, FILE* fp, base::MD5Context* context) {
134 const size_t ret = fread(item, sizeof(T), 1, fp);
146 // Write |item| to |fp|, and fold the output data into the checksum in
149 bool WriteItem(const T& item, FILE* fp, base::MD5Context* context) {
150 const size_t ret = fwrite(&item, sizeof(T), 1, fp);
163 // Read |count| items into |values| from |fp|, and fold them into the
166 bool ReadToContainer(CT* values, size_t count, FILE* fp,
173 if (!ReadItem(&value, fp, context))
184 // Write values between |beg| and |end| to |fp|, and fold the data into the
188 FILE* fp, base::MD5Context* context) {
190 if (!WriteItem(*iter, fp, context))
196 // Write all of |values| to |fp|, and fold the data into the checksum
199 bool WriteContainer(const CT& values, FILE* fp,
201 return WriteRange(values.begin(), values.end(), fp, context);
215 bool ReadAndVerifyChecksum(FILE* fp, base::MD5Context* context) {
220 if (!ReadItem(&file_digest, fp, context))
251 // Helper function to read the file header and chunk TOC. Rewinds |fp| and
258 FILE* fp,
263 DCHECK(fp);
269 if (!FileRewind(fp))
271 if (!ReadItem(&header->v8, fp, context))
287 if (!FileRewind(fp))
289 if (!ReadItem(&header->v7, fp, context))
306 if (!ReadToContainer(add_chunks, add_chunks_count, fp, context) ||
307 !ReadToContainer(sub_chunks, sub_chunks_count, fp, context)) {
312 if (version > 7 && !ReadAndVerifyChecksum(fp, context)) {
321 // Rewinds |fp|, initializes |context|, then writes a file header and
326 FILE* fp,
328 if (!FileRewind(fp))
338 if (!WriteItem(header, fp, context))
341 if (!WriteContainer(add_chunks, fp, context) ||
342 !WriteContainer(sub_chunks, fp, context))
348 if (!WriteItem(header_digest, fp, context))
437 // Append indicated amount of data from |fp|.
440 FILE* fp, base::MD5Context* context) {
442 ReadToContainer(&add_prefixes_, add_prefix_count, fp, context) &&
443 ReadToContainer(&sub_prefixes_, sub_prefix_count, fp, context) &&
444 ReadToContainer(&add_full_hashes_, add_hash_count, fp, context) &&
445 ReadToContainer(&sub_full_hashes_, sub_hash_count, fp, context);
529 FILE* fp, base::MD5Context* context) {
541 WriteItem(shard_header, fp, context) &&
543 fp, context) &&
545 fp, context) &&
547 fp, context) &&
549 fp, context);