mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-19 08:38:14 +01:00
Re-format C function signatures
This commit is contained in:
1 parent
51b1258b61
commit
2914bae3b2
26 files changed
+833
-532
No files matched your search
@@ -53,7 +53,8 @@ const char* cc = "cc";
|
||||
const char* cc_version = "???";
|
||||
#endif
|
||||
|
||||
static uint32_t calculate_hash(uint8_t* x_ptr, size_t x_len) {
|
||||
static uint32_t //
|
||||
calculate_hash(uint8_t* x_ptr, size_t x_len) {
|
||||
uint32_t s1 = 1;
|
||||
uint32_t s2 = 0;
|
||||
|
||||
@@ -115,7 +116,8 @@ static uint32_t calculate_hash(uint8_t* x_ptr, size_t x_len) {
|
||||
|
||||
uint8_t buffer[BUFFER_SIZE] = {0};
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int //
|
||||
main(int argc, char** argv) {
|
||||
bool nocheck = false;
|
||||
int i;
|
||||
for (i = 0; i < argc; i++) {
|
||||
|
||||
@@ -88,7 +88,8 @@ const char* cc = "cc";
|
||||
const char* cc_version = "???";
|
||||
#endif
|
||||
|
||||
static inline uint32_t load_u32be(uint8_t* p) {
|
||||
static inline uint32_t //
|
||||
load_u32be(uint8_t* p) {
|
||||
return ((uint32_t)(p[0]) << 24) | ((uint32_t)(p[1]) << 16) |
|
||||
((uint32_t)(p[2]) << 8) | ((uint32_t)(p[3]) << 0);
|
||||
}
|
||||
@@ -126,7 +127,8 @@ uint64_t bytes_per_pixel = 0;
|
||||
uint64_t bytes_per_row = 0;
|
||||
uint64_t bytes_per_frame = 0;
|
||||
|
||||
const char* read_stdin() {
|
||||
const char* //
|
||||
read_stdin() {
|
||||
while (src_len < SRC_BUFFER_SIZE) {
|
||||
const int stdin_fd = 0;
|
||||
ssize_t n = read(stdin_fd, src_buffer + src_len, SRC_BUFFER_SIZE - src_len);
|
||||
@@ -143,7 +145,8 @@ const char* read_stdin() {
|
||||
return "input is too large";
|
||||
}
|
||||
|
||||
const char* process_png_chunks(uint8_t* p, size_t n) {
|
||||
const char* //
|
||||
process_png_chunks(uint8_t* p, size_t n) {
|
||||
while (n > 0) {
|
||||
// Process the 8 byte chunk header.
|
||||
if (n < 8) {
|
||||
@@ -225,7 +228,8 @@ const char* process_png_chunks(uint8_t* p, size_t n) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* decode_once(bool frag_dst, bool frag_idat) {
|
||||
const char* //
|
||||
decode_once(bool frag_dst, bool frag_idat) {
|
||||
wuffs_zlib__decoder dec;
|
||||
wuffs_base__status status =
|
||||
wuffs_zlib__decoder__initialize(&dec, sizeof dec, WUFFS_VERSION, 0);
|
||||
@@ -295,7 +299,8 @@ const char* decode_once(bool frag_dst, bool frag_idat) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char* decode(bool frag_dst, bool frag_idat) {
|
||||
const char* //
|
||||
decode(bool frag_dst, bool frag_idat) {
|
||||
int reps;
|
||||
if (bytes_per_frame < 100000) {
|
||||
reps = 1000;
|
||||
@@ -336,14 +341,16 @@ const char* decode(bool frag_dst, bool frag_idat) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int fail(const char* msg) {
|
||||
int //
|
||||
fail(const char* msg) {
|
||||
const int stderr_fd = 2;
|
||||
write(stderr_fd, msg, strnlen(msg, 4095));
|
||||
write(stderr_fd, "\n", 1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int //
|
||||
main(int argc, char** argv) {
|
||||
const char* msg = read_stdin();
|
||||
if (msg) {
|
||||
return fail(msg);
|
||||
|
||||
@@ -66,13 +66,15 @@
|
||||
// recent. For some reason, this #include hits "No such file or directory" on
|
||||
// Ubuntu 18.04 (linux 4.15, glibc 2.27), and there's also been problems on
|
||||
// Debian systems. Instead, we explicitly define our own memfd_create.
|
||||
static int my_memfd_create(const char* name, unsigned int flags) {
|
||||
static int //
|
||||
my_memfd_create(const char* name, unsigned int flags) {
|
||||
return syscall(__NR_memfd_create, name, flags);
|
||||
}
|
||||
|
||||
#define N (128 * 1024)
|
||||
|
||||
void* make_ring_buffer() {
|
||||
void* //
|
||||
make_ring_buffer() {
|
||||
int page_size = getpagesize();
|
||||
if ((N < page_size) || (page_size <= 0) || ((N % page_size) != 0)) {
|
||||
return NULL;
|
||||
@@ -105,7 +107,8 @@ void* make_ring_buffer() {
|
||||
return base;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int //
|
||||
main(int argc, char** argv) {
|
||||
uint8_t* base = make_ring_buffer();
|
||||
if (!base) {
|
||||
fprintf(stderr, "could not make ring buffer\n");
|
||||
|
||||
@@ -165,10 +165,10 @@ const char*
|
||||
wuffs_deflate__error__internal_error_inconsistent_huffman_decoder_state =
|
||||
"?deflate: internal error: inconsistent Huffman decoder state";
|
||||
|
||||
static wuffs_base__status wuffs_deflate__decoder__decode_huffman_fast(
|
||||
wuffs_deflate__decoder* self,
|
||||
wuffs_base__io_buffer* a_dst,
|
||||
wuffs_base__io_buffer* a_src) {
|
||||
static wuffs_base__status //
|
||||
wuffs_deflate__decoder__decode_huffman_fast(wuffs_deflate__decoder* self,
|
||||
wuffs_base__io_buffer* a_dst,
|
||||
wuffs_base__io_buffer* a_src) {
|
||||
return wuffs_base__make_status(NULL);
|
||||
}
|
||||
|
||||
@@ -217,16 +217,16 @@ static const uint32_t wuffs_base__width_to_mask_table[33] = {
|
||||
|
||||
// This is the generated function that we are explicitly overriding. Note that
|
||||
// the function name is "wuffs_etc", not "c_wuffs_etc".
|
||||
static wuffs_base__status wuffs_deflate__decoder__decode_huffman_fast(
|
||||
wuffs_deflate__decoder* self,
|
||||
wuffs_base__io_buffer* a_dst,
|
||||
wuffs_base__io_buffer* a_src);
|
||||
static wuffs_base__status //
|
||||
wuffs_deflate__decoder__decode_huffman_fast(wuffs_deflate__decoder* self,
|
||||
wuffs_base__io_buffer* a_dst,
|
||||
wuffs_base__io_buffer* a_src);
|
||||
|
||||
// This is the overriding implementation.
|
||||
wuffs_base__status c_wuffs_deflate__decoder__decode_huffman_fast(
|
||||
wuffs_deflate__decoder* self,
|
||||
wuffs_base__io_buffer* a_dst,
|
||||
wuffs_base__io_buffer* a_src) {
|
||||
wuffs_base__status //
|
||||
c_wuffs_deflate__decoder__decode_huffman_fast(wuffs_deflate__decoder* self,
|
||||
wuffs_base__io_buffer* a_dst,
|
||||
wuffs_base__io_buffer* a_src) {
|
||||
// Avoid the -Werror=unused-function warning for the now-unused
|
||||
// overridden wuffs_deflate__decoder__decode_huffman_fast.
|
||||
(void)(wuffs_deflate__decoder__decode_huffman_fast);
|
||||
|
||||
Reference in new issue
Block a user