Hi Vu,

I have changed the patch according to the comments.
I will push the patch after testing.
Best Regards,
Thanh

-----Original Message-----
From: Nguyen Minh Vu [mailto:vu.m.ngu...@dektech.com.au] 
Sent: Thursday, 22 August 2019 9:06 PM
To: Thanh Nguyen; gary....@dektech.com.au; thang.d.ngu...@dektech.com.au; 
minh.c...@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [PATCH 1/1] smf: Fix c-linkage errors [#3065]

+ Add Lennart to reviewers list

Those methods that are wrapped inside 'extern "C"' 
(/smf/smfd/SmfUtils.h) seem to be called from C++ source files only.

So, perhaps the simple fix for that is moving them out of 'extern "C"'.

Regards, Vu

On 8/20/19 8:12 AM, Thanh Nguyen wrote:
> Faults in C linkage for PBE area is fixed.
> ---
>   src/smf/smfd/SmfUpgradeCampaign.cc |  3 ++-
>   src/smf/smfd/SmfUtils.cc           | 14 ++++++++++++++
>   src/smf/smfd/SmfUtils.h            | 10 ++++++++--
>   3 files changed, 24 insertions(+), 3 deletions(-)
>
> diff --git a/src/smf/smfd/SmfUpgradeCampaign.cc 
> b/src/smf/smfd/SmfUpgradeCampaign.cc
> index 3c50bf7..4a1591a 100644
> --- a/src/smf/smfd/SmfUpgradeCampaign.cc
> +++ b/src/smf/smfd/SmfUpgradeCampaign.cc
> @@ -930,7 +930,8 @@ void SmfUpgradeCampaign::continueExec() {
>       if (o_result == true) {
>         LOG_NO("The campaign have been restarted to many times");
>         int cnt = smfd_cb->smfCampMaxRestart;
> -      std::string error = "To many campaign restarts, max " + cnt;
> +      std::string error = "To many campaign restarts, max "
> +          + std::to_string(cnt);
>         SmfCampaignThread::instance()->campaign()->setError(error);
>         changeState(SmfCampStateExecFailed::instance());
>         TRACE_LEAVE();
> diff --git a/src/smf/smfd/SmfUtils.cc b/src/smf/smfd/SmfUtils.cc
> index 882a3e6..0abb4b1 100644
> --- a/src/smf/smfd/SmfUtils.cc
> +++ b/src/smf/smfd/SmfUtils.cc
> @@ -1091,6 +1091,13 @@ std::string smf_valueToString(SaImmAttrValueT value, 
> SaImmValueTypeT type) {
>     return ost.str();
>   }
>   
> +char* smf_valueToString(char* buffer, SaImmAttrValueT value,
> +    SaImmValueTypeT type) {
> +  std::string tmp = smf_valueToString(value, type);
> +  memcpy(buffer, tmp.c_str(), tmp.length());
> +  return buffer;
> +}
> +
>   // 
> ------------------------------------------------------------------------------
>   // smf_opStringToInt()
>   // 
> ------------------------------------------------------------------------------
> @@ -1342,6 +1349,13 @@ const std::string smfStateToString(const uint32_t 
> &i_stateId,
>     }
>   }
>   
> +char* smfStateToString(char* buffer, const uint32_t &i_stateId,
> +                                   const uint32_t &i_state) {
> +  std::string tmp = smfStateToString(i_stateId, i_state);
> +  memcpy(buffer, tmp.c_str(), tmp.length());
> +  return buffer;
> +}
> +
>   bool compare_du_part(unitNameAndState &first, unitNameAndState &second) {
>     unsigned int i = 0;
>     while ((i < first.name.length()) && (i < second.name.length())) {
> diff --git a/src/smf/smfd/SmfUtils.h b/src/smf/smfd/SmfUtils.h
> index 894e3c9..394c000 100644
> --- a/src/smf/smfd/SmfUtils.h
> +++ b/src/smf/smfd/SmfUtils.h
> @@ -42,6 +42,12 @@
>   class SmfImmOperation;
>   class SmfRollbackCcb;
>   
> +extern std::string smf_valueToString(SaImmAttrValueT value,
> +                                     SaImmValueTypeT type);
> +extern const std::string smfStateToString(const uint32_t& i_stateId,
> +                                          const uint32_t& i_state);
> +
> +
>   /* ========================================================================
>    *   TYPE DEFINITIONS
>    * ========================================================================
> @@ -62,14 +68,14 @@ extern bool smf_stringsToValues(SaImmAttrValuesT_2* 
> i_attribute,
>                                   std::list<std::string>& i_values);
>   extern bool smf_stringToValue(SaImmValueTypeT i_type, SaImmAttrValueT* 
> i_value,
>                                 const char* i_str);
> -extern std::string smf_valueToString(SaImmAttrValueT value,
> +extern char* smf_valueToString(char* buffer, SaImmAttrValueT value,
>                                        SaImmValueTypeT type);
>   extern int smf_opStringToInt(const char* i_str);
>   extern int smf_system(std::string i_cmd);
>   extern void updateSaflog(const std::string& i_dn, const uint32_t& i_stateId,
>                            const uint32_t& i_newState,
>                            const uint32_t& i_oldState);
> -extern const std::string smfStateToString(const uint32_t& i_stateId,
> +extern char* smfStateToString(char* buffer, const uint32_t& i_stateId,
>                                             const uint32_t& i_state);
>   extern bool compare_du_part(unitNameAndState& first, unitNameAndState& 
> second);
>   extern bool unique_du_part(unitNameAndState& first, unitNameAndState& 
> second);




_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to