I shall constify subject and body.
BTW, the initialisation of address in MAPISendMail() is also a write-strings
violation. But it appears that it is redirected before any use. So I
shall remove its initialisation, too.
Thanks,
-- Andy.
Andrew Talbot <[EMAIL PROTECTED]> writes:
> Alexandre Julliard wrote:
>
>> These are not part of a Win32 API structure, there's no reason they
>> can't be made const.
>>
> Great. I shall submit a patch to declare all the string elements of
> Wine's MapiMessage type as LPCSTR.
No, MapiMessage is
Alexandre Julliard wrote:
> Andrew Talbot <[EMAIL PROTECTED]> writes:
>
>> @@ -113,8 +114,8 @@
>> }
>> if (message->nFileCount) FIXME("Ignoring attachments\n");
>>
>> -subject = message->lpszSubject ? message->lpszSubject : "";
>> -body = message->lpszNoteText ? message->lpszN
Andrew Talbot <[EMAIL PROTECTED]> writes:
> @@ -113,8 +114,8 @@
> }
> if (message->nFileCount) FIXME("Ignoring attachments\n");
>
> -subject = message->lpszSubject ? message->lpszSubject : "";
> -body = message->lpszNoteText ? message->lpszNoteText : "";
> +subject = messag
Hans Leidekker wrote:
>
> Don't be sorry. I like your persistence.
And I appreciate your kindness, thank you.
> I see what you mean now, yes address doesn't have to be initialised,
> there's no way it could be used uninitialised in this code.
>
> -Hans
I shall let the dust settle, then probab
On Sunday 04 June 2006 11:45, Andrew Talbot wrote:
> I am sorry to make such a meal of this
Don't be sorry. I like your persistence.
> What I am saying is, because of all the checking code which follows, can we
> be confident that every message->lpRecips[i].lpszAddress must have gained a
> value
>>
>> would it be safe to omit the initialization of "address"?
>
> Yes, but it shortens the lines below and improves readability of
> the code.
>
> -Hans
I am sorry to make such a meal of this, but - in addition to the
write-strings issue - I noticed that the original code initialized
"address
On Sunday 04 June 2006 00:27, Andrew Talbot wrote:
> address = message->lpRecips[i].lpszAddress;
> if (address)
> {
>
> would it be safe to omit the initialization of "address"?
Yes, but it shortens the lines below and improves readability of
the code.
-Hans
Hans Leidekker wrote:
> [...] How about this patch?
>
> -char *address = "", *to = NULL, *cc = NULL, *bcc = NULL, *subject,
> *body;
> +char *to = NULL, *cc = NULL, *bcc = NULL;
> +const char *subject, *body, *address = "";
>
> -Hans
Because of the testing:
if (!message) retur
Hans Leidekker wrote:
>
> I see no warnings with -Wwrite-strings and -Wcast-qual.
>
> -Hans
Hans,
Yes, you are right. Of course, the values are being taken from the SDK
elements, not being assigned to them, so the local variable can and should
be constified.
-- Andy.
On Saturday 03 June 2006 22:06, Andrew Talbot wrote:
> The problem is that the SDK defines the strings as non-const, so making
> subject and body const char * would cause a qual-cast violation.
I see no warnings with -Wwrite-strings and -Wcast-qual.
-Hans
Actually, sorry, my earlier statement was rubbish. But the point of the
Write-strings warning is to flag the discarding of a qualifer. Thus
char *s = "string"; /* bad */
discards the effective const factor of the string constant. So I can't
assign const char * values to char * variables.
--
Option 2 is the way to go.
-- A.
Hans Leidekker wrote:
> That won't do either because these pointers are dereferenced a few lines
> further down. How about this patch?
>
> -char *address = "", *to = NULL, *cc = NULL, *bcc = NULL, *subject,
> *body;
> +char *to = NULL, *cc = NULL, *bcc = NULL;
> +const char *subject,
On Saturday 03 June 2006 21:26, Andrew Talbot wrote:
> subject = message->lpszSubject;
> body = message->lpszNoteText;
That won't do either because these pointers are dereferenced a few lines
further down. How about this patch?
-char *address = "", *to = NULL, *cc = NULL, *bcc = NUL
Peter Oberndorfer wrote:
> On Saturday 03 June 2006 16:33, Andrew Talbot wrote:
>> Changelog:
>> mapi32: Write-strings warnings fix.
>>
>> diff -urN a/dlls/mapi32/sendmail.c b/dlls/mapi32/sendmail.c
>> --- a/dlls/mapi32/sendmail.c 2006-05-23 17:24:40.000
On Saturday 03 June 2006 16:33, Andrew Talbot wrote:
> Changelog:
> mapi32: Write-strings warnings fix.
>
> diff -urN a/dlls/mapi32/sendmail.c b/dlls/mapi32/sendmail.c
> --- a/dlls/mapi32/sendmail.c 2006-05-23 17:24:40.0 +0100
> +++ b/dlls/mapi32/sendmail.c
17 matches
Mail list logo