Skip to content

Commit 9bdf7fe

Browse files
committed
Fix compilation on MSVC
1 parent 7d3cc96 commit 9bdf7fe

File tree

9 files changed

+20
-81
lines changed

9 files changed

+20
-81
lines changed

include/libimobiledevice-glue/nskeyedarchive.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ LIMD_GLUE_API void nskeyedarchive_free(nskeyedarchive_t ka);
5757

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

60-
LIMD_GLUE_API uint64_t nskeyedarchive_add_top_class(nskeyedarchive_t ka, const char* classname, ...) __attribute__ ((sentinel(0)));
60+
LIMD_GLUE_API uint64_t nskeyedarchive_add_top_class(nskeyedarchive_t ka, const char* classname, ...);
6161
LIMD_GLUE_API void nskeyedarchive_add_top_class_uid(nskeyedarchive_t ka, uint64_t uid);
62-
LIMD_GLUE_API void nskeyedarchive_append_class(nskeyedarchive_t ka, const char* classname, ...) __attribute__ ((sentinel(0)));
62+
LIMD_GLUE_API void nskeyedarchive_append_class(nskeyedarchive_t ka, const char* classname, ...);
6363
LIMD_GLUE_API void nskeyedarchive_append_object(nskeyedarchive_t ka, plist_t object);
6464

6565
LIMD_GLUE_API void nskeyedarchive_nsarray_append_item(nskeyedarchive_t ka, uint64_t uid, enum nskeyedarchive_class_type_t type, ...);

src/Makefile.am

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ libimobiledevice_glue_1_0_la_SOURCES = \
2121
sha1.c \
2222
sha256.c \
2323
sha512.c \
24-
fixedint.h \
2524
common.h
2625

2726
if WIN32

src/fixedint.h

Lines changed: 0 additions & 72 deletions
This file was deleted.

src/sha1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include "common.h"
1313
#include "libimobiledevice-glue/sha.h"
1414

15-
#include "fixedint.h"
15+
#include <stdint.h>
1616

1717
#define ROLc(x, y) \
1818
( (((unsigned long)(x)<<(unsigned long)((y)&31)) | \

src/sha256.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include "common.h"
1313
#include "libimobiledevice-glue/sha.h"
1414

15-
#include "fixedint.h"
15+
#include <stdint.h>
1616

1717
/* the K array */
1818
static const uint32_t K[64] = {

src/sha512.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Tom St Denis, [email protected], http://libtom.org
1010
*/
1111

12-
#include "fixedint.h"
12+
#include <stdint.h>
1313

1414
#include "common.h"
1515
#include "libimobiledevice-glue/sha.h"

src/socket.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@
2626
#include <stddef.h>
2727
#include <stdlib.h>
2828
#include <string.h>
29-
#include <unistd.h>
3029
#include <errno.h>
30+
#ifndef _MSC_VER
31+
#include <unistd.h>
3132
#include <sys/time.h>
3233
#include <sys/stat.h>
34+
#endif
3335
#ifdef _WIN32
3436
#include <winsock2.h>
3537
#include <ws2tcpip.h>
@@ -154,8 +156,14 @@ enum poll_status
154156
poll_status_error
155157
};
156158

159+
#ifdef _MSC_VER
160+
#define ALWAYS_INLINE __forceinline
161+
#else
162+
#define ALWAYS_INLINE __attribute__((always_inline))
163+
#endif
164+
157165
#ifdef _WIN32
158-
static inline __attribute__((always_inline)) int WSAError_to_errno(int wsaerr)
166+
static ALWAYS_INLINE int WSAError_to_errno(int wsaerr)
159167
{
160168
switch (wsaerr) {
161169
case WSAEINVAL:
@@ -200,7 +208,7 @@ static inline __attribute__((always_inline)) int WSAError_to_errno(int wsaerr)
200208
#endif
201209

202210
// timeout of -1 means infinity
203-
static inline __attribute__((always_inline)) enum poll_status poll_wrapper(int fd, fd_mode mode, int timeout)
211+
static ALWAYS_INLINE enum poll_status poll_wrapper(int fd, fd_mode mode, int timeout)
204212
{
205213
#ifdef HAVE_POLL
206214
// https://man7.org/linux/man-pages/man2/select.2.html

src/termcolors.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828

2929
#include <stdio.h>
3030
#include <stdlib.h>
31+
#ifndef _MSC_VER
3132
#include <unistd.h>
33+
#endif
3234
#include <string.h>
3335
#include <stdarg.h>
3436

src/utils.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030
#include <stdlib.h>
3131
#include <string.h>
3232
#include <time.h>
33+
#ifndef _MSC_VER
3334
#include <sys/time.h>
35+
#endif
3436
#include <inttypes.h>
3537
#include <ctype.h>
3638
#include <errno.h>

0 commit comments

Comments
 (0)