VirtualBox

Changeset 92842 in vbox


Ignore:
Timestamp:
Dec 9, 2021 9:51:57 AM (3 years ago)
Author:
vboxsync
Message:

Main: bugref:1909: Fixed type conversion for atomic variable

Location:
trunk/src/VBox/Frontends/VBoxManage
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/Makefile.kmk

    r92835 r92842  
    319319                'const uint32_t g_cHelpLangEntries = RT_ELEMENTS(g_apHelpLangEntries);' \
    320320                '' \
    321                 'void * volatile g_pHelpLangEntry = (void *)&g_apHelpLangEntries[0];'\
     321                'PHELP_LANG_ENTRY volatile g_pHelpLangEntry = &g_apHelpLangEntries[0];'\
    322322                ''
    323323        $(QUIET)$(CP) --changed -- "$@" "$(patsubst %.ts,%,$@)"
     
    366366                'extern const uint32_t  g_cHelpLangEntries;' \
    367367                '' \
    368                 'extern void * volatile g_pHelpLangEntry;' \
     368                'extern PHELP_LANG_ENTRY volatile g_pHelpLangEntry;' \
    369369                '' \
    370370                'RT_C_DECLS_END' \
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp

    r92830 r92842  
    511511    if (pszLang == NULL || pszLang[0] == 0 || (pszLang[0] == 'C' && pszLang[1] == 0))
    512512        pszLang = "en_US";
    513     void *pHelpLangEntry = NULL;
     513    PHELP_LANG_ENTRY pHelpLangEntry = NULL;
    514514    /* find language entry matching exactly pszLang */
    515515    for (uint32_t i = 0; i < g_cHelpLangEntries; i++)
     
    517517        if (strcmp(g_apHelpLangEntries[i].pszLang, pszLang) == 0)
    518518        {
    519             pHelpLangEntry = (void *)&g_apHelpLangEntries[i];
     519            pHelpLangEntry = &g_apHelpLangEntries[i];
    520520            break;
    521521        }
     
    530530                && memcmp(g_apHelpLangEntries[i].pszLang, pszLang, cbLang) == 0)
    531531            {
    532                 pHelpLangEntry = (void *)&g_apHelpLangEntries[i];
     532                pHelpLangEntry = &g_apHelpLangEntries[i];
    533533                break;
    534534            }
     
    537537    /* set to en_US (i.e. untranslated) if not found */
    538538    if (pHelpLangEntry == NULL)
    539         pHelpLangEntry = (void *)&g_apHelpLangEntries[0];
    540 
    541      ASMAtomicWritePtrVoid(&g_pHelpLangEntry, pHelpLangEntry);
     539        pHelpLangEntry = &g_apHelpLangEntries[0];
     540
     541    ASMAtomicWritePtr(&g_pHelpLangEntry, pHelpLangEntry);
    542542#else
    543543    NOREF(pszLang);
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp

    r92835 r92842  
    114114    uint32_t cFound = 0;
    115115#ifdef VBOX_WITH_VBOXMANAGE_NLS
    116     HELP_LANG_ENTRY *pHelpLangEntry[2] = {(HELP_LANG_ENTRY *)ASMAtomicReadPtr(&g_pHelpLangEntry), &g_apHelpLangEntries[0] };
     116    PHELP_LANG_ENTRY pHelpLangEntry[2] = {ASMAtomicReadPtrT(&g_pHelpLangEntry, PHELP_LANG_ENTRY), &g_apHelpLangEntries[0] };
    117117#else
    118     HELP_LANG_ENTRY *pHelpLangEntry[1] = {(HELP_LANG_ENTRY *)g_pHelpLangEntry};
     118    PHELP_LANG_ENTRY pHelpLangEntry[1] = {(PHELP_LANG_ENTRY)g_pHelpLangEntry};
    119119#endif
    120120    /* Try to find translated, then untranslated */
     
    176176    uint32_t cFound = 0;
    177177#ifdef VBOX_WITH_VBOXMANAGE_NLS
    178     HELP_LANG_ENTRY *pHelpLangEntry[2] = {(HELP_LANG_ENTRY *)ASMAtomicReadPtr(&g_pHelpLangEntry), &g_apHelpLangEntries[0] };
     178    PHELP_LANG_ENTRY pHelpLangEntry[2] = {ASMAtomicReadPtrT(&g_pHelpLangEntry, PHELP_LANG_ENTRY), &g_apHelpLangEntries[0] };
    179179#else
    180     HELP_LANG_ENTRY *pHelpLangEntry[1] = {(HELP_LANG_ENTRY *)g_pHelpLangEntry};
     180    PHELP_LANG_ENTRY pHelpLangEntry[1] = {(PHELP_LANG_ENTRY)g_pHelpLangEntry};
    181181#endif
    182182    /* Try to find translated, then untranslated */
     
    10361036        uint32_t cPendingBlankLines = 0;
    10371037#ifdef VBOX_WITH_VBOXMANAGE_NLS
    1038         HELP_LANG_ENTRY *pHelpLangEntry = (HELP_LANG_ENTRY *)ASMAtomicReadPtr(&g_pHelpLangEntry);
     1038        PHELP_LANG_ENTRY pHelpLangEntry = ASMAtomicReadPtrT(&g_pHelpLangEntry, PHELP_LANG_ENTRY);
    10391039#else
    1040         HELP_LANG_ENTRY *pHelpLangEntry = (HELP_LANG_ENTRY *)g_pHelpLangEntry;
     1040        PHELP_LANG_ENTRY pHelpLangEntry = (PHELP_LANG_ENTRY)g_pHelpLangEntry;
    10411041#endif
    10421042        for (uint32_t i = 0; i < pHelpLangEntry->cHelpEntries; i++)
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