这些错误是什么? (avro)

时间:2017-01-11 09:58:56

标签: c avro kaa

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

1 个答案:

答案 0 :(得分: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个参数。