Alex Helfet
408505ae31
8 byte alignment on capn_segment, updated comments about this.
...
As discussed in PR: https://github.com/opensourcerouting/c-capnproto/pull/15#discussion_r107588334
2017-03-23 05:11:45 +00:00
Alex Helfet
57d0ffea33
Remove UNUSED(x) macro. No longer needed.
2017-03-23 04:37:51 +00:00
Alex Helfet
ef88fd8e9d
Fixed some issues raised by eqvinox in pull request.
...
PR URL: 1b25eae747
2017-03-23 04:33:03 +00:00
Alex Helfet
1b25eae747
Fix runtime library compiler warnings and errors in GCC.
2017-03-22 17:47:59 +00:00
Alex Helfet
0be620602a
Fix compiler warnings and errors in GCC.
2017-03-22 17:40:05 +00:00
Theo Hill
7b7346a73c
lib: make buf arg const in write_fd pointer
...
For capn_write_fd() the write() function would be ideal to pass as
write_fd, but write() has type ssize_t (*)(int, const void *, size_t),
whereas write_fd expects ssize_t (*)(int, void *, size_t). Passing
write() directly with GCC 5.4 causes a warning
-Wincompatible-pointer-types (on by default).
2016-08-06 17:42:19 -07:00
David Lamparter
81352b068d
Revert "lib: endianness: don't break strict-aliasing"
...
This reverts commit 1afce9573a .
Turns out this is a misunderstanding of the C standard... meh.
2016-06-30 14:59:53 +02:00
David Lamparter
f2058f60c0
lib: make capn_{de,in}flate + capn_stream private
...
There is no point in having these functions be part of the public API.
2016-06-27 16:06:02 +02:00
David Lamparter
33ae16bba8
lib: don't overrun buffer in capn_write_mem_packed
...
Missing braces end up scaling the offset by * 4 ... which is actually a
stack/heap overflow.
2016-06-27 16:03:03 +02:00
David Lamparter
3059f4dd5c
lib: make capn_inflate() work with unaligned data
...
init_fp itself tries to read 4 bytes for the segment count.
2016-06-27 15:34:51 +02:00
David Lamparter
1afce9573a
lib: endianness: don't break strict-aliasing
...
Strict aliasing prohibits writing to union members of one type, then
reading another type. The read is undefined. Use memcpy instead (which
compilers will hopefully optimize away...)
2016-06-22 14:22:11 +02:00
David Lamparter
0abd16d62c
lib: try GCC builtins for endian byteswap
2016-06-22 14:14:46 +02:00
David Lamparter
b3b83e0343
lib: make endian check more platform-friendly
...
neither Windows nor OSX have endian.h
autoconf checking this makes things worse on Windows too, so let's just
try endian.h on "unix" systems.
2016-06-22 14:03:36 +02:00
David Lamparter
48535d02bd
whitespace fixes
2016-06-22 13:44:56 +02:00
David Lamparter
1c0652db2d
Merge branch 'pullreq-6' (dropped ms_c_capnproto/)
2016-06-22 13:32:29 +02:00
David Lamparter
2b15c6ceae
Merge pull request #5 from mikegarts/working.with.stricter.compilers
...
working with stricter compiler flags
2016-06-22 13:27:15 +02:00
Nathanael Jones
27df3d6064
Align capn_segment to 64-bit boundaries on MSVC
...
Unless capn_segment is defined with __declspec(align(64)),
check_segment_alignment fails to compile in x86 mode, as (sizeof(struct
capn_segment)&7) -> (44 & 7) evaluates to 4
Always compiles in x64 mode, as (sizeof(struct capn_segment)&7) -> (80 &
7) evaluates to 0
2016-05-11 10:30:41 -07:00
Nathanael Jones
8f37e0f618
Define default value for char *e
...
Visual studio's execution flow analysis insists that (e) could be
undefined. I don't see it, but this permits compilation.
2016-05-11 09:58:42 -07:00
Nathanael Jones
8d0ccbeeae
Define ssize_t for MSVC
...
ssize_t is not available in visual studio, nor is sys/param.h We typedef
intmax_t to ssize_t
2016-05-11 09:57:41 -07:00
Michael Gartsbein
1d5a2c83b5
include fix
2016-05-05 10:55:12 +03:00
Michael Gartsbein
ec9bb1417e
compile time endianess check, faster on little endian cpus
2016-04-28 12:02:29 +03:00
Michael Gartsbein
12ad949df8
working with stricter compiler flags
2016-04-28 12:01:08 +03:00
Michael Gartsbein
90c3473406
support set of non terminated string (with len)
2016-04-06 11:40:18 +03:00
Michael Gartsbein
bf2c598f63
uint8_t cast
2016-03-29 10:26:01 +03:00
David Lamparter
00eaeeb936
lib: fix API
...
capn_new_string is exported as symbol but not in the header
capn_write_mem_packed is internal but the symbol is visible
2016-03-19 00:39:30 +01:00
David Lamparter
811d3046e1
rename to "[lib]capnp_c", use lib/ subdir
2016-03-19 00:39:29 +01:00