Fixed strncpy() warnings
Changed strncpy() to strcpy() when copying new string values
This commit is contained in:
parent
f07fa4e9c7
commit
26c15c9ca2
|
|
@ -44,19 +44,21 @@ struct HKTV : Service::Television {
|
||||||
active = new Characteristic::Active();
|
active = new Characteristic::Active();
|
||||||
activeIdentifier = new Characteristic::ActiveIdentifier(0);
|
activeIdentifier = new Characteristic::ActiveIdentifier(0);
|
||||||
new Characteristic::ConfiguredName("My TV");
|
new Characteristic::ConfiguredName("My TV");
|
||||||
// new Characteristic::PowerModeSelection(); // write-only Characteristic that enables "View TV Settings" on controls screen
|
new Characteristic::PowerModeSelection(); // write-only Characteristic that enables "View TV Settings" on controls screen
|
||||||
new Characteristic::PictureMode(1);
|
new Characteristic::PictureMode(1);
|
||||||
new Characteristic::ClosedCaptions();
|
new Characteristic::ClosedCaptions();
|
||||||
new Characteristic::Brightness(50);
|
new Characteristic::Brightness(50);
|
||||||
new Characteristic::CurrentMediaState(1);
|
new Characteristic::CurrentMediaState(1);
|
||||||
|
new Characteristic::TargetMediaState(1);
|
||||||
new Characteristic::RemoteKey();
|
new Characteristic::RemoteKey();
|
||||||
|
new Characteristic::SleepDiscoveryMode(1);
|
||||||
|
|
||||||
speaker = new Service::TelevisionSpeaker();
|
speaker = new Service::TelevisionSpeaker();
|
||||||
mute = new Characteristic::Mute();
|
mute = new Characteristic::Mute();
|
||||||
speakerActive = new Characteristic::Active(1);
|
speakerActive = new Characteristic::Active(1);
|
||||||
volume = new Characteristic::Volume();
|
volume = new Characteristic::Volume();
|
||||||
new Characteristic::VolumeControlType(3);
|
new Characteristic::VolumeControlType(1);
|
||||||
new Characteristic::VolumeSelector();
|
new Characteristic::VolumeSelector(1);
|
||||||
|
|
||||||
hdmi1 = new Service::InputSource();
|
hdmi1 = new Service::InputSource();
|
||||||
new Characteristic::ConfiguredName("HDMI 1");
|
new Characteristic::ConfiguredName("HDMI 1");
|
||||||
|
|
@ -82,6 +84,7 @@ struct HKTV : Service::Television {
|
||||||
addLink(hdmi1);
|
addLink(hdmi1);
|
||||||
addLink(hdmi2);
|
addLink(hdmi2);
|
||||||
addLink(netflix);
|
addLink(netflix);
|
||||||
|
addLink(speaker);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean update(){
|
boolean update(){
|
||||||
|
|
@ -117,9 +120,17 @@ void setup() {
|
||||||
new Characteristic::Identify();
|
new Characteristic::Identify();
|
||||||
|
|
||||||
new Service::HAPProtocolInformation();
|
new Service::HAPProtocolInformation();
|
||||||
new Characteristic::Version("1.1.0");
|
new Characteristic::Version("1.1.0");
|
||||||
|
|
||||||
new HKTV();
|
new HKTV();
|
||||||
|
|
||||||
|
new Service::Speaker();
|
||||||
|
new Characteristic::Mute();
|
||||||
|
// new Characteristic::Active(1);
|
||||||
|
new Characteristic::Volume();
|
||||||
|
// new Characteristic::VolumeControlType(1);
|
||||||
|
// new Characteristic::VolumeSelector(1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|
|
||||||
|
|
@ -1729,9 +1729,7 @@ StatusCode SpanCharacteristic::loadUpdate(char *val, char *ev){
|
||||||
|
|
||||||
case STRING:
|
case STRING:
|
||||||
newValue.STRING = (char *)realloc(newValue.STRING, strlen(val) + 1);
|
newValue.STRING = (char *)realloc(newValue.STRING, strlen(val) + 1);
|
||||||
strncpy(newValue.STRING, val, strlen(val));
|
strcpy(newValue.STRING, val);
|
||||||
newValue.STRING[strlen(val)] = '\0';
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -309,8 +309,7 @@ struct SpanCharacteristic{
|
||||||
|
|
||||||
void uvSet(UVal &u, const char *val){
|
void uvSet(UVal &u, const char *val){
|
||||||
u.STRING = (char *)realloc(u.STRING, strlen(val) + 1);
|
u.STRING = (char *)realloc(u.STRING, strlen(val) + 1);
|
||||||
strncpy(u.STRING, val, strlen(val));
|
strcpy(u.STRING, val);
|
||||||
u.STRING[strlen(val)] = '\0';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *getString(){
|
char *getString(){
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue