Skip to content

Commit

Permalink
Fix compilation on MSVC
Browse files Browse the repository at this point in the history
  • Loading branch information
mrexodia committed Nov 28, 2024
1 parent 7d3cc96 commit 9bdf7fe
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 81 deletions.
4 changes: 2 additions & 2 deletions include/libimobiledevice-glue/nskeyedarchive.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ LIMD_GLUE_API void nskeyedarchive_free(nskeyedarchive_t ka);

LIMD_GLUE_API void nskeyedarchive_set_top_ref_key_name(nskeyedarchive_t ka, const char* keyname);

LIMD_GLUE_API uint64_t nskeyedarchive_add_top_class(nskeyedarchive_t ka, const char* classname, ...) __attribute__ ((sentinel(0)));
LIMD_GLUE_API uint64_t nskeyedarchive_add_top_class(nskeyedarchive_t ka, const char* classname, ...);
LIMD_GLUE_API void nskeyedarchive_add_top_class_uid(nskeyedarchive_t ka, uint64_t uid);
LIMD_GLUE_API void nskeyedarchive_append_class(nskeyedarchive_t ka, const char* classname, ...) __attribute__ ((sentinel(0)));
LIMD_GLUE_API void nskeyedarchive_append_class(nskeyedarchive_t ka, const char* classname, ...);
LIMD_GLUE_API void nskeyedarchive_append_object(nskeyedarchive_t ka, plist_t object);

LIMD_GLUE_API void nskeyedarchive_nsarray_append_item(nskeyedarchive_t ka, uint64_t uid, enum nskeyedarchive_class_type_t type, ...);
Expand Down
1 change: 0 additions & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ libimobiledevice_glue_1_0_la_SOURCES = \
sha1.c \
sha256.c \
sha512.c \
fixedint.h \
common.h

if WIN32
Expand Down
72 changes: 0 additions & 72 deletions src/fixedint.h

This file was deleted.

2 changes: 1 addition & 1 deletion src/sha1.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "common.h"
#include "libimobiledevice-glue/sha.h"

#include "fixedint.h"
#include <stdint.h>

#define ROLc(x, y) \
( (((unsigned long)(x)<<(unsigned long)((y)&31)) | \
Expand Down
2 changes: 1 addition & 1 deletion src/sha256.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "common.h"
#include "libimobiledevice-glue/sha.h"

#include "fixedint.h"
#include <stdint.h>

/* the K array */
static const uint32_t K[64] = {
Expand Down
2 changes: 1 addition & 1 deletion src/sha512.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Tom St Denis, [email protected], http://libtom.org
*/

#include "fixedint.h"
#include <stdint.h>

#include "common.h"
#include "libimobiledevice-glue/sha.h"
Expand Down
14 changes: 11 additions & 3 deletions src/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#ifndef _MSC_VER
#include <unistd.h>
#include <sys/time.h>
#include <sys/stat.h>
#endif
#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
Expand Down Expand Up @@ -154,8 +156,14 @@ enum poll_status
poll_status_error
};

#ifdef _MSC_VER
#define ALWAYS_INLINE __forceinline
#else
#define ALWAYS_INLINE __attribute__((always_inline))
#endif

#ifdef _WIN32
static inline __attribute__((always_inline)) int WSAError_to_errno(int wsaerr)
static ALWAYS_INLINE int WSAError_to_errno(int wsaerr)
{
switch (wsaerr) {
case WSAEINVAL:
Expand Down Expand Up @@ -200,7 +208,7 @@ static inline __attribute__((always_inline)) int WSAError_to_errno(int wsaerr)
#endif

// timeout of -1 means infinity
static inline __attribute__((always_inline)) enum poll_status poll_wrapper(int fd, fd_mode mode, int timeout)
static ALWAYS_INLINE enum poll_status poll_wrapper(int fd, fd_mode mode, int timeout)
{
#ifdef HAVE_POLL
// https://man7.org/linux/man-pages/man2/select.2.html
Expand Down
2 changes: 2 additions & 0 deletions src/termcolors.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@

#include <stdio.h>
#include <stdlib.h>
#ifndef _MSC_VER
#include <unistd.h>
#endif
#include <string.h>
#include <stdarg.h>

Expand Down
2 changes: 2 additions & 0 deletions src/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
#ifndef _MSC_VER
#include <sys/time.h>
#endif
#include <inttypes.h>
#include <ctype.h>
#include <errno.h>
Expand Down

0 comments on commit 9bdf7fe

Please sign in to comment.