Uploaded image for project: 'Traffic Server'
  1. Traffic Server
  2. TS-4828

gcc warning comparison between signed and unsigned integer expressions

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 7.0.0
    • Build
    • None

    Description

      Warnings when enabling -Wextra:

      stats_over_http.c:137:62: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
             if (snprintf(b, sizeof(b), "\"%s\": " fmt ",\n", a, v) < sizeof(b)) {     \
      --
      stats_over_http.c:141:66: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
             if (snprintf(b, sizeof(b), "\"%s\": \"" fmt "\",\n", a, v) < sizeof(b)) { \
      --
      stats_over_http.c:137:62: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
             if (snprintf(b, sizeof(b), "\"%s\": " fmt ",\n", a, v) < sizeof(b)) {     \
      --
      stats_over_http.c:141:66: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
             if (snprintf(b, sizeof(b), "\"%s\": \"" fmt "\",\n", a, v) < sizeof(b)) { \
      --
      stats_over_http.c:137:62: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
             if (snprintf(b, sizeof(b), "\"%s\": " fmt ",\n", a, v) < sizeof(b)) {     \
      --
      stats_over_http.c:141:66: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
             if (snprintf(b, sizeof(b), "\"%s\": \"" fmt "\",\n", a, v) < sizeof(b)) { \
      --
      stats_over_http.c:130:64: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
           if (snprintf(b, sizeof(b), "\"%s\": \"" fmt "\",\n", a, v) < sizeof(b)) \
      --
      acme.c:267:27: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
           if (!path || path_len < (strlen(ACME_WK_PATH) + 2) || *path != '.' || memcmp(path, ACME_WK_PATH, strlen(ACME_WK_PATH))) {
      --
      remap_purge.c:149:57: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
           TSHttpTxnErrorBodySet(txnp, TSstrdup(response), len >= sizeof(response) ? sizeof(response) - 1 : len, NULL);
      --
      remap_purge.c:149:100: error: signed and unsigned type in conditional expression [-Werror=sign-compare]
           TSHttpTxnErrorBodySet(txnp, TSstrdup(response), len >= sizeof(response) ? sizeof(response) - 1 : len, NULL);
      --
      ts_lua_fetch.c:327:21: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
               if (key_len == TS_MIME_LEN_CONTENT_LENGTH && !strncasecmp(TS_MIME_FIELD_CONTENT_LENGTH, key, key_len)) { // Content-Length
      --
      ts_lua_fetch.c:330:28: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
               } else if (key_len == TS_MIME_LEN_HOST && !strncasecmp(TS_MIME_FIELD_HOST, key, key_len)) { // Host
      --
      ts_lua_fetch.c:333:28: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
               } else if (key_len == TS_MIME_LEN_USER_AGENT && !strncasecmp(TS_MIME_FIELD_USER_AGENT, key, key_len)) { // User-Agent
      --
      url_sig.c:522:17: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
         for (i = 0; i < sig_len; i++) {
      --
      http_load/http_load.c:1182:25: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
             for (i     = 0; i < sizeof(bytes); ++i)
      

      Attachments

        Issue Links

          Activity

            People

              bcall Bryan Call
              bcall Bryan Call
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 50m
                  50m