Android 传递'的参数2时出错;加密压缩设置&x27;丢弃';常数';来自指针目标类型的限定符
我尝试用gcc 5.2编译android内核,并修复了所有错误,除了以下错误: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
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中的常量丢失了。非常感谢。