php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
cdf.c File Reference
#include "file.h"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <ctype.h>
#include <limits.h>
#include "cdf.h"

Go to the source code of this file.

Macros

#define EFTYPE   EINVAL
 
#define SIZE_T_MAX   CAST(size_t, ~0ULL)
 
#define DPRINTF(a)
 
#define NEED_SWAP   (cdf_bo.u == CAST(uint32_t, 0x01020304))
 
#define CDF_TOLE8(x)
 
#define CDF_TOLE4(x)
 
#define CDF_TOLE2(x)
 
#define CDF_TOLE(x)
 
#define CDF_GETUINT32(x, y)
 
#define CDF_MALLOC(n)
 
#define CDF_REALLOC(p, n)
 
#define CDF_CALLOC(n, u)
 
#define CDF_UNPACK(a)
 
#define CDF_UNPACKA(a)
 
#define CDF_SEC_LIMIT   (UINT32_MAX / (64 * ss))
 
#define CDF_SHLEN_LIMIT   (UINT32_MAX / 64)
 
#define CDF_PROP_LIMIT   (UINT32_MAX / (64 * sizeof(cdf_property_info_t)))
 
#define extract_catalog_field(t, f, l)
 

Functions

uint16_t cdf_tole2 (uint16_t sv)
 
uint32_t cdf_tole4 (uint32_t sv)
 
uint64_t cdf_tole8 (uint64_t sv)
 
void cdf_swap_header (cdf_header_t *h)
 
void cdf_unpack_header (cdf_header_t *h, char *buf)
 
void cdf_swap_dir (cdf_directory_t *d)
 
void cdf_swap_class (cdf_classid_t *d)
 
void cdf_unpack_dir (cdf_directory_t *d, char *buf)
 
int cdf_zero_stream (cdf_stream_t *scn)
 
int cdf_read_header (const cdf_info_t *info, cdf_header_t *h)
 
ssize_t cdf_read_sector (const cdf_info_t *info, void *buf, size_t offs, size_t len, const cdf_header_t *h, cdf_secid_t id)
 
ssize_t cdf_read_short_sector (const cdf_stream_t *sst, void *buf, size_t offs, size_t len, const cdf_header_t *h, cdf_secid_t id)
 
int cdf_read_sat (const cdf_info_t *info, cdf_header_t *h, cdf_sat_t *sat)
 
size_t cdf_count_chain (const cdf_sat_t *sat, cdf_secid_t sid, size_t size)
 
int cdf_read_long_sector_chain (const cdf_info_t *info, const cdf_header_t *h, const cdf_sat_t *sat, cdf_secid_t sid, size_t len, cdf_stream_t *scn)
 
int cdf_read_short_sector_chain (const cdf_header_t *h, const cdf_sat_t *ssat, const cdf_stream_t *sst, cdf_secid_t sid, size_t len, cdf_stream_t *scn)
 
int cdf_read_sector_chain (const cdf_info_t *info, const cdf_header_t *h, const cdf_sat_t *sat, const cdf_sat_t *ssat, const cdf_stream_t *sst, cdf_secid_t sid, size_t len, cdf_stream_t *scn)
 
int cdf_read_dir (const cdf_info_t *info, const cdf_header_t *h, const cdf_sat_t *sat, cdf_dir_t *dir)
 
int cdf_read_ssat (const cdf_info_t *info, const cdf_header_t *h, const cdf_sat_t *sat, cdf_sat_t *ssat)
 
int cdf_read_short_stream (const cdf_info_t *info, const cdf_header_t *h, const cdf_sat_t *sat, const cdf_dir_t *dir, cdf_stream_t *scn, const cdf_directory_t **root)
 
int cdf_read_doc_summary_info (const cdf_info_t *info, const cdf_header_t *h, const cdf_sat_t *sat, const cdf_sat_t *ssat, const cdf_stream_t *sst, const cdf_dir_t *dir, cdf_stream_t *scn)
 
int cdf_read_summary_info (const cdf_info_t *info, const cdf_header_t *h, const cdf_sat_t *sat, const cdf_sat_t *ssat, const cdf_stream_t *sst, const cdf_dir_t *dir, cdf_stream_t *scn)
 
