VirtualBox

Changeset 2646 in kBuild for trunk/src


Ignore:
Timestamp:
Sep 9, 2012 2:30:17 AM (12 years ago)
Author:
bird
Message:

kmk_printf: Don't use 'j' as a size specifier to sprintf on windows.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/kmkbuiltin/printf.c

    r2591 r2646  
    638638        size_t len;
    639639
    640         len = strlen(str) + 2;
    641         if (len > sizeof copy) {
     640        len = strlen(str) - 1;
     641        if (len > sizeof(copy) - 5) {
    642642                warnx("format %s too complex\n", str);
    643643                len = 4;
    644644        }
    645         (void)memmove(copy, str, len - 3);
    646         copy[len - 3] = 'j';
    647         copy[len - 2] = ch;
    648         copy[len - 1] = '\0';
     645        (void)memmove(copy, str, len);
     646#ifndef _MSC_VER
     647        copy[len++] = 'j';
     648#else
     649        copy[len++] = 'I';
     650        copy[len++] = '6';
     651        copy[len++] = '4';
     652#endif
     653        copy[len++] = ch;
     654        copy[len] = '\0';
    649655        return copy;
    650656}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette