Rename some tests and benches for consistency.

This commit is contained in:
Nigel Tao committed 2017-07-07 12:37:15 +10:00
1 parent 0561297826
commit fe96654119
4 files changed
+150 -147

No files matched your search

+4 -4
View File
@@ -3,13 +3,13 @@
#include "zlib.h"
unsigned int flate_mimic_read_func(void* ctx, unsigned char** buf) {
unsigned int mimic_flate_read_func(void* ctx, unsigned char** buf) {
puffs_base_buf1* src = (puffs_base_buf1*)(ctx);
*buf = src->ptr + src->ri;
return src->wi - src->ri;
}
int flate_mimic_write_func(void* ctx, unsigned char* ptr, unsigned int len) {
int mimic_flate_write_func(void* ctx, unsigned char* ptr, unsigned int len) {
puffs_base_buf1* dst = (puffs_base_buf1*)(ctx);
size_t n = len;
if (n > dst->len - dst->wi) {
@@ -20,7 +20,7 @@ int flate_mimic_write_func(void* ctx, unsigned char* ptr, unsigned int len) {
return 0;
}
const char* flate_mimic_decode(puffs_base_buf1* dst, puffs_base_buf1* src) {
const char* mimic_flate_decode(puffs_base_buf1* dst, puffs_base_buf1* src) {
const char* ret = NULL;
uint8_t window[32 * 1024];
@@ -32,7 +32,7 @@ const char* flate_mimic_decode(puffs_base_buf1* dst, puffs_base_buf1* src) {
}
int ib_err =
inflateBack(&z, flate_mimic_read_func, src, flate_mimic_write_func, dst);
inflateBack(&z, mimic_flate_read_func, src, mimic_flate_write_func, dst);
if (ib_err != Z_STREAM_END) {
ret = "inflateBack failed";
goto cleanup1;
+4 -4
View File
@@ -3,7 +3,7 @@
#include "gif_lib.h"
int gif_mimic_read_func(GifFileType* f, GifByteType* ptr, int len) {
int mimic_gif_read_func(GifFileType* f, GifByteType* ptr, int len) {
puffs_base_buf1* src = (puffs_base_buf1*)(f->UserData);
if (len < 0) {
return 0;
@@ -18,13 +18,13 @@ int gif_mimic_read_func(GifFileType* f, GifByteType* ptr, int len) {
return n;
}
const char* gif_mimic_decode(puffs_base_buf1* dst, puffs_base_buf1* src) {
const char* mimic_gif_decode(puffs_base_buf1* dst, puffs_base_buf1* src) {
const char* ret = NULL;
// TODO: #ifdef API calls for libgif version 4 vs version 5? Note that:
// - Version 4 ships with Ubunty 14.04 LTS "Trusty".
// - Version 5 ships with Ubunty 16.04 LTS "Xenial".
GifFileType* f = DGifOpen(src, gif_mimic_read_func);
GifFileType* f = DGifOpen(src, mimic_gif_read_func);
if (!f) {
ret = "DGifOpen failed";
goto cleanup0;
@@ -43,7 +43,7 @@ const char* gif_mimic_decode(puffs_base_buf1* dst, puffs_base_buf1* src) {
// Copy the pixel data from the GifFileType* f to the dst buffer, since the
// former is free'd at the end of this function.
//
// In theory, this gif_mimic_decode function might be faster overall if the
// In theory, this mimic_gif_decode function might be faster overall if the
// DGifSlurp call above decoded the pixel data directly into dst instead of
// into an intermediate buffer that needed to be malloc'ed and then free'd.
// In practice, doing so did not seem to show a huge difference. (See commit