darren sim
darren sim

Reputation: 9

What are these errors ? ( avro)

What are these errors ?

/home/pi/try/client/c/libs/kaa/src/kaa/gen/kaa_logging_gen.c:93:9: error: too many arguments to function ‘avro_binary_encoding.read_char’
         avro_binary_encoding.read_char(reader, &record->NodeId);
         ^
/home/pi/try/client/c/libs/kaa/src/kaa/gen/kaa_logging_gen.c:95:2: error: too many arguments to function ‘avro_binary_encoding.read_char’
  avro_binary_encoding.read_char(reader, &record->OnlineStat);
  ^
/home/pi/try/client/c/libs/kaa/src/kaa/gen/kaa_logging_gen.c:99:2: error: too many arguments to function ‘avro_binary_encoding.read_char’
  avro_binary_encoding.read_char(reader, &record->FirmwareVER);

Previously i gotten errors where they said read_char and write_char is not declared as functions. but after declaring the function , i still got an error. But the function is something we dont know how to do .

What we done for write_char and read_char is :

static int read_char(avro_reader_t reader)
{
    /*
     * no-op
     */
    AVRO_UNUSED(reader);

    return 3;
}

static int write_char(avro_writer_t writer)
{
    /*
     * no-op
     */
    AVRO_UNUSED(writer);

    return 3;
}

Below are other examples of other functions :

static int read_string(avro_reader_t reader, char **s, int64_t *len)
{
    (void)len;
    int64_t  str_len = 0;
    int rval;
    check_prefix(rval, read_long(reader, &str_len),
             "Cannot read string length: ");
    *s = (char *) KAA_MALLOC(str_len + 1);
    if (!*s) {
        return ENOMEM;
    }
    (*s)[str_len] = '\0';
    AVRO_READ(reader, *s, str_len);
    return 0;
}

static int write_string(avro_writer_t writer, const char *s)
{
    int64_t len = strlen(s);
    return write_bytes(writer, s, len);
}

Upvotes: 0

Views: 83

Answers (1)

theCrow
theCrow

Reputation: 346

It seems like you have passed two arguments for functions defined with one argument

static int read_char(avro_reader_t reader)
static int write_char(avro_writer_t writer)

has one argument each but you called them using

avro_binary_encoding.read_char(reader, &record->NodeId);
avro_binary_encoding.read_char(reader, &record->OnlineStat);
avro_binary_encoding.read_char(reader, &record->FirmwareVER);

which passed 2 arguments.

Upvotes: 1

Related Questions