Back to index

php5  5.3.10
Classes | Defines | Typedefs | Functions
cdf.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  cdf_header_t
struct  cdf_directory_t
struct  cdf_sat_t
struct  cdf_dir_t
struct  cdf_stream_t
struct  cdf_classid_t
struct  cdf_summary_info_header_t
struct  cdf_section_declaration_t
struct  cdf_section_header_t
struct  cdf_property_info_t
struct  cdf_info_t
union  cdf_property_info_t.pi_val
struct  cdf_property_info_t.pi_val._pi_str

Defines

#define CDF_LOOP_LIMIT   10000
#define CDF_SECID_NULL   0
#define CDF_SECID_FREE   -1
#define CDF_SECID_END_OF_CHAIN   -2
#define CDF_SECID_SECTOR_ALLOCATION_TABLE   -3
#define CDF_SECID_MASTER_SECTOR_ALLOCATION_TABLE   -4
#define CDF_MAGIC   0xE11AB1A1E011CFD0LL
#define CDF_SEC_SIZE(h)   (1 << (h)->h_sec_size_p2)
#define CDF_SEC_POS(h, secid)   (CDF_SEC_SIZE(h) + (secid) * CDF_SEC_SIZE(h))
#define CDF_SHORT_SEC_SIZE(h)   (1 << (h)->h_short_sec_size_p2)
#define CDF_SHORT_SEC_POS(h, secid)   ((secid) * CDF_SHORT_SEC_SIZE(h))
#define CDF_DIRID_NULL   -1
#define CDF_BASE_YEAR   1601
#define CDF_TIME_PREC   10000000
#define CDF_DIR_TYPE_EMPTY   0
#define CDF_DIR_TYPE_USER_STORAGE   1
#define CDF_DIR_TYPE_USER_STREAM   2
#define CDF_DIR_TYPE_LOCKBYTES   3
#define CDF_DIR_TYPE_PROPERTY   4
#define CDF_DIR_TYPE_ROOT_STORAGE   5
#define CDF_DIR_COLOR_READ   0
#define CDF_DIR_COLOR_BLACK   1
#define CDF_DIRECTORY_SIZE   128
#define CDF_SECTION_DECLARATION_OFFSET   0x1c
#define pi_u64   pi_val._pi_u64
#define pi_s64   pi_val._pi_s64
#define pi_u32   pi_val._pi_u32
#define pi_s32   pi_val._pi_s32
#define pi_u16   pi_val._pi_u16
#define pi_s16   pi_val._pi_s16
#define pi_tp   pi_val._pi_tp
#define pi_str   pi_val._pi_str
#define CDF_ROUND(val, by)   (((val) + (by) - 1) & ~((by) - 1))
#define CDF_EMPTY   0x00000000
#define CDF_NULL   0x00000001
#define CDF_SIGNED16   0x00000002
#define CDF_SIGNED32   0x00000003
#define CDF_FLOAT   0x00000004
#define CDF_DOUBLE   0x00000005
#define CDF_CY   0x00000006
#define CDF_DATE   0x00000007
#define CDF_BSTR   0x00000008
#define CDF_DISPATCH   0x00000009
#define CDF_ERROR   0x0000000a
#define CDF_BOOL   0x0000000b
#define CDF_VARIANT   0x0000000c
#define CDF_UNKNOWN   0x0000000d
#define CDF_DECIMAL   0x0000000e
#define CDF_SIGNED8   0x00000010
#define CDF_UNSIGNED8   0x00000011
#define CDF_UNSIGNED16   0x00000012
#define CDF_UNSIGNED32   0x00000013
#define CDF_SIGNED64   0x00000014
#define CDF_UNSIGNED64   0x00000015
#define CDF_INT   0x00000016
#define CDF_UINT   0x00000017
#define CDF_VOID   0x00000018
#define CDF_HRESULT   0x00000019
#define CDF_PTR   0x0000001a
#define CDF_SAFEARRAY   0x0000001b
#define CDF_CARRAY   0x0000001c
#define CDF_USERDEFINED   0x0000001d
#define CDF_LENGTH32_STRING   0x0000001e
#define CDF_LENGTH32_WSTRING   0x0000001f
#define CDF_FILETIME   0x00000040
#define CDF_BLOB   0x00000041
#define CDF_STREAM   0x00000042
#define CDF_STORAGE   0x00000043
#define CDF_STREAMED_OBJECT   0x00000044
#define CDF_STORED_OBJECT   0x00000045
#define CDF_BLOB_OBJECT   0x00000046
#define CDF_CLIPBOARD   0x00000047
#define CDF_CLSID   0x00000048
#define CDF_VECTOR   0x00001000
#define CDF_ARRAY   0x00002000
#define CDF_BYREF   0x00004000
#define CDF_RESERVED   0x00008000
#define CDF_ILLEGAL   0x0000ffff
#define CDF_ILLEGALMASKED   0x00000fff
#define CDF_TYPEMASK   0x00000fff
#define CDF_PROPERTY_CODE_PAGE   0x00000001
#define CDF_PROPERTY_TITLE   0x00000002
#define CDF_PROPERTY_SUBJECT   0x00000003
#define CDF_PROPERTY_AUTHOR   0x00000004
#define CDF_PROPERTY_KEYWORDS   0x00000005
#define CDF_PROPERTY_COMMENTS   0x00000006
#define CDF_PROPERTY_TEMPLATE   0x00000007
#define CDF_PROPERTY_LAST_SAVED_BY   0x00000008
#define CDF_PROPERTY_REVISION_NUMBER   0x00000009
#define CDF_PROPERTY_TOTAL_EDITING_TIME   0x0000000a
#define CDF_PROPERTY_LAST_PRINTED   0X0000000b
#define CDF_PROPERTY_CREATE_TIME   0x0000000c
#define CDF_PROPERTY_LAST_SAVED_TIME   0x0000000d
#define CDF_PROPERTY_NUMBER_OF_PAGES   0x0000000e
#define CDF_PROPERTY_NUMBER_OF_WORDS   0x0000000f
#define CDF_PROPERTY_NUMBER_OF_CHARACTERS   0x00000010
#define CDF_PROPERTY_THUMBNAIL   0x00000011
#define CDF_PROPERTY_NAME_OF_APPLICATION   0x00000012
#define CDF_PROPERTY_SECURITY   0x00000013
#define CDF_PROPERTY_LOCALE_ID   0x80000000

Typedefs

typedef int32_t cdf_secid_t
typedef int32_t cdf_dirid_t
typedef int64_t cdf_timestamp_t

Functions

