Hi Richard,
Yes, it is a bug. Thanks for reporting. There is a null byte \0 that
should be written at the end position and it is not. The null terminator
is not strictly needed, but is handy because then you get a C string
and strlen() and others can work.
I'm fixing the code. A temporary solution would be to add the
null byte outside the function, as it is guaranteed there it will be there
anyway
ret = cmsIT8SaveToMem (it8, data, (cmsUInt32Number *) &size);
if (ret) {
data[size-1] = 0;
}
Thanks!
Marti Maria
Richard Hughes <[email protected]> escribió:
> Hey all,
>
> I'm trying to use cmsIT8SaveToMem to save a ti3 profile. I'm doing
> something like this:
>
> /* write the file */
> ret = cmsIT8SaveToMem (it8, NULL, (cmsUInt32Number *) &size);
> g_assert (ret);
> data = g_malloc (size);
> ret = cmsIT8SaveToMem (it8, data, (cmsUInt32Number *) &size);
> g_assert (ret);
>
> /* save file */
> ret = g_file_replace_contents (file, data, size, NULL,
> FALSE, G_FILE_CREATE_NONE,
> NULL, NULL, error);
> if (!ret)
> goto out;
>
> And I'm getting a file with this output:
>
> CTI3
> DESCRIPTOR "Calibration Target chart information 3"
> ORIGINATOR "cd-self-test"
> DEVICE_CLASS "DISPLAY"
> COLOR_REP "RGB_XYZ"
> TARGET_INSTRUMENT "huey"
> NUMBER_OF_FIELDS 7
> NUMBER_OF_SETS 1
> BEGIN_DATA_FORMAT
> SAMPLE_ID RGB_R RGB_G RGB_B XYZ_X XYZ_Y XYZ_Z
> END_DATA_FORMAT
> BEGIN_DATA
> 1 0 0 0 0 0 0
> END_DATA
> T
>
> Notice the 'T' on the last line? This makes any ti3 file then loaded
> spit out a "Property data expected" warning. Ideas welcome, thanks!
>
> Richard.
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Lcms-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/lcms-user
>
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Lcms-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lcms-user