From 64bdfbd620b89ffbe08a7532749c2c3531924f09 Mon Sep 17 00:00:00 2001 From: kichik Date: Tue, 20 Sep 2005 17:42:28 +0000 Subject: [PATCH] fixed portability git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4280 212acab6-be3b-0410-9dea-997c60f758d6 --- Contrib/VPatch/Source/Plugin/checksum.c | 16 +++++++++++++++- Contrib/VPatch/Source/Plugin/md5.c | 10 +++++----- Contrib/VPatch/Source/Plugin/vpatchdll.c | 2 +- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/Contrib/VPatch/Source/Plugin/checksum.c b/Contrib/VPatch/Source/Plugin/checksum.c index 90f38be7..81b1d27e 100644 --- a/Contrib/VPatch/Source/Plugin/checksum.c +++ b/Contrib/VPatch/Source/Plugin/checksum.c @@ -25,12 +25,26 @@ #include "checksum.h" +#ifdef _MSC_VER +# define FORCE_INLINE __forceinline +#else +# ifdef __GNUC__ +# if __GNUC__ < 3 +# define FORCE_INLINE inline +# else +# define FORCE_INLINE inline __attribute__ ((always_inline)) +# endif +# else +# define FORCE_INLINE inline +# endif +#endif + /* ------------------------ CRC32 checksum calculation ----------------- */ UINT CRCTable[256]; BOOL bInitCRC = FALSE; -_inline void InitCRC() { +FORCE_INLINE void InitCRC() { int i, j; unsigned long c; for (c = i = 0; i < 256; c = ++i) { for (j = 0; j < 8; j++) { diff --git a/Contrib/VPatch/Source/Plugin/md5.c b/Contrib/VPatch/Source/Plugin/md5.c index da1cfb07..0c9f7ce1 100644 --- a/Contrib/VPatch/Source/Plugin/md5.c +++ b/Contrib/VPatch/Source/Plugin/md5.c @@ -21,7 +21,7 @@ ghost@aladdin.com */ -/* $Id: md5.c,v 1.6 2002/04/13 19:20:28 lpd Exp $ */ +/* $Id: md5.c,v 1.1 2005/09/17 09:25:44 kichik Exp $ */ /* Independent implementation of MD5 (RFC 1321). @@ -53,7 +53,7 @@ #include "md5.h" -void memcpy( void *dest, const void *src, int count ) { +void md5_memcpy( void *dest, const void *src, int count ) { md5_byte_t* bDest = (md5_byte_t*)dest; md5_byte_t* bSrc = (md5_byte_t*)src; int i = 0; @@ -174,7 +174,7 @@ md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/) X = (const md5_word_t *)data; } else { /* not aligned */ - memcpy(xbuf, data, 64); + md5_memcpy(xbuf, data, 64); X = xbuf; } } @@ -348,7 +348,7 @@ md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes) if (offset) { int copy = (offset + nbytes > 64 ? 64 - offset : nbytes); - memcpy(pms->buf + offset, p, copy); + md5_memcpy(pms->buf + offset, p, copy); if (offset + copy < 64) return; p += copy; @@ -362,7 +362,7 @@ md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes) /* Process a final partial block. */ if (left) - memcpy(pms->buf, p, left); + md5_memcpy(pms->buf, p, left); } void diff --git a/Contrib/VPatch/Source/Plugin/vpatchdll.c b/Contrib/VPatch/Source/Plugin/vpatchdll.c index e945298d..11b863f5 100644 --- a/Contrib/VPatch/Source/Plugin/vpatchdll.c +++ b/Contrib/VPatch/Source/Plugin/vpatchdll.c @@ -27,7 +27,7 @@ #include #include "apply_patch.h" #include "checksum.h" -#include "..\..\..\ExDLL\exdll.h" +#include "../../../ExDLL/exdll.h" /* ------------------------ Plug-in code ------------------------- */