[Kde-pim] Review Request: vobject.c:755: warning: initialization discards ... AND vobject.c:922: warning: return discards ...

Guy Maurel guy-kde at maurel.de
Mon Nov 16 16:37:10 GMT 2009


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/2189/
-----------------------------------------------------------

Review request for KDE PIM.


Summary
-------

The dashboard
  http://dashboard.akonadi-project.org/CDash/index.php?project=
reports:
/.../kdepimlibs/kcal/versit/vobject.c:755: warning: initialization discards qualifiers from pointer target type
/.../kdepimlibs/kcal/versit/vobject.c:757: warning: initialization discards qualifiers from pointer target type
/.../kdepimlibs/kcal/versit/vobject.c:789: warning: initialization discards qualifiers from pointer target type
/.../kdepimlibs/kcal/versit/vobject.c:831: warning: initialization discards qualifiers from pointer target type
/.../kdepimlibs/kcal/versit/vobject.c:840: warning: initialization discards qualifiers from pointer target type
/.../kdepimlibs/kcal/versit/vobject.c:844: warning: initialization discards qualifiers from pointer target type
/.../kdepimlibs/kcal/versit/vobject.c:850: warning: initialization discards qualifiers from pointer target type

at
static const struct PreDefProp propNames[] = {

AND
/.../kdepimlibs/kcal/versit/vobject.c:922: warning: return discards qualifiers from pointer target type

at
lookupPropInfo

The two problems have to be consider together.

my proposal:
The c-code includes the "vobject.h" file. At line 384, one found:
  extern const char** fieldedProp;

One must use the same pointer-pointer declaration else where.
One·have to change a few times the line:
  static const char * const <declarator>[] = {
to:
  static const char * <declarator>[] = {
to get a clean initialization.

At the function "lookupPropInfo", one only needs the index in the array propNames[].
As the use of it is only local to the scope of this file, it is easy to access the array
at the functions "writeAttrValue", "writeProp" and "writeVObject_".

The if:
  if (pi && ((pi->flags & PD_BEGIN) != 0))
can be change to:
  if( i != INDEX_NOT_FOUND) {
    pi= propNames[i];
    if ((pi.flags & PD_INTERNAL) != 0)
what is type compatible and easy to read.

see: vobject-gm-72.diff


Diffs
-----

  /trunk/KDE/kdepimlibs/kcal/versit/vobject.c 1050091 

Diff: http://reviewboard.kde.org/r/2189/diff


Testing
-------


Thanks,

Guy

_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/


More information about the kde-pim mailing list