int cdf_timestamp_to_timespec (struct timeval *, cdf_timestamp_t)
int cdf_timespec_to_timestamp (cdf_timestamp_t *, const struct timeval *)
int cdf_read_header (const cdf_info_t *, cdf_header_t *)
void cdf_swap_header (cdf_header_t *)
void cdf_unpack_header (cdf_header_t *, char *)
void cdf_swap_dir (cdf_directory_t *)
void cdf_unpack_dir (cdf_directory_t *, char *)
void cdf_swap_class (cdf_classid_t *)
ssize_t cdf_read_sector (const cdf_info_t *, void *, size_t, size_t, const cdf_header_t *, cdf_secid_t)
ssize_t cdf_read_short_sector (const cdf_stream_t *, void *, size_t, size_t, const cdf_header_t *, cdf_secid_t)
int cdf_read_sat (const cdf_info_t *, cdf_header_t *, cdf_sat_t *)
size_t cdf_count_chain (const cdf_sat_t *, cdf_secid_t, size_t)
int cdf_read_long_sector_chain (const cdf_info_t *, const cdf_header_t *, const cdf_sat_t *, cdf_secid_t, size_t, cdf_stream_t *)
int cdf_read_short_sector_chain (const cdf_header_t *, const cdf_sat_t *, const cdf_stream_t *, cdf_secid_t, size_t, cdf_stream_t *)
int cdf_read_sector_chain (const cdf_info_t *, const cdf_header_t *, const cdf_sat_t *, const cdf_sat_t *, const cdf_stream_t *, cdf_secid_t, size_t, cdf_stream_t *)
int cdf_read_dir (const cdf_info_t *, const cdf_header_t *, const cdf_sat_t *, cdf_dir_t *)
int cdf_read_ssat (const cdf_info_t *, const cdf_header_t *, const cdf_sat_t *, cdf_sat_t *)
int cdf_read_short_stream (const cdf_info_t *, const cdf_header_t *, const cdf_sat_t *, const cdf_dir_t *, cdf_stream_t *)
int cdf_read_property_info (const cdf_stream_t *, uint32_t, cdf_property_info_t **, size_t *, size_t *)
int cdf_read_summary_info (const cdf_info_t *, const cdf_header_t *, const cdf_sat_t *, const cdf_sat_t *, const cdf_stream_t *, const cdf_dir_t *, cdf_stream_t *)
int cdf_unpack_summary_info (const cdf_stream_t *, cdf_summary_info_header_t *, cdf_property_info_t **, size_t *)
int cdf_print_classid (char *, size_t, const cdf_classid_t *)
int cdf_print_property_name (char *, size_t, uint32_t)
int cdf_print_elapsed_time (char *, size_t, cdf_timestamp_t)
uint16_t cdf_tole2 (uint16_t)
uint32_t cdf_tole4 (uint32_t)
uint64_t cdf_tole8 (uint64_t)

Class Documentation

struct cdf_header_t

Definition at line 43 of file cdf.h.

Class Members
uint16_t h_byte_order
uint64_t h_magic
cdf_secid_t h_master_sat
uint32_t h_min_size_standard_stream
uint32_t h_num_sectors_in_master_sat
uint32_t h_num_sectors_in_sat
uint32_t h_num_sectors_in_short_sat
uint16_t h_revision
uint16_t h_sec_size_p2
uint32_t h_secid_first_directory
cdf_secid_t h_secid_first_sector_in_master_sat
cdf_secid_t h_secid_first_sector_in_short_sat
uint16_t h_short_sec_size_p2
uint8_t h_unused0
uint8_t h_unused1
uint64_t h_uuid
uint16_t h_version
struct cdf_directory_t

Definition at line 80 of file cdf.h.

Class Members
uint8_t d_color
cdf_timestamp_t d_created
uint32_t d_flags
cdf_dirid_t d_left_child
cdf_timestamp_t d_modified
uint16_t d_name
uint16_t d_namelen
cdf_dirid_t d_right_child
uint32_t d_size
cdf_dirid_t d_storage
uint64_t d_storage_uuid
cdf_secid_t d_stream_first_sector
uint8_t d_type
uint32_t d_unused0
struct cdf_sat_t

Definition at line 107 of file cdf.h.

Class Members
size_t sat_len
cdf_secid_t * sat_tab
struct cdf_dir_t

Definition at line 112 of file cdf.h.

Collaboration diagram for cdf_dir_t:
Class Members
size_t dir_len
cdf_directory_t * dir_tab
struct cdf_stream_t

Definition at line 117 of file cdf.h.

Class Members
size_t sst_dirlen
size_t sst_len
void * sst_tab
struct cdf_classid_t

Definition at line 123 of file cdf.h.

Class Members
uint32_t cl_dword
uint8_t cl_six
uint8_t cl_two
uint16_t cl_word
struct cdf_summary_info_header_t

Definition at line 130 of file cdf.h.

Collaboration diagram for cdf_summary_info_header_t:
Class Members
uint16_t si_byte_order
cdf_classid_t si_class
uint32_t si_count
uint16_t si_os
uint16_t si_os_version
uint16_t si_zero
struct cdf_section_declaration_t

Definition at line 141 of file cdf.h.

Collaboration diagram for cdf_section_declaration_t:
Class Members
cdf_classid_t sd_class
uint32_t sd_offset
struct cdf_section_header_t

Definition at line 146 of file cdf.h.

Class Members
uint32_t sh_len
uint32_t sh_properties
struct cdf_property_info_t

Definition at line 151 of file cdf.h.

Class Members
uint32_t pi_id
uint32_t pi_type
union cdf_property_info_t pi_val
struct cdf_info_t

Definition at line 249 of file cdf.h.

Class Members
const unsigned char * i_buf
int i_fd
size_t i_len
union cdf_property_info_t.pi_val

Definition at line 154 of file cdf.h.

Class Members
int16_t _pi_s16
int32_t _pi_s32
int64_t _pi_s64
pi_val _pi_str
cdf_timestamp_t _pi_tp
uint16_t _pi_u16
uint32_t _pi_u32
uint64_t _pi_u64
struct cdf_property_info_t.pi_val._pi_str

Definition at line 162 of file cdf.h.

Class Members
const char * s_buf
uint32_t s_len

Define Documentation

#define CDF_ARRAY   0x00002000

Definition at line 221 of file cdf.h.

#define CDF_BASE_YEAR   1601

Definition at line 77 of file cdf.h.

#define CDF_BLOB   0x00000041

Definition at line 212 of file cdf.h.

#define CDF_BLOB_OBJECT   0x00000046

Definition at line 217 of file cdf.h.

#define CDF_BOOL   0x0000000b

Definition at line 191 of file cdf.h.

#define CDF_BSTR   0x00000008

Definition at line 188 of file cdf.h.

#define CDF_BYREF   0x00004000

Definition at line 222 of file cdf.h.

#define CDF_CARRAY   0x0000001c

Definition at line 207 of file cdf.h.

#define CDF_CLIPBOARD   0x00000047

Definition at line 218 of file cdf.h.

#define CDF_CLSID   0x00000048

Definition at line 219 of file cdf.h.

#define CDF_CY   0x00000006

Definition at line 186 of file cdf.h.

#define CDF_DATE   0x00000007

Definition at line 187 of file cdf.h.

