Merge pull request #1 from kohlschuetter/ck1

Fix buffer overflow bug in read/write
Fix C compiler warnings

Made some casts explicit.
Remove synchronized block for 1-byte read/writes

Probably not worth the effort to synchronize.