~exec64/freekdl

02621346f3233f1bb613015ad47011b34069e3d7 — Harry Jeffery 10 months ago d257c4a
Fix issues found by -Wall -Wextra
2 files changed, 16 insertions(+), 18 deletions(-)

M freekdl.c
M test.c
M freekdl.c => freekdl.c +5 -3
@@ 29,16 29,19 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <stdlib.h>
static void *fkdl_malloc(void *context, size_t len)
{
  (void)context;
  return malloc(len);
}

static void *fkdl_realloc(void *context, void *ptr, size_t len)
{
  (void)context;
  return realloc(ptr, len);
}

static void fkdl_free(void *context, void *ptr)
{
  (void)context;
  free(ptr);
}



@@ 2096,10 2099,10 @@ fkdl_bool fkdl_nodeRemoveProperty(

  size_t i;
  for (i = 0; i < node->propertiesLen; ++i) {
    if (!node->properties[i].key.len != key->len) {
    if (node->properties[i].key.len != key->len) {
      continue;
    }
    if (memcmp(node->properties[i].key.data,
    if (fkdl_memcmp(node->properties[i].key.data,
               key->data,
               key->len)) {
      continue;


@@ 2736,7 2739,6 @@ fkdl_bool fkdl_readDocument(
  struct fkdl_array tokens = {
    .itemSize = sizeof(struct fkdl_token),
  };
  struct fkdl_error tokenError;

  if (!tokenise(
        input,

M test.c => test.c +11 -15
@@ 35,14 35,14 @@ int checkUtf8Write(uint32_t input, const char *expected, size_t expectedSize)
  if (memcmp(buf, expected, expectedSize < size ? expectedSize : size)) {
    printf("checkUtf8 for 0x%x failed. value=0x%hhx 0x%hhx 0x%hhx 0x%hhx != expected=0x%hhx 0x%hhx 0x%hhx 0x%hhx\n",
      input,
      size >= 1 ? buf[0] : 0,
      size >= 2 ? buf[1] : 0,
      size >= 3 ? buf[2] : 0,
      size >= 4 ? buf[3] : 0,
      expectedSize >= 1 ? expected[0] : 0,
      expectedSize >= 2 ? expected[1] : 0,
      expectedSize >= 3 ? expected[2] : 0,
      expectedSize >= 4 ? expected[3] : 0);
      (unsigned char)(size >= 1 ? buf[0] : 0),
      (unsigned char)(size >= 2 ? buf[1] : 0),
      (unsigned char)(size >= 3 ? buf[2] : 0),
      (unsigned char)(size >= 4 ? buf[3] : 0),
      (unsigned char)(expectedSize >= 1 ? expected[0] : 0),
      (unsigned char)(expectedSize >= 2 ? expected[1] : 0),
      (unsigned char)(expectedSize >= 3 ? expected[2] : 0),
      (unsigned char)(expectedSize >= 4 ? expected[3] : 0));
    return 0;
  }
  if (size != expectedSize) {


@@ 168,9 168,6 @@ int testPeekChar(void)
int testPeekWordCase(struct fkdl_cursor *cursor, const char *word, int shouldBeTrue)
{
  struct fkdl_cursor before = *cursor;
  uint32_t out = 0;
  size_t outSize = 0;
  struct fkdl_error error = {0};
  if (shouldBeTrue != peekWord(cursor, word)) {
    printf("For \"%s\" and \"%s\" peekWord returned %d not %d.\n",
      cursor->input + cursor->index,


@@ 189,9 186,6 @@ int testPeekWordCase(struct fkdl_cursor *cursor, const char *word, int shouldBeT
int testPeekStrCase(struct fkdl_cursor *cursor, const char *str, int shouldBeTrue)
{
  struct fkdl_cursor before = *cursor;
  uint32_t out = 0;
  size_t outSize = 0;
  struct fkdl_error error = {0};
  if (shouldBeTrue != peekStr(cursor, str)) {
    printf("For \"%s\" and \"%s\" peekStr returned %d not %d.\n",
      cursor->input + cursor->index,


@@ 839,7 833,6 @@ int testReadBasicDocument(void)
"    paragraph \"This is the second paragraph\"\n"
"    paragraph \"This is the third paragraph\"\n"
"}\n"
// "footer text=\"😁 All rights reserved\"\n";
"footer text=\"\xf0\x9f\x98\x81 All rights reserved\"\n";
  struct fkdl_document document;
  struct fkdl_error error;


@@ 1867,6 1860,9 @@ int testExamples(void)

int main(int argc, char **argv)
{
  (void)argc;
  (void)argv;

  if (testUtf8() &&
      testPeekChar() &&
      testPeekStr() &&