Le 23/03/2011 16:29, Ludovic Rousseau a écrit :
Hello,
I get this:
pkcs15-iasecc.c: In function ‘iasecc_file_convert_acls’:
pkcs15-iasecc.c:312: warning: initialization discards qualifiers from
pointer target type
The problem is the line:
struct sc_acl_entry *acl = sc_file_get_acl_entry(file, ii);
If I change it to:
const struct sc_acl_entry *acl = sc_file_get_acl_entry(file,
ii);
I then get errors:
pkcs15-iasecc.c: In function ‘iasecc_file_convert_acls’:
pkcs15-iasecc.c:320: error: assignment of read-only location
pkcs15-iasecc.c:321: error: assignment of read-only location
pkcs15-iasecc.c:324: error: assignment of read-only location
pkcs15-iasecc.c:325: error: assignment of read-only location
This is because the iasecc_file_convert_acls() function _does_ change
the (const) structure returned by sc_file_get_acl_entry().
Complete function:
...
I don't know what is the proper way to fix this.
Remove 'cost' qualifier from the function prototype, like in attachment ?
By
Kind wishes,
Viktor.
--
Viktor Tarasov <viktor.tara...@opentrust.com>
Index: src/libopensc/sc.c
===================================================================
--- src/libopensc/sc.c (révision 5268)
+++ src/libopensc/sc.c (copie de travail)
@@ -398,17 +398,17 @@
return 0;
}
-const sc_acl_entry_t * sc_file_get_acl_entry(const sc_file_t *file,
+sc_acl_entry_t * sc_file_get_acl_entry(const sc_file_t *file,
unsigned int operation)
{
sc_acl_entry_t *p;
- static const sc_acl_entry_t e_never = {
+ static sc_acl_entry_t e_never = {
SC_AC_NEVER, SC_AC_KEY_REF_NONE, {{0, 0, 0, {0}}}, NULL
};
- static const sc_acl_entry_t e_none = {
+ static sc_acl_entry_t e_none = {
SC_AC_NONE, SC_AC_KEY_REF_NONE, {{0, 0, 0, {0}}}, NULL
};
- static const sc_acl_entry_t e_unknown = {
+ static sc_acl_entry_t e_unknown = {
SC_AC_UNKNOWN, SC_AC_KEY_REF_NONE, {{0, 0, 0, {0}}}, NULL
};
Index: src/libopensc/opensc.h
===================================================================
--- src/libopensc/opensc.h (révision 5268)
+++ src/libopensc/opensc.h (copie de travail)
@@ -1034,7 +1034,7 @@
int sc_file_add_acl_entry(sc_file_t *file, unsigned int operation,
unsigned int method, unsigned long key_ref);
-const struct sc_acl_entry * sc_file_get_acl_entry(const sc_file_t *file,
+struct sc_acl_entry * sc_file_get_acl_entry(const sc_file_t *file,
unsigned int operation);
void sc_file_clear_acl_entries(sc_file_t *file, unsigned int operation);
_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel