Skip to content

Commit

Permalink
Add extern "C" guards to public headers
Browse files Browse the repository at this point in the history
  • Loading branch information
nikias committed Dec 27, 2024
1 parent 1d9046f commit 440dbbb
Show file tree
Hide file tree
Showing 11 changed files with 88 additions and 0 deletions.
8 changes: 8 additions & 0 deletions include/libimobiledevice-glue/cbuf.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,16 @@ struct char_buf {
unsigned int capacity;
};

#ifdef __cplusplus
extern "C" {
#endif

LIMD_GLUE_API struct char_buf* char_buf_new();
LIMD_GLUE_API void char_buf_free(struct char_buf* cbuf);
LIMD_GLUE_API void char_buf_append(struct char_buf* cbuf, unsigned int length, unsigned char* data);

#ifdef __cplusplus
}
#endif

#endif /* __CBUF_H */
8 changes: 8 additions & 0 deletions include/libimobiledevice-glue/collection.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ struct collection {
int capacity;
};

#ifdef __cplusplus
extern "C" {
#endif

LIMD_GLUE_API void collection_init(struct collection *col);
LIMD_GLUE_API void collection_add(struct collection *col, void *element);
LIMD_GLUE_API int collection_remove(struct collection *col, void *element);
Expand All @@ -51,4 +55,8 @@ LIMD_GLUE_API void collection_copy(struct collection *dest, struct collection *s
} \
} while(0);

#ifdef __cplusplus
}
#endif

#endif
8 changes: 8 additions & 0 deletions include/libimobiledevice-glue/glue.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@
#endif
#endif

#ifdef __cplusplus
extern "C" {
#endif

LIMD_GLUE_API const char* libimobiledevice_glue_version();

#ifdef __cplusplus
}
#endif

