diff options
author | Angelo Mantellini <manangel@cisco.com> | 2019-02-05 08:50:26 +0100 |
---|---|---|
committer | Angelo Mantellini <manangel@cisco.com> | 2019-02-06 16:23:04 +0100 |
commit | 9f68541e0f55495d61dd9e583bec38740a247597 (patch) | |
tree | 55519e34159ac1eb691e080e4c1eab5b0e4847bd /libparc/parc/algol | |
parent | b77148ddc3def71e6c412c3afb5f1c20be2d77cd (diff) |
[HICN-26] Windows compatibilty for libparc
Change-Id: I6ebff82a81a2bf42fa3bf210ff0e6e530ce21915
Signed-off-by: Angelo Mantellini <manangel@cisco.com>
Diffstat (limited to 'libparc/parc/algol')
148 files changed, 437 insertions, 224 deletions
diff --git a/libparc/parc/algol/internal_parc_Event.c b/libparc/parc/algol/internal_parc_Event.c index 54c193ea..9335e1e0 100755..100644 --- a/libparc/parc/algol/internal_parc_Event.c +++ b/libparc/parc/algol/internal_parc_Event.c @@ -13,10 +13,6 @@ * limitations under the License. */ -/** - */ -#include <config.h> - #include <parc/assert/parc_Assert.h> #include <parc/algol/parc_Memory.h> #include "internal_parc_Event.h" diff --git a/libparc/parc/algol/internal_parc_Event.h b/libparc/parc/algol/internal_parc_Event.h index ab157a56..ab157a56 100755..100644 --- a/libparc/parc/algol/internal_parc_Event.h +++ b/libparc/parc/algol/internal_parc_Event.h diff --git a/libparc/parc/algol/parc_AtomicInteger.c b/libparc/parc/algol/parc_AtomicInteger.c index b32a698f..b32a698f 100755..100644 --- a/libparc/parc/algol/parc_AtomicInteger.c +++ b/libparc/parc/algol/parc_AtomicInteger.c diff --git a/libparc/parc/algol/parc_AtomicInteger.h b/libparc/parc/algol/parc_AtomicInteger.h index 729d9a01..729d9a01 100755..100644 --- a/libparc/parc/algol/parc_AtomicInteger.h +++ b/libparc/parc/algol/parc_AtomicInteger.h diff --git a/libparc/parc/algol/parc_Base64.c b/libparc/parc/algol/parc_Base64.c index cac0aa4d..e4e66437 100755..100644 --- a/libparc/parc/algol/parc_Base64.c +++ b/libparc/parc/algol/parc_Base64.c @@ -71,7 +71,9 @@ const uint8_t decodeTable[256] = { '~', '~', '~', '~', '~', '~', '~', '~', '~', '~', '~', '~', '~', '~', '~', '~' }; +#ifndef min #define min(a, b) ((a < b) ? a : b) +#endif /** * Encode the 3-byte quantum pointed to by <code>quantum</code> into 4 encoded characters. @@ -198,7 +200,7 @@ parcBase64_Encode(PARCBufferComposer *result, PARCBuffer *plainText) } PARCBufferComposer * -parcBase64_EncodeArray(PARCBufferComposer *output, size_t length, const uint8_t array[length]) +parcBase64_EncodeArray(PARCBufferComposer *output, size_t length, const uint8_t *array) { size_t offset = 0; @@ -233,7 +235,7 @@ parcBase64_DecodeString(PARCBufferComposer *output, const char *encodedString) } PARCBufferComposer * -parcBase64_DecodeArray(PARCBufferComposer *output, size_t length, const uint8_t array[length]) +parcBase64_DecodeArray(PARCBufferComposer *output, size_t length, const uint8_t *array) { size_t offset = 0; bool success = true; diff --git a/libparc/parc/algol/parc_BitVector.c b/libparc/parc/algol/parc_BitVector.c index 21a66c23..68a86459 100755..100644 --- a/libparc/parc/algol/parc_BitVector.c +++ b/libparc/parc/algol/parc_BitVector.c @@ -171,7 +171,7 @@ parcBitVector_SetVector(PARCBitVector *parcBitVector, const PARCBitVector *bitsT parcAssertNotNull(parcBitVector, "parcBitVector_SetVector passed a NULL parcBitVector"); parcAssertNotNull(parcBitVector, "parcBitVector_SetVector passed a NULL vector of bits to set"); int settingBit = 0; - for (int i = 0; i < bitsToSet->numberOfBitsSet; i++) { + for (unsigned int i = 0; i < bitsToSet->numberOfBitsSet; i++) { settingBit = parcBitVector_NextBitSet(bitsToSet, settingBit); parcAssertTrue(settingBit != -1, "Number of bits claimed set inconsistent with bits found"); parcBitVector_Set(parcBitVector, settingBit); @@ -220,8 +220,8 @@ parcBitVector_ClearVector(PARCBitVector *parcBitVector, const PARCBitVector *bit return; } - int clearingBit = 0; - for (int i = 0; i < bitsToClear->numberOfBitsSet; i++) { + unsigned int clearingBit = 0; + for (unsigned int i = 0; i < bitsToClear->numberOfBitsSet; i++) { clearingBit = parcBitVector_NextBitSet(bitsToClear, clearingBit); // only clear up to the end of the original vector if (clearingBit >= parcBitVector->bitLength) { @@ -271,7 +271,7 @@ parcBitVector_Contains(const PARCBitVector *parcBitVector, const PARCBitVector * bool result = true; int testBit = 0; - for (int i = 0; i < testVector->numberOfBitsSet; i++, testBit++) { + for (unsigned int i = 0; i < testVector->numberOfBitsSet; i++, testBit++) { testBit = parcBitVector_NextBitSet(testVector, testBit); if (parcBitVector_Get(parcBitVector, testBit) != 1) { result = false; diff --git a/libparc/parc/algol/parc_BitVector.h b/libparc/parc/algol/parc_BitVector.h index 552fd911..552fd911 100755..100644 --- a/libparc/parc/algol/parc_BitVector.h +++ b/libparc/parc/algol/parc_BitVector.h diff --git a/libparc/parc/algol/parc_Buffer.c b/libparc/parc/algol/parc_Buffer.c index 20520f9c..261aac6d 100755..100644 --- a/libparc/parc/algol/parc_Buffer.c +++ b/libparc/parc/algol/parc_Buffer.c @@ -761,7 +761,7 @@ parcBuffer_GetUint8(PARCBuffer *buffer) } PARCBuffer * -parcBuffer_GetBytes(PARCBuffer *buffer, size_t length, uint8_t array[length]) +parcBuffer_GetBytes(PARCBuffer *buffer, size_t length, uint8_t *array) { parcBuffer_OptionalAssertValid(buffer); _trapIfBufferUnderflow(buffer, length); @@ -863,7 +863,7 @@ parcBuffer_PutAtIndex(PARCBuffer *buffer, size_t index, uint8_t value) } PARCBuffer * -parcBuffer_PutArray(PARCBuffer *buffer, size_t arrayLength, const uint8_t array[arrayLength]) +parcBuffer_PutArray(PARCBuffer *buffer, size_t arrayLength, const uint8_t *array) { parcBuffer_OptionalAssertValid(buffer); parcAssertTrue(parcBuffer_Remaining(buffer) >= arrayLength, @@ -977,7 +977,7 @@ parcBuffer_ToHexString(const PARCBuffer *buffer) } bool -parcBuffer_SkipOver(PARCBuffer *buffer, size_t length, const uint8_t bytesToSkipOver[length]) +parcBuffer_SkipOver(PARCBuffer *buffer, size_t length, const uint8_t *bytesToSkipOver) { while (parcBuffer_Remaining(buffer) > 0) { uint8_t character = parcBuffer_GetUint8(buffer); @@ -990,7 +990,7 @@ parcBuffer_SkipOver(PARCBuffer *buffer, size_t length, const uint8_t bytesToSkip } bool -parcBuffer_SkipTo(PARCBuffer *buffer, size_t length, const uint8_t bytesToSkipTo[length]) +parcBuffer_SkipTo(PARCBuffer *buffer, size_t length, const uint8_t *bytesToSkipTo) { bool result = false; diff --git a/libparc/parc/algol/parc_Buffer.h b/libparc/parc/algol/parc_Buffer.h index 665019db..fdc205f8 100644 --- a/libparc/parc/algol/parc_Buffer.h +++ b/libparc/parc/algol/parc_Buffer.h @@ -362,7 +362,7 @@ PARCBuffer *parcBuffer_AllocateCString(const char *string); * } * @endcode */ -PARCBuffer *parcBuffer_CreateFromArray(const void *bytes, size_t length); +PARCBuffer *parcBuffer_CreateFromArray(const void *bytes, const size_t length); /** * Parse a null-terminated hexadecimal string to create a new `PARCBuffer` instance. diff --git a/libparc/parc/algol/parc_BufferChunker.c b/libparc/parc/algol/parc_BufferChunker.c index f3a4ab67..03c67f58 100644 --- a/libparc/parc/algol/parc_BufferChunker.c +++ b/libparc/parc/algol/parc_BufferChunker.c @@ -20,7 +20,9 @@ #include <stdio.h> #include <string.h> +#ifndef _WIN32 #include <sys/time.h> +#endif #include <parc/algol/parc_Object.h> #include <parc/algol/parc_Buffer.h> diff --git a/libparc/parc/algol/parc_BufferChunker.h b/libparc/parc/algol/parc_BufferChunker.h index 16f21c49..16f21c49 100755..100644 --- a/libparc/parc/algol/parc_BufferChunker.h +++ b/libparc/parc/algol/parc_BufferChunker.h diff --git a/libparc/parc/algol/parc_BufferComposer.c b/libparc/parc/algol/parc_BufferComposer.c index 30e23acf..30e23acf 100755..100644 --- a/libparc/parc/algol/parc_BufferComposer.c +++ b/libparc/parc/algol/parc_BufferComposer.c diff --git a/libparc/parc/algol/parc_BufferComposer.h b/libparc/parc/algol/parc_BufferComposer.h index 25c69258..e0ec5112 100755..100644 --- a/libparc/parc/algol/parc_BufferComposer.h +++ b/libparc/parc/algol/parc_BufferComposer.h @@ -30,6 +30,7 @@ struct parc_buffer_composer; typedef struct parc_buffer_composer PARCBufferComposer; +#include <config.h> #include <parc/algol/parc_Buffer.h> extern parcObjectDescriptor_Declaration(PARCBufferComposer); diff --git a/libparc/parc/algol/parc_BufferDictionary.c b/libparc/parc/algol/parc_BufferDictionary.c index c2438129..c2438129 100755..100644 --- a/libparc/parc/algol/parc_BufferDictionary.c +++ b/libparc/parc/algol/parc_BufferDictionary.c diff --git a/libparc/parc/algol/parc_BufferDictionary.h b/libparc/parc/algol/parc_BufferDictionary.h index 60aa90cb..60aa90cb 100755..100644 --- a/libparc/parc/algol/parc_BufferDictionary.h +++ b/libparc/parc/algol/parc_BufferDictionary.h diff --git a/libparc/parc/algol/parc_ByteArray.c b/libparc/parc/algol/parc_ByteArray.c index 1d81d211..e4cc0480 100644 --- a/libparc/parc/algol/parc_ByteArray.c +++ b/libparc/parc/algol/parc_ByteArray.c @@ -108,7 +108,7 @@ parcByteArray_Allocate(const size_t length) } PARCByteArray * -parcByteArray_Wrap(const size_t length, uint8_t array[length]) +parcByteArray_Wrap(const size_t length, uint8_t *array) { if (array != NULL) { PARCByteArray *result = parcObject_CreateInstance(PARCByteArray); @@ -209,7 +209,7 @@ parcByteArray_Compare(const PARCByteArray *x, const PARCByteArray *y) } PARCByteArray * -parcByteArray_PutBytes(PARCByteArray *result, size_t offset, size_t length, const uint8_t source[length]) +parcByteArray_PutBytes(PARCByteArray *result, size_t offset, size_t length, const uint8_t *source) { parcByteArray_OptionalAssertValid(result); parcTrapOutOfBoundsIf(offset > result->length, @@ -224,7 +224,7 @@ parcByteArray_PutBytes(PARCByteArray *result, size_t offset, size_t length, cons } PARCByteArray * -parcByteArray_GetBytes(const PARCByteArray *result, size_t offset, size_t length, uint8_t array[length]) +parcByteArray_GetBytes(const PARCByteArray *result, size_t offset, size_t length, uint8_t *array) { parcByteArray_OptionalAssertValid(result); @@ -265,7 +265,7 @@ static void _parcByteArray_PrettyPrintLine(const unsigned char *memory, size_t offset, size_t length) { int bytesPerLine = 16; - char accumulator[bytesPerLine + 1]; + char *accumulator = (char *)malloc(sizeof(char) * (bytesPerLine + 1)); memset(accumulator, ' ', bytesPerLine); accumulator[bytesPerLine] = 0; @@ -286,6 +286,7 @@ _parcByteArray_PrettyPrintLine(const unsigned char *memory, size_t offset, size_ } } printf(" %s\n", accumulator); + free(accumulator); } void diff --git a/libparc/parc/algol/parc_ByteArray.h b/libparc/parc/algol/parc_ByteArray.h index c7a26285..71047339 100644 --- a/libparc/parc/algol/parc_ByteArray.h +++ b/libparc/parc/algol/parc_ByteArray.h @@ -156,7 +156,7 @@ PARCByteArray *parcByteArray_Allocate(const size_t capacity); * } * @endcode */ -PARCByteArray *parcByteArray_Wrap(size_t capacity, uint8_t *array); +PARCByteArray *parcByteArray_Wrap(const size_t capacity, uint8_t *array); /** * Returns the pointer to the `uint8_t` array that backs this `PARCByteArray`. @@ -560,7 +560,7 @@ PARCHashCode parcByteArray_HashCode(const PARCByteArray *array); * } * @endcode */ -uint8_t *parcByteArray_AddressOfIndex(const PARCByteArray *array, size_t index); +uint8_t *parcByteArray_AddressOfIndex(const PARCByteArray *array, const size_t index); /** * Pretty print the given `PARCByteArray` instance. diff --git a/libparc/parc/algol/parc_CMacro.h b/libparc/parc/algol/parc_CMacro.h index a47129ea..0b948d2f 100644 --- a/libparc/parc/algol/parc_CMacro.h +++ b/libparc/parc/algol/parc_CMacro.h @@ -35,7 +35,10 @@ * parcCMacro_IfElse is a c-macro trick for implementing a macro If-Else switch. * It uses parcCMacro_ThirdParam to select between A or B depending on whether __VA_ARGS__ expands to a comma. */ -#define parcCMacro_IfElse(A, B, ...) parcCMacro_ThirdParam(__VA_ARGS__, A, B, NOOP) + +
+#define EXPAND( x ) x
+#define parcCMacro_IfElse(A, B, ...) EXPAND(parcCMacro_ThirdParam( __VA_ARGS__ , A, B, NOOP)) /** \cond */ #define _parcCMacro_Cat_(A, B) A ## B diff --git a/libparc/parc/algol/parc_Chunker.c b/libparc/parc/algol/parc_Chunker.c index b84ed05f..f6c94b6d 100755..100644 --- a/libparc/parc/algol/parc_Chunker.c +++ b/libparc/parc/algol/parc_Chunker.c @@ -13,14 +13,13 @@ * limitations under the License. */ -/** - */ +#ifndef _WIN32 +#include <sys/time.h> +#endif #include <config.h> - #include <stdio.h> #include <string.h> -#include <sys/time.h> #include <parc/algol/parc_Object.h> #include <parc/algol/parc_Memory.h> diff --git a/libparc/parc/algol/parc_Chunker.h b/libparc/parc/algol/parc_Chunker.h index 305acad7..305acad7 100755..100644 --- a/libparc/parc/algol/parc_Chunker.h +++ b/libparc/parc/algol/parc_Chunker.h diff --git a/libparc/parc/algol/parc_Clock.c b/libparc/parc/algol/parc_Clock.c index 95cf74bc..58624fc9 100755..100644 --- a/libparc/parc/algol/parc_Clock.c +++ b/libparc/parc/algol/parc_Clock.c @@ -68,7 +68,7 @@ _counterClock_GetTimeval(const PARCClock *clock, struct timeval *output) uint64_t value = parcAtomicInteger_Uint64Increment(&cc->counter); // put 19 bits in the micro-seconds so it is never larger than 1E+6 - output->tv_sec = value >> 19; + output->tv_sec = (long) (value >> 19); output->tv_usec = value & 0x7FFFF; } @@ -94,6 +94,17 @@ parcClock_Counter(void) return clock; } +#ifdef _WIN32 +static int _clock_gettime(int value, struct timespec *spec) { + __int64 wintime; + GetSystemTimeAsFileTime((FILETIME *)&wintime); + wintime -= 116444736000000000i64; //1jan1601 to 1jan1970 + spec->tv_sec = wintime / 10000000i64; //seconds + spec->tv_nsec = wintime % 10000000i64 * 100; //nano-seconds + return 0; +} +#endif + // =========== // Wallclock @@ -105,6 +116,11 @@ _wallclock_GetTimeval(const PARCClock *dummy __attribute__((unused)), struct tim clock_gettime(CLOCK_REALTIME, &ts); output->tv_sec = ts.tv_sec; output->tv_usec = ts.tv_nsec / 1000; +#elif _WIN32 + struct timespec ts; + _clock_gettime(TIME_UTC, &ts); + output->tv_sec = (long)ts.tv_sec; + output->tv_usec = ts.tv_nsec / 1000; #else clock_serv_t clockService; mach_timespec_t mts; @@ -167,6 +183,11 @@ _monoclock_GetTimeval(const PARCClock *dummy __attribute__((unused)), struct tim clock_gettime(CLOCK_MONOTONIC_RAW, &ts); output->tv_sec = ts.tv_sec; output->tv_usec = ts.tv_nsec / 1000; +#elif _WIN32 + struct timespec ts; + _clock_gettime(TIME_UTC, &ts); + output->tv_sec = (long)ts.tv_sec; + output->tv_usec = ts.tv_nsec / 1000; #else clock_serv_t clockService; mach_timespec_t mts; diff --git a/libparc/parc/algol/parc_Clock.h b/libparc/parc/algol/parc_Clock.h index 35c77fd7..698773b9 100755..100644 --- a/libparc/parc/algol/parc_Clock.h +++ b/libparc/parc/algol/parc_Clock.h @@ -98,8 +98,11 @@ #ifndef PARC_parc_Clock_h #define PARC_parc_Clock_h -#include <inttypes.h> +#ifndef _WIN32 #include <sys/time.h> +#endif + +#include <inttypes.h> struct parc_clock; typedef struct parc_clock PARCClock; diff --git a/libparc/parc/algol/parc_Collection.h b/libparc/parc/algol/parc_Collection.h index 87deff12..87deff12 100755..100644 --- a/libparc/parc/algol/parc_Collection.h +++ b/libparc/parc/algol/parc_Collection.h diff --git a/libparc/parc/algol/parc_Deque.c b/libparc/parc/algol/parc_Deque.c index 84808766..c0b83551 100644 --- a/libparc/parc/algol/parc_Deque.c +++ b/libparc/parc/algol/parc_Deque.c @@ -13,17 +13,15 @@ * limitations under the License. */ -/** - */ -#include <config.h> - -#include <parc/assert/parc_Assert.h> +#ifndef _WIN32 +#include <sys/queue.h> +#endif +#include <config.h> #include <stdio.h> -#include <sys/queue.h> +#include <parc/assert/parc_Assert.h> #include <parc/algol/parc_Deque.h> - #include <parc/algol/parc_DisplayIndented.h> #include <parc/algol/parc_Object.h> #include <parc/algol/parc_Memory.h> diff --git a/libparc/parc/algol/parc_Deque.h b/libparc/parc/algol/parc_Deque.h index 57dd39b1..8b988dee 100755..100644 --- a/libparc/parc/algol/parc_Deque.h +++ b/libparc/parc/algol/parc_Deque.h @@ -345,7 +345,7 @@ bool parcDeque_Equals(const PARCDeque *x, const PARCDeque *y); * @endcode * */ -void parcDeque_Display(const PARCDeque *deque, int indentation); +void parcDeque_Display(const PARCDeque *deque, const int indentation); /** * Wakes up a single thread that is waiting on this object (see `parcDeque_Wait)`. diff --git a/libparc/parc/algol/parc_Dictionary.c b/libparc/parc/algol/parc_Dictionary.c index a7a59de6..a7a59de6 100755..100644 --- a/libparc/parc/algol/parc_Dictionary.c +++ b/libparc/parc/algol/parc_Dictionary.c diff --git a/libparc/parc/algol/parc_Dictionary.h b/libparc/parc/algol/parc_Dictionary.h index 1ba98a65..1ba98a65 100755..100644 --- a/libparc/parc/algol/parc_Dictionary.h +++ b/libparc/parc/algol/parc_Dictionary.h diff --git a/libparc/parc/algol/parc_DisplayIndented.c b/libparc/parc/algol/parc_DisplayIndented.c index 39e1d76e..a17e7f04 100755..100644 --- a/libparc/parc/algol/parc_DisplayIndented.c +++ b/libparc/parc/algol/parc_DisplayIndented.c @@ -13,19 +13,18 @@ * limitations under the License. */ -/** - */ -#include <config.h> - -#include <parc/assert/parc_Assert.h> +#ifndef _WIN32 +#include <unistd.h> +#endif +#include <config.h> #include <stdio.h> #include <stdlib.h> #include <stdarg.h> -#include <unistd.h> #include <string.h> #include <ctype.h> +#include <parc/assert/parc_Assert.h> #include <parc/algol/parc_DisplayIndented.h> static char *_spaces = " "; @@ -38,7 +37,7 @@ _indent(int indentation) size_t result = 0; if (indentation > 0) { - result = write(1, _spaces, indentation * _indentationFactor); + result = write(1, _spaces, (unsigned int)(indentation * _indentationFactor)); parcAssertTrue(result == (indentation * _indentationFactor), "Write(2) failed to write %zd bytes.", indentation * _indentationFactor); } @@ -54,11 +53,11 @@ _parcDisplayIndented_Print(int indentation, char *string) while (start != NULL) { _indent(indentation); if (end != NULL) { - ssize_t nwritten = write(1, start, end - start + 1); + ssize_t nwritten = write(1, start, (unsigned int)(end - start + 1)); parcAssertTrue(nwritten >= 0, "Error calling write"); start = end + 1; } else { - ssize_t nwritten = write(1, start, strlen(start)); + ssize_t nwritten = write(1, start, (unsigned int)strlen(start)); parcAssertTrue(nwritten >= 0, "Error calling write"); break; } @@ -87,11 +86,10 @@ parcDisplayIndented_PrintLine(int indentation, const char *format, ...) } void -parcDisplayIndented_PrintMemory(int indentation, size_t length, const char memory[length]) +parcDisplayIndented_PrintMemory(int indentation, size_t length, const char *memory) { int bytesPerLine = 16; - - char accumulator[bytesPerLine + 1]; + char *accumulator = (char *)malloc(sizeof(char)*(bytesPerLine + 1)); memset(accumulator, ' ', bytesPerLine); accumulator[bytesPerLine] = 0; @@ -111,4 +109,5 @@ parcDisplayIndented_PrintMemory(int indentation, size_t length, const char memor offset += bytesInLine; } printf(" %s]\n", accumulator); + free(accumulator); } diff --git a/libparc/parc/algol/parc_ElasticString.h b/libparc/parc/algol/parc_ElasticString.h index c6e39eb1..c6e39eb1 100755..100644 --- a/libparc/parc/algol/parc_ElasticString.h +++ b/libparc/parc/algol/parc_ElasticString.h diff --git a/libparc/parc/algol/parc_Environment.c b/libparc/parc/algol/parc_Environment.c index 2955a139..2ca11b4d 100644 --- a/libparc/parc/algol/parc_Environment.c +++ b/libparc/parc/algol/parc_Environment.c @@ -13,15 +13,15 @@ * limitations under the License. */ -/** - */ -#include <config.h> -#include <sys/types.h> -#include <pwd.h> -#include <stdlib.h> +#ifndef _WIN32 #include <unistd.h> +#include <pwd.h> +#endif +#include <config.h> +#include <sys/types.h> +#include <stdlib.h> #include <parc/algol/parc_Environment.h> #include <parc/algol/parc_File.h> @@ -35,11 +35,23 @@ parcEnvironment_GetHomeDirectory(void) PARCFile * parcEnvironment_HomeDirectory(void) { - char *path; +#ifdef _WIN32 + char *pValue; + size_t len; + errno_t err = _dupenv_s(&pValue, &len, "USERPROFILE"); + if (err != 0) { + return parcFile_Create(pValue); + } + else { + return NULL; + } +#else + char *path; if ((path = getenv("HOME")) == NULL) { path = getpwuid(getuid())->pw_dir; } - return parcFile_Create(path); +#endif + } diff --git a/libparc/parc/algol/parc_Environment.h b/libparc/parc/algol/parc_Environment.h index 04610176..04610176 100755..100644 --- a/libparc/parc/algol/parc_Environment.h +++ b/libparc/parc/algol/parc_Environment.h diff --git a/libparc/parc/algol/parc_Event.c b/libparc/parc/algol/parc_Event.c index 1621edac..1621edac 100755..100644 --- a/libparc/parc/algol/parc_Event.c +++ b/libparc/parc/algol/parc_Event.c diff --git a/libparc/parc/algol/parc_EventBuffer.c b/libparc/parc/algol/parc_EventBuffer.c index 6293680c..9867d916 100644 --- a/libparc/parc/algol/parc_EventBuffer.c +++ b/libparc/parc/algol/parc_EventBuffer.c @@ -162,7 +162,7 @@ parcEventBuffer_copyOut(PARCEventBuffer *readBuffer, void *data_out, size_t leng { parcAssertNotNull(data_out, "parcEventBuffer_Copy was passed a null data_out buffer\n"); parcEventBuffer_OptionalAssertValid(readBuffer); - return evbuffer_copyout(readBuffer->evbuffer, data_out, length); + return (int)evbuffer_copyout(readBuffer->evbuffer, data_out, length); } int diff --git a/libparc/parc/algol/parc_EventBuffer.h b/libparc/parc/algol/parc_EventBuffer.h index 8e82a5e6..8e82a5e6 100755..100644 --- a/libparc/parc/algol/parc_EventBuffer.h +++ b/libparc/parc/algol/parc_EventBuffer.h diff --git a/libparc/parc/algol/parc_EventQueue.c b/libparc/parc/algol/parc_EventQueue.c index dffab1e7..3542b408 100755..100644 --- a/libparc/parc/algol/parc_EventQueue.c +++ b/libparc/parc/algol/parc_EventQueue.c @@ -176,7 +176,7 @@ parcEventQueue_SetFileDescriptor(PARCEventQueue *parcEventQueue, int fd) int parcEventQueue_GetFileDescriptor(PARCEventQueue *parcEventQueue) { - return bufferevent_getfd(parcEventQueue->buffereventBuffer); + return (int)bufferevent_getfd(parcEventQueue->buffereventBuffer); } PARCEventType @@ -239,7 +239,7 @@ parcEventQueue_Printf(PARCEventQueue *parcEventQueue, const char *fmt, ...) int parcEventQueue_Read(PARCEventQueue *parcEventQueue, void *data, size_t dataLength) { - return bufferevent_read(parcEventQueue->buffereventBuffer, data, dataLength); + return (int)bufferevent_read(parcEventQueue->buffereventBuffer, data, dataLength); } int diff --git a/libparc/parc/algol/parc_EventQueue.h b/libparc/parc/algol/parc_EventQueue.h index 282df302..d6ed1bce 100644 --- a/libparc/parc/algol/parc_EventQueue.h +++ b/libparc/parc/algol/parc_EventQueue.h @@ -27,8 +27,11 @@ #ifndef libparc_parc_EventQueue_h #define libparc_parc_EventQueue_h -#include <sys/types.h> +#ifndef _WIN32 #include <sys/socket.h> +#endif + +#include <sys/types.h> #include <parc/algol/parc_Event.h> diff --git a/libparc/parc/algol/parc_EventScheduler.c b/libparc/parc/algol/parc_EventScheduler.c index 3983740e..59103f49 100755..100644 --- a/libparc/parc/algol/parc_EventScheduler.c +++ b/libparc/parc/algol/parc_EventScheduler.c @@ -13,16 +13,15 @@ * limitations under the License. */ -/** - */ -#include <config.h> - -#include <parc/assert/parc_Assert.h> +#ifndef _WIN32 +#include <unistd.h> +#endif +#include <config.h> #include <stdio.h> -#include <unistd.h> #include "internal_parc_Event.h" +#include <parc/assert/parc_Assert.h> #include <parc/algol/parc_EventScheduler.h> #include <parc/algol/parc_FileOutputStream.h> #include <parc/logging/parc_Log.h> diff --git a/libparc/parc/algol/parc_EventSignal.c b/libparc/parc/algol/parc_EventSignal.c index 7bb094bd..7bb094bd 100755..100644 --- a/libparc/parc/algol/parc_EventSignal.c +++ b/libparc/parc/algol/parc_EventSignal.c diff --git a/libparc/parc/algol/parc_EventSignal.h b/libparc/parc/algol/parc_EventSignal.h index e289f506..e289f506 100755..100644 --- a/libparc/parc/algol/parc_EventSignal.h +++ b/libparc/parc/algol/parc_EventSignal.h diff --git a/libparc/parc/algol/parc_EventSocket.c b/libparc/parc/algol/parc_EventSocket.c index 62aa10bc..c44c824a 100755..100644 --- a/libparc/parc/algol/parc_EventSocket.c +++ b/libparc/parc/algol/parc_EventSocket.c @@ -35,7 +35,10 @@ static int _parc_event_socket_debug_enabled = 0; * Current implementation based on top of libevent2 */ +#ifndef _WIN32 #include <sys/errno.h> +#endif + #include <event2/listener.h> /** @@ -71,7 +74,7 @@ _parc_evconn_error_callback(struct evconnlistener *listener, void *ctx) PARCEventSocket *parcEventSocket = (PARCEventSocket *) ctx; int error = EVUTIL_SOCKET_ERROR(); - char *errorString = evutil_socket_error_to_string(error); + char *errorString = (char *)evutil_socket_error_to_string(error); parcEventSocket_LogDebug(parcEventSocket, "_parc_evconn_error_callback(error=%d,errorString=%s,parcEventSocket=%p)\n", error, errorString, parcEventSocket); diff --git a/libparc/parc/algol/parc_EventSocket.h b/libparc/parc/algol/parc_EventSocket.h index 48a11b25..286e528d 100755..100644 --- a/libparc/parc/algol/parc_EventSocket.h +++ b/libparc/parc/algol/parc_EventSocket.h @@ -27,8 +27,11 @@ #ifndef libparc_parc_EventSocket_h #define libparc_parc_EventSocket_h -#include <sys/types.h> +#ifndef _WIN32 #include <sys/socket.h> +#endif + +#include <sys/types.h> /** * Current implementation based on top of libevent2 diff --git a/libparc/parc/algol/parc_EventTimer.c b/libparc/parc/algol/parc_EventTimer.c index 82f731b1..82f731b1 100755..100644 --- a/libparc/parc/algol/parc_EventTimer.c +++ b/libparc/parc/algol/parc_EventTimer.c diff --git a/libparc/parc/algol/parc_EventTimer.h b/libparc/parc/algol/parc_EventTimer.h index 4a960853..4a960853 100755..100644 --- a/libparc/parc/algol/parc_EventTimer.h +++ b/libparc/parc/algol/parc_EventTimer.h diff --git a/libparc/parc/algol/parc_File.c b/libparc/parc/algol/parc_File.c index 353ffcca..f39a31af 100644 --- a/libparc/parc/algol/parc_File.c +++ b/libparc/parc/algol/parc_File.c @@ -25,20 +25,21 @@ #define __USE_XOPEN_EXTENDED #endif //__USE_XOPEN_EXTENDED -#include <stdio.h> +#ifndef _WIN32 #include <unistd.h> +#include <ftw.h> +#endif + +#include <stdio.h> #include <fcntl.h> #include <sys/stat.h> - -#include <ftw.h> #include <inttypes.h> #include <pthread.h> #include <string.h> #include <errno.h> #include <parc/assert/parc_Assert.h> - #include <parc/algol/parc_Object.h> #include <parc/algol/parc_PathName.h> #include <parc/algol/parc_File.h> @@ -134,7 +135,13 @@ parcFile_Mkdir(const PARCFile *file) parcFile_OptionalAssertValid(file); char *string = parcPathName_ToString(file->pathName); + +#ifndef _WIN32 bool result = (mkdir(string, 0777) == 0); +#else + bool result = (CreateDirectory(string, NULL) == 0); +#endif + parcMemory_Deallocate((void **) &string); return result; @@ -167,6 +174,7 @@ parcFile_IsDirectory(const PARCFile *file) return result; } +#ifndef _WIN32 static int _deleteNode(const char *path, const struct stat *stat, int flag, struct FTW *ftwbuf) { @@ -179,6 +187,7 @@ _deleteNode(const char *path, const struct stat *stat, int flag, struct FTW *ftw } return result; } +#endif /** * @function parcFile_Delete @@ -201,16 +210,21 @@ parcFile_Delete(const PARCFile *file) bool result = false; if (parcFile_IsDirectory(file)) { - // depth first, dont't follow symlinks, do not cross mount points. - int flags = FTW_DEPTH | FTW_PHYS | FTW_MOUNT; - // maximum 20 fds open at a time - int maximumFileDescriptors = 20; +#ifndef _WIN32 + // depth first, dont't follow symlinks, do not cross mount points. + int flags = FTW_DEPTH | FTW_PHYS | FTW_MOUNT; + // maximum 20 fds open at a time + int maximumFileDescriptors = 20; + + int failure = nftw(string, _deleteNode, maximumFileDescriptors, flags); + parcAssertFalse(failure, "Error on recursive delete: (%d) %s", errno, strerror(errno)); - int failure = nftw(string, _deleteNode, maximumFileDescriptors, flags); - parcAssertFalse(failure, "Error on recursive delete: (%d) %s", errno, strerror(errno)); + result = failure == false; +#else + result = RemoveDirectoryA(string); +#endif - result = failure == false; } else { result = (unlink(string) == 0); } diff --git a/libparc/parc/algol/parc_File.h b/libparc/parc/algol/parc_File.h index 42ef232e..42ef232e 100755..100644 --- a/libparc/parc/algol/parc_File.h +++ b/libparc/parc/algol/parc_File.h diff --git a/libparc/parc/algol/parc_FileChunker.c b/libparc/parc/algol/parc_FileChunker.c index d7acd58e..0af63e15 100644 --- a/libparc/parc/algol/parc_FileChunker.c +++ b/libparc/parc/algol/parc_FileChunker.c @@ -16,18 +16,17 @@ /** */ +#ifndef _WIN32 #include <config.h> +#endif #include <stdio.h> #include <string.h> -#include <sys/time.h> #include <parc/algol/parc_Object.h> #include <parc/algol/parc_Buffer.h> #include <parc/algol/parc_Memory.h> - #include <parc/algol/parc_RandomAccessFile.h> - #include <parc/algol/parc_FileChunker.h> PARCChunkerInterface *PARCFileChunkerAsChunker = &(PARCChunkerInterface) { @@ -174,7 +173,7 @@ _parcChunker_NextFromBuffer(PARCFileChunker *chunker, _ChunkerState *state) { size_t chunkSize = state->nextChunkSize; - parcRandomAccessFile_Seek(chunker->fhandle, state->position, PARCRandomAccessFilePosition_Start); + parcRandomAccessFile_Seek(chunker->fhandle, (long)(state->position), PARCRandomAccessFilePosition_Start); PARCBuffer *slice = parcBuffer_Allocate(chunkSize); parcRandomAccessFile_Read(chunker->fhandle, slice); diff --git a/libparc/parc/algol/parc_FileChunker.h b/libparc/parc/algol/parc_FileChunker.h index 6ab0d267..6ab0d267 100755..100644 --- a/libparc/parc/algol/parc_FileChunker.h +++ b/libparc/parc/algol/parc_FileChunker.h diff --git a/libparc/parc/algol/parc_FileInputStream.c b/libparc/parc/algol/parc_FileInputStream.c index 186d07b5..0ccd912d 100755..100644 --- a/libparc/parc/algol/parc_FileInputStream.c +++ b/libparc/parc/algol/parc_FileInputStream.c @@ -13,15 +13,15 @@ * limitations under the License. */ -/** - */ -#include <config.h> +#ifndef _WIN32 +#include <sys/uio.h> +#include <unistd.h> +#endif +#include <config.h> #include <fcntl.h> #include <stdio.h> #include <sys/types.h> -#include <sys/uio.h> -#include <unistd.h> #include <sys/stat.h> #include <parc/assert/parc_Assert.h> @@ -88,7 +88,7 @@ parcFileInputStream_Read(PARCFileInputStream *inputStream, PARCBuffer *buffer) { while (parcBuffer_HasRemaining(buffer)) { void *buf = parcBuffer_Overlay(buffer, 0); - ssize_t nread = read(inputStream->fd, buf, parcBuffer_Remaining(buffer)); + ssize_t nread = read(inputStream->fd, buf, (unsigned int)parcBuffer_Remaining(buffer)); if (nread < 0) { break; } diff --git a/libparc/parc/algol/parc_FileInputStream.h b/libparc/parc/algol/parc_FileInputStream.h index f7f7987a..f7f7987a 100755..100644 --- a/libparc/parc/algol/parc_FileInputStream.h +++ b/libparc/parc/algol/parc_FileInputStream.h diff --git a/libparc/parc/algol/parc_FileOutputStream.c b/libparc/parc/algol/parc_FileOutputStream.c index 3e5c8cd6..c119e67f 100755..100644 --- a/libparc/parc/algol/parc_FileOutputStream.c +++ b/libparc/parc/algol/parc_FileOutputStream.c @@ -13,15 +13,14 @@ * limitations under the License. */ -/** - */ -#include <config.h> +#ifndef _WIN32 +#include <unistd.h> +#endif +#include <config.h> #include <stdio.h> -#include <unistd.h> #include <parc/assert/parc_Assert.h> - #include <parc/algol/parc_FileOutputStream.h> #include <parc/algol/parc_Object.h> @@ -75,7 +74,7 @@ parcFileOutputStream_Write(PARCFileOutputStream *outputStream, PARCBuffer *buffe size_t remaining = parcBuffer_Remaining(buffer); size_t chunkSize = remaining > maximumChunkSize ? maximumChunkSize : remaining; void *buf = parcBuffer_Overlay(buffer, chunkSize); - ssize_t nwritten = write(outputStream->fd, buf, chunkSize); + ssize_t nwritten = write(outputStream->fd, buf, (unsigned int)chunkSize); if (nwritten == -1) { break; } diff --git a/libparc/parc/algol/parc_Hash.c b/libparc/parc/algol/parc_Hash.c index 1884c74c..fae29a63 100755..100644 --- a/libparc/parc/algol/parc_Hash.c +++ b/libparc/parc/algol/parc_Hash.c @@ -18,11 +18,13 @@ * website for details on the algorithm: http://www.isthe.com/chongo/tech/comp/fnv * */ -#include <config.h> -#include <stdint.h> +#ifndef _WIN32 #include <unistd.h> +#endif +#include <config.h> +#include <stdint.h> #include <parc/algol/parc_Hash.h> #include <parc/algol/parc_Object.h> diff --git a/libparc/parc/algol/parc_Hash.h b/libparc/parc/algol/parc_Hash.h index 92227041..92227041 100755..100644 --- a/libparc/parc/algol/parc_Hash.h +++ b/libparc/parc/algol/parc_Hash.h diff --git a/libparc/parc/algol/parc_HashCode.c b/libparc/parc/algol/parc_HashCode.c index 8554429c..8554429c 100755..100644 --- a/libparc/parc/algol/parc_HashCode.c +++ b/libparc/parc/algol/parc_HashCode.c diff --git a/libparc/parc/algol/parc_HashCode.h b/libparc/parc/algol/parc_HashCode.h index dd572bee..dd572bee 100755..100644 --- a/libparc/parc/algol/parc_HashCode.h +++ b/libparc/parc/algol/parc_HashCode.h diff --git a/libparc/parc/algol/parc_HashCodeTable.c b/libparc/parc/algol/parc_HashCodeTable.c index 9531e312..d4c5a7ae 100755..100644 --- a/libparc/parc/algol/parc_HashCodeTable.c +++ b/libparc/parc/algol/parc_HashCodeTable.c @@ -165,7 +165,7 @@ _rehash(LinearAddressingHashTable *old_table, LinearAddressingHashTable *new_tab } static void -_expand(PARCHashCodeTable *hashCodeTable) +_expandTable(PARCHashCodeTable *hashCodeTable) { LinearAddressingHashTable temp_table; LinearAddressingHashTable *old_table = &hashCodeTable->hashtable; @@ -269,7 +269,7 @@ parcHashCodeTable_Add(PARCHashCodeTable *table, void *key, void *data) parcAssertNotNull(data, "Parameter data must be non-null"); if (table->hashtable.tableSize >= table->hashtable.expandThreshold) { - _expand(table); + _expandTable(table); } HashCodeType hashcode = table->keyHashCodeFunc(key); @@ -278,7 +278,7 @@ parcHashCodeTable_Add(PARCHashCodeTable *table, void *key, void *data) do { result = _innerTableAdd(&table->hashtable, table->keyEqualsFunc, hashcode, key, data); if (result == ADD_NOSPACE) { - _expand(table); + _expandTable(table); } } while (result == ADD_NOSPACE); diff --git a/libparc/parc/algol/parc_HashMap.c b/libparc/parc/algol/parc_HashMap.c index 5e73a4c3..58137b20 100644 --- a/libparc/parc/algol/parc_HashMap.c +++ b/libparc/parc/algol/parc_HashMap.c @@ -91,7 +91,7 @@ _parcHashMap_GetEntry(const PARCHashMap *hashMap, const PARCObject *key) { PARCHashCode keyHash = parcObject_HashCode(key); - int bucket = keyHash % hashMap->capacity; + int bucket = (int)(keyHash % hashMap->capacity); _PARCHashMapEntry *result = NULL; @@ -399,7 +399,7 @@ _parcHashMap_Resize(PARCHashMap *hashMap, size_t newCapacity) while (parcIterator_HasNext(elementIt)) { _PARCHashMapEntry *entry = parcIterator_Next(elementIt); PARCHashCode keyHash = parcObject_HashCode(entry->key); - int newBucket = keyHash % newCapacity; + int newBucket = (int)(keyHash % newCapacity); if (newBuckets[newBucket] == NULL) { newBuckets[newBucket] = parcLinkedList_Create(); } @@ -422,7 +422,7 @@ parcHashMap_Remove(PARCHashMap *hashMap, const PARCObject *key) { PARCHashCode keyHash = parcObject_HashCode(key); - int bucket = keyHash % hashMap->capacity; + int bucket = (int)(keyHash % hashMap->capacity); bool result = false; @@ -476,7 +476,7 @@ parcHashMap_Put(PARCHashMap *hashMap, const PARCObject *key, const PARCObject *v entry = _parcHashMapEntry_Create(key, value); PARCHashCode keyHash = parcObject_HashCode(key); - int bucket = keyHash % hashMap->capacity; + int bucket = (int)(keyHash % hashMap->capacity); if (hashMap->buckets[bucket] == NULL) { hashMap->buckets[bucket] = parcLinkedList_Create(); @@ -560,7 +560,7 @@ _parcHashMap_Init(PARCHashMap *map __attribute__((unused))) state->listIterator = NULL; for (size_t i = 0; i < map->capacity; ++i) { if (map->buckets[i] != NULL) { - state->bucket = i; + state->bucket = (int)i; state->listIterator = parcLinkedList_CreateIterator(map->buckets[i]); break; } diff --git a/libparc/parc/algol/parc_HashMap.h b/libparc/parc/algol/parc_HashMap.h index 3ab26cd9..3ab26cd9 100755..100644 --- a/libparc/parc/algol/parc_HashMap.h +++ b/libparc/parc/algol/parc_HashMap.h diff --git a/libparc/parc/algol/parc_InputStream.c b/libparc/parc/algol/parc_InputStream.c index ade5a46a..ade5a46a 100755..100644 --- a/libparc/parc/algol/parc_InputStream.c +++ b/libparc/parc/algol/parc_InputStream.c diff --git a/libparc/parc/algol/parc_InputStream.h b/libparc/parc/algol/parc_InputStream.h index 3ab6849a..3ab6849a 100755..100644 --- a/libparc/parc/algol/parc_InputStream.h +++ b/libparc/parc/algol/parc_InputStream.h diff --git a/libparc/parc/algol/parc_Iterator.c b/libparc/parc/algol/parc_Iterator.c index 5ef67bf4..5ef67bf4 100755..100644 --- a/libparc/parc/algol/parc_Iterator.c +++ b/libparc/parc/algol/parc_Iterator.c diff --git a/libparc/parc/algol/parc_JSON.c b/libparc/parc/algol/parc_JSON.c index f69396d2..f69396d2 100755..100644 --- a/libparc/parc/algol/parc_JSON.c +++ b/libparc/parc/algol/parc_JSON.c diff --git a/libparc/parc/algol/parc_JSON.h b/libparc/parc/algol/parc_JSON.h index dc8996ca..dc8996ca 100755..100644 --- a/libparc/parc/algol/parc_JSON.h +++ b/libparc/parc/algol/parc_JSON.h diff --git a/libparc/parc/algol/parc_JSONArray.c b/libparc/parc/algol/parc_JSONArray.c index a92e6422..a92e6422 100755..100644 --- a/libparc/parc/algol/parc_JSONArray.c +++ b/libparc/parc/algol/parc_JSONArray.c diff --git a/libparc/parc/algol/parc_JSONArray.h b/libparc/parc/algol/parc_JSONArray.h index 7b322867..7b322867 100755..100644 --- a/libparc/parc/algol/parc_JSONArray.h +++ b/libparc/parc/algol/parc_JSONArray.h diff --git a/libparc/parc/algol/parc_JSONPair.c b/libparc/parc/algol/parc_JSONPair.c index 11676523..11676523 100755..100644 --- a/libparc/parc/algol/parc_JSONPair.c +++ b/libparc/parc/algol/parc_JSONPair.c diff --git a/libparc/parc/algol/parc_JSONPair.h b/libparc/parc/algol/parc_JSONPair.h index dff8485b..dff8485b 100755..100644 --- a/libparc/parc/algol/parc_JSONPair.h +++ b/libparc/parc/algol/parc_JSONPair.h diff --git a/libparc/parc/algol/parc_JSONParser.c b/libparc/parc/algol/parc_JSONParser.c index a8a0510b..a8a0510b 100755..100644 --- a/libparc/parc/algol/parc_JSONParser.c +++ b/libparc/parc/algol/parc_JSONParser.c diff --git a/libparc/parc/algol/parc_JSONParser.h b/libparc/parc/algol/parc_JSONParser.h index 425a2427..425a2427 100755..100644 --- a/libparc/parc/algol/parc_JSONParser.h +++ b/libparc/parc/algol/parc_JSONParser.h diff --git a/libparc/parc/algol/parc_JSONValue.c b/libparc/parc/algol/parc_JSONValue.c index f5aff0b4..8b9af28d 100755..100644 --- a/libparc/parc/algol/parc_JSONValue.c +++ b/libparc/parc/algol/parc_JSONValue.c @@ -757,7 +757,7 @@ parcJSONValue_GetBoolean(const PARCJSONValue *value) static long double _parcJSONValue_GetNumber(const PARCJSONValue *value) { - long double fraction = value->value.number.fraction / powl(10.0, value->value.number.fractionLog10); + long double fraction = (long double)value->value.number.fraction / (long double)powl(10.0, (long double) value->value.number.fractionLog10); long double number = (long double) value->value.number.sign * ((long double) value->value.number.whole + fraction); long double result = number * powl(10.0, (long double) value->value.number.exponent); @@ -815,7 +815,7 @@ parcJSONValue_GetTimeval(const PARCJSONValue *jsonTimeval, struct timeval *timev PARCJSON *json = parcJSONValue_GetJSON(jsonTimeval); PARCJSONValue *value = parcJSON_GetValueByName(json, "seconds"); - timeval->tv_sec = parcJSONValue_GetInteger(value); + timeval->tv_sec = (long)parcJSONValue_GetInteger(value); value = parcJSON_GetValueByName(json, "micros"); timeval->tv_usec = (int) parcJSONValue_GetInteger(value); diff --git a/libparc/parc/algol/parc_JSONValue.h b/libparc/parc/algol/parc_JSONValue.h index 0f93b2bc..0f93b2bc 100755..100644 --- a/libparc/parc/algol/parc_JSONValue.h +++ b/libparc/parc/algol/parc_JSONValue.h diff --git a/libparc/parc/algol/parc_KeyValue.c b/libparc/parc/algol/parc_KeyValue.c index 352bf3e8..352bf3e8 100755..100644 --- a/libparc/parc/algol/parc_KeyValue.c +++ b/libparc/parc/algol/parc_KeyValue.c diff --git a/libparc/parc/algol/parc_KeyValue.h b/libparc/parc/algol/parc_KeyValue.h index a4bc3915..a4bc3915 100755..100644 --- a/libparc/parc/algol/parc_KeyValue.h +++ b/libparc/parc/algol/parc_KeyValue.h diff --git a/libparc/parc/algol/parc_KeyedElement.c b/libparc/parc/algol/parc_KeyedElement.c index 265987cd..265987cd 100755..100644 --- a/libparc/parc/algol/parc_KeyedElement.c +++ b/libparc/parc/algol/parc_KeyedElement.c diff --git a/libparc/parc/algol/parc_KeyedElement.h b/libparc/parc/algol/parc_KeyedElement.h index e794360f..e794360f 100755..100644 --- a/libparc/parc/algol/parc_KeyedElement.h +++ b/libparc/parc/algol/parc_KeyedElement.h diff --git a/libparc/parc/algol/parc_LinkedList.c b/libparc/parc/algol/parc_LinkedList.c index b5bbd0a6..4b0dd17e 100644 --- a/libparc/parc/algol/parc_LinkedList.c +++ b/libparc/parc/algol/parc_LinkedList.c @@ -13,17 +13,15 @@ * limitations under the License. */ -/** - */ -#include <config.h> - -#include <parc/assert/parc_Assert.h> +#ifndef _WIN32 +#include <sys/queue.h> +#endif +#include <config.h> #include <stdio.h> -#include <sys/queue.h> +#include <parc/assert/parc_Assert.h> #include <parc/algol/parc_LinkedList.h> - #include <parc/algol/parc_DisplayIndented.h> #include <parc/algol/parc_Object.h> #include <parc/algol/parc_Memory.h> diff --git a/libparc/parc/algol/parc_LinkedList.h b/libparc/parc/algol/parc_LinkedList.h index 381e2a18..fbf46ac9 100644 --- a/libparc/parc/algol/parc_LinkedList.h +++ b/libparc/parc/algol/parc_LinkedList.h @@ -499,7 +499,7 @@ bool parcLinkedList_Equals(const PARCLinkedList *x, const PARCLinkedList *y); * @endcode * */ -void parcLinkedList_Display(const PARCLinkedList *list, int indentation); +void parcLinkedList_Display(const PARCLinkedList *list, const int indentation); /** * Wakes up a single thread that is waiting on this object (see `parcLinkedList_Wait)`. diff --git a/libparc/parc/algol/parc_List.c b/libparc/parc/algol/parc_List.c index bdb343f8..fef3853e 100644 --- a/libparc/parc/algol/parc_List.c +++ b/libparc/parc/algol/parc_List.c @@ -101,7 +101,7 @@ parcList_Add(PARCList *list, void *element) } bool -parcList_AddAll(PARCList *list, size_t argc, void *argv[argc]) +parcList_AddAll(PARCList *list, size_t argc, void **argv) { for (int i = 0; i < argc; i++) { (list->interface->Add)(list->instance, argv[i]); @@ -166,7 +166,7 @@ parcList_GetAtIndex(const PARCList *list, size_t index) int parcList_HashCode(const PARCList *list) { - return (list->interface->HashCode)(list->instance); + return (int)(list->interface->HashCode)(list->instance); } ssize_t @@ -177,7 +177,7 @@ parcList_IndexOf(const PARCList *list, PARCObject *element) if (list->interface->IndexOf) { result = (list->interface->IndexOf)(list->instance, element); } else { - for (ssize_t i = 0; i < parcList_Size(list); i++) { + for (size_t i = 0; i < parcList_Size(list); i++) { PARCObject *e = parcList_GetAtIndex(list, i); if (parcObject_Equals(e, element)) { result = i; diff --git a/libparc/parc/algol/parc_Map.c b/libparc/parc/algol/parc_Map.c index e5371c99..e5371c99 100755..100644 --- a/libparc/parc/algol/parc_Map.c +++ b/libparc/parc/algol/parc_Map.c diff --git a/libparc/parc/algol/parc_Map.h b/libparc/parc/algol/parc_Map.h index c63b23c5..c63b23c5 100755..100644 --- a/libparc/parc/algol/parc_Map.h +++ b/libparc/parc/algol/parc_Map.h diff --git a/libparc/parc/algol/parc_Memory.c b/libparc/parc/algol/parc_Memory.c index eebdadf0..6552a902 100755..100644 --- a/libparc/parc/algol/parc_Memory.c +++ b/libparc/parc/algol/parc_Memory.c @@ -13,21 +13,19 @@ * limitations under the License. */ -/** - */ -#include <config.h> - -#include <parc/assert/parc_Assert.h> - +#ifndef _WIN32 #include <unistd.h> +#endif + +#include <config.h> #include <stdlib.h> #include <stdarg.h> #include <string.h> #include <stdio.h> - #include <stdint.h> #include <stdbool.h> +#include <parc/assert/parc_Assert.h> #include <parc/algol/parc_Memory.h> #include <parc/algol/parc_SafeMemory.h> #include <parc/algol/parc_StdlibMemory.h> @@ -93,6 +91,14 @@ parcMemory_DeallocateImpl(void **pointer) ((PARCMemoryDeallocate *) parcMemory->Deallocate)(pointer); } +#ifdef _WIN32 +void +parcMemory_DeallocateAlignImpl(void **pointer) +{ + ((PARCMemoryDeallocateAlign *) parcMemory->DeallocateAlign)(pointer); +} +#endif + void * parcMemory_Reallocate(void *pointer, size_t newSize) { @@ -138,6 +144,9 @@ PARCMemoryInterface PARCMemoryAsPARCMemory = { .AllocateAndClear = (uintptr_t) parcMemory_AllocateAndClear, .MemAlign = (uintptr_t) parcMemory_MemAlign, .Deallocate = (uintptr_t) parcMemory_DeallocateImpl, +#ifdef _WIN32 + .DeallocateAlign = (uintptr_t)parcMemory_DeallocateAlignImpl, +#endif .Reallocate = (uintptr_t) parcMemory_Reallocate, .StringDuplicate = (uintptr_t) parcMemory_StringDuplicate, .Outstanding = (uintptr_t) parcMemory_Outstanding diff --git a/libparc/parc/algol/parc_Memory.h b/libparc/parc/algol/parc_Memory.h index fe3c4b5a..6e4a84e8 100644 --- a/libparc/parc/algol/parc_Memory.h +++ b/libparc/parc/algol/parc_Memory.h @@ -43,6 +43,10 @@ typedef int (PARCMemoryMemAlign)(void **pointer, size_t alignment, size_t size); typedef void (PARCMemoryDeallocate)(void **pointer); +#ifdef _WIN32 +typedef void (PARCMemoryDeallocateAlign)(void **pointer); +#endif + typedef void *(PARCMemoryReallocate)(void *pointer, size_t newSize); typedef char *(PARCMemoryStringDuplicate)(const char *string, size_t length); @@ -121,6 +125,19 @@ typedef struct parc_memory_interface { */ uintptr_t Deallocate; +#ifdef _WIN32 + /** + * Deallocate memory previously Aligned allocated via `MemAlign`. + * + * @param [in,out] pointer A pointer to a `void *` pointer to the address of the allocated memory that will be set to zero. + * + * @see AllocateAndClear + * @see Allocate + * @see Reallocate + */ + uintptr_t DeallocateAlign; +#endif + /** * Try to change the size of the allocation pointed to by @p pointer to @p newSize, and returns ptr. * If there is not enough room to enlarge the memory allocation pointed to by @p pointer, @@ -308,8 +325,35 @@ int parcMemory_MemAlign(void **pointer, const size_t alignment, const size_t siz */ void parcMemory_DeallocateImpl(void **pointer); +#ifdef _WIN32 +/** + * Deallocate memory previously allocated via `MemAlign`. + * + * @param [in,out] pointer A pointer to a `void *` pointer to the address of the allocated memory that will be set to zero. + * + * Example: + * @code + * { + * void *allocatedMemory; + * + * allocatedMemory = parcMemory_Allocate(100); + * if (allocatedMemory == NULL) { + * // allocation failed + * } + * } + * @endcode + * + * @see parcMemory_MemAlign + */ +void parcMemory_DeallocateAlignImpl(void **pointer); +#endif + #define parcMemory_Deallocate(_pointer_) parcMemory_DeallocateImpl((void **) _pointer_) +#ifdef _WIN32 +#define parcMemory_DeallocateAlign(_pointer_) parcMemory_DeallocateAlignImpl((void **) _pointer_) +#endif + /** * Try to change the size of the allocation pointed to by @p pointer to @p newSize, and returns ptr. * If there is not enough room to enlarge the memory allocation pointed to by @p pointer, @@ -432,7 +476,7 @@ size_t parcMemory_RoundUpToCacheLine(const size_t size); * * @see parcMemory_RoundUpToCacheLine */ -size_t parcMemory_RoundUpToMultiple(size_t size, size_t multiple); +size_t parcMemory_RoundUpToMultiple(const size_t size, const size_t multiple); /** * @def parcMemory_SafeFree diff --git a/libparc/parc/algol/parc_Network.c b/libparc/parc/algol/parc_Network.c index 2b6c8888..543a77b9 100644 --- a/libparc/parc/algol/parc_Network.c +++ b/libparc/parc/algol/parc_Network.c @@ -13,19 +13,16 @@ * limitations under the License. */ -/** - */ -#include <config.h> - -#include <parc/assert/parc_Assert.h> - +#ifndef _WIN32 #include <sys/socket.h> -#include <ctype.h> -#include <sys/types.h> #include <netdb.h> +#endif +#include <config.h> +#include <ctype.h> +#include <sys/types.h> #include <parc/algol/parc_Network.h> - +#include <parc/assert/parc_Assert.h> #include <parc/algol/parc_Memory.h> #include <parc/algol/parc_BufferComposer.h> #include <parc/algol/parc_Buffer.h> @@ -52,7 +49,7 @@ parcNetwork_SockAddress(const char *address, in_port_t port) parcAssertNotNull(result, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(struct sockaddr_in)); if (result != NULL) { parcAssertTrue(ai->ai_addrlen == sizeof(struct sockaddr_in), - "Sockaddr wrong length, expected %zu got %u", sizeof(struct sockaddr_in), ai->ai_addrlen); + "Sockaddr wrong length, expected %zu got %zu", sizeof(struct sockaddr_in), ai->ai_addrlen); memcpy(result, ai->ai_addr, ai->ai_addrlen); result->sin_port = htons(port); addr = (struct sockaddr *) result; @@ -65,7 +62,7 @@ parcNetwork_SockAddress(const char *address, in_port_t port) parcAssertNotNull(result, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(struct sockaddr_in6)); if (result != NULL) { parcAssertTrue(ai->ai_addrlen == sizeof(struct sockaddr_in6), - "Sockaddr wrong length, expected %zu got %u", sizeof(struct sockaddr_in6), ai->ai_addrlen); + "Sockaddr wrong length, expected %zu got %zu", sizeof(struct sockaddr_in6), ai->ai_addrlen); memcpy(result, ai->ai_addr, ai->ai_addrlen); result->sin6_port = htons(port); @@ -304,6 +301,7 @@ parcNetwork_ParseLinkAddress(const char *address) } parcTrapIllegalValue(address, "Bad scheme '%s'", address); + return NULL; } bool @@ -370,9 +368,11 @@ parcNetwork_IsSocketLocal(struct sockaddr *sock) bool isLocal = false; switch (sock->sa_family) { +#ifndef _WIN32 case PF_LOCAL: isLocal = true; break; +#endif case PF_INET: isLocal = _isInet4Loopback((struct sockaddr_in *) sock); diff --git a/libparc/parc/algol/parc_Network.h b/libparc/parc/algol/parc_Network.h index bf7cfcbd..4b95138b 100644 --- a/libparc/parc/algol/parc_Network.h +++ b/libparc/parc/algol/parc_Network.h @@ -22,8 +22,10 @@ #ifndef libparc_parc_Networking_h #define libparc_parc_Networking_h +#ifndef _WIN32 #include <arpa/inet.h> #include <netinet/in.h> +#endif #include <parc/algol/parc_BufferComposer.h> #include <parc/algol/parc_Buffer.h> diff --git a/libparc/parc/algol/parc_Object.c b/libparc/parc/algol/parc_Object.c index 70a24f34..422a97f7 100644 --- a/libparc/parc/algol/parc_Object.c +++ b/libparc/parc/algol/parc_Object.c @@ -13,25 +13,23 @@ * limitations under the License. */ -/** - */ -#include <config.h> - -#include <parc/assert/parc_Assert.h> +#ifndef _WIN32 +#include <unistd.h> +#include <sys/errno.h> +#include <sys/time.h> +#endif +#include <config.h> #include <stdio.h> #include <inttypes.h> -#include <unistd.h> #include <stdlib.h> #include <string.h> -#include <sys/errno.h> #include <pthread.h> #include <time.h> -#include <sys/time.h> - #include <stdint.h> #include <stdbool.h> +#include <parc/assert/parc_Assert.h> #include <parc/algol/parc_DisplayIndented.h> #include <parc/algol/parc_Object.h> #include <parc/algol/parc_Memory.h> @@ -364,7 +362,11 @@ parcObject_Acquire(const PARCObject *object) _PARCObjectHeader *header = _parcObject_Header(object); +#ifndef _WIN32 parcAtomicUint64_Increment(&header->references); +#else + InterlockedIncrement((unsigned volatile *)(&header->references)); +#endif return (PARCObject *) object; } @@ -528,7 +530,12 @@ _parcObject_InitializeLocking(_PARCObjectLocking *locking) pthread_mutex_init(&locking->lock, &_parcObject_GlobalLockAttributes); pthread_cond_init(&locking->notification, NULL); - locking->locker = (pthread_t) NULL; +#ifndef _WIN32 + locking->locker = (pthread_t)NULL; +#else + locking->locker = (pthread_t) { NULL, 0 }; +#endif + } } @@ -578,6 +585,8 @@ parcObject_CreateInstanceImpl(const PARCObjectDescriptor *descriptor) size_t totalMemoryLength = prefixLength + descriptor->objectSize; void *origin = NULL; + + //origin = parcMemory_AllocateAndClear(totalMemoryLength); parcMemory_MemAlign(&origin, sizeof(void *), totalMemoryLength); if (origin == NULL) { @@ -630,7 +639,11 @@ parcObject_Release(PARCObject **objectPointer) parcTrapIllegalValueIf(header->references == 0, "PARCObject@%p references must be > 0", object); +#ifndef _WIN32 PARCReferenceCount result = parcAtomicUint64_Decrement(&header->references); +#else + PARCReferenceCount result = InterlockedDecrement((unsigned volatile *)(&header->references)); +#endif if (result == 0) { if (_parcObject_Destructor(header->descriptor, objectPointer)) { @@ -639,7 +652,11 @@ parcObject_Release(PARCObject **objectPointer) } if (header->isAllocated) { void *origin = _parcObject_Origin(object); +#ifndef _WIN32 parcMemory_Deallocate(&origin); +#else + parcMemory_DeallocateAlign(&origin); +#endif } parcAssertNotNull(*objectPointer, "Class implementation unnecessarily clears the object pointer."); } else { @@ -770,7 +787,13 @@ parcObject_Unlock(const PARCObject *object) if (object != NULL) { _PARCObjectLocking *locking = _parcObjectHeader_Locking(object); if (locking != NULL) { - locking->locker = (pthread_t) NULL; + +#ifndef _WIN32 + locking->locker = (pthread_t)NULL; +#else + locking->locker = (pthread_t) { NULL, 0 }; +#endif + result = (pthread_mutex_unlock(&locking->lock) == 0); parcAssertTrue(result, "Attempted to unlock an unowned lock."); @@ -840,7 +863,11 @@ parcObject_IsLocked(const PARCObject *object) _PARCObjectLocking *locking = _parcObjectHeader_Locking(object); if (locking != NULL) { - result = locking->locker != (pthread_t) NULL; +#ifndef _WIN32 + result = locking->locker != (pthread_t)NULL; +#else + result = locking->locker.p != NULL; +#endif } return result; @@ -890,7 +917,7 @@ parcObject_WaitFor(const PARCObject *object, const uint64_t nanoSeconds) .tv_sec = now.tv_sec, .tv_nsec = (now.tv_usec * 1000) }; - time.tv_nsec += nanoSeconds; + time.tv_nsec += (long)nanoSeconds; time.tv_sec += time.tv_nsec / 1000000000; time.tv_nsec = time.tv_nsec % 1000000000; @@ -932,8 +959,11 @@ bool parcObject_BarrierSet(const PARCObject *object) { _PARCObjectHeader *header = _parcObject_Header(object); - +#ifndef _WIN32 while (__sync_bool_compare_and_swap(&header->barrier, false, true) == false) { +#else + while (InterlockedCompareExchange((unsigned volatile *)&header->barrier, false, true) != header->barrier) { +#endif ; } return true; @@ -944,7 +974,12 @@ parcObject_BarrierUnset(const PARCObject *object) { _PARCObjectHeader *header = _parcObject_Header(object); +#ifndef _WIN32 while (__sync_bool_compare_and_swap(&header->barrier, true, false) == false) { +#else + while (InterlockedCompareExchange((unsigned volatile *)&header->barrier, true, false) != header->barrier) { +#endif + ; } diff --git a/libparc/parc/algol/parc_Object.h b/libparc/parc/algol/parc_Object.h index ac7e9652..ba9392a4 100644 --- a/libparc/parc/algol/parc_Object.h +++ b/libparc/parc/algol/parc_Object.h @@ -623,7 +623,7 @@ const PARCObjectDescriptor *parcObject_SetDescriptor(PARCObject *object, const P }; \ _Pragma("GCC diagnostic pop") \ const PARCObjectDescriptor parcObject_DescriptorName(_subtype) -#else +#elif defined(__GNUC__) #define parcObject_Extends(_subtype, _superType, ...) \ _Pragma("GCC diagnostic ignored \"-Woverride-init\"") \ parcObjectDescriptor_Declaration(_subtype) = { \ @@ -647,7 +647,29 @@ const PARCObjectDescriptor *parcObject_SetDescriptor(PARCObject *object, const P }; \ _Pragma("GCC diagnostic warning \"-Woverride-init\"") \ const PARCObjectDescriptor parcObject_DescriptorName(_subtype) -#endif +#else
+#define parcObject_Extends(_subtype, _superType, ...) \
+ parcObjectDescriptor_Declaration(_subtype) = { \
+ .super = &parcObject_DescriptorName(_superType), \
+ .name = #_subtype, \
+ .objectSize = 0, \
+ .objectAlignment = 0, \
+ .destroy = NULL, \
+ .destructor = NULL, \
+ .release = NULL, \
+ .copy = NULL, \
+ .toString = NULL, \
+ .equals = NULL, \
+ .compare = NULL, \
+ .hashCode = NULL, \
+ .toJSON = NULL, \
+ .display = NULL, \
+ .isLockable = true, \
+ .typeState = NULL, \
+ __VA_ARGS__ \
+ }; \
+ const PARCObjectDescriptor parcObject_DescriptorName(_subtype)
+#endif
/** * Define a new PARC Object implementation, by composing a new PARC Object Descriptor referencing an old one. diff --git a/libparc/parc/algol/parc_OldSortedList.c b/libparc/parc/algol/parc_OldSortedList.c index c50d856d..c50d856d 100755..100644 --- a/libparc/parc/algol/parc_OldSortedList.c +++ b/libparc/parc/algol/parc_OldSortedList.c diff --git a/libparc/parc/algol/parc_OldSortedList.h b/libparc/parc/algol/parc_OldSortedList.h index 2a00a0fa..2a00a0fa 100755..100644 --- a/libparc/parc/algol/parc_OldSortedList.h +++ b/libparc/parc/algol/parc_OldSortedList.h diff --git a/libparc/parc/algol/parc_OutputStream.c b/libparc/parc/algol/parc_OutputStream.c index d00c1f09..d00c1f09 100755..100644 --- a/libparc/parc/algol/parc_OutputStream.c +++ b/libparc/parc/algol/parc_OutputStream.c diff --git a/libparc/parc/algol/parc_OutputStream.h b/libparc/parc/algol/parc_OutputStream.h index db0ba343..db0ba343 100755..100644 --- a/libparc/parc/algol/parc_OutputStream.h +++ b/libparc/parc/algol/parc_OutputStream.h diff --git a/libparc/parc/algol/parc_PathName.c b/libparc/parc/algol/parc_PathName.c index 56e57d27..ec6b2a5b 100755..100644 --- a/libparc/parc/algol/parc_PathName.c +++ b/libparc/parc/algol/parc_PathName.c @@ -13,19 +13,16 @@ * limitations under the License. */ -/** - */ -#include <config.h> - -#include <parc/assert/parc_Assert.h> +#ifndef _WIN32 +#include <unistd.h> +#endif +#include <config.h> #include <stdbool.h> #include <stdio.h> #include <string.h> -#include <unistd.h> - #include <parc/algol/parc_Deque.h> - +#include <parc/assert/parc_Assert.h> #include <parc/algol/parc_Object.h> #include <parc/algol/parc_DisplayIndented.h> #include <parc/algol/parc_Memory.h> @@ -80,7 +77,7 @@ parcObject_ExtendPARCObject(PARCPathName, _destroy, parcPathName_Copy, parcPathN parcPathName_Equals, NULL, NULL, NULL); PARCPathName * -parcPathName_ParseToLimit(size_t limit, const char path[limit]) +parcPathName_ParseToLimit(size_t limit, const char *path) { PARCPathName *result = parcPathName_Create(); diff --git a/libparc/parc/algol/parc_PriorityQueue.c b/libparc/parc/algol/parc_PriorityQueue.c index c6c003b1..6fea804b 100755..100644 --- a/libparc/parc/algol/parc_PriorityQueue.c +++ b/libparc/parc/algol/parc_PriorityQueue.c @@ -251,7 +251,7 @@ _bubbleUp(PARCPriorityQueue *queue, size_t elementIndex) * @endcode */ static void -_expand(PARCPriorityQueue *queue) +_expandTable(PARCPriorityQueue *queue) { queue->capacity *= 2; queue->array = parcMemory_Reallocate(queue->array, sizeof(HeapEntry) * queue->capacity); @@ -320,7 +320,7 @@ parcPriorityQueue_Add(PARCPriorityQueue *queue, void *data) parcAssertNotNull(data, "Parameter data must be non-null"); if (queue->size + 1 > queue->capacity) { - _expand(queue); + _expandTable(queue); } // insert at the end of the array diff --git a/libparc/parc/algol/parc_PriorityQueue.h b/libparc/parc/algol/parc_PriorityQueue.h index 45a6ffab..45a6ffab 100755..100644 --- a/libparc/parc/algol/parc_PriorityQueue.h +++ b/libparc/parc/algol/parc_PriorityQueue.h diff --git a/libparc/parc/algol/parc_Properties.c b/libparc/parc/algol/parc_Properties.c index 2a6c7d33..623128a0 100644 --- a/libparc/parc/algol/parc_Properties.c +++ b/libparc/parc/algol/parc_Properties.c @@ -222,7 +222,7 @@ parcProperties_SetProperty(PARCProperties *properties, const char *name, const c } const char * -parcProperties_GetProperty(const PARCProperties *properties, const char *name) +parcProperties_GetProperty(const PARCProperties *properties, const char *restrict name) { char *result = NULL; diff --git a/libparc/parc/algol/parc_RandomAccessFile.c b/libparc/parc/algol/parc_RandomAccessFile.c index 9a5e7914..9a5e7914 100755..100644 --- a/libparc/parc/algol/parc_RandomAccessFile.c +++ b/libparc/parc/algol/parc_RandomAccessFile.c diff --git a/libparc/parc/algol/parc_RandomAccessFile.h b/libparc/parc/algol/parc_RandomAccessFile.h index f4f20150..f4f20150 100755..100644 --- a/libparc/parc/algol/parc_RandomAccessFile.h +++ b/libparc/parc/algol/parc_RandomAccessFile.h diff --git a/libparc/parc/algol/parc_ReadOnlyBuffer.c b/libparc/parc/algol/parc_ReadOnlyBuffer.c index 25628ae8..25628ae8 100755..100644 --- a/libparc/parc/algol/parc_ReadOnlyBuffer.c +++ b/libparc/parc/algol/parc_ReadOnlyBuffer.c diff --git a/libparc/parc/algol/parc_SafeMemory.c b/libparc/parc/algol/parc_SafeMemory.c index 76908548..337dfb5f 100644 --- a/libparc/parc/algol/parc_SafeMemory.c +++ b/libparc/parc/algol/parc_SafeMemory.c @@ -62,14 +62,16 @@ # include <execinfo.h> #endif +#ifndef _WIN32 #include <unistd.h> +#include <sys/errno.h> +#include <sys/queue.h> +#endif + #include <stdlib.h> #include <string.h> #include <stdio.h> -#include <sys/errno.h> -#include <sys/queue.h> #include <pthread.h> - #include <stdint.h> #include <inttypes.h> #include <stdbool.h> @@ -565,7 +567,7 @@ parcSafeMemory_IsValid(const void *memory) { bool result = true; - PARCSafeMemoryState state = _parcSafeMemory_GetState(memory); + PARCSafeMemoryState state = _parcSafeMemory_GetState((const PARCSafeMemoryUsable *)memory); if (state != PARCSafeMemoryState_OK) { return false; } @@ -629,12 +631,12 @@ parcSafeMemory_Display(const void *memory, int indentation) if (memory == NULL) { parcDisplayIndented_PrintLine(indentation, "PARCSafeMemory@NULL"); } else { - _MemoryPrefix *prefix = _parcSafeMemory_GetPrefix(memory); + _MemoryPrefix *prefix = _parcSafeMemory_GetPrefix((const PARCSafeMemoryUsable *)memory); parcDisplayIndented_PrintLine(indentation, "PARCSafeMemory@%p {", (void *) memory); parcDisplayIndented_PrintLine(indentation + 1, "%p=[ magic=0x%" PRIx64 " requestedLength=%zd, actualLength=%zd, alignment=%zd, guard=0x%" PRIx64 "]", - _parcSafeMemory_GetOrigin(memory), + _parcSafeMemory_GetOrigin((const PARCSafeMemoryUsable *)memory), prefix->magic, prefix->requestedLength, prefix->actualLength, diff --git a/libparc/parc/algol/parc_Stack.c b/libparc/parc/algol/parc_Stack.c index 72cae53c..72cae53c 100755..100644 --- a/libparc/parc/algol/parc_Stack.c +++ b/libparc/parc/algol/parc_Stack.c diff --git a/libparc/parc/algol/parc_Stack.h b/libparc/parc/algol/parc_Stack.h index e64e02f4..e64e02f4 100755..100644 --- a/libparc/parc/algol/parc_Stack.h +++ b/libparc/parc/algol/parc_Stack.h diff --git a/libparc/parc/algol/parc_StdlibMemory.c b/libparc/parc/algol/parc_StdlibMemory.c index 11381a54..536823d0 100755..100644 --- a/libparc/parc/algol/parc_StdlibMemory.c +++ b/libparc/parc/algol/parc_StdlibMemory.c @@ -13,20 +13,18 @@ * limitations under the License. */ -/** - */ -#include <config.h> +#ifndef _WIN32 +#include <sys/errno.h> +#endif +#include <config.h> #include <stdio.h> #include <stdlib.h> -#include <sys/errno.h> #include <stdbool.h> #include <string.h> -#include <strings.h> #include <pthread.h> #include <parc/assert/parc_Assert.h> - #include <parc/algol/parc_StdlibMemory.h> static uint32_t _parcStdlibMemory_OutstandingAllocations; @@ -114,14 +112,23 @@ parcStdlibMemory_MemAlign(void **pointer, size_t alignment, size_t size) return EINVAL; } +#ifndef _WIN32 int failure = posix_memalign(pointer, alignment, size); if (failure != 0) { return failure; } + if (*pointer == NULL) { return ENOMEM; } +#else + *pointer= _aligned_malloc(size, alignment); + + if (*pointer == NULL) { + return errno; + } +#endif _parcStdlibMemory_IncrementOutstandingAllocations(); @@ -141,6 +148,22 @@ parcStdlibMemory_Deallocate(void **pointer) _parcStdlibMemory_DecrementOutstandingAllocations(); } +#ifdef _WIN32 +void +parcStdlibMemory_DeallocateAlign(void **pointer) +{ +#ifndef PARCLibrary_DISABLE_VALIDATION + parcTrapIllegalValueIf(_parcStdlibMemory_OutstandingAllocations == 0, + "parcStdlibMemory_DeallocateAlign invoked with nothing left to free (double free somewhere?)\n"); +#endif + _aligned_free(*pointer); + *pointer = NULL; + + _parcStdlibMemory_DecrementOutstandingAllocations(); +} + +#endif + void * parcStdlibMemory_Reallocate(void *pointer, size_t newSize) { @@ -174,6 +197,9 @@ PARCMemoryInterface PARCStdlibMemoryAsPARCMemory = { .AllocateAndClear = (uintptr_t) parcStdlibMemory_AllocateAndClear, .MemAlign = (uintptr_t) parcStdlibMemory_MemAlign, .Deallocate = (uintptr_t) parcStdlibMemory_Deallocate, +#ifdef _WIN32 + .DeallocateAlign = (uintptr_t) parcStdlibMemory_DeallocateAlign, +#endif .Reallocate = (uintptr_t) parcStdlibMemory_Reallocate, .StringDuplicate = (uintptr_t) parcStdlibMemory_StringDuplicate, .Outstanding = (uintptr_t) parcStdlibMemory_Outstanding diff --git a/libparc/parc/algol/parc_StdlibMemory.h b/libparc/parc/algol/parc_StdlibMemory.h index 9abbf915..9ac135b2 100755..100644 --- a/libparc/parc/algol/parc_StdlibMemory.h +++ b/libparc/parc/algol/parc_StdlibMemory.h @@ -103,6 +103,20 @@ int parcStdlibMemory_MemAlign(void **pointer, size_t alignment, size_t size); */ void parcStdlibMemory_Deallocate(void **pointer); +#ifdef _WIN32 +/** + * Deallocate the memory pointed to by @p pointer + * + * @param [in,out] pointer A pointer to a pointer to the memory to be deallocated + * + * Example: + * @code + * <#example#> + * @endcode + */ +void parcStdlibMemory_DeallocateAlign(void **pointer); +#endif + /** * Resizes previously allocated memory at @p pointer to @p newSize. If necessary, * new memory is allocated and the content copied from the old memory to the diff --git a/libparc/parc/algol/parc_String.c b/libparc/parc/algol/parc_String.c index 78aaf470..78aaf470 100755..100644 --- a/libparc/parc/algol/parc_String.c +++ b/libparc/parc/algol/parc_String.c diff --git a/libparc/parc/algol/parc_Time.c b/libparc/parc/algol/parc_Time.c index 07ab185b..8f292c1b 100755..100644 --- a/libparc/parc/algol/parc_Time.c +++ b/libparc/parc/algol/parc_Time.c @@ -13,17 +13,16 @@ * limitations under the License. */ -/** - */ -#include <config.h> +#ifndef _WIN32 +#include <sys/time.h> +#endif +#include <config.h> #include <stdio.h> #include <string.h> #include <time.h> -#include <sys/time.h> #include <parc/assert/parc_Assert.h> - #include <parc/algol/parc_Time.h> #include <parc/algol/parc_Memory.h> @@ -43,11 +42,20 @@ char * parcTime_TimevalAsRFC3339(const struct timeval *utcTime, char result[64]) { char tmbuf[64]; + struct tm *nowtm; + +#ifndef _WIN32 + struct tm theTime; + nowtm = gmtime_r(&utcTime->tv_sec, &theTime); +#else struct tm theTime; + __int64 ltime = utcTime->tv_sec; + int x = _gmtime64_s(&theTime, <ime); + nowtm = &theTime; +#endif - struct tm *nowtm = gmtime_r(&utcTime->tv_sec, &theTime); strftime(tmbuf, sizeof tmbuf, "%Y-%m-%dT%H:%M:%S", nowtm); - snprintf(result, 64, "%s.%06ldZ", tmbuf, (long) utcTime->tv_usec); + snprintf(result, 64, "%s.%06ldZ", tmbuf, (long)utcTime->tv_usec); return result; } @@ -57,7 +65,16 @@ parcTime_TimevalAsISO8601(const struct timeval *utcTime, char result[64]) char tmbuf[64]; struct tm theTime; - struct tm *nowtm = gmtime_r(&utcTime->tv_sec, &theTime); + struct tm *nowtm; + +#ifndef _WIN32 + nowtm = gmtime_r(&utcTime->tv_sec, &theTime); +#else + __int64 ltime = utcTime->tv_sec; + _gmtime64_s(&theTime, <ime); + nowtm = &theTime; +#endif + strftime(tmbuf, sizeof tmbuf, "%Y-%m-%d %H:%M:%S", nowtm); snprintf(result, 64, "%s.%06ldZ", tmbuf, (long) utcTime->tv_usec); return result; @@ -66,7 +83,7 @@ parcTime_TimevalAsISO8601(const struct timeval *utcTime, char result[64]) char * parcTime_TimeAsRFC3339(const time_t utcTime, char result[64]) { - struct timeval theTime = { utcTime, 0 }; + struct timeval theTime = { (long)utcTime, 0 }; return parcTime_TimevalAsRFC3339(&theTime, result); } @@ -83,7 +100,7 @@ parcTime_NowAsRFC3339(char result[64]) char * parcTime_TimeAsISO8601(const time_t utcTime, char result[64]) { - struct timeval theTime = { utcTime, 0 }; + struct timeval theTime = { (long)utcTime, 0 }; return parcTime_TimevalAsISO8601(&theTime, result); } diff --git a/libparc/parc/algol/parc_Time.h b/libparc/parc/algol/parc_Time.h index 2a68144e..a04d02ae 100644 --- a/libparc/parc/algol/parc_Time.h +++ b/libparc/parc/algol/parc_Time.h @@ -26,7 +26,10 @@ #ifndef libparc_parc_Time_h #define libparc_parc_Time_h +#ifndef _WIN32 #include <sys/time.h> +#endif + #include <stdint.h> /** diff --git a/libparc/parc/algol/parc_TreeMap.c b/libparc/parc/algol/parc_TreeMap.c index 9922829b..9922829b 100755..100644 --- a/libparc/parc/algol/parc_TreeMap.c +++ b/libparc/parc/algol/parc_TreeMap.c diff --git a/libparc/parc/algol/parc_TreeMap.h b/libparc/parc/algol/parc_TreeMap.h index 5f0ed8d8..5f0ed8d8 100755..100644 --- a/libparc/parc/algol/parc_TreeMap.h +++ b/libparc/parc/algol/parc_TreeMap.h diff --git a/libparc/parc/algol/parc_TreeRedBlack.c b/libparc/parc/algol/parc_TreeRedBlack.c index 71a23f10..71a23f10 100755..100644 --- a/libparc/parc/algol/parc_TreeRedBlack.c +++ b/libparc/parc/algol/parc_TreeRedBlack.c diff --git a/libparc/parc/algol/parc_TreeRedBlack.h b/libparc/parc/algol/parc_TreeRedBlack.h index 52d4af36..52d4af36 100755..100644 --- a/libparc/parc/algol/parc_TreeRedBlack.h +++ b/libparc/parc/algol/parc_TreeRedBlack.h diff --git a/libparc/parc/algol/parc_URI.c b/libparc/parc/algol/parc_URI.c index e14dfc9f..94f74981 100644 --- a/libparc/parc/algol/parc_URI.c +++ b/libparc/parc/algol/parc_URI.c @@ -13,22 +13,17 @@ * limitations under the License. */ -/** - * - */ -#include <config.h> - -#include <parc/assert/parc_Assert.h> - +#ifndef _WIN32 #include <unistd.h> +#endif + +#include <config.h> #include <stdio.h> #include <string.h> -#include <strings.h> #include <ctype.h> #include <stdarg.h> - +#include <parc/assert/parc_Assert.h> #include <parc/algol/parc_URI.h> - #include <parc/algol/parc_URIPath.h> #include <parc/algol/parc_Object.h> #include <parc/algol/parc_Buffer.h> diff --git a/libparc/parc/algol/parc_URIAuthority.c b/libparc/parc/algol/parc_URIAuthority.c index 1e3468d1..96b5611a 100644 --- a/libparc/parc/algol/parc_URIAuthority.c +++ b/libparc/parc/algol/parc_URIAuthority.c @@ -13,22 +13,18 @@ * limitations under the License. */ -/** - * - */ -#include <config.h> - -#include <parc/assert/parc_Assert.h> - +#ifndef _WIN32 #include <unistd.h> +#endif + +#include <config.h> #include <stdio.h> #include <string.h> -#include <strings.h> #include <ctype.h> #include <stdarg.h> +#include <parc/assert/parc_Assert.h> #include <parc/algol/parc_URIAuthority.h> - #include <parc/algol/parc_Memory.h> #include <parc/algol/parc_Object.h> #include <parc/algol/parc_SafeMemory.h> diff --git a/libparc/parc/algol/parc_URIPath.c b/libparc/parc/algol/parc_URIPath.c index 04636852..78f28f6f 100755..100644 --- a/libparc/parc/algol/parc_URIPath.c +++ b/libparc/parc/algol/parc_URIPath.c @@ -13,21 +13,19 @@ * limitations under the License. */ -/** - */ -#include <config.h> - -#include <parc/assert/parc_Assert.h> - +#ifndef _WIN32 #include <unistd.h> +#include <strings.h> +#endif + +#include <config.h> #include <stdio.h> #include <string.h> -#include <strings.h> #include <ctype.h> #include <stdarg.h> +#include <parc/assert/parc_Assert.h> #include <parc/algol/parc_URIPath.h> - #include <parc/algol/parc_URISegment.h> #include <parc/algol/parc_ArrayList.h> #include <parc/algol/parc_Memory.h> diff --git a/libparc/parc/algol/parc_URIPath.h b/libparc/parc/algol/parc_URIPath.h index 4e2d62e5..4e2d62e5 100755..100644 --- a/libparc/parc/algol/parc_URIPath.h +++ b/libparc/parc/algol/parc_URIPath.h diff --git a/libparc/parc/algol/parc_URISegment.c b/libparc/parc/algol/parc_URISegment.c index 786a7182..aa009665 100755..100644 --- a/libparc/parc/algol/parc_URISegment.c +++ b/libparc/parc/algol/parc_URISegment.c @@ -13,21 +13,17 @@ * limitations under the License. */ -/** - */ -#include <config.h> - -#include <parc/assert/parc_Assert.h> - +#ifndef _WIN32 #include <unistd.h> +#endif + +#include <config.h> #include <stdio.h> #include <string.h> -#include <strings.h> #include <ctype.h> #include <stdarg.h> - +#include <parc/assert/parc_Assert.h> #include <parc/algol/parc_URISegment.h> - #include <parc/algol/parc_Memory.h> #include <parc/algol/parc_Object.h> @@ -131,7 +127,7 @@ parcURISegment_CreateFromBuffer(PARCBuffer *buffer) } PARCURISegment * -parcURISegment_Create(size_t length, const unsigned char segment[length]) +parcURISegment_Create(size_t length, const unsigned char *segment) { PARCURISegment *result = NULL; diff --git a/libparc/parc/algol/parc_Unsigned.h b/libparc/parc/algol/parc_Unsigned.h index b61195e4..b61195e4 100755..100644 --- a/libparc/parc/algol/parc_Unsigned.h +++ b/libparc/parc/algol/parc_Unsigned.h diff --git a/libparc/parc/algol/parc_Varint.c b/libparc/parc/algol/parc_Varint.c index 7a1d2698..7a1d2698 100755..100644 --- a/libparc/parc/algol/parc_Varint.c +++ b/libparc/parc/algol/parc_Varint.c diff --git a/libparc/parc/algol/parc_Varint.h b/libparc/parc/algol/parc_Varint.h index 6d7e60b8..6d7e60b8 100755..100644 --- a/libparc/parc/algol/parc_Varint.h +++ b/libparc/parc/algol/parc_Varint.h diff --git a/libparc/parc/algol/parc_Vector.c b/libparc/parc/algol/parc_Vector.c index 1d0e9a1d..1d0e9a1d 100755..100644 --- a/libparc/parc/algol/parc_Vector.c +++ b/libparc/parc/algol/parc_Vector.c diff --git a/libparc/parc/algol/parc_Vector.h b/libparc/parc/algol/parc_Vector.h index 825fc635..825fc635 100755..100644 --- a/libparc/parc/algol/parc_Vector.h +++ b/libparc/parc/algol/parc_Vector.h diff --git a/libparc/parc/algol/test/test_parc_ArrayList.c b/libparc/parc/algol/test/test_parc_ArrayList.c index 51e9e11c..51e9e11c 100755..100644 --- a/libparc/parc/algol/test/test_parc_ArrayList.c +++ b/libparc/parc/algol/test/test_parc_ArrayList.c diff --git a/libparc/parc/algol/test/test_parc_Base64.c b/libparc/parc/algol/test/test_parc_Base64.c index 4509ded3..4509ded3 100755..100644 --- a/libparc/parc/algol/test/test_parc_Base64.c +++ b/libparc/parc/algol/test/test_parc_Base64.c diff --git a/libparc/parc/algol/test/test_parc_BitVector.c b/libparc/parc/algol/test/test_parc_BitVector.c index 9a4d0806..9a4d0806 100755..100644 --- a/libparc/parc/algol/test/test_parc_BitVector.c +++ b/libparc/parc/algol/test/test_parc_BitVector.c diff --git a/libparc/parc/algol/test/test_parc_BufferChunker.c b/libparc/parc/algol/test/test_parc_BufferChunker.c index 8f770968..8f770968 100755..100644 --- a/libparc/parc/algol/test/test_parc_BufferChunker.c +++ b/libparc/parc/algol/test/test_parc_BufferChunker.c diff --git a/libparc/parc/algol/test/test_parc_ByteArray.c b/libparc/parc/algol/test/test_parc_ByteArray.c index 971d79dd..971d79dd 100755..100644 --- a/libparc/parc/algol/test/test_parc_ByteArray.c +++ b/libparc/parc/algol/test/test_parc_ByteArray.c diff --git a/libparc/parc/algol/test/test_parc_Chunker.c b/libparc/parc/algol/test/test_parc_Chunker.c index 945e6bab..945e6bab 100755..100644 --- a/libparc/parc/algol/test/test_parc_Chunker.c +++ b/libparc/parc/algol/test/test_parc_Chunker.c diff --git a/libparc/parc/algol/test/test_parc_Deque.c b/libparc/parc/algol/test/test_parc_Deque.c index 02884b4a..02884b4a 100755..100644 --- a/libparc/parc/algol/test/test_parc_Deque.c +++ b/libparc/parc/algol/test/test_parc_Deque.c diff --git a/libparc/parc/algol/test/test_parc_Display.c b/libparc/parc/algol/test/test_parc_Display.c index 29b9fdf2..29b9fdf2 100755..100644 --- a/libparc/parc/algol/test/test_parc_Display.c +++ b/libparc/parc/algol/test/test_parc_Display.c diff --git a/libparc/parc/algol/test/test_parc_Environment.c b/libparc/parc/algol/test/test_parc_Environment.c index e4513b31..e4513b31 100755..100644 --- a/libparc/parc/algol/test/test_parc_Environment.c +++ b/libparc/parc/algol/test/test_parc_Environment.c diff --git a/libparc/parc/algol/test/test_parc_EventScheduler.c b/libparc/parc/algol/test/test_parc_EventScheduler.c index 8195bd2e..8195bd2e 100755..100644 --- a/libparc/parc/algol/test/test_parc_EventScheduler.c +++ b/libparc/parc/algol/test/test_parc_EventScheduler.c diff --git a/libparc/parc/algol/test/test_parc_EventTimer.c b/libparc/parc/algol/test/test_parc_EventTimer.c index f6b9917e..f6b9917e 100755..100644 --- a/libparc/parc/algol/test/test_parc_EventTimer.c +++ b/libparc/parc/algol/test/test_parc_EventTimer.c diff --git a/libparc/parc/algol/test/test_parc_FileChunker.c b/libparc/parc/algol/test/test_parc_FileChunker.c index 6060cff6..6060cff6 100755..100644 --- a/libparc/parc/algol/test/test_parc_FileChunker.c +++ b/libparc/parc/algol/test/test_parc_FileChunker.c diff --git a/libparc/parc/algol/test/test_parc_FileInputStream.c b/libparc/parc/algol/test/test_parc_FileInputStream.c index 49032050..49032050 100755..100644 --- a/libparc/parc/algol/test/test_parc_FileInputStream.c +++ b/libparc/parc/algol/test/test_parc_FileInputStream.c diff --git a/libparc/parc/algol/test/test_parc_FileOutputStream.c b/libparc/parc/algol/test/test_parc_FileOutputStream.c index aa4236ae..aa4236ae 100755..100644 --- a/libparc/parc/algol/test/test_parc_FileOutputStream.c +++ b/libparc/parc/algol/test/test_parc_FileOutputStream.c diff --git a/libparc/parc/algol/test/test_parc_Hash.c b/libparc/parc/algol/test/test_parc_Hash.c index cc92a867..cc92a867 100755..100644 --- a/libparc/parc/algol/test/test_parc_Hash.c +++ b/libparc/parc/algol/test/test_parc_Hash.c diff --git a/libparc/parc/algol/test/test_parc_HashCode.c b/libparc/parc/algol/test/test_parc_HashCode.c index a5b21137..a5b21137 100755..100644 --- a/libparc/parc/algol/test/test_parc_HashCode.c +++ b/libparc/parc/algol/test/test_parc_HashCode.c diff --git a/libparc/parc/algol/test/test_parc_HashCodeTable.c b/libparc/parc/algol/test/test_parc_HashCodeTable.c index c2adf9d2..c2adf9d2 100755..100644 --- a/libparc/parc/algol/test/test_parc_HashCodeTable.c +++ b/libparc/parc/algol/test/test_parc_HashCodeTable.c diff --git a/libparc/parc/algol/test/test_parc_InputStream.c b/libparc/parc/algol/test/test_parc_InputStream.c index 46d47862..46d47862 100755..100644 --- a/libparc/parc/algol/test/test_parc_InputStream.c +++ b/libparc/parc/algol/test/test_parc_InputStream.c diff --git a/libparc/parc/algol/test/test_parc_JSONArray.c b/libparc/parc/algol/test/test_parc_JSONArray.c index d0ad9ec5..d0ad9ec5 100755..100644 --- a/libparc/parc/algol/test/test_parc_JSONArray.c +++ b/libparc/parc/algol/test/test_parc_JSONArray.c diff --git a/libparc/parc/algol/test/test_parc_JSONParser.c b/libparc/parc/algol/test/test_parc_JSONParser.c index 63bcea8d..63bcea8d 100755..100644 --- a/libparc/parc/algol/test/test_parc_JSONParser.c +++ b/libparc/parc/algol/test/test_parc_JSONParser.c diff --git a/libparc/parc/algol/test/test_parc_KeyValue.c b/libparc/parc/algol/test/test_parc_KeyValue.c index f9440602..f9440602 100755..100644 --- a/libparc/parc/algol/test/test_parc_KeyValue.c +++ b/libparc/parc/algol/test/test_parc_KeyValue.c diff --git a/libparc/parc/algol/test/test_parc_KeyedElement.c b/libparc/parc/algol/test/test_parc_KeyedElement.c index a6866437..a6866437 100755..100644 --- a/libparc/parc/algol/test/test_parc_KeyedElement.c +++ b/libparc/parc/algol/test/test_parc_KeyedElement.c diff --git a/libparc/parc/algol/test/test_parc_Memory.c b/libparc/parc/algol/test/test_parc_Memory.c index 5fb18ce3..5fb18ce3 100755..100644 --- a/libparc/parc/algol/test/test_parc_Memory.c +++ b/libparc/parc/algol/test/test_parc_Memory.c diff --git a/libparc/parc/algol/test/test_parc_Network.c b/libparc/parc/algol/test/test_parc_Network.c index 864fe25d..864fe25d 100755..100644 --- a/libparc/parc/algol/test/test_parc_Network.c +++ b/libparc/parc/algol/test/test_parc_Network.c diff --git a/libparc/parc/algol/test/test_parc_Object.c b/libparc/parc/algol/test/test_parc_Object.c index 687654fe..687654fe 100755..100644 --- a/libparc/parc/algol/test/test_parc_Object.c +++ b/libparc/parc/algol/test/test_parc_Object.c diff --git a/libparc/parc/algol/test/test_parc_PathName.c b/libparc/parc/algol/test/test_parc_PathName.c index b596aaa2..b596aaa2 100755..100644 --- a/libparc/parc/algol/test/test_parc_PathName.c +++ b/libparc/parc/algol/test/test_parc_PathName.c diff --git a/libparc/parc/algol/test/test_parc_Stack.c b/libparc/parc/algol/test/test_parc_Stack.c index 3ca27682..3ca27682 100755..100644 --- a/libparc/parc/algol/test/test_parc_Stack.c +++ b/libparc/parc/algol/test/test_parc_Stack.c diff --git a/libparc/parc/algol/test/test_parc_TreeMap.c b/libparc/parc/algol/test/test_parc_TreeMap.c index 9355380b..9355380b 100755..100644 --- a/libparc/parc/algol/test/test_parc_TreeMap.c +++ b/libparc/parc/algol/test/test_parc_TreeMap.c diff --git a/libparc/parc/algol/test/test_parc_TreeRedBlack.c b/libparc/parc/algol/test/test_parc_TreeRedBlack.c index 7fb1828a..7fb1828a 100755..100644 --- a/libparc/parc/algol/test/test_parc_TreeRedBlack.c +++ b/libparc/parc/algol/test/test_parc_TreeRedBlack.c diff --git a/libparc/parc/algol/test/test_parc_Varint.c b/libparc/parc/algol/test/test_parc_Varint.c index cf0c865c..cf0c865c 100755..100644 --- a/libparc/parc/algol/test/test_parc_Varint.c +++ b/libparc/parc/algol/test/test_parc_Varint.c |