#define CDF_DECIMAL   0x0000000e

Definition at line 194 of file cdf.h.

#define CDF_DIR_COLOR_BLACK   1

Definition at line 92 of file cdf.h.

#define CDF_DIR_COLOR_READ   0

Definition at line 91 of file cdf.h.

#define CDF_DIR_TYPE_EMPTY   0

Definition at line 84 of file cdf.h.

#define CDF_DIR_TYPE_LOCKBYTES   3

Definition at line 87 of file cdf.h.

#define CDF_DIR_TYPE_PROPERTY   4

Definition at line 88 of file cdf.h.

#define CDF_DIR_TYPE_ROOT_STORAGE   5

Definition at line 89 of file cdf.h.

#define CDF_DIR_TYPE_USER_STORAGE   1

Definition at line 85 of file cdf.h.

#define CDF_DIR_TYPE_USER_STREAM   2

Definition at line 86 of file cdf.h.

#define CDF_DIRECTORY_SIZE   128

Definition at line 105 of file cdf.h.

#define CDF_DIRID_NULL   -1

Definition at line 74 of file cdf.h.

#define CDF_DISPATCH   0x00000009

Definition at line 189 of file cdf.h.

#define CDF_DOUBLE   0x00000005

Definition at line 185 of file cdf.h.

#define CDF_EMPTY   0x00000000

Definition at line 180 of file cdf.h.

#define CDF_ERROR   0x0000000a

Definition at line 190 of file cdf.h.

#define CDF_FILETIME   0x00000040

Definition at line 211 of file cdf.h.

#define CDF_FLOAT   0x00000004

Definition at line 184 of file cdf.h.

#define CDF_HRESULT   0x00000019

Definition at line 204 of file cdf.h.

#define CDF_ILLEGAL   0x0000ffff

Definition at line 224 of file cdf.h.

#define CDF_ILLEGALMASKED   0x00000fff

Definition at line 225 of file cdf.h.

#define CDF_INT   0x00000016

Definition at line 201 of file cdf.h.

#define CDF_LENGTH32_STRING   0x0000001e

Definition at line 209 of file cdf.h.

#define CDF_LENGTH32_WSTRING   0x0000001f

Definition at line 210 of file cdf.h.

#define CDF_LOOP_LIMIT   10000

Definition at line 35 of file cdf.h.

#define CDF_MAGIC   0xE11AB1A1E011CFD0LL

Definition at line 48 of file cdf.h.

#define CDF_NULL   0x00000001

Definition at line 181 of file cdf.h.

#define CDF_PROPERTY_AUTHOR   0x00000004

Definition at line 231 of file cdf.h.

#define CDF_PROPERTY_CODE_PAGE   0x00000001

Definition at line 228 of file cdf.h.

#define CDF_PROPERTY_COMMENTS   0x00000006

Definition at line 233 of file cdf.h.

#define CDF_PROPERTY_CREATE_TIME   0x0000000c

Definition at line 239 of file cdf.h.

#define CDF_PROPERTY_KEYWORDS   0x00000005

Definition at line 232 of file cdf.h.

#define CDF_PROPERTY_LAST_PRINTED   0X0000000b

Definition at line 238 of file cdf.h.

#define CDF_PROPERTY_LAST_SAVED_BY   0x00000008

Definition at line 235 of file cdf.h.

#define CDF_PROPERTY_LAST_SAVED_TIME   0x0000000d

Definition at line 240 of file cdf.h.

#define CDF_PROPERTY_LOCALE_ID   0x80000000

Definition at line 247 of file cdf.h.

#define CDF_PROPERTY_NAME_OF_APPLICATION   0x00000012

Definition at line 245 of file cdf.h.

#define CDF_PROPERTY_NUMBER_OF_CHARACTERS   0x00000010

Definition at line 243 of file cdf.h.

#define CDF_PROPERTY_NUMBER_OF_PAGES   0x0000000e

Definition at line 241 of file cdf.h.

#define CDF_PROPERTY_NUMBER_OF_WORDS   0x0000000f

Definition at line 242 of file cdf.h.

#define CDF_PROPERTY_REVISION_NUMBER   0x00000009

Definition at line 236 of file cdf.h.

#define CDF_PROPERTY_SECURITY   0x00000013

Definition at line 246 of file cdf.h.

#define CDF_PROPERTY_SUBJECT   0x00000003

Definition at line 230 of file cdf.h.

#define CDF_PROPERTY_TEMPLATE   0x00000007

Definition at line 234 of file cdf.h.

#define CDF_PROPERTY_THUMBNAIL   0x00000011

Definition at line 244 of file cdf.h.

#define CDF_PROPERTY_TITLE   0x00000002

Definition at line 229 of file cdf.h.

#define CDF_PROPERTY_TOTAL_EDITING_TIME   0x0000000a

Definition at line 237 of file cdf.h.

#define CDF_PTR   0x0000001a

Definition at line 205 of file cdf.h.

#define CDF_RESERVED   0x00008000

Definition at line 223 of file cdf.h.

#define CDF_ROUND (   val,
  by 
)    (((val) + (by) - 1) & ~((by) - 1))

Definition at line 177 of file cdf.h.

#define CDF_SAFEARRAY   0x0000001b

Definition at line 206 of file cdf.h.

#define CDF_SEC_POS (   h,
  secid 
)    (CDF_SEC_SIZE(h) + (secid) * CDF_SEC_SIZE(h))

Definition at line 69 of file cdf.h.

#define CDF_SEC_SIZE (   h)    (1 << (h)->h_sec_size_p2)

Definition at line 68 of file cdf.h.

#define CDF_SECID_END_OF_CHAIN   -2

Definition at line 39 of file cdf.h.

#define CDF_SECID_FREE   -1

Definition at line 38 of file cdf.h.

Definition at line 41 of file cdf.h.

#define CDF_SECID_NULL   0

Definition at line 37 of file cdf.h.

Definition at line 40 of file cdf.h.

#define CDF_SECTION_DECLARATION_OFFSET   0x1c

Definition at line 139 of file cdf.h.

#define CDF_SHORT_SEC_POS (   h,
  secid 
)    ((secid) * CDF_SHORT_SEC_SIZE(h))

Definition at line 71 of file cdf.h.

#define CDF_SHORT_SEC_SIZE (   h)    (1 << (h)->h_short_sec_size_p2)

Definition at line 70 of file cdf.h.

#define CDF_SIGNED16   0x00000002

Definition at line 182 of file cdf.h.

#define CDF_SIGNED32   0x00000003

Definition at line 183 of file cdf.h.

#define CDF_SIGNED64   0x00000014

Definition at line 199 of file cdf.h.

#define CDF_SIGNED8   0x00000010

Definition at line 195 of file cdf.h.

#define CDF_STORAGE   0x00000043

Definition at line 214 of file cdf.h.

#define CDF_STORED_OBJECT   0x00000045

Definition at line 216 of file cdf.h.