#endif
8 changes: 8 additions & 0 deletions include/libimobiledevice-glue/nskeyedarchive.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ enum nskeyedarchive_class_type_t {

typedef struct nskeyedarchive_st *nskeyedarchive_t;

#ifdef __cplusplus
extern "C" {
#endif

LIMD_GLUE_API nskeyedarchive_t nskeyedarchive_new(void);
LIMD_GLUE_API nskeyedarchive_t nskeyedarchive_new_from_plist(plist_t plist);
LIMD_GLUE_API nskeyedarchive_t nskeyedarchive_new_from_data(const void* data, uint32_t size);
Expand Down Expand Up @@ -87,4 +91,8 @@ LIMD_GLUE_API int nskeyedarchive_get_class_property(nskeyedarchive_t ka, uint64_

LIMD_GLUE_API plist_t nskeyedarchive_to_plist(nskeyedarchive_t ka);

#ifdef __cplusplus
}
#endif

#endif
8 changes: 8 additions & 0 deletions include/libimobiledevice-glue/opack.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,15 @@
#include <libimobiledevice-glue/glue.h>
#include <plist/plist.h>

#ifdef __cplusplus
extern "C" {
#endif

LIMD_GLUE_API void opack_encode_from_plist(plist_t plist, unsigned char** out, unsigned int* out_len);
LIMD_GLUE_API int opack_decode_to_plist(unsigned char* buf, unsigned int buf_len, plist_t* plist_out);

#ifdef __cplusplus
}
#endif

#endif /* __OPACK_H */
8 changes: 8 additions & 0 deletions include/libimobiledevice-glue/sha.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

#include <libimobiledevice-glue/glue.h>

#ifdef __cplusplus
extern "C" {
#endif

/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
Expand Down Expand Up @@ -83,4 +87,8 @@ LIMD_GLUE_API int sha384_final(sha384_context * md, unsigned char *out);
LIMD_GLUE_API int sha384_update(sha384_context * md, const void *data, size_t inlen);
LIMD_GLUE_API int sha384(const unsigned char *message, size_t message_len, unsigned char *out);

#ifdef __cplusplus
}
#endif

#endif
8 changes: 8 additions & 0 deletions include/libimobiledevice-glue/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ typedef enum fd_mode fd_mode;

#include <libimobiledevice-glue/glue.h>

#ifdef __cplusplus
extern "C" {
#endif

#ifndef _WIN32
LIMD_GLUE_API int socket_create_unix(const char *filename);
LIMD_GLUE_API int socket_connect_unix(const char *filename);
Expand All @@ -69,4 +73,8 @@ LIMD_GLUE_API const char *socket_addr_to_string(struct sockaddr *addr, char *add

LIMD_GLUE_API int get_primary_mac_address(unsigned char mac_addr_buf[6]);

#ifdef __cplusplus
}
#endif

#endif /* SOCKET_SOCKET_H */
8 changes: 8 additions & 0 deletions include/libimobiledevice-glue/termcolors.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@
#define BG_WHITE "\e[107m"
#define BG_DEFAULT "\e[49m"

#ifdef __cplusplus
extern "C" {
#endif

/* automatically called by library constructor */
LIMD_GLUE_API void term_colors_init();

Expand All @@ -85,4 +89,8 @@ LIMD_GLUE_API int cprintf(const char* fmt, ...);
LIMD_GLUE_API int cfprintf(FILE* stream, const char* fmt, ...);
LIMD_GLUE_API int cvfprintf(FILE* stream, const char* fmt, va_list vargs);

#ifdef __cplusplus
}
#endif

#endif
8 changes: 8 additions & 0 deletions include/libimobiledevice-glue/thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ typedef pthread_once_t thread_once_t;
#define THREAD_T_NULL (THREAD_T)NULL
#endif

#ifdef __cplusplus
extern "C" {
#endif

typedef void* (*thread_func_t)(void* data);

LIMD_GLUE_API int thread_new(THREAD_T* thread, thread_func_t thread_func, void* data);
Expand Down Expand Up @@ -99,4 +103,8 @@ LIMD_GLUE_API int cond_signal(cond_t* cond);
LIMD_GLUE_API int cond_wait(cond_t* cond, mutex_t* mutex);
LIMD_GLUE_API int cond_wait_timeout(cond_t* cond, mutex_t* mutex, unsigned int timeout_ms);

#ifdef __cplusplus
}
#endif

#endif
8 changes: 8 additions & 0 deletions include/libimobiledevice-glue/tlv.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ struct tlv_buf {
};
typedef struct tlv_buf* tlv_buf_t;

#ifdef __cplusplus
extern "C" {
#endif

LIMD_GLUE_API tlv_buf_t tlv_buf_new();
LIMD_GLUE_API void tlv_buf_free(tlv_buf_t tlv);

Expand All @@ -40,4 +44,8 @@ LIMD_GLUE_API int tlv_data_get_uint(const void* tlv_data, unsigned int tlv_lengt
LIMD_GLUE_API int tlv_data_get_uint8(const void* tlv_data, unsigned int tlv_length, uint8_t tag, uint8_t* value);
LIMD_GLUE_API int tlv_data_copy_data(const void* tlv_data, unsigned int tlv_length, uint8_t tag, void** out, unsigned int* out_len);

#ifdef __cplusplus
}
#endif

#endif /* __TLV_H */
8 changes: 8 additions & 0 deletions include/libimobiledevice-glue/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@

#define MAC_EPOCH 978307200

#ifdef __cplusplus
extern "C" {
#endif

LIMD_GLUE_API char *string_concat(const char *str, ...);
LIMD_GLUE_API char *string_append(char *str, ...);
LIMD_GLUE_API char *string_build_path(const char *elem, ...);
Expand All @@ -41,4 +45,8 @@ LIMD_GLUE_API char *generate_uuid(void);
LIMD_GLUE_API int buffer_read_from_filename(const char *filename, char **buffer, uint64_t *length);
LIMD_GLUE_API int buffer_write_to_filename(const char *filename, const char *buffer, uint64_t length);

#ifdef __cplusplus
}
#endif

#endif

0 comments on commit 440dbbb

Please sign in to comment.