int cdf_read_user_stream (const cdf_info_t *info, const cdf_header_t *h, const cdf_sat_t *sat, const cdf_sat_t *ssat, const cdf_stream_t *sst, const cdf_dir_t *dir, const char *name, cdf_stream_t *scn)
 
int cdf_find_stream (const cdf_dir_t *dir, const char *name, int type)
 
int cdf_read_property_info (const cdf_stream_t *sst, const cdf_header_t *h, uint32_t offs, cdf_property_info_t **info, size_t *count, size_t *maxcount)
 
int cdf_unpack_summary_info (const cdf_stream_t *sst, const cdf_header_t *h, cdf_summary_info_header_t *ssi, cdf_property_info_t **info, size_t *count)
 
int cdf_unpack_catalog (const cdf_header_t *h, const cdf_stream_t *sst, cdf_catalog_t **cat)
 
int cdf_print_classid (char *buf, size_t buflen, const cdf_classid_t *id)
 
int cdf_print_property_name (char *buf, size_t bufsiz, uint32_t p)
 
int cdf_print_elapsed_time (char *buf, size_t bufsiz, cdf_timestamp_t ts)
 
char * cdf_u16tos8 (char *buf, size_t len, const uint16_t *p)
 

Macro Definition Documentation

◆ CDF_CALLOC

#define CDF_CALLOC ( n,
u )
Value:
uint32_t u
Definition cdf.c:78
zend_long n
Definition ffi.c:4979
#define ecalloc(nmemb, size)
Definition zend_alloc.h:158

Definition at line 98 of file cdf.c.

◆ CDF_GETUINT32

#define CDF_GETUINT32 ( x,
y )
Value:
cdf_getuint32(x, y)

Definition at line 94 of file cdf.c.

◆ CDF_MALLOC

#define CDF_MALLOC ( n)
Value:
#define emalloc(size)
Definition zend_alloc.h:151

Definition at line 96 of file cdf.c.

◆ CDF_PROP_LIMIT

#define CDF_PROP_LIMIT   (UINT32_MAX / (64 * sizeof(cdf_property_info_t)))

Definition at line 869 of file cdf.c.

◆ CDF_REALLOC

#define CDF_REALLOC ( p,
n )
Value:
p
Definition session.c:1105
#define erealloc(ptr, size)
Definition zend_alloc.h:159

Definition at line 97 of file cdf.c.

◆ CDF_SEC_LIMIT

#define CDF_SEC_LIMIT   (UINT32_MAX / (64 * ss))

◆ CDF_SHLEN_LIMIT

#define CDF_SHLEN_LIMIT   (UINT32_MAX / 64)

Definition at line 868 of file cdf.c.

◆ CDF_TOLE

#define CDF_TOLE ( x)
Value:
(/*CONSTCOND*/sizeof(x) == 2 ? \
CDF_TOLE2(CAST(uint16_t, x)) : \
(/*CONSTCOND*/sizeof(x) == 4 ? \
CDF_TOLE4(CAST(uint32_t, x)) : \
CDF_TOLE8(CAST(uint64_t, x))))
sizeof(Countable|array $value, int $mode=COUNT_NORMAL)
#define CDF_TOLE4(x)
Definition cdf.c:85
#define CDF_TOLE8(x)
Definition cdf.c:83
#define CAST(T, b)
Definition file.h:425

Definition at line 89 of file cdf.c.

◆ CDF_TOLE2

#define CDF_TOLE2 ( x)
Value:
(CAST(uint16_t, NEED_SWAP ? _cdf_tole2(x) : CAST(uint16_t, x)))
#define NEED_SWAP
Definition cdf.c:81

Definition at line 87 of file cdf.c.

◆ CDF_TOLE4

#define CDF_TOLE4 ( x)
Value:
(CAST(uint32_t, NEED_SWAP ? _cdf_tole4(x) : CAST(uint32_t, x)))

Definition at line 85 of file cdf.c.

◆ CDF_TOLE8

#define CDF_TOLE8 ( x)
Value:
(CAST(uint64_t, NEED_SWAP ? _cdf_tole8(x) : CAST(uint64_t, x)))

Definition at line 83 of file cdf.c.

◆ CDF_UNPACK

