VirtualBox

Ignore:
Timestamp:
Jul 20, 2009 3:11:45 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
50300
Message:

iprt/string: change behaviour of Utf16 to Latin1 to reject untranslatable strings instead of doing a best-effort translation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/string/utf-16.cpp

    r21714 r21728  
    667667        if (!wc)
    668668            break;
     669        else if (wc < 256)
     670            ++cch;
    669671        else if (wc < 0xd800 || wc > 0xdfff)
    670672        {
    671673            if (wc < 0xfffe)
    672                 ++cch;
     674            {
     675                rc = VERR_NO_TRANSLATION;
     676                break;
     677            }
    673678            else
    674679            {
     
    699704                break;
    700705            }
    701             ++cch;
     706            rc = VERR_NO_TRANSLATION;
     707            break;
    702708        }
    703709    }
     
    745751            else if (wc < 0xfffe)
    746752            {
    747                 if (cch < 1)
    748                 {
    749                     RTStrAssertMsgFailed(("Buffer overflow! 3\n"));
    750                     rc = VERR_BUFFER_OVERFLOW;
    751                     break;
    752                 }
    753                 cch--;
    754                 *pwch++ = '?';
     753                rc = VERR_NO_TRANSLATION;
     754                break;
    755755            }
    756756            else
     
    782782                break;
    783783            }
    784             if (cch < 1)
    785             {
    786                 RTStrAssertMsgFailed(("Buffer overflow! 4\n"));
    787                 rc = VERR_BUFFER_OVERFLOW;
    788                 break;
    789             }
    790             cch--;
    791             *pwch++ = '?';
     784            rc = VERR_NO_TRANSLATION;
     785            break;
    792786        }
    793787    }
Note: See TracChangeset for help on using the changeset viewer.

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