MLX42 1.0
MLX42
Loading...
Searching...
No Matches
lodepng.c File Reference
#include "lodepng/lodepng.h"
Include dependency graph for lodepng.c:

Go to the source code of this file.

Data Structures

struct  ucvector
 

Macros

#define LODEPNG_INLINE   /* not available */
 
#define LODEPNG_RESTRICT   /* not available */
 
#define LODEPNG_MAX(a, b)   (((a) > (b)) ? (a) : (b))
 
#define LODEPNG_MIN(a, b)   (((a) < (b)) ? (a) : (b))
 
#define CERROR_BREAK(errorvar, code)
 
#define ERROR_BREAK(code)   CERROR_BREAK(error, code)
 
#define CERROR_RETURN_ERROR(errorvar, code)
 
#define CERROR_TRY_RETURN(call)
 
#define CERROR_RETURN(errorvar, code)
 

Typedefs

typedef struct ucvector ucvector
 

Functions

voidlodepng_malloc (size_t size)
 
voidlodepng_realloc (void *ptr, size_t new_size)
 
void lodepng_free (void *ptr)
 
static void lodepng_memcpy (void *LODEPNG_RESTRICT dst, const void *LODEPNG_RESTRICT src, size_t size)
 
static void lodepng_memset (void *LODEPNG_RESTRICT dst, int value, size_t num)
 
static size_t lodepng_strlen (const char *a)
 
static unsigned ucvector_reserve (ucvector *p, size_t size)
 
static unsigned ucvector_resize (ucvector *p, size_t size)
 
static ucvector ucvector_init (unsigned char *buffer, size_t size)
 

Variables

const charLODEPNG_VERSION_STRING = "20230410"
 

Macro Definition Documentation

◆ CERROR_BREAK

#define CERROR_BREAK (   errorvar,
  code 
)
Value:
{\
break;\
}
GLuint GLsizei GLsizei * length
Definition glad.h:3372

Definition at line 179 of file lodepng.c.

179 {\
180 errorvar = code;\
181 break;\
182}

◆ CERROR_RETURN

#define CERROR_RETURN (   errorvar,
  code 
)
Value:
{\
return;\
}

Definition at line 200 of file lodepng.c.

200 {\
201 errorvar = code;\
202 return;\
203}

◆ CERROR_RETURN_ERROR

#define CERROR_RETURN_ERROR (   errorvar,
  code 
)
Value:
{\
return code;\
}

Definition at line 188 of file lodepng.c.

188 {\
189 errorvar = code;\
190 return code;\
191}

◆ CERROR_TRY_RETURN

#define CERROR_TRY_RETURN (   call)
Value:
{\
unsigned error = call;\
if(error) return error;\
}

Definition at line 194 of file lodepng.c.

194 {\
195 unsigned error = call;\
196 if(error) return error;\
197}

◆ ERROR_BREAK

#define ERROR_BREAK (   code)    CERROR_BREAK(error, code)

Definition at line 185 of file lodepng.c.

◆ LODEPNG_INLINE

#define LODEPNG_INLINE   /* not available */

Definition at line 104 of file lodepng.c.

◆ LODEPNG_MAX

#define LODEPNG_MAX (   a,
  b 
)    (((a) > (b)) ? (a) : (b))

Definition at line 141 of file lodepng.c.

◆ LODEPNG_MIN

#define LODEPNG_MIN (   a,
  b 
)    (((a) < (b)) ? (a) : (b))

Definition at line 142 of file lodepng.c.

◆ LODEPNG_RESTRICT

#define LODEPNG_RESTRICT   /* not available */

Definition at line 113 of file lodepng.c.

Typedef Documentation

◆ ucvector

Function Documentation

◆ lodepng_free()

void lodepng_free ( void ptr)

◆ lodepng_malloc()

void * lodepng_malloc ( size_t  size)

◆ lodepng_memcpy()

static void lodepng_memcpy ( void *LODEPNG_RESTRICT  dst,
const void *LODEPNG_RESTRICT  src,
size_t  size 
)
static

Definition at line 120 of file lodepng.c.

121 {
122 size_t i;
123 for(i = 0; i < size; i++) ((char*)dst)[i] = ((const char*)src)[i];
124}
GLenum src
Definition glad.h:4176
GLenum GLenum dst
Definition glad.h:4176
GLsizeiptr size
Definition glad.h:3302

◆ lodepng_memset()

static void lodepng_memset ( void *LODEPNG_RESTRICT  dst,
int  value,
size_t  num 
)
static

Definition at line 126 of file lodepng.c.

127 {
128 size_t i;
129 for(i = 0; i < num; i++) ((char*)dst)[i] = (char)value;
130}
GLfloat value
Definition glad.h:2667

◆ lodepng_realloc()

void * lodepng_realloc ( void ptr,
size_t  new_size 
)
Here is the caller graph for this function:

◆ lodepng_strlen()

static size_t lodepng_strlen ( const char a)
static

Definition at line 133 of file lodepng.c.

133 {
134 const char* orig = a;
135 /* avoid warning about unused function in case of disabled COMPILE... macros */
137 while(*a) a++;
138 return (size_t)(a - orig);
139}
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GLboolean GLboolean GLboolean GLboolean a
Definition glad.h:3632
static size_t lodepng_strlen(const char *a)
Definition lodepng.c:133
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ucvector_init()

static ucvector ucvector_init ( unsigned char buffer,
size_t  size 
)
static

Definition at line 288 of file lodepng.c.

288 {
289 ucvector v;
290 v.data = buffer;
291 v.allocsize = v.size = size;
292 return v;
293}
GLdouble v
Definition glad.h:2712
GLenum GLfloat * buffer
Definition glad.h:2634
unsigned char * data
Definition lodepng.c:263

◆ ucvector_reserve()

static unsigned ucvector_reserve ( ucvector p,
size_t  size 
)
static

Definition at line 269 of file lodepng.c.

269 {
270 if(size > p->allocsize) {
271 size_t newsize = size + (p->allocsize >> 1u);
272 void* data = lodepng_realloc(p->data, newsize);
273 if(data) {
274 p->allocsize = newsize;
275 p->data = (unsigned char*)data;
276 }
277 else return 0; /*error: not enough memory*/
278 }
279 return 1; /*success*/
280}
GLboolean * data
Definition glad.h:2049
void * lodepng_realloc(void *ptr, size_t new_size)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ucvector_resize()

static unsigned ucvector_resize ( ucvector p,
size_t  size 
)
static

Definition at line 283 of file lodepng.c.

283 {
284 p->size = size;
285 return ucvector_reserve(p, size);
286}
static unsigned ucvector_reserve(ucvector *p, size_t size)
Definition lodepng.c:269
Here is the call graph for this function:

Variable Documentation

◆ LODEPNG_VERSION_STRING

const char* LODEPNG_VERSION_STRING = "20230410"

Definition at line 47 of file lodepng.c.