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

Side by Side Diff: third_party/lzma/v4_65/files/C/7zBuf2.c

Issue 624713003: Keep only base/extractor.[cc|h]. (Closed) Base URL: https://chromium.googlesource.com/external/omaha.git@master
Patch Set: Created 6 years, 2 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 | « third_party/lzma/v4_65/files/C/7zBuf.c ('k') | third_party/lzma/v4_65/files/C/7zCrc.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /* 7zBuf2.c -- Byte Buffer
2 2008-10-04 : Igor Pavlov : Public domain */
3
4 #include <string.h>
5 #include "7zBuf.h"
6
7 void DynBuf_Construct(CDynBuf *p)
8 {
9 p->data = 0;
10 p->size = 0;
11 p->pos = 0;
12 }
13
14 void DynBuf_SeekToBeg(CDynBuf *p)
15 {
16 p->pos = 0;
17 }
18
19 int DynBuf_Write(CDynBuf *p, const Byte *buf, size_t size, ISzAlloc *alloc)
20 {
21 if (size > p->size - p->pos)
22 {
23 size_t newSize = p->pos + size;
24 Byte *data;
25 newSize += newSize / 4;
26 data = (Byte *)alloc->Alloc(alloc, newSize);
27 if (data == 0)
28 return 0;
29 p->size = newSize;
30 memcpy(data, p->data, p->pos);
31 alloc->Free(alloc, p->data);
32 p->data = data;
33 }
34 memcpy(p->data + p->pos, buf, size);
35 p->pos += size;
36 return 1;
37 }
38
39 void DynBuf_Free(CDynBuf *p, ISzAlloc *alloc)
40 {
41 alloc->Free(alloc, p->data);
42 p->data = 0;
43 p->size = 0;
44 p->pos = 0;
45 }
OLDNEW
« no previous file with comments | « third_party/lzma/v4_65/files/C/7zBuf.c ('k') | third_party/lzma/v4_65/files/C/7zCrc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698