We weren't dereferencing the variable, so this should have been safe.
However, it isn't clear in the C and C++ standards whether it
legitimately was safe. So let's just fix it.
```
simplereader.c:180:9: warning: pointer ‘buf’ may be used after ‘free’ [-Wuse-after-free]
simplereader.c:177:5: note: call to ‘free’ here
```
Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
bytestring got escaped hex string literal output format to not to confuse e.g. "\x11" bytestring with 11 integer
Signed-off-by: phirsov <41143811+phirsov@users.noreply.github.com>
fread(...) function returns the number of items read so far, not number of bytes, ergo, reading one st.st_size sized item produces 1 on success and 0 on failure.
Possibly fixing issue #77
Signed-off-by: phirsov <41143811+phirsov@users.noreply.github.com>
We changed a lot of "char*" that was binary to "uint8_t*". The example
was never fixed.
This fixes#23.
Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
This commit also starts to add unit tests.
The API, as tested, works. The simplereader.c example is probably broken
and will be fixed later.
Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>