Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/221.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 传递'的参数2时出错;加密压缩设置&x27;丢弃';常数';来自指针目标类型的限定符_Android_C_Gcc_Linux Kernel_Gcc5.2 - Fatal编程技术网

Android 传递'的参数2时出错;加密压缩设置&x27;丢弃';常数';来自指针目标类型的限定符

Android 传递'的参数2时出错;加密压缩设置&x27;丢弃';常数';来自指针目标类型的限定符,android,c,gcc,linux-kernel,gcc5.2,Android,C,Gcc,Linux Kernel,Gcc5.2,我尝试用gcc 5.2编译android内核,并修复了所有错误,除了以下错误: crypto/testmgr.c:1112:36: warning: passing argument 2 of 'crypto_compress_setup' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] error, forbidden warning: testmgr.c:1112 代码如下: stat

我尝试用gcc 5.2编译android内核,并修复了所有错误,除了以下错误:

crypto/testmgr.c:1112:36: warning: passing argument 2 of 'crypto_compress_setup' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
error, forbidden warning: testmgr.c:1112
代码如下:

static int test_pcomp(struct crypto_pcomp *tfm,
                      struct pcomp_testvec *ctemplate,
                      struct pcomp_testvec *dtemplate, int ctcount,
                      int dtcount)
{
    const char *algo = crypto_tfm_alg_driver_name(crypto_pcomp_tfm(tfm));
    unsigned int i;
    char result[COMP_BUF_SIZE];
    int res;

    for (i = 0; i < ctcount; i++) {
        struct comp_request req;
        unsigned int produced = 0;

        res = crypto_compress_setup(tfm, ctemplate[i].params,
                        ctemplate[i].paramsize);
        if (res) {
            pr_err("alg: pcomp: compression setup failed on test "
                   "%d for %s: error=%d\n", i + 1, algo, res);
            return res;
static int test\u pcomp(结构加密\u pcomp*tfm,
结构pcomp_testvec*ctemplate,
结构pcomp_testvec*dtemplate,int ctcount,
整数(dtcount)
{
const char*algo=crypto_tfm_alg_driver_name(crypto_pcomp_tfm(tfm));
无符号整数i;
字符结果[COMP_BUF_SIZE];
国际关系;
对于(i=0;i
查看定义。如您所见,
.params
字段的类型为
const void*
。因此,应该进一步遵守此
const
限定符。但它看起来像
crypto\u compress\u setup()
在您的例子中,它的第二个参数不是常量。这就是编译器抛出该警告的原因。但这很奇怪,因为主线内核正确声明了这个参数:look(第99行)。所以我要检查内核中的
crypto\u compress\u setup()
。是的,compress.h中的常量丢失了。非常感谢。