Decode functions with length checks

Add decode functions for integers, unsigned integers, longs, unsigned
longs and atoms with checks to prevent reading beyond the length of the
input buffer.

The checks work with the assumption that the type field is 1 byte.

ei_decode_atom will fail if the buffer length is equal to or larger
than MAXATOMLEN, so the length of the input string is not checked.