webmproject / sjpeg

SimpleJPEG: simple jpeg encoder
Apache License 2.0
70 stars 12 forks source link

introduce generic ByteSink for outputting bytes #73

Closed skal65535 closed 6 years ago

skal65535 commented 6 years ago

Implement some useful variants: MemorySink and StringSink (next: VectorSink)

Rationalize the Memory allocation: all internal buffers pass through the Alloc() and Free() functions, so we can later track or limit allocation traffic.

Protect all new[] with (std::nothrow) and catch the error.

TODO(after): move the ByteSink declaration to a public header (like: sjpeg.h) for exposure.

Change-Id: I6e1b3cee8f62af12e60a1e40b64e8e5e23102798