#define CDF_STREAM   0x00000042

Definition at line 213 of file cdf.h.

#define CDF_STREAMED_OBJECT   0x00000044

Definition at line 215 of file cdf.h.

#define CDF_TIME_PREC   10000000

Definition at line 78 of file cdf.h.

#define CDF_TYPEMASK   0x00000fff

Definition at line 226 of file cdf.h.

#define CDF_UINT   0x00000017

Definition at line 202 of file cdf.h.

#define CDF_UNKNOWN   0x0000000d

Definition at line 193 of file cdf.h.

#define CDF_UNSIGNED16   0x00000012

Definition at line 197 of file cdf.h.

#define CDF_UNSIGNED32   0x00000013

Definition at line 198 of file cdf.h.

#define CDF_UNSIGNED64   0x00000015

Definition at line 200 of file cdf.h.

#define CDF_UNSIGNED8   0x00000011

Definition at line 196 of file cdf.h.

#define CDF_USERDEFINED   0x0000001d

Definition at line 208 of file cdf.h.

#define CDF_VARIANT   0x0000000c

Definition at line 192 of file cdf.h.

#define CDF_VECTOR   0x00001000

Definition at line 220 of file cdf.h.

#define CDF_VOID   0x00000018

Definition at line 203 of file cdf.h.

#define pi_s16   pi_val._pi_s16

Definition at line 172 of file cdf.h.

#define pi_s32   pi_val._pi_s32

Definition at line 170 of file cdf.h.

#define pi_s64   pi_val._pi_s64

Definition at line 168 of file cdf.h.

#define pi_str   pi_val._pi_str

Definition at line 174 of file cdf.h.

#define pi_tp   pi_val._pi_tp

Definition at line 173 of file cdf.h.

#define pi_u16   pi_val._pi_u16

Definition at line 171 of file cdf.h.

#define pi_u32   pi_val._pi_u32

Definition at line 169 of file cdf.h.

#define pi_u64   pi_val._pi_u64

Definition at line 167 of file cdf.h.


Typedef Documentation

Definition at line 73 of file cdf.h.

Definition at line 33 of file cdf.h.

Definition at line 76 of file cdf.h.


Function Documentation

Definition at line 417 of file cdf.c.

{
       size_t i, j;
       cdf_secid_t maxsector = (cdf_secid_t)(sat->sat_len * size);

       DPRINTF(("Chain:"));
       for (j = i = 0; sid >= 0; i++, j++) {
              DPRINTF((" %d", sid));
              if (j >= CDF_LOOP_LIMIT) {
                     DPRINTF(("Counting chain loop limit"));
                     errno = EFTYPE;
                     return (size_t)-1;
              }
              if (sid > maxsector) {
                     DPRINTF(("Sector %d > %d\n", sid, maxsector));
                     errno = EFTYPE;
                     return (size_t)-1;
              }
              sid = CDF_TOLE4(sat->sat_tab[sid]);
       }
       DPRINTF(("\n"));
       return i;
}

Here is the caller graph for this function:

int cdf_print_classid ( char *  ,
size_t  ,
const cdf_classid_t  
)

Definition at line 890 of file cdf.c.

{
       return snprintf(buf, buflen, "%.8x-%.4x-%.4x-%.2x%.2x-"
           "%.2x%.2x%.2x%.2x%.2x%.2x", id->cl_dword, id->cl_word[0],
           id->cl_word[1], id->cl_two[0], id->cl_two[1], id->cl_six[0],
           id->cl_six[1], id->cl_six[2], id->cl_six[3], id->cl_six[4],
           id->cl_six[5]);
}

Definition at line 937 of file cdf.c.

{
       size_t len = 0;
       int days, hours, mins, secs;

       ts /= CDF_TIME_PREC;
       secs = ts % 60;
       ts /= 60;
       mins = ts % 60;
       ts /= 60;
       hours = ts % 24;
       ts /= 24;
       days = ts;

       if (days) {
              len += snprintf(buf + len, bufsiz - len, "%dd+", days);
              if (len >= bufsiz)
                     return len;
       }

       if (days || hours) {
              len += snprintf(buf + len, bufsiz - len, "%.2d:", hours);
              if (len >= bufsiz)
                     return len;
       }

       len += snprintf(buf + len, bufsiz - len, "%.2d:", mins);
       if (len >= bufsiz)
              return len;

       len += snprintf(buf + len, bufsiz - len, "%.2d", secs);
       return len;
}

Here is the caller graph for this function:

int cdf_print_property_name ( char *  ,
size_t  ,
uint32_t   
)

Definition at line 926 of file cdf.c.

{
       size_t i;

       for (i = 0; i < __arraycount(vn); i++)
              if (vn[i].v == p)
                     return snprintf(buf, bufsiz, "%s", vn[i].n);
       return snprintf(buf, bufsiz, "0x%x", p);
}

Here is the caller graph for this function:

int cdf_read_dir ( const cdf_info_t ,
const cdf_header_t ,
const cdf_sat_t ,
cdf_dir_t  
)

Definition at line 541 of file cdf.c.

