forked from protocolbuffers/upb
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sync with internal Google development.
This breaks the open-source build, will follow up with a change to fix it.
- Loading branch information
Showing
31 changed files
with
2,118 additions
and
774 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// | ||
// upb - a minimalist implementation of protocol buffers. | ||
// | ||
// Copyright (c) 2011 Google Inc. See LICENSE for details. | ||
// Author: Josh Haberman <jhaberman@gmail.com> | ||
|
||
#include "bytestream.hpp" | ||
|
||
namespace upb { | ||
|
||
upb_bytesrc_vtbl* ByteSourceBase::vtable() { | ||
static upb_bytesrc_vtbl vtbl = { | ||
&ByteSourceBase::VFetch, | ||
&ByteSourceBase::VDiscard, | ||
&ByteSourceBase::VCopy, | ||
&ByteSourceBase::VGetPtr, | ||
}; | ||
return &vtbl; | ||
} | ||
|
||
upb_bytesuccess_t ByteSourceBase::VFetch(void *src, uint64_t ofs, size_t *len) { | ||
return static_cast<ByteSourceBase*>(src)->Fetch(ofs, len); | ||
} | ||
|
||
void ByteSourceBase::VCopy( | ||
const void *src, uint64_t ofs, size_t len, char* dest) { | ||
static_cast<const ByteSourceBase*>(src)->Copy(ofs, len, dest); | ||
} | ||
|
||
void ByteSourceBase::VDiscard(void *src, uint64_t ofs) { | ||
static_cast<ByteSourceBase*>(src)->Discard(ofs); | ||
} | ||
|
||
const char * ByteSourceBase::VGetPtr( | ||
const void *src, uint64_t ofs, size_t* len) { | ||
return static_cast<const ByteSourceBase*>(src)->GetPtr(ofs, len); | ||
} | ||
|
||
} // namespace upb |
Oops, something went wrong.