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

Side by Side Diff: source/libvpx/third_party/libmkv/EbmlBufferWriter.c

Issue 168343002: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: libvpx: Pull from upstream Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « source/libvpx/test/vp8_boolcoder_test.cc ('k') | source/libvpx/third_party/libmkv/Makefile » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // #include <strmif.h> 1 // #include <strmif.h>
2 #include "EbmlBufferWriter.h" 2 #include "EbmlBufferWriter.h"
3 #include "EbmlWriter.h" 3 #include "EbmlWriter.h"
4 // #include <cassert> 4 // #include <cassert>
5 // #include <limits> 5 // #include <limits>
6 // #include <malloc.h> //_alloca 6 // #include <malloc.h> //_alloca
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <wchar.h> 8 #include <wchar.h>
9 #include <string.h> 9 #include <string.h>
10 10
11 void Ebml_Write(EbmlGlobal *glob, const void *buffer_in, unsigned long len) { 11 void Ebml_Write(EbmlGlobal *glob, const void *buffer_in, unsigned long len) {
12 unsigned char *src = glob->buf; 12 unsigned char *src = glob->buf;
13 src += glob->offset; 13 src += glob->offset;
14 memcpy(src, buffer_in, len); 14 memcpy(src, buffer_in, len);
15 glob->offset += len; 15 glob->offset += len;
16 } 16 }
17 17
18 static void _Serialize(EbmlGlobal *glob, const unsigned char *p, const unsigned char *q) { 18 static void _Serialize(EbmlGlobal *glob, const unsigned char *p, const unsigned char *q) {
19 while (q != p) { 19 while (q != p) {
20 --q; 20 --q;
21
22 unsigned long cbWritten;
23 memcpy(&(glob->buf[glob->offset]), q, 1); 21 memcpy(&(glob->buf[glob->offset]), q, 1);
24 glob->offset++; 22 glob->offset++;
25 } 23 }
26 } 24 }
27 25
28 void Ebml_Serialize(EbmlGlobal *glob, const void *buffer_in, unsigned long len) { 26 void Ebml_Serialize(EbmlGlobal *glob, const void *buffer_in, unsigned long len) {
29 // assert(buf); 27 // assert(buf);
30 28
31 const unsigned char *const p = (const unsigned char *)(buffer_in); 29 const unsigned char *const p = (const unsigned char *)(buffer_in);
32 const unsigned char *const q = p + len; 30 const unsigned char *const q = p + len;
(...skipping 12 matching lines...) Expand all
45 43
46 void Ebml_EndSubElement(EbmlGlobal *glob, EbmlLoc *ebmlLoc) { 44 void Ebml_EndSubElement(EbmlGlobal *glob, EbmlLoc *ebmlLoc) {
47 unsigned long long size = glob->offset - ebmlLoc->offset - 8; 45 unsigned long long size = glob->offset - ebmlLoc->offset - 8;
48 unsigned long long curOffset = glob->offset; 46 unsigned long long curOffset = glob->offset;
49 glob->offset = ebmlLoc->offset; 47 glob->offset = ebmlLoc->offset;
50 size |= 0x0100000000000000LLU; 48 size |= 0x0100000000000000LLU;
51 Ebml_Serialize(glob, &size, 8); 49 Ebml_Serialize(glob, &size, 8);
52 glob->offset = curOffset; 50 glob->offset = curOffset;
53 } 51 }
54 52
OLDNEW
« no previous file with comments | « source/libvpx/test/vp8_boolcoder_test.cc ('k') | source/libvpx/third_party/libmkv/Makefile » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698