0 Replies Latest reply on Jan 25, 2017 2:34 PM by msdobrescu

    PIProperty proper handling?

    msdobrescu Level 1



      I've seen this:


      /** Plug-in property. Properties contain information about

          plug-in resource files, such as their type and location. */

      typedef struct PIProperty {

          /** Vendor-specific identifier. */

          PIType vendorID;

          /** Identification key for this resource type. */

          PIType propertyKey;

          /** 0-based index of this resource within its type.

               Must be unique for properties of a given type within

               a property list. */

          ai::int32 propertyID;

          /** Number of characters in the data array. Rounded to a multiple of 4. */

          ai::int32 propertyLength;

          /** The property data array that contains the property value, a string of 4 characters. */

          char propertyData[1];

      } PIProperty;


      where "char propertyData[1];" should contain more than 1 char.


      How is a correct memory handling for it? I assume it will contain a long string when it is used as [out] parameter.

      How to avoid memory leaks?


      How sould be initialized correctly when it is used as [in] parameter?


      Thank you.