From: szy Date: Mon, 10 Jun 2019 09:59:39 +0000 (+0300) Subject: 0030772: Data Exchange - Invalid person's name constructed by STEPConstruct_AP203Cont... X-Git-Tag: V7_4_0_beta~119 X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=61aef3ce0551b672f9ed471b02cc47d1d4deb32f;p=occt.git 0030772: Data Exchange - Invalid person's name constructed by STEPConstruct_AP203Context class. // fixed remarks. --- diff --git a/src/STEPConstruct/STEPConstruct_AP203Context.cxx b/src/STEPConstruct/STEPConstruct_AP203Context.cxx index 54e2ca9066..a5cae628cd 100644 --- a/src/STEPConstruct/STEPConstruct_AP203Context.cxx +++ b/src/STEPConstruct/STEPConstruct_AP203Context.cxx @@ -179,15 +179,14 @@ Handle(StepBasic_PersonAndOrganization) STEPConstruct_AP203Context::DefaultPerso // construct person`s name OSD_Process sys; - Standard_CString usr = sys.UserName().ToCString(); -#if !defined(_WIN32) && !defined(__ANDROID__) - if ( usr ) { - struct passwd *pwd = getpwnam ( usr ); - if ( pwd ) usr = pwd->pw_gecos; + TCollection_AsciiString user (sys.UserName()); +#if !defined(_WIN32) && !defined(__ANDROID__) + if ( !user.IsEmpty() ) { + struct passwd *pwd = getpwnam ( user.ToCString() ); + if ( pwd ) user = pwd->pw_gecos; } - else usr = "Unknown"; + else user = "Unknown"; #endif - TCollection_AsciiString user ( usr ); Handle(TCollection_HAsciiString) fname = new TCollection_HAsciiString (""); Handle(TCollection_HAsciiString) lname = new TCollection_HAsciiString (""); Handle(Interface_HArray1OfHAsciiString) mname;