Skip to content
This repository has been archived by the owner on Jul 8, 2022. It is now read-only.

Commit

Permalink
Attribute: Don't treat an integer as an char* (#403)
Browse files Browse the repository at this point in the history
Currently the compiler outputs

attrgetsetprop.cpp: In member function ‘void Tango::Attribute::get_properties(Tango::AttributeConfig_3&)’:
attrgetsetprop.cpp:200:91: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   conf.event_prop.per_event.period = CORBA::string_dup((const char *)(DEFAULT_EVENT_PERIOD));

and that is justified as DEFAULT_EVENT_PERIOD is an integer.

Using the plain output operator into the stream is the preferred way.
  • Loading branch information
t-b authored and Ingvord committed Oct 24, 2017
1 parent 58e4f9c commit c1be198
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/server/attrgetsetprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,16 @@ void Attribute::get_properties(Tango::AttributeConfig_3 &conf)
str.precision(TANGO_FLOAT_PRECISION);

if (event_period == INT_MAX)
conf.event_prop.per_event.period = Tango::string_dup((const char *)(DEFAULT_EVENT_PERIOD));
{
str << DEFAULT_EVENT_PERIOD;
}
else
{
str << event_period;
MEM_STREAM_2_CORBA(conf.event_prop.per_event.period,str);
}

MEM_STREAM_2_CORBA(conf.event_prop.per_event.period,str);

//
// Copy change event properties
//
Expand Down

0 comments on commit c1be198

Please sign in to comment.