#define CDF_UNPACK ( a)
Value:
(void)memcpy(&(a), &buf[len], sizeof(a)), len += sizeof(a)
size_t len
Definition apprentice.c:174
memcpy(ptr1, ptr2, size)
zend_ffi_ctype_name_buf buf
Definition ffi.c:4685
$obj a
Definition test.php:84
ZEND_API void(ZEND_FASTCALL *zend_touch_vm_stack_data)(void *vm_stack_data)

Definition at line 172 of file cdf.c.

◆ CDF_UNPACKA

#define CDF_UNPACKA ( a)
Value:
(void)memcpy((a), &buf[len], sizeof(a)), len += sizeof(a)

Definition at line 174 of file cdf.c.

◆ DPRINTF

#define DPRINTF ( a)

Definition at line 73 of file cdf.c.

◆ EFTYPE

#define EFTYPE   EINVAL

Definition at line 61 of file cdf.c.

◆ extract_catalog_field

#define extract_catalog_field ( t,
f,
l )
Value:
if (b + l + sizeof(cep->f) > eb) { \
cep->ce_namlen = 0; \
break; \
} \
memcpy(&cep->f, b + (l), sizeof(cep->f)); \
ce[i].f = CAST(t, CDF_TOLE(cep->f))
#define CDF_TOLE(x)
Definition cdf.c:89

Definition at line 1150 of file cdf.c.

◆ NEED_SWAP

#define NEED_SWAP   (cdf_bo.u == CAST(uint32_t, 0x01020304))

Definition at line 81 of file cdf.c.

◆ SIZE_T_MAX

#define SIZE_T_MAX   CAST(size_t, ~0ULL)

Definition at line 65 of file cdf.c.

Function Documentation

◆ cdf_count_chain()

size_t cdf_count_chain ( const cdf_sat_t * sat,
cdf_secid_t sid,
size_t size )

Definition at line 531 of file cdf.c.

◆ cdf_find_stream()

int cdf_find_stream ( const cdf_dir_t * dir,
const char * name,
int type )

Definition at line 851 of file cdf.c.

◆ cdf_print_classid()

int cdf_print_classid ( char * buf,
size_t buflen,
const cdf_classid_t * id )

Definition at line 1227 of file cdf.c.

◆ cdf_print_elapsed_time()

int cdf_print_elapsed_time ( char * buf,
size_t bufsiz,
cdf_timestamp_t ts )

Definition at line 1274 of file cdf.c.

◆ cdf_print_property_name()

int cdf_print_property_name ( char * buf,
size_t bufsiz,
uint32_t p )

Definition at line 1263 of file cdf.c.

◆ cdf_read_dir()

int cdf_read_dir ( const cdf_info_t * info,
const cdf_header_t * h,
const cdf_sat_t * sat,
cdf_dir_t * dir )

Definition at line 673 of file cdf.c.

◆ cdf_read_doc_summary_info()

int cdf_read_doc_summary_info ( const cdf_info_t * info,
const cdf_header_t * h,
const cdf_sat_t * sat,
const cdf_sat_t * ssat,
const cdf_stream_t * sst,
const cdf_dir_t * dir,
cdf_stream_t * scn )

Definition at line 815 of file cdf.c.

◆ cdf_read_header()

int cdf_read_header ( const cdf_info_t * info,
cdf_header_t * h )

Definition at line 367 of file cdf.c.

◆ cdf_read_long_sector_chain()

int cdf_read_long_sector_chain ( const cdf_info_t * info,
const cdf_header_t * h,
const cdf_sat_t * sat,
cdf_secid_t sid,
size_t len,
cdf_stream_t * scn )

Definition at line 569 of file cdf.c.

◆ cdf_read_property_info()

int cdf_read_property_info ( const cdf_stream_t * sst,
const cdf_header_t * h,
uint32_t offs,
cdf_property_info_t ** info,
size_t * count,
size_t * maxcount )

Definition at line 963 of file cdf.c.

◆ cdf_read_sat()

int cdf_read_sat ( const cdf_info_t * info,
cdf_header_t * h,
cdf_sat_t * sat )

Definition at line 444 of file cdf.c.

◆ cdf_read_sector()

ssize_t cdf_read_sector ( const cdf_info_t * info,
void * buf,
size_t offs,
size_t len,
const cdf_header_t * h,
cdf_secid_t id )

Definition at line 400 of file cdf.c.

◆ cdf_read_sector_chain()

