Finally fixed space bug with labels on windows correctly
This commit is contained in:
parent
599e616d13
commit
f4cc875861
1 changed files with 4 additions and 14 deletions
|
|
@ -23898,26 +23898,15 @@ static void load_info_about_label_surface(FILE * lfi)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
fgets(tmpstr, 1024, lfi);
|
/* Using fancy "%[]" operator to scan until the end of a line */
|
||||||
nwchar = mbstowcs(wtmpstr, tmpstr, 1024) - 2;
|
tmp_fscanf_return = fscanf(lfi, "%[^\n]\n", tmpstr);
|
||||||
/* FIXME: */
|
mbstowcs(wtmpstr, tmpstr, 1024);
|
||||||
/*
|
|
||||||
According to the document, return value of MultiByteToWideChar() is the number of
|
|
||||||
characters written to the buffer.
|
|
||||||
|
|
||||||
https://docs.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-multibytetowidechar
|
|
||||||
|
|
||||||
However, it seems to return a value 2 larger here.
|
|
||||||
|
|
||||||
2022/02/11 Shin-ichi TOYAMA
|
|
||||||
*/
|
|
||||||
for (l = 0; l < new_node->save_texttool_len; l++)
|
for (l = 0; l < new_node->save_texttool_len; l++)
|
||||||
new_node->save_texttool_str[l] = wtmpstr[l];
|
new_node->save_texttool_str[l] = wtmpstr[l];
|
||||||
new_node->save_texttool_str[l] = L'\0';
|
new_node->save_texttool_str[l] = L'\0';
|
||||||
#else
|
#else
|
||||||
/* Using fancy "%[]" operator to scan until the end of a line */
|
/* Using fancy "%[]" operator to scan until the end of a line */
|
||||||
tmp_fscanf_return = fscanf(lfi, "%l[^\n]\n", new_node->save_texttool_str);
|
tmp_fscanf_return = fscanf(lfi, "%l[^\n]\n", new_node->save_texttool_str);
|
||||||
nwchar = wcslen(new_node->save_texttool_str);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
@ -23926,6 +23915,7 @@ static void load_info_about_label_surface(FILE * lfi)
|
||||||
|
|
||||||
/* If the string is shorter than what we expect (new_node->save_texttool_len),
|
/* If the string is shorter than what we expect (new_node->save_texttool_len),
|
||||||
then it must have been prefixed with spaces that we lost. */
|
then it must have been prefixed with spaces that we lost. */
|
||||||
|
nwchar = wcslen(new_node->save_texttool_str);
|
||||||
if (nwchar < new_node->save_texttool_len)
|
if (nwchar < new_node->save_texttool_len)
|
||||||
{
|
{
|
||||||
wchar_t *wtmpstr;
|
wchar_t *wtmpstr;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue