aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@a4e77c2c-9104-11de-800e-5b313e0d2bf3>2012-02-24 18:05:29 +0000
committeragl@chromium.org <agl@chromium.org@a4e77c2c-9104-11de-800e-5b313e0d2bf3>2012-02-24 18:05:29 +0000
commit98281afef95be7fee74edc8df7351f8b5e9969d1 (patch)
tree17909e33c070d07ed3a019770b6b5ced92a63687 /include
parentd27e4d28a8a974c1966ecfd49b9740a226a682c9 (diff)
downloadots-98281afef95be7fee74edc8df7351f8b5e9969d1.tar.gz
Remove dependency on winsock2 (ws2_32.dll) on Windows.
Use intrinsics for byte order conversion, per suggestion by maruel. Are there any other opentype tests to verify functionality? Wiki page says I need security team access to get the malicious fonts. Patch-by: dcurtis BUG=115477 TEST=No longer crashes with new ffmpeg. git-svn-id: http://ots.googlecode.com/svn/trunk@82 a4e77c2c-9104-11de-800e-5b313e0d2bf3
Diffstat (limited to 'include')
-rw-r--r--include/opentype-sanitiser.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/include/opentype-sanitiser.h b/include/opentype-sanitiser.h
index 0d5aeeb..4d9a15d 100644
--- a/include/opentype-sanitiser.h
+++ b/include/opentype-sanitiser.h
@@ -6,6 +6,7 @@
#define OPENTYPE_SANITISER_H_
#if defined(_WIN32)
+#include <stdlib.h>
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef short int16_t;
@@ -14,7 +15,10 @@ typedef int int32_t;
typedef unsigned int uint32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
-#include <winsock2.h> // for htons/ntohs
+#define ntohl(x) _byteswap_ulong (x)
+#define ntohs(x) _byteswap_ushort (x)
+#define htonl(x) _byteswap_ulong (x)
+#define htons(x) _byteswap_ushort (x)
#else
#include <arpa/inet.h>
#include <stdint.h>