mapi32: Write-strings warnings fix

Andrew Talbot Andrew.Talbot at talbotville.com
Sat Jun 3 14:26:49 CDT 2006


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.000000000 +0100
>> +++ b/dlls/mapi32/sendmail.c 2006-06-03 14:44:21.000000000 +0100
>> @@ -113,8 +113,8 @@
>>      }
>>      if (message->nFileCount) FIXME("Ignoring attachments\n");
>>  
>> -    subject = message->lpszSubject ? message->lpszSubject : "";
>> -    body = message->lpszNoteText ? message->lpszNoteText : "";
>> +    subject = message->lpszSubject ? message->lpszSubject : NULL;
>> +    body = message->lpszNoteText ? message->lpszNoteText : NULL;
> I think this is wrong, as it makes the whole "? :" construct unnecessary.
> (for non NULL it evaluates to "message->lpszNoteText" and for NULL it
> becomes NULL;
>> 
> Greetings Peter

Hi Peter,

I believe you are right! I started by trying to prevent the assignment of an
empty string constant to a non-const pointer to char, looked up the
MapiMessage struc specification and noted that an unsupplied value of
lpszSubject or lpszNoteText could otherwise be represented by NULL, saving
me a small amount of work. But I failed to observe that the constructs then
simplify to

    subject = message->lpszSubject;
    body = message->lpszNoteText;

I shall submit an amended version of the patch, accordingly. Well-spotted
and thanks!

-- Andy.





More information about the wine-devel mailing list