Changeset 5498


Ignore:
Timestamp:
Dec 3, 2010 11:42:31 AM (4 years ago)
Author:
tboeckel
Message:
  • YAM_MAf.c: reverted the index save optimization as snprintf() might return larger numbers than the amount of character actually used.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r5497 r5498  
    66$URL$ 
    77 
     82010-12-03 Thore Böckelmann <tboeckel@gmx.de> 
     9 
     10  * YAM_MAf.c: reverted the index save optimization as snprintf() might return 
     11    larger numbers than the amount of character actually used. 
     12 
    8132010-12-02  Alexandre Balaban <abalaban@free.fr> 
     14 
    915  * locale/french.ct: updated according to latest changes. 
    1016 
  • trunk/src/YAM_MAf.c

    r5489 r5498  
    454454      char buf[SIZE_LARGE]; 
    455455 
     456      snprintf(buf, sizeof(buf), "%s\n%s\n%s\n%s\n%s\n%s\n%s\n", 
     457                                 mail->Subject, 
     458                                 mail->From.Address, mail->From.RealName, 
     459                                 mail->To.Address, mail->To.RealName, 
     460                                 mail->ReplyTo.Address, mail->ReplyTo.RealName); 
     461 
    456462      strlcpy(cmail.mailFile, mail->MailFile, sizeof(cmail.mailFile)); 
    457463      cmail.date = mail->Date; 
     
    464470      cmail.cIRTMsgID = mail->cIRTMsgID; 
    465471      cmail.size = mail->Size; 
    466       // snprintf() returns the number of bytes used, this saves an additional strlen() call 
    467       cmail.moreBytes = snprintf(buf, sizeof(buf), "%s\n%s\n%s\n%s\n%s\n%s\n%s\n", 
    468                                                    mail->Subject, 
    469                                                    mail->From.Address, mail->From.RealName, 
    470                                                    mail->To.Address, mail->To.RealName, 
    471                                                    mail->ReplyTo.Address, mail->ReplyTo.RealName); 
     472      cmail.moreBytes = strlen(buf); 
    472473 
    473474      fwrite(&cmail, sizeof(struct ComprMail), 1, fh); 
Note: See TracChangeset for help on using the changeset viewer.