Coverage Report

Created: 2026-01-17 06:49

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libplist/src/plist.h
Line
Count
Source
1
/*
2
 * plist.h
3
 * contains structures and the like for plists
4
 *
5
 * Copyright (c) 2008 Zach C. All Rights Reserved.
6
 *
7
 * This library is free software; you can redistribute it and/or
8
 * modify it under the terms of the GNU Lesser General Public
9
 * License as published by the Free Software Foundation; either
10
 * version 2.1 of the License, or (at your option) any later version.
11
 *
12
 * This library is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
 * Lesser General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Lesser General Public
18
 * License along with this library; if not, write to the Free Software
19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
20
 */
21
22
#ifndef PLIST_H
23
#define PLIST_H
24
25
#ifdef HAVE_CONFIG_H
26
#include <config.h>
27
#endif
28
29
#include <sys/types.h>
30
#include <sys/stat.h>
31
32
#ifdef _MSC_VER
33
#pragma warning(disable:4996)
34
#pragma warning(disable:4244)
35
#include <winsock2.h>
36
#else
37
#include <sys/time.h>
38
#endif
39
40
#ifdef LIBPLIST_STATIC
41
  #define PLIST_API
42
#elif defined(_WIN32)
43
  #define PLIST_API __declspec( dllexport )
44
#else
45
  #if __GNUC__ >= 4
46
    #define PLIST_API __attribute__((visibility("default")))
47
  #else
48
    #define PLIST_API
49
  #endif
50
#endif
51
52
#include "plist/plist.h"
53
54
struct plist_data_s
55
{
56
    union
57
    {
58
        char boolval;
59
        uint64_t intval;
60
        double realval;
61
        char *strval;
62
        uint8_t *buff;
63
        void *hashtable;
64
    };
65
    uint64_t length;
66
    plist_type type;
67
};
68
69
typedef struct plist_data_s *plist_data_t;
70
71
plist_t plist_new_node(plist_data_t data);
72
plist_data_t plist_get_data(plist_t node);
73
plist_data_t plist_new_plist_data(void);
74
void plist_free_data(plist_data_t data);
75
int plist_data_compare(const void *a, const void *b);
76
77
extern plist_err_t plist_write_to_string_default(plist_t plist, char **output, uint32_t* length, plist_write_options_t options);
78
extern plist_err_t plist_write_to_string_limd(plist_t plist, char **output, uint32_t* length, plist_write_options_t options);
79
extern plist_err_t plist_write_to_string_plutil(plist_t plist, char **output, uint32_t* length, plist_write_options_t options);
80
extern plist_err_t plist_write_to_stream_default(plist_t plist, FILE *stream, plist_write_options_t options);
81
extern plist_err_t plist_write_to_stream_limd(plist_t plist, FILE *stream, plist_write_options_t options);
82
extern plist_err_t plist_write_to_stream_plutil(plist_t plist, FILE *stream, plist_write_options_t options);
83
84
static inline unsigned int plist_node_ptr_hash(const void *ptr)
85
0
{
86
0
    uintptr_t h = (uintptr_t)ptr;
87
0
    h ^= (h >> 16);
88
0
    h *= 0x85ebca6b;
89
0
    return (unsigned int)h;
90
0
}
Unexecuted instantiation: oplist.c:plist_node_ptr_hash
Unexecuted instantiation: plist.c:plist_node_ptr_hash
Unexecuted instantiation: xplist.c:plist_node_ptr_hash
Unexecuted instantiation: bplist.c:plist_node_ptr_hash
Unexecuted instantiation: jplist.c:plist_node_ptr_hash
Unexecuted instantiation: out-default.c:plist_node_ptr_hash
Unexecuted instantiation: out-plutil.c:plist_node_ptr_hash
Unexecuted instantiation: out-limd.c:plist_node_ptr_hash
91
92
static inline int plist_node_ptr_compare(const void *a, const void *b)
93
0
{
94
0
    return a == b;
95
0
}
Unexecuted instantiation: oplist.c:plist_node_ptr_compare
Unexecuted instantiation: plist.c:plist_node_ptr_compare
Unexecuted instantiation: xplist.c:plist_node_ptr_compare
Unexecuted instantiation: bplist.c:plist_node_ptr_compare
Unexecuted instantiation: jplist.c:plist_node_ptr_compare
Unexecuted instantiation: out-default.c:plist_node_ptr_compare
Unexecuted instantiation: out-plutil.c:plist_node_ptr_compare
Unexecuted instantiation: out-limd.c:plist_node_ptr_compare
96
97
#endif