Fix compilation errors when using gcc-7.2.0 for the crosstool-ng toolchain

* Change snprintf for strlcat does not complain w/gcc7.2.0 and it is safer, thanks @projectgus
* Use proper quotes for character literals

Merges https://github.com/espressif/esp-idf/pull/1163
pull/1469/head
Roman Valls Guimera 2017-10-25 23:23:42 +02:00 zatwierdzone przez Ivan Grokhotkov
rodzic a4d45a0a4d
commit 36d6e4e2c7
3 zmienionych plików z 5 dodań i 4 usunięć

Wyświetl plik

@ -270,7 +270,7 @@ extern char *suboptarg; /* getsubopt(3) external variable */
*/
#ifndef lint
static const char rcsid[]="$Id: getopt_long.c,v 1.1 2009/10/16 19:50:28 rodney Exp rodney $";
//static const char rcsid[]="$Id: getopt_long.c,v 1.1 2009/10/16 19:50:28 rodney Exp rodney $";
#endif /* lint */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.

Wyświetl plik

@ -569,7 +569,8 @@ static const uint8_t * _mdns_read_fqdn(const uint8_t * packet, const uint8_t * s
&& (strcmp(buf, MDNS_DEFAULT_DOMAIN) != 0)
&& (strcmp(buf, "ip6") != 0)
&& (strcmp(buf, "in-addr") != 0)) {
snprintf((char*)name, MDNS_NAME_BUF_LEN, "%s.%s", name->host, buf);
strlcat(name->host, ".", sizeof(name->host));
strlcat(name->host, buf, sizeof(name->host));
} else if (strcmp(buf, MDNS_SUB_STR) == 0) {
name->sub = 1;
} else {

Wyświetl plik

@ -62,7 +62,7 @@ void HashList::insert(const Item& item, size_t index)
void HashList::erase(size_t index)
{
for (auto it = std::begin(mBlockList); it != std::end(mBlockList);) {
for (auto it = mBlockList.begin(); it != mBlockList.end();) {
bool haveEntries = false;
for (size_t i = 0; i < it->mCount; ++i) {
if (it->mNodes[i].mIndex == index) {
@ -88,7 +88,7 @@ void HashList::erase(size_t index)
size_t HashList::find(size_t start, const Item& item)
{
const uint32_t hash_24 = item.calculateCrc32WithoutValue() & 0xffffff;
for (auto it = std::begin(mBlockList); it != std::end(mBlockList); ++it) {
for (auto it = mBlockList.begin(); it != mBlockList.end(); ++it) {
for (size_t index = 0; index < it->mCount; ++index) {
HashListNode& e = it->mNodes[index];
if (e.mIndex >= start &&