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 three bugs found in issue 20 #22

Merged
merged 6 commits into from Oct 15, 2021

Commits on Oct 15, 2021

  1. Needs to copy the final null in DateTimeStrg()

    The output of DateTimeStrg() was missing a terminating null. This
    causes crashes when one tries to includes it later as part of
    "/* VTT %S compiler %S */".
    HinTak committed Oct 15, 2021
    Configuration menu
    Copy the full SHA
    f441575 View commit details
    Browse the repository at this point in the history
  2. Replace %li with %i in format specifier in TTEngine.cpp, to avoid imp…

    …licit casting to long
    
    This is a variation of the issue with 32-bit long on Windows. On 64-bit
    Linux, these %li causes casting to 64-bit types. A negative number
    becomes a large positive value, 4294967296 + number, and generates
    "Number too large to be parsed, larger than 32,767" errors, when used with
    the "-a compile everything" option.
    
    %li in other files than TTEngine.cpp applies to user messages, instead,
    and for now, left unchanged.
    
    Part of microsoft#20
    HinTak committed Oct 15, 2021
    Configuration menu
    Copy the full SHA
    da32770 View commit details
    Browse the repository at this point in the history
  3. Replace %s with WIDE_STR_FORMAT, so we can replace it with compiler-s…

    …pecific macros later.
    
    Done with:
        sed -i -e 's/L"%s"/WIDE_STR_FORMAT/' *.cpp
        sed -i -e 's/%s"/" WIDE_STR_FORMAT/g' *.cpp
        sed -i -e 's/L"%s/WIDE_STR_FORMAT L"/g' *.cpp
        sed -i -e 's/%s/" WIDE_STR_FORMAT L"/g' *.cpp
    
    Except one NARROW_STR_FORMAT.
    
    Conflicts:
    	src/TTFont.cpp
    	src/vttcompile.cpp
    HinTak committed Oct 15, 2021
    Configuration menu
    Copy the full SHA
    839249d View commit details
    Browse the repository at this point in the history
  4. Use different wide string format specifier, depending on the compiler…

    … used
    
    Reference:
    
    https://docs.microsoft.com/en-us/cpp/c-runtime-library/format-specification-syntax-printf-and-wprintf-functions?view=msvc-160
    
    "
    The arguments that follow the format string are interpreted according
    to the corresponding type character and the optional size
    prefix. Conversions for character types char and wchar_t are specified
    by using c or C, and single-byte and multi-byte or wide character
    strings are specified by using s or S, depending on which formatting
    function is being used. Character and string arguments that are
    specified by using c and s are interpreted as char and char* by printf
    family functions, or as wchar_t and wchar_t* by wprintf family
    functions. Character and string arguments that are specified by using
    C and S are interpreted as wchar_t and wchar_t* by printf family
    functions, or as char and char* by wprintf family functions. This
    behavior is Microsoft-specific.
    
    Microsoft-specific:
    The Z type character, and the behavior of the c, C, s, and S type
    characters when they're used with the printf and wprintf functions,
    are Microsoft extensions. The ISO C standard uses c and s consistently
    for narrow characters and strings, and C and S for wide characters and
    strings, in all formatting functions.
    "
    
    This is the truncated string problem seen in
    microsoft#20
    HinTak committed Oct 15, 2021
    Configuration menu
    Copy the full SHA
    cc75c60 View commit details
    Browse the repository at this point in the history
  5. Replace %hs by NARROW_STR_FORMAT, in line with this group of changes.

    Done with:
        sed -i -e 's/%hs/" NARROW_STR_FORMAT L"/g' *.cpp
    HinTak committed Oct 15, 2021
    Configuration menu
    Copy the full SHA
    8cf66f9 View commit details
    Browse the repository at this point in the history
  6. Convert two non-error-message format %li to %i.

    Found by:
        grep -n %li *.cpp | grep -v ErrMsg, | grep -v errMsg, | grep -v error,
    HinTak committed Oct 15, 2021
    Configuration menu
    Copy the full SHA
    dfc85d1 View commit details
    Browse the repository at this point in the history