0
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);

以前我收到错误,他们说 read_char 和 write_char 没有声明为函数。但是在声明函数之后,我仍然得到一个错误。但是这个功能是我们不知道怎么做的。

我们为 write_char 和 read_char 所做的是:

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;
}

以下是其他功能的其他示例:

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);
}
4

1 回答 1

1

似乎您已经为使用一个参数定义的函数传递了两个参数

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

每个都有一个参数,但您使用

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

它通过了 2 个参数。

于 2017-01-11T10:09:24.827 回答