mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-21 16:47:28 +01:00
Generate C constructors and destructors.
This commit is contained in:
1 parent
a1dd73a58c
commit
ca9fba83c5
5 files changed
+98
-12
No files matched your search
+19
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
// Puffs requires a word size of at least 32 bits because it assumes that
|
||||
// converting a u32 to usize will never overflow. For example, the size of a
|
||||
@@ -14,12 +15,16 @@
|
||||
#error "Puffs requires a word size of at least 32 bits"
|
||||
#endif
|
||||
|
||||
// ---------------- Status Codes
|
||||
|
||||
typedef enum {
|
||||
puffs_gif_status_ok = 0,
|
||||
puffs_gif_status_short_dst = -1,
|
||||
puffs_gif_status_short_src = -2,
|
||||
} puffs_gif_status;
|
||||
|
||||
// ---------------- Structs
|
||||
|
||||
typedef struct {
|
||||
puffs_gif_status status;
|
||||
uint32_t f_literal_width;
|
||||
@@ -27,3 +32,17 @@ typedef struct {
|
||||
uint8_t f_suffixes[4096];
|
||||
uint16_t f_prefixes[4096];
|
||||
} puffs_gif_lzw_decoder;
|
||||
|
||||
// ---------------- Constructor and Destructor Prototypes
|
||||
|
||||
void puffs_gif_lzw_decoder_constructor(puffs_gif_lzw_decoder* self);
|
||||
|
||||
void puffs_gif_lzw_decoder_destructor(puffs_gif_lzw_decoder* self);
|
||||
|
||||
// ---------------- Constructor and Destructor Implementations
|
||||
|
||||
void puffs_gif_lzw_decoder_constructor(puffs_gif_lzw_decoder* self) {
|
||||
memset(self, 0, sizeof(*self));
|
||||
}
|
||||
|
||||
void puffs_gif_lzw_decoder_destructor(puffs_gif_lzw_decoder* self) {}
|
||||
+11
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
// Puffs requires a word size of at least 32 bits because it assumes that
|
||||
// converting a u32 to usize will never overflow. For example, the size of a
|
||||
@@ -18,12 +19,16 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// ---------------- Status Codes
|
||||
|
||||
typedef enum {
|
||||
puffs_gif_status_ok = 0,
|
||||
puffs_gif_status_short_dst = -1,
|
||||
puffs_gif_status_short_src = -2,
|
||||
} puffs_gif_status;
|
||||
|
||||
// ---------------- Structs
|
||||
|
||||
typedef struct {
|
||||
puffs_gif_status status;
|
||||
uint32_t f_literal_width;
|
||||
@@ -32,6 +37,12 @@ typedef struct {
|
||||
uint16_t f_prefixes[4096];
|
||||
} puffs_gif_lzw_decoder;
|
||||
|
||||
// ---------------- Constructor and Destructor Prototypes
|
||||
|
||||
void puffs_gif_lzw_decoder_constructor(puffs_gif_lzw_decoder* self);
|
||||
|
||||
void puffs_gif_lzw_decoder_destructor(puffs_gif_lzw_decoder* self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
Reference in new issue
Block a user