3 Commits

Author SHA1 Message Date
cedricAbonnel
7a0a67a396 Update LibTeleinfo.cpp
error: ‘strlcpy’ was not declared in this scope and ist not a standard C function.
You might like to use strncpy.
2020-08-27 20:54:55 +02:00
Charles
8bdba6f2a5 Fix buffer size 2020-06-14 21:39:37 +02:00
Charles
4e2a5b603d Bump to 1.1.2 2020-06-14 21:39:03 +02:00
3 changed files with 6 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "LibTeleinfo",
"version": "1.1.1",
"version": "1.1.2",
"keywords": "teleinfo, french, meter, power, erdf, linky, tic",
"description": "Decoder for Teleinfo (aka TIC) from French smart power meters",
"repository":

View File

@@ -1,5 +1,5 @@
name=LibTeleinfo
version=1.1.1
version=1.1.2
author=Charles-Henri Hallard <hallard.me>
maintainer=Charles-Henri Hallard <community.hallard.me>
sentence=Decoder for Teleinfo (aka TIC) from French smart power meters

View File

@@ -224,7 +224,7 @@ ValueList * TInfo::valueAdd(char * name, char * value, uint8_t checksum, uint8_t
// Do we have enought space to hold new value ?
if (strlen(me->value) >= lgvalue ) {
// Copy it
strlcpy(me->value, value , lgvalue + 1);
strncpy(me->value, value , lgvalue + 1);
me->checksum = checksum ;
// That's all
@@ -422,12 +422,12 @@ char * TInfo::valueGet(char * name, char * value)
me = me->next;
// Check if we match this LABEL
if (lgname==strlen(me->name) && strncmp(me->name, name, lgname)==0) {
if (lgname==strlen(me->name) && strcmp(me->name, name)==0) {
// this one has a value ?
if (me->value) {
// copy to dest buffer
uint8_t lgvalue = strlen(me->value);
strlcpy(value, me->value , lgvalue );
strncpy(value, me->value , lgvalue + 1 );
return ( value );
}
}
@@ -662,7 +662,7 @@ ValueList * TInfo::checkLine(char * pline)
return NULL;
// Get our own working copy
strlcpy( buff, _recv_buff, len+1);
strncpy( buff, pline, len+1);
p = &buff[0];
ptok = p; // for sure we start with token name