]> granicus.if.org Git - esp-idf/commitdiff
Fix compilation errors when using gcc-7.2.0 for the crosstool-ng toolchain
authorRoman Valls Guimera <brainstorm@nopcode.org>
Wed, 25 Oct 2017 21:23:42 +0000 (23:23 +0200)
committerAngus Gratton <gus@projectgus.com>
Sun, 3 Dec 2017 23:18:40 +0000 (10:18 +1100)
* 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

components/console/argtable3/argtable3.c
components/mdns/mdns.c
components/nvs_flash/src/nvs_item_hash_list.cpp

index f3772f1a9bada8cd7fe5a33bddb8da0b6c952d27..ed577c83aaa2c34a433248ad6dcb0fd7360e13e3 100644 (file)
@@ -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.
index c77283e071a2252bc6b6b5c0cf7e36a08e48286c..171da177c4fbceb615dcc3dea22947ae99971e0d 100644 (file)
@@ -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 {
index cf48477d61e354795b35a9961c885a8a49242d72..e483c5969789c93f8f2d96a0ead5bc6b2988de53 100644 (file)
@@ -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 &&