@@ -518,10 +518,10 @@ _profile_getattr(CmsProfileObject* self, cmsInfoType field)
518518 buf ,
519519 256 );
520520 if (written ) {
521- return PyUnicode_DecodeFSDefault (buf );
521+ return PyUnicode_FromString (buf );
522522 }
523523 // UNDONE suppressing error here by sending back blank string.
524- return PyUnicode_DecodeFSDefault ("" );
524+ return PyUnicode_FromString ("" );
525525}
526526
527527static PyObject *
@@ -532,17 +532,18 @@ cms_profile_getattr_product_name(CmsProfileObject* self, void* closure)
532532 // was long, Just the model, in 1.x
533533 PyObject * model = _profile_getattr (self , cmsInfoModel );
534534 PyObject * manufacturer = _profile_getattr (self , cmsInfoManufacturer );
535+ PyObject * result ;
535536
536- if (!PyString_Size (model ) && !PyString_Size (manufacturer )){
537+ if (!PyUnicode_GetSize (model ) && !PyUnicode_GetSize (manufacturer )){
537538 return _profile_getattr (self , cmsInfoDescription );
538539 }
539- if (!PyString_Size (manufacturer ) || PyString_Size (model )> 30 ){
540+ if (!PyUnicode_GetSize (manufacturer ) || PyUnicode_GetSize (model )> 30 ){
540541 return model ;
541542 }
542- PyString_Concat ( & model ,
543- PyString_FromString (" - " ));
544- PyString_Concat ( & model ,_profile_getattr (self , cmsInfoManufacturer ));
545- return model ;
543+ result = PyUnicode_Concat ( model ,
544+ PyUnicode_FromString (" - " ));
545+ result = PyUnicode_Concat ( result ,_profile_getattr (self , cmsInfoManufacturer ));
546+ return result ;
546547}
547548
548549static PyObject *
@@ -553,9 +554,9 @@ cms_profile_getattr_product_desc(CmsProfileObject* self, void* closure)
553554}
554555
555556void _info_concat (PyObject * * ret , PyObject * elt ){
556- if (PyString_Size (elt )){
557- PyString_Concat ( ret , elt );
558- PyString_Concat ( ret , PyString_FromString ("\r\n\r\n" ));
557+ if (PyUnicode_GetSize (elt )){
558+ * ret = PyUnicode_Concat ( * ret , elt );
559+ * ret = PyUnicode_Concat ( * ret , PyUnicode_FromString ("\r\n\r\n" ));
559560 }
560561}
561562
@@ -565,7 +566,7 @@ cms_profile_getattr_product_info(CmsProfileObject* self, void* closure)
565566 // info was description \r\n\r\n copyright \r\n\r\n K007 tag \r\n\r\n whitepoint
566567 PyObject * description = _profile_getattr (self , cmsInfoDescription );
567568 PyObject * copyright = _profile_getattr (self , cmsInfoCopyright );
568- PyObject * ret = PyString_FromString ("" );
569+ PyObject * ret = PyUnicode_FromString ("" );
569570
570571 _info_concat (& ret , description );
571572 _info_concat (& ret , copyright );
@@ -580,7 +581,7 @@ cms_profile_getattr_product_info(CmsProfileObject* self, void* closure)
580581 if (cmsTempFromWhitePoint (& tempK , & xyyWhitePt )){
581582 char tempstr [10 ];
582583 snprintf (tempstr , 10 , "%5.0f" , tempK );
583- _info_concat (& ret , PyString_FromFormat ("White Point: %sK" , tempstr ));
584+ _info_concat (& ret , PyUnicode_FromFormat ("White Point: %sK" , tempstr ));
584585 }
585586 }
586587 return ret ;
0 commit comments