VirtualBox

Changeset 34165 in vbox


Ignore:
Timestamp:
Nov 18, 2010 12:23:15 PM (14 years ago)
Author:
vboxsync
Message:

Main/linux/USBGetDevices: force Utf8 for the usbfs too

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/linux/USBGetDevices.cpp

    r33540 r34165  
    334334 * Reads a string, i.e. allocates memory and copies it.
    335335 *
    336  * We assume that a string is pure ASCII, if that's not the case
    337  * tell me how to figure out the codeset please.
     336 * We assume that a string is Utf8 and if that's not the case
     337 * (pre-2.6.32-kernels used Latin-1, but so few devices return non-ASCII that
     338 * this usually goes unnoticed) then we mercilessly force it to be so.
    338339 */
    339340static int usbReadStr(const char *pszValue, const char **ppsz)
    340341{
     342    char *psz;
     343
    341344    if (*ppsz)
    342345        RTStrFree((char *)*ppsz);
    343     *ppsz = RTStrDup(pszValue);
    344     if (*ppsz)
     346    psz = RTStrDup(pszValue);
     347    if (psz)
     348    {
     349        RTStrPurgeEncoding(psz);
     350        *ppsz = psz;
    345351        return VINF_SUCCESS;
     352    }
    346353    return VERR_NO_MEMORY;
    347354}
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