int cdf_read_sector_chain ( const cdf_info_t * info,
const cdf_header_t * h,
const cdf_sat_t * sat,
const cdf_sat_t * ssat,
const cdf_stream_t * sst,
cdf_secid_t sid,
size_t len,
cdf_stream_t * scn )

Definition at line 660 of file cdf.c.

◆ cdf_read_short_sector()

ssize_t cdf_read_short_sector ( const cdf_stream_t * sst,
void * buf,
size_t offs,
size_t len,
const cdf_header_t * h,
cdf_secid_t id )

Definition at line 415 of file cdf.c.

◆ cdf_read_short_sector_chain()

int cdf_read_short_sector_chain ( const cdf_header_t * h,
const cdf_sat_t * ssat,
const cdf_stream_t * sst,
cdf_secid_t sid,
size_t len,
cdf_stream_t * scn )

Definition at line 618 of file cdf.c.

◆ cdf_read_short_stream()

int cdf_read_short_stream ( const cdf_info_t * info,
const cdf_header_t * h,
const cdf_sat_t * sat,
const cdf_dir_t * dir,
cdf_stream_t * scn,
const cdf_directory_t ** root )

Definition at line 771 of file cdf.c.

◆ cdf_read_ssat()

int cdf_read_ssat ( const cdf_info_t * info,
const cdf_header_t * h,
const cdf_sat_t * sat,
cdf_sat_t * ssat )

Definition at line 728 of file cdf.c.

◆ cdf_read_summary_info()

int cdf_read_summary_info ( const cdf_info_t * info,
const cdf_header_t * h,
const cdf_sat_t * sat,
const cdf_sat_t * ssat,
const cdf_stream_t * sst,
const cdf_dir_t * dir,
cdf_stream_t * scn )

Definition at line 824 of file cdf.c.

◆ cdf_read_user_stream()

int cdf_read_user_stream ( const cdf_info_t * info,
const cdf_header_t * h,
const cdf_sat_t * sat,
const cdf_sat_t * ssat,
const cdf_stream_t * sst,
const cdf_dir_t * dir,
const char * name,
cdf_stream_t * scn )

Definition at line 833 of file cdf.c.

◆ cdf_swap_class()

void cdf_swap_class ( cdf_classid_t * d)

Definition at line 270 of file cdf.c.

◆ cdf_swap_dir()

void cdf_swap_dir ( cdf_directory_t * d)

Definition at line 253 of file cdf.c.

◆ cdf_swap_header()

void cdf_swap_header ( cdf_header_t * h)

Definition at line 196 of file cdf.c.

◆ cdf_tole2()

uint16_t cdf_tole2 ( uint16_t sv)

Definition at line 178 of file cdf.c.

◆ cdf_tole4()

uint32_t cdf_tole4 ( uint32_t sv)

Definition at line 184 of file cdf.c.

◆ cdf_tole8()

uint64_t cdf_tole8 ( uint64_t sv)

Definition at line 190 of file cdf.c.

◆ cdf_u16tos8()

char * cdf_u16tos8 ( char * buf,
size_t len,
const uint16_t * p )

Definition at line 1309 of file cdf.c.

◆ cdf_unpack_catalog()

int cdf_unpack_catalog ( const cdf_header_t * h,
const cdf_stream_t * sst,
cdf_catalog_t ** cat )

Definition at line 1159 of file cdf.c.

◆ cdf_unpack_dir()

void cdf_unpack_dir ( cdf_directory_t * d,
char * buf )

Definition at line 278 of file cdf.c.

◆ cdf_unpack_header()

void cdf_unpack_header ( cdf_header_t * h,
char * buf )

Definition at line 227 of file cdf.c.

◆ cdf_unpack_summary_info()

int cdf_unpack_summary_info ( const cdf_stream_t * sst,
const cdf_header_t * h,
cdf_summary_info_header_t * ssi,
cdf_property_info_t ** info,
size_t * count )

Definition at line 1120 of file cdf.c.

◆ cdf_zero_stream()

int cdf_zero_stream ( cdf_stream_t * scn)

Definition at line 299 of file cdf.c.

Variable Documentation

◆ n

const char* n

Definition at line 1238 of file cdf.c.

◆ s

Definition at line 77 of file cdf.c.

◆ u

uint32_t u

Definition at line 78 of file cdf.c.

◆ v

uint32_t v

Definition at line 1237 of file cdf.c.