Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clang string-plus-int warning #3729

Conversation

@rikardfalkeborn
Copy link
Contributor

commented Apr 4, 2019

Clang 8 warns about adding a string to an int does not append to the
string. Indeed it doesn't, but that was not the intention either. Use
array indexing as suggested to silence the warning. There should be no
functional changes.

The full warning message was:

smtp.c:1221:29: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
      eob = strdup(SMTP_EOB + 2);
            ~~~~~~~~~~~~~~~~^~~~
../lib/memdebug.h:88:37: note: expanded from macro 'strdup'
#define strdup(ptr) curl_dbg_strdup(ptr, __LINE__, __FILE__)
                                    ^~~
smtp.c:1221:29: note: use array indexing to silence this warning
      eob = strdup(SMTP_EOB + 2);
                            ^
                   &        [
../lib/memdebug.h:88:37: note: expanded from macro 'strdup'
Clang 8 warns about adding a string to an int does not append to the
string. Indeed it doesn't, but that was not the intention either. Use
array indexing as suggested to silence the warning. There should be no
functional changes.

The full warning message was:

    smtp.c:1221:29: warning: adding 'int' to a string does not append to the string [-Wstring-plus-int]
          eob = strdup(SMTP_EOB + 2);
                ~~~~~~~~~~~~~~~~^~~~
    ../lib/memdebug.h:88:37: note: expanded from macro 'strdup'
    #define strdup(ptr) curl_dbg_strdup(ptr, __LINE__, __FILE__)
                                        ^~~
    smtp.c:1221:29: note: use array indexing to silence this warning
          eob = strdup(SMTP_EOB + 2);
                                ^
                       &        [
    ../lib/memdebug.h:88:37: note: expanded from macro 'strdup'
@jay jay closed this in f5a7747 Apr 5, 2019
@jay

This comment has been minimized.

Copy link
Member

commented Apr 5, 2019

Thanks

@rikardfalkeborn rikardfalkeborn deleted the rikardfalkeborn:string-plus-int-warning-clang8 branch Apr 5, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jul 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants
You can’t perform that action at this time.