Comments (2)
Summary of old comments:
Thanks much for your interest in open-vcdiff, and for sharing your feedback.
I think the use of
const char*
versusconst void*
is debatable.Passing a
const char*
for dictionary_contents specifies unambiguously the units in whichdictionary_size
is expressed: the dictionary containsdictionary_size
char
values (bytes.) One of my colleagues pointed out that this has the advantage that a pointer to the end of the dictionary can be found by calculatingdictionary_contents + dictionary_size
; such a calculation would not work with avoid*
and would require an explicit cast.On the other hand, standard functions such as
memcmp
andmemcpy
takevoid*
arguments to represent pointers to contiguous bytes. The existence of those interfaces supports your position.As another reference point from the compression milieu, zlib uses
Bytef*
for its input and output, which is a typedef forunsigned char*
.Would anyone else care to offer an opinion on this issue?
Answer:
- The type 'size_t' already unambiguously denotes a byte count.
- Your point about offsetting from the dictionary pointer relates to the library implementation; but the design of an API should give the convenience of clients higher priority (unless it would severely penalize the implementation, of course.) So I don't think it's a good balance to require clients to cast the pointers, just to save a few casts in the implementation. [Also, FYI, gcc allows pointer arithmetic on
void*
for exactly this reason.]
My personal opinion is that the API should be changed to use void*
from open-vcdiff.
Just my $0.02: I prefer uint8_t*
for byte buffers.
from open-vcdiff.
Related Issues (20)
- autotools issue
- VCD_COMPILE_ASSERT warns with -Wunused-local-typedef
- The dictionary file cannot be an FIFO HOT 1
- Upgrade dependencies and switch to cmake.
- fetch_prereq requires svn HOT 1
- Compile error on Oracle Linux 7.2 HOT 1
- Fetching prerequisites no longer works HOT 1
- blockhash_test is failing with -DCMAKE_BUILD_TYPE=Release HOT 1
- instructions on creating dictionaries HOT 1
- Adler32 isn't initialized correctly
- Compile error on Fedora 24 HOT 1
- EncodeToInterface and DecodeToInterface methods should be public
- can't compile with MinGW
- gtest Source dropped
- How to read xdelta3 files with secondary compression enabled? HOT 1
- Build instructions unclear HOT 1
- Nit: fix range check in vcdecoder.cc
- COPY instructions shouldn't be allowed to cross the source segment/target window boundary
- Applying a decode twice nukes the target file
- Support for linking against open-vcdiff on Windows?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from open-vcdiff.