{
       size_t i, j;
       size_t ss = CDF_SEC_SIZE(h), ns, nd;
       char *buf;
       cdf_secid_t sid = h->h_secid_first_directory;

       ns = cdf_count_chain(sat, sid, ss);
       if (ns == (size_t)-1)
              return -1;

       nd = ss / CDF_DIRECTORY_SIZE;

       dir->dir_len = ns * nd;
       dir->dir_tab = calloc(dir->dir_len, sizeof(dir->dir_tab[0]));
       if (dir->dir_tab == NULL)
              return -1;

       if ((buf = malloc(ss)) == NULL) {
              free(dir->dir_tab);
              return -1;
       }

       for (j = i = 0; i < ns; i++, j++) {
              if (j >= CDF_LOOP_LIMIT) {
                     DPRINTF(("Read dir loop limit"));
                     errno = EFTYPE;
                     goto out;
              }
              if (cdf_read_sector(info, buf, 0, ss, h, sid) != (ssize_t)ss) {
                     DPRINTF(("Reading directory sector %d", sid));
                     goto out;
              }
              for (j = 0; j < nd; j++) {
                     cdf_unpack_dir(&dir->dir_tab[i * nd + j],
                         &buf[j * CDF_DIRECTORY_SIZE]);
              }
              sid = CDF_TOLE4(sat->sat_tab[sid]);
       }
       if (NEED_SWAP)
              for (i = 0; i < dir->dir_len; i++)
                     cdf_swap_dir(&dir->dir_tab[i]);
       free(buf);
       return 0;
out:
       free(dir->dir_tab);
       free(buf);
       return -1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int cdf_read_header ( const cdf_info_t ,
cdf_header_t  
)

Definition at line 281 of file cdf.c.

{
       char buf[512];

       (void)memcpy(cdf_bo.s, "\01\02\03\04", 4);
       if (cdf_read(info, (off_t)0, buf, sizeof(buf)) == -1)
              return -1;
       cdf_unpack_header(h, buf);
       cdf_swap_header(h);
       if (h->h_magic != CDF_MAGIC) {
              DPRINTF(("Bad magic 0x%llx != 0x%llx\n",
                  (unsigned long long)h->h_magic,
                  (unsigned long long)CDF_MAGIC));
              goto out;
       }
       if (h->h_sec_size_p2 > 20) {
              DPRINTF(("Bad sector size 0x%u\n", h->h_sec_size_p2));
              goto out;
       }
       if (h->h_short_sec_size_p2 > 20) {
              DPRINTF(("Bad short sector size 0x%u\n",
                  h->h_short_sec_size_p2));
              goto out;
       }
       return 0;
out:
       errno = EFTYPE;
       return -1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int cdf_read_long_sector_chain ( const cdf_info_t ,
const cdf_header_t ,
const cdf_sat_t ,
cdf_secid_t  ,
size_t  ,
cdf_stream_t  
)

Definition at line 442 of file cdf.c.

{
       size_t ss = CDF_SEC_SIZE(h), i, j;
       ssize_t nr;
       scn->sst_len = cdf_count_chain(sat, sid, ss);
       scn->sst_dirlen = len;

       if (scn->sst_len == (size_t)-1)
              return -1;

       scn->sst_tab = calloc(scn->sst_len, ss);
       if (scn->sst_tab == NULL)
              return -1;

       for (j = i = 0; sid >= 0; i++, j++) {
              if (j >= CDF_LOOP_LIMIT) {
                     DPRINTF(("Read long sector chain loop limit"));
                     errno = EFTYPE;
                     goto out;
              }
              if (i >= scn->sst_len) {
                     DPRINTF(("Out of bounds reading long sector chain "
                         "%u > %u\n", i, scn->sst_len));
                     errno = EFTYPE;
                     goto out;
              }
              if ((nr = cdf_read_sector(info, scn->sst_tab, i * ss, ss, h,
                  sid)) != (ssize_t)ss) {
                     if (i == scn->sst_len - 1 && nr > 0) {
                            /* Last sector might be truncated */
                            return 0;
                     }
                     DPRINTF(("Reading long sector chain %d", sid));
                     goto out;
              }
              sid = CDF_TOLE4(sat->sat_tab[sid]);
       }
       return 0;
out:
       free(scn->sst_tab);
       return -1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 698 of file cdf.c.

{
       const cdf_section_header_t *shp;
       cdf_section_header_t sh;
       const uint32_t *p, *q, *e;
       int16_t s16;
       int32_t s32;
       uint32_t u32;
       int64_t s64;
       uint64_t u64;
       cdf_timestamp_t tp;
       size_t i, o, nelements, j;
       cdf_property_info_t *inp;

       if (offs > UINT32_MAX / 4) {
              errno = EFTYPE;
              goto out;
       }
       shp = (const void *)((const char *)sst->sst_tab + offs);
       if (cdf_check_stream_offset(sst, shp, sizeof(*shp)) == -1)
              goto out;
       sh.sh_len = CDF_TOLE4(shp->sh_len);
#define CDF_SHLEN_LIMIT (UINT32_MAX / 8)
       if (sh.sh_len > CDF_SHLEN_LIMIT) {
              errno = EFTYPE;
              goto out;
       }
       sh.sh_properties = CDF_TOLE4(shp->sh_properties);
#define CDF_PROP_LIMIT (UINT32_MAX / (4 * sizeof(*inp)))
       if (sh.sh_properties > CDF_PROP_LIMIT)
              goto out;
       DPRINTF(("section len: %u properties %u\n", sh.sh_len,
           sh.sh_properties));
       if (*maxcount) {
              if (*maxcount > CDF_PROP_LIMIT)
                     goto out;
              *maxcount += sh.sh_properties;
              inp = realloc(*info, *maxcount * sizeof(*inp));
       } else {
              *maxcount = sh.sh_properties;
              inp = malloc(*maxcount * sizeof(*inp));
       }
       if (inp == NULL)
              goto out;
       *info = inp;
       inp += *count;
       *count += sh.sh_properties;
       p = (const void *)((const char *)sst->sst_tab + offs + sizeof(sh));
       e = (const void *)(((const char *)shp) + sh.sh_len);
       if (cdf_check_stream_offset(sst, e, 0) == -1)
              goto out;
       for (i = 0; i < sh.sh_properties; i++) {
              q = (const uint32_t *)((const char *)p +
                  CDF_TOLE4(p[(i << 1) + 1])) - 2;
              if (q > e) {
                     DPRINTF(("Ran of the end %p > %p\n", q, e));
                     goto out;
              }
              inp[i].pi_id = CDF_TOLE4(p[i << 1]);
              inp[i].pi_type = CDF_TOLE4(q[0]);
              DPRINTF(("%d) id=%x type=%x offs=%x\n", i, inp[i].pi_id,
                  inp[i].pi_type, (const char *)q - (const char *)p));
              if (inp[i].pi_type & CDF_VECTOR) {
                     nelements = CDF_TOLE4(q[1]);
                     o = 2;
              } else {
                     nelements = 1;
                     o = 1;
              }
              if (inp[i].pi_type & (CDF_ARRAY|CDF_BYREF|CDF_RESERVED))
                     goto unknown;
              switch (inp[i].pi_type & CDF_TYPEMASK) {
              case CDF_EMPTY:
                     break;
              case CDF_SIGNED16:
                     if (inp[i].pi_type & CDF_VECTOR)
                            goto unknown;
                     (void)memcpy(&s16, &q[o], sizeof(s16));
                     inp[i].pi_s16 = CDF_TOLE2(s16);
                     break;
              case CDF_SIGNED32:
                     if (inp[i].pi_type & CDF_VECTOR)
                            goto unknown;
                     (void)memcpy(&s32, &q[o], sizeof(s32));
                     inp[i].pi_s32 = CDF_TOLE4(s32);
                     break;
              case CDF_BOOL:
              case CDF_UNSIGNED32:
                     if (inp[i].pi_type & CDF_VECTOR)
                            goto unknown;
                     (void)memcpy(&u32, &q[o], sizeof(u32));
                     inp[i].pi_u32 = CDF_TOLE4(u32);
                     break;
              case CDF_SIGNED64:
                     if (inp[i].pi_type & CDF_VECTOR)
                            goto unknown;
                     (void)memcpy(&s64, &q[o], sizeof(s64));
                     inp[i].pi_s64 = CDF_TOLE4(s64);
                     break;
              case CDF_UNSIGNED64:
                     if (inp[i].pi_type & CDF_VECTOR)
                            goto unknown;
                     (void)memcpy(&u64, &q[o], sizeof(u64));
                     inp[i].pi_u64 = CDF_TOLE4(u64);
                     break;
              case CDF_LENGTH32_STRING:
                     if (nelements > 1) {
                            size_t nelem = inp - *info;
                            if (*maxcount > CDF_PROP_LIMIT
                                || nelements > CDF_PROP_LIMIT)
                                   goto out;
                            *maxcount += nelements;
                            inp = realloc(*info, *maxcount * sizeof(*inp));
                            if (inp == NULL)
                                   goto out;
                            *info = inp;
                            inp = *info + nelem;
                     }
                     DPRINTF(("nelements = %d\n", nelements));
                     for (j = 0; j < nelements; j++, i++) {
                            uint32_t l = CDF_TOLE4(q[o]);
                            inp[i].pi_str.s_len = l;
                            inp[i].pi_str.s_buf = (const char *)(&q[o+1]);
                            DPRINTF(("l = %d, r = %d, s = %s\n", l,
                                CDF_ROUND(l, sizeof(l)),
                                inp[i].pi_str.s_buf));
                            l = 4 + CDF_ROUND(l, sizeof(l));
                            o += l >> 2;
                     }
                     i--;
                     break;
              case CDF_FILETIME:
                     if (inp[i].pi_type & CDF_VECTOR)
                            goto unknown;
                     (void)memcpy(&tp, &q[o], sizeof(tp));
                     inp[i].pi_tp = CDF_TOLE8(tp);
                     break;
              case CDF_CLIPBOARD:
                     if (inp[i].pi_type & CDF_VECTOR)
                            goto unknown;
                     break;
              default:
              unknown:
                     DPRINTF(("Don't know how to deal with %x\n",
                         inp[i].pi_type));
                     goto out;
              }
       }
       return 0;
out:
       free(*info);
       return -1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int cdf_read_sat ( const cdf_info_t ,
cdf_header_t ,
cdf_sat_t  
)

Definition at line 335 of file cdf.c.

{
       size_t i, j, k;
       size_t ss = CDF_SEC_SIZE(h);
       cdf_secid_t *msa, mid, sec;
       size_t nsatpersec = (ss / sizeof(mid)) - 1;

       for (i = 0; i < __arraycount(h->h_master_sat); i++)
              if (h->h_master_sat[i] == CDF_SECID_FREE)
                     break;

#define CDF_SEC_LIMIT (UINT32_MAX / (4 * ss))
       if (h->h_num_sectors_in_master_sat > CDF_SEC_LIMIT / nsatpersec ||
           i > CDF_SEC_LIMIT) {
              DPRINTF(("Number of sectors in master SAT too big %u %zu\n",
                  h->h_num_sectors_in_master_sat, i));
              errno = EFTYPE;
              return -1;
       }

       sat->sat_len = h->h_num_sectors_in_master_sat * nsatpersec + i;
       DPRINTF(("sat_len = %zu ss = %zu\n", sat->sat_len, ss));
       if ((sat->sat_tab = calloc(sat->sat_len, ss)) == NULL)
              return -1;

       for (i = 0; i < __arraycount(h->h_master_sat); i++) {
              if (h->h_master_sat[i] < 0)
                     break;
              if (cdf_read_sector(info, sat->sat_tab, ss * i, ss, h,
                  h->h_master_sat[i]) != (ssize_t)ss) {
                     DPRINTF(("Reading sector %d", h->h_master_sat[i]));
                     goto out1;
              }
       }

       if ((msa = calloc(1, ss)) == NULL)
              goto out1;

       mid = h->h_secid_first_sector_in_master_sat;
       for (j = 0; j < h->h_num_sectors_in_master_sat; j++) {
              if (mid < 0)
                     goto out;
              if (j >= CDF_LOOP_LIMIT) {
                     DPRINTF(("Reading master sector loop limit"));
                     errno = EFTYPE;
                     goto out2;
              }
              if (cdf_read_sector(info, msa, 0, ss, h, mid) != (ssize_t)ss) {
                     DPRINTF(("Reading master sector %d", mid));
                     goto out2;
              }
              for (k = 0; k < nsatpersec; k++, i++) {
                     sec = CDF_TOLE4(msa[k]);
                     if (sec < 0)
                            goto out;
                     if (i >= sat->sat_len) {
                         DPRINTF(("Out of bounds reading MSA %u >= %u",
                            i, sat->sat_len));
                         errno = EFTYPE;
                         goto out2;
                     }
                     if (cdf_read_sector(info, sat->sat_tab, ss * i, ss, h,
                         sec) != (ssize_t)ss) {
                            DPRINTF(("Reading sector %d",
                                CDF_TOLE4(msa[k])));
                            goto out2;
                     }
              }
              mid = CDF_TOLE4(msa[nsatpersec]);
       }
out:
       sat->sat_len = i;
       free(msa);
       return 0;
out2:
       free(msa);
out1:
       free(sat->sat_tab);
       return -1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

ssize_t cdf_read_sector ( const cdf_info_t ,
void *  ,
size_t  ,
size_t  ,
const cdf_header_t ,
cdf_secid_t   
)

Definition at line 313 of file cdf.c.

{
       assert((size_t)CDF_SEC_SIZE(h) == len);
       return cdf_read(info, (off_t)CDF_SEC_POS(h, id),
           ((char *)buf) + offs, len);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int cdf_read_sector_chain ( const cdf_info_t ,
const cdf_header_t ,
const cdf_sat_t ,
const cdf_sat_t ,
const cdf_stream_t ,
cdf_secid_t  ,
size_t  ,
cdf_stream_t  
)

Definition at line 528 of file cdf.c.

{

       if (len < h->h_min_size_standard_stream)
              return cdf_read_short_sector_chain(h, ssat, sst, sid, len,
                  scn);
       else
              return cdf_read_long_sector_chain(info, h, sat, sid, len, scn);
}

Here is the call graph for this function:

Here is the caller graph for this function:

ssize_t cdf_read_short_sector ( const cdf_stream_t ,
void *  ,
size_t  ,
size_t  ,
const cdf_header_t ,
cdf_secid_t   
)

Definition at line 322 of file cdf.c.

{
       assert((size_t)CDF_SHORT_SEC_SIZE(h) == len);
       (void)memcpy(((char *)buf) + offs,
           ((const char *)sst->sst_tab) + CDF_SHORT_SEC_POS(h, id), len);
       return len;
}

Here is the caller graph for this function:

int cdf_read_short_sector_chain ( const cdf_header_t ,
const cdf_sat_t ,
const cdf_stream_t ,
cdf_secid_t  ,
size_t  ,
cdf_stream_t  
)

Definition at line 487 of file cdf.c.

{
       size_t ss = CDF_SHORT_SEC_SIZE(h), i, j;
       scn->sst_len = cdf_count_chain(ssat, sid, CDF_SEC_SIZE(h));
       scn->sst_dirlen = len;

       if (sst->sst_tab == NULL || scn->sst_len == (size_t)-1)
              return -1;

       scn->sst_tab = calloc(scn->sst_len, ss);
       if (scn->sst_tab == NULL)
              return -1;

       for (j = i = 0; sid >= 0; i++, j++) {
              if (j >= CDF_LOOP_LIMIT) {
                     DPRINTF(("Read short sector chain loop limit"));
                     errno = EFTYPE;
                     goto out;
              }
              if (i >= scn->sst_len) {
                     DPRINTF(("Out of bounds reading short sector chain "
                         "%u > %u\n", i, scn->sst_len));
                     errno = EFTYPE;
                     goto out;
              }
              if (cdf_read_short_sector(sst, scn->sst_tab, i * ss, ss, h,
                  sid) != (ssize_t)ss) {
                     DPRINTF(("Reading short sector chain %d", sid));
                     goto out;
              }
              sid = CDF_TOLE4(ssat->sat_tab[sid]);
       }
       return 0;
out:
       free(scn->sst_tab);
       return -1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int cdf_read_short_stream ( const cdf_info_t ,
const cdf_header_t ,
const cdf_sat_t ,
const cdf_dir_t ,
cdf_stream_t  
)

Definition at line 635 of file cdf.c.

{
       size_t i;
       const cdf_directory_t *d;

       for (i = 0; i < dir->dir_len; i++)
              if (dir->dir_tab[i].d_type == CDF_DIR_TYPE_ROOT_STORAGE)
                     break;

       /* If the it is not there, just fake it; some docs don't have it */
       if (i == dir->dir_len)
              goto out;
       d = &dir->dir_tab[i];

       /* If the it is not there, just fake it; some docs don't have it */
       if (d->d_stream_first_sector < 0)
              goto out;

       return  cdf_read_long_sector_chain(info, h, sat,
           d->d_stream_first_sector, d->d_size, scn);
out:
       scn->sst_tab = NULL;
       scn->sst_len = 0;
       scn->sst_dirlen = 0;
       return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int cdf_read_ssat ( const cdf_info_t ,
const cdf_header_t ,
const cdf_sat_t ,
cdf_sat_t  
)

Definition at line 594 of file cdf.c.

{
       size_t i, j;
       size_t ss = CDF_SEC_SIZE(h);
       cdf_secid_t sid = h->h_secid_first_sector_in_short_sat;

       ssat->sat_len = cdf_count_chain(sat, sid, CDF_SEC_SIZE(h));
       if (ssat->sat_len == (size_t)-1)
              return -1;

       ssat->sat_tab = calloc(ssat->sat_len, ss);
       if (ssat->sat_tab == NULL)
              return -1;

       for (j = i = 0; sid >= 0; i++, j++) {
              if (j >= CDF_LOOP_LIMIT) {
                     DPRINTF(("Read short sat sector loop limit"));
                     errno = EFTYPE;
                     goto out;
              }
              if (i >= ssat->sat_len) {
                     DPRINTF(("Out of bounds reading short sector chain "
                         "%u > %u\n", i, ssat->sat_len));
                     errno = EFTYPE;
                     goto out;
              }
              if (cdf_read_sector(info, ssat->sat_tab, i * ss, ss, h, sid) !=
                  (ssize_t)ss) {
                     DPRINTF(("Reading short sat sector %d", sid));
                     goto out;
              }
              sid = CDF_TOLE4(sat->sat_tab[sid]);
       }
       return 0;
out:
       free(ssat->sat_tab);
       return -1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int cdf_read_summary_info ( const cdf_info_t ,
const cdf_header_t ,
const cdf_sat_t ,
const cdf_sat_t ,
const cdf_stream_t ,
const cdf_dir_t ,
cdf_stream_t  
)

Definition at line 673 of file cdf.c.

{
       size_t i;
       const cdf_directory_t *d;
       static const char name[] = "\05SummaryInformation";

       for (i = 0; i < dir->dir_len; i++)
              if (dir->dir_tab[i].d_type == CDF_DIR_TYPE_USER_STREAM &&
                  cdf_namecmp(name, dir->dir_tab[i].d_name, sizeof(name))
                  == 0)
                     break;

       if (i == dir->dir_len) {
              DPRINTF(("Cannot find summary information section\n"));
              errno = EFTYPE;
              return -1;
       }
       d = &dir->dir_tab[i];
       return cdf_read_sector_chain(info, h, sat, ssat, sst,
           d->d_stream_first_sector, d->d_size, scn);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 212 of file cdf.c.

{
       d->cl_dword = CDF_TOLE4(d->cl_dword);
       d->cl_word[0] = CDF_TOLE2(d->cl_word[0]);
       d->cl_word[1] = CDF_TOLE2(d->cl_word[1]);
}

Here is the caller graph for this function:

Definition at line 196 of file cdf.c.

{
       d->d_namelen = CDF_TOLE2(d->d_namelen);
       d->d_left_child = CDF_TOLE4(d->d_left_child);
       d->d_right_child = CDF_TOLE4(d->d_right_child);
       d->d_storage = CDF_TOLE4(d->d_storage);
       d->d_storage_uuid[0] = CDF_TOLE8(d->d_storage_uuid[0]);
       d->d_storage_uuid[1] = CDF_TOLE8(d->d_storage_uuid[1]);
       d->d_flags = CDF_TOLE4(d->d_flags);
       d->d_created = CDF_TOLE8(d->d_created);
       d->d_modified = CDF_TOLE8(d->d_modified);
       d->d_stream_first_sector = CDF_TOLE4(d->d_stream_first_sector);
       d->d_size = CDF_TOLE4(d->d_size);
}

Here is the caller graph for this function:

Definition at line 141 of file cdf.c.

{
       size_t i;

       h->h_magic = CDF_TOLE8(h->h_magic);
       h->h_uuid[0] = CDF_TOLE8(h->h_uuid[0]);
       h->h_uuid[1] = CDF_TOLE8(h->h_uuid[1]);
       h->h_revision = CDF_TOLE2(h->h_revision);
       h->h_version = CDF_TOLE2(h->h_version);
       h->h_byte_order = CDF_TOLE2(h->h_byte_order);
       h->h_sec_size_p2 = CDF_TOLE2(h->h_sec_size_p2);
       h->h_short_sec_size_p2 = CDF_TOLE2(h->h_short_sec_size_p2);
       h->h_num_sectors_in_sat = CDF_TOLE4(h->h_num_sectors_in_sat);
       h->h_secid_first_directory = CDF_TOLE4(h->h_secid_first_directory);
       h->h_min_size_standard_stream =
           CDF_TOLE4(h->h_min_size_standard_stream);
       h->h_secid_first_sector_in_short_sat =
           CDF_TOLE4(h->h_secid_first_sector_in_short_sat);
       h->h_num_sectors_in_short_sat =
           CDF_TOLE4(h->h_num_sectors_in_short_sat);
       h->h_secid_first_sector_in_master_sat =
           CDF_TOLE4(h->h_secid_first_sector_in_master_sat);
       h->h_num_sectors_in_master_sat =
           CDF_TOLE4(h->h_num_sectors_in_master_sat);
       for (i = 0; i < __arraycount(h->h_master_sat); i++)
              h->h_master_sat[i] = CDF_TOLE4(h->h_master_sat[i]);
}

Here is the caller graph for this function:

int cdf_timespec_to_timestamp ( cdf_timestamp_t ,
const struct timeval *   
)

Definition at line 146 of file cdf_time.c.

{
       (void)&t;
       (void)&ts;
#ifdef notyet
       struct tm tm;
       if (gmtime_r(&ts->ts_sec, &tm) == NULL) {
              errno = EINVAL;
              return -1;
       }
       *t = (ts->ts_usec / CDF_TIME_PREC) * CDF_TIME_PREC;
       *t = tm.tm_sec;
       *t += tm.tm_min * 60;
       *t += tm.tm_hour * 60 * 60;
       *t += tm.tm_mday * 60 * 60 * 24;
#endif
       return 0;
}
int cdf_timestamp_to_timespec ( struct timeval *  ,
cdf_timestamp_t   
)

Definition at line 99 of file cdf_time.c.

{
       struct tm tm;
#ifdef HAVE_STRUCT_TM_TM_ZONE
       static char UTC[] = "UTC";
#endif
       int rdays;

       /* Time interval, in microseconds */
       ts->tv_usec = (t % CDF_TIME_PREC) * CDF_TIME_PREC;

       t /= CDF_TIME_PREC;
       tm.tm_sec = t % 60;
       t /= 60;

       tm.tm_min = t % 60;
       t /= 60;

       tm.tm_hour = t % 24;
       t /= 24;

       /* XXX: Approx */
       tm.tm_year = CDF_BASE_YEAR + (t / 365);

       rdays = cdf_getdays(tm.tm_year);
       t -= rdays;
       tm.tm_mday = cdf_getday(tm.tm_year, t);
       tm.tm_mon = cdf_getmonth(tm.tm_year, t);
       tm.tm_wday = 0;
       tm.tm_yday = 0;
       tm.tm_isdst = 0;
#ifdef HAVE_STRUCT_TM_TM_GMTOFF
       tm.tm_gmtoff = 0;
#endif
#ifdef HAVE_STRUCT_TM_TM_ZONE
       tm.tm_zone = UTC;
#endif
       tm.tm_year -= 1900;
       ts->tv_sec = mktime(&tm);
       if (ts->tv_sec == -1) {
              errno = EINVAL;
              return -1;
       }
       return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 89 of file cdf.c.

{
       uint16_t rv;
       uint8_t *s = (uint8_t *)(void *)&sv; 
       uint8_t *d = (uint8_t *)(void *)&rv; 
       d[0] = s[1];
       d[1] = s[0];
       return rv;
}

Definition at line 103 of file cdf.c.

{
       uint32_t rv;
       uint8_t *s = (uint8_t *)(void *)&sv; 
       uint8_t *d = (uint8_t *)(void *)&rv; 
       d[0] = s[3];
       d[1] = s[2];
       d[2] = s[1];
       d[3] = s[0];
       return rv;
}

Definition at line 119 of file cdf.c.

{
       uint64_t rv;
       uint8_t *s = (uint8_t *)(void *)&sv; 
       uint8_t *d = (uint8_t *)(void *)&rv; 
       d[0] = s[7];
       d[1] = s[6];
       d[2] = s[5];
       d[3] = s[4];
       d[4] = s[3];
       d[5] = s[2];
       d[6] = s[1];
       d[7] = s[0];
       return rv;
}
void cdf_unpack_dir ( cdf_directory_t ,
char *   
)

Definition at line 220 of file cdf.c.

{
       size_t len = 0;

       CDF_UNPACKA(d->d_name);
       CDF_UNPACK(d->d_namelen);
       CDF_UNPACK(d->d_type);
       CDF_UNPACK(d->d_color);
       CDF_UNPACK(d->d_left_child);
       CDF_UNPACK(d->d_right_child);
       CDF_UNPACK(d->d_storage);
       CDF_UNPACKA(d->d_storage_uuid);
       CDF_UNPACK(d->d_flags);
       CDF_UNPACK(d->d_created);
       CDF_UNPACK(d->d_modified);
       CDF_UNPACK(d->d_stream_first_sector);
       CDF_UNPACK(d->d_size);
       CDF_UNPACK(d->d_unused0);
}

Here is the caller graph for this function:

void cdf_unpack_header ( cdf_header_t ,
char *   
)

Definition at line 170 of file cdf.c.

{
       size_t i;
       size_t len = 0;

       CDF_UNPACK(h->h_magic);
       CDF_UNPACKA(h->h_uuid);
       CDF_UNPACK(h->h_revision);
       CDF_UNPACK(h->h_version);
       CDF_UNPACK(h->h_byte_order);
       CDF_UNPACK(h->h_sec_size_p2);
       CDF_UNPACK(h->h_short_sec_size_p2);
       CDF_UNPACKA(h->h_unused0);
       CDF_UNPACK(h->h_num_sectors_in_sat);
       CDF_UNPACK(h->h_secid_first_directory);
       CDF_UNPACKA(h->h_unused1);
       CDF_UNPACK(h->h_min_size_standard_stream);
       CDF_UNPACK(h->h_secid_first_sector_in_short_sat);
       CDF_UNPACK(h->h_num_sectors_in_short_sat);
       CDF_UNPACK(h->h_secid_first_sector_in_master_sat);
       CDF_UNPACK(h->h_num_sectors_in_master_sat);
       for (i = 0; i < __arraycount(h->h_master_sat); i++)
              CDF_UNPACK(h->h_master_sat[i]);
}

Here is the caller graph for this function:

Definition at line 854 of file cdf.c.

{
       size_t i, maxcount;
       const cdf_summary_info_header_t *si = sst->sst_tab;
       const cdf_section_declaration_t *sd = (const void *)
           ((const char *)sst->sst_tab + CDF_SECTION_DECLARATION_OFFSET);

       if (cdf_check_stream_offset(sst, si, sizeof(*si)) == -1 ||
           cdf_check_stream_offset(sst, sd, sizeof(*sd)) == -1)
              return -1;
       ssi->si_byte_order = CDF_TOLE2(si->si_byte_order);
       ssi->si_os_version = CDF_TOLE2(si->si_os_version);
       ssi->si_os = CDF_TOLE2(si->si_os);
       ssi->si_class = si->si_class;
       cdf_swap_class(&ssi->si_class);
       ssi->si_count = CDF_TOLE2(si->si_count);
       *count = 0;
       maxcount = 0;
       *info = NULL;
       for (i = 0; i < CDF_TOLE4(si->si_count); i++) {
              if (i >= CDF_LOOP_LIMIT) {
                     DPRINTF(("Unpack summary info loop limit"));
                     errno = EFTYPE;
                     return -1;
              }
              if (cdf_read_property_info(sst, CDF_TOLE4(sd->sd_offset),
                  info, count, &maxcount) == -1)
                     return -1;
       }
       return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function: