Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(358)

Side by Side Diff: courgette/third_party/bsdiff/bsdiff_apply.cc

Issue 2031193002: [Courgette] Refactor BSDiff namespaces and bsdiff::search() interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « courgette/third_party/bsdiff/bsdiff.h ('k') | courgette/third_party/bsdiff/bsdiff_create.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2003, 2004 Colin Percival 1 // Copyright 2003, 2004 Colin Percival
2 // All rights reserved 2 // All rights reserved
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted providing that the following conditions 5 // modification, are permitted providing that the following conditions
6 // are met: 6 // are met:
7 // 1. Redistributions of source code must retain the above copyright 7 // 1. Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer. 8 // notice, this list of conditions and the following disclaimer.
9 // 2. Redistributions in binary form must reproduce the above copyright 9 // 2. Redistributions in binary form must reproduce the above copyright
10 // notice, this list of conditions and the following disclaimer in the 10 // notice, this list of conditions and the following disclaimer in the
(...skipping 26 matching lines...) Expand all
37 37
38 #include "courgette/third_party/bsdiff/bsdiff.h" 38 #include "courgette/third_party/bsdiff/bsdiff.h"
39 39
40 #include <stddef.h> 40 #include <stddef.h>
41 #include <stdint.h> 41 #include <stdint.h>
42 42
43 #include "base/files/memory_mapped_file.h" 43 #include "base/files/memory_mapped_file.h"
44 #include "courgette/crc.h" 44 #include "courgette/crc.h"
45 #include "courgette/streams.h" 45 #include "courgette/streams.h"
46 46
47 namespace courgette { 47 namespace {
48
49 using courgette::CalculateCrc;
50 using courgette::SinkStream;
51 using courgette::SinkStreamSet;
52 using courgette::SourceStream;
53 using courgette::SourceStreamSet;
54
55 } // namespace
56
57 namespace bsdiff {
48 58
49 BSDiffStatus MBS_ReadHeader(SourceStream* stream, MBSPatchHeader* header) { 59 BSDiffStatus MBS_ReadHeader(SourceStream* stream, MBSPatchHeader* header) {
50 if (!stream->Read(header->tag, sizeof(header->tag))) 60 if (!stream->Read(header->tag, sizeof(header->tag)))
51 return READ_ERROR; 61 return READ_ERROR;
52 if (!stream->ReadVarint32(&header->slen)) 62 if (!stream->ReadVarint32(&header->slen))
53 return READ_ERROR; 63 return READ_ERROR;
54 if (!stream->ReadVarint32(&header->scrc32)) 64 if (!stream->ReadVarint32(&header->scrc32))
55 return READ_ERROR; 65 return READ_ERROR;
56 if (!stream->ReadVarint32(&header->dlen)) 66 if (!stream->ReadVarint32(&header->dlen))
57 return READ_ERROR; 67 return READ_ERROR;
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 218
209 // Write the stream to disk. 219 // Write the stream to disk.
210 int written = base::WriteFile( 220 int written = base::WriteFile(
211 new_file_path, reinterpret_cast<const char*>(new_sink_stream.Buffer()), 221 new_file_path, reinterpret_cast<const char*>(new_sink_stream.Buffer()),
212 static_cast<int>(new_sink_stream.Length())); 222 static_cast<int>(new_sink_stream.Length()));
213 if (written != static_cast<int>(new_sink_stream.Length())) 223 if (written != static_cast<int>(new_sink_stream.Length()))
214 return WRITE_ERROR; 224 return WRITE_ERROR;
215 return OK; 225 return OK;
216 } 226 }
217 227
218 } // namespace 228 } // namespace bsdiff
OLDNEW
« no previous file with comments | « courgette/third_party/bsdiff/bsdiff.h ('k') | courgette/third_party/bsdiff/bsdiff_create.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698