Menu

#1798 CIMCObjectPath addKey with CIMC_chars saves garbage

pending-wont-fix
sfcc (103)
5
2011-05-26
2009-12-26
Anonymous
No

This simple testcase does not work:

CIMCValue value;
op = ce->ft->newObjectPath(ce, "root/cimv2", NULL , &status);
value.chars = "hello";
op->ft->addKey(op, "keyname", &value, CIMC_chars);
data = op->ft->getKey(op, "keyname", &status);
if (!status.rc)
printf("error retrieving key\n");

printf("data type: %i\n", data.type);
printf("data: %s\n", data.value.string);
// or also printf("data: %s\n", data.value.string->ft->getCharPtr(data.value.string, NULL));

The returned data is of type 5632 (CIMC_string) as expected, but the value is garbage

The same testcase, creating a CIMCString with ce->ft->newString, adding the key, and retrieving it, works.

Discussion

  • Sean Swehla

    Sean Swehla - 2010-01-12

    If you change this line:

    op->ft->addKey(op, "keyname", &value, CIMC_chars);

    to:

    op->ft->addKey(op, "keyname", "hello" CIMC_chars);

    you should see the behavior you expect.

     
  • Chris Buccella

    Chris Buccella - 2011-05-26

    Existing SFCC programs are assuming usage described in smswehla's comment. Fixing this would break them, so leaving it as-is.

     
  • Chris Buccella

    Chris Buccella - 2011-05-26
    • status: open --> pending-wont-fix
     

Log in to post a comment.