OSGeo / libgeotiff

Official repository of the libgeotiff project
182 stars 70 forks source link

geo_names.c: Silence warning in GetNameFromDatabase #17

Closed Algunenano closed 5 years ago

Algunenano commented 5 years ago

Comes from https://github.com/OSGeo/gdal/pull/1409/commits/1982bde2f3c7b17960e285be8614a05a89610f97#r270982654.

This is to address a false positive warning from GCC 8:

   In function ‘GetNameFromDatabase.isra.1.constprop’,
        inlined from ‘GTIFValueNameEx’ at geo_names.c:212:21:
    geo_names.c:130:13: warning: ‘strncpy’ specified bound 120 equals destination size [-Wstringop-truncation]
                 strncpy(pszOut, pszName, nOutSize);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    In function ‘GetNameFromDatabase.isra.1.constprop’,
        inlined from ‘GTIFValueNameEx’ at geo_names.c:193:21:
    geo_names.c:130:13: warning: ‘strncpy’ specified bound 120 equals destination size [-Wstringop-truncation]
                 strncpy(pszOut, pszName, nOutSize);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    In function ‘GetNameFromDatabase.isra.1.constprop’,
        inlined from ‘GTIFValueNameEx’ at geo_names.c:198:21:
    geo_names.c:130:13: warning: ‘strncpy’ specified bound 120 equals destination size [-Wstringop-truncation]
                 strncpy(pszOut, pszName, nOutSize);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    In function ‘GetNameFromDatabase.isra.1.constprop’,
        inlined from ‘GTIFValueNameEx’ at geo_names.c:188:21:
    geo_names.c:130:13: warning: ‘strncpy’ specified bound 120 equals destination size [-Wstringop-truncation]
                 strncpy(pszOut, pszName, nOutSize);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    In function ‘GetNameFromDatabase.isra.1.constprop’,
        inlined from ‘GTIFValueNameEx’ at geo_names.c:206:21:
    geo_names.c:130:13: warning: ‘strncpy’ specified bound 120 equals destination size [-Wstringop-truncation]
                 strncpy(pszOut, pszName, nOutSize);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~