Changeset 85306 in vbox
- Timestamp:
- Jul 13, 2020 12:10:02 PM (4 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 5 edited
-
glue/string.cpp (modified) (1 diff)
-
idl/comimpl.xsl (modified) (15 diffs)
-
include/VirtualBoxImpl.h (modified) (2 diffs)
-
src-server/MachineImpl.cpp (modified) (5 diffs)
-
src-server/VirtualBoxImpl.cpp (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/glue/string.cpp
r85288 r85306 185 185 throw std::bad_alloc(); 186 186 } 187 188 HRESULT Bstr::cleanupAndCopyFromNoThrow(const char *a_pszSrc, size_t a_cchMax) RT_NOEXCEPT 189 { 190 /* 191 * Check for empty input (m_bstr == NULL means empty, there are no NULL strings). 192 */ 193 cleanup(); 194 if (!a_cchMax || !a_pszSrc || !*a_pszSrc) 195 return S_OK; 196 197 /* 198 * Calculate the length and allocate a BSTR string buffer of the right 199 * size, i.e. optimize heap usage. 200 */ 201 HRESULT hrc; 202 size_t cwc; 203 int vrc = ::RTStrCalcUtf16LenEx(a_pszSrc, a_cchMax, &cwc); 204 if (RT_SUCCESS(vrc)) 205 { 206 m_bstr = ::SysAllocStringByteLen(NULL, (unsigned)(cwc * sizeof(OLECHAR))); 207 if (RT_LIKELY(m_bstr)) 208 { 209 PRTUTF16 pwsz = (PRTUTF16)m_bstr; 210 vrc = ::RTStrToUtf16Ex(a_pszSrc, a_cchMax, &pwsz, cwc + 1, NULL); 211 if (RT_SUCCESS(vrc)) 212 return S_OK; 213 214 /* This should not happen! */ 215 AssertRC(vrc); 216 cleanup(); 217 hrc = E_UNEXPECTED; 218 } 219 else 220 hrc = E_OUTOFMEMORY; 221 } 222 else 223 { 224 /* Unexpected: Invalid UTF-8 input. */ 225 AssertLogRelMsgFailed(("%Rrc %.*Rhxs\n", vrc, RTStrNLen(a_pszSrc, a_cchMax), a_pszSrc)); 226 hrc = E_UNEXPECTED; 227 } 228 return hrc; 229 } 230 187 231 188 232 int Bstr::compareUtf8(const char *a_pszRight, CaseSensitivity a_enmCase /*= CaseSensitive*/) const -
trunk/src/VBox/Main/idl/comimpl.xsl
r85305 r85306 35 35 <!-- $G_kind contains what kind of COM class implementation we generate --> 36 36 <xsl:variable name="G_xsltFilename" select="'autogen.xsl'" /> 37 <xsl:variable name="G_generateBstrVariants" select="'yes'" /> 37 38 38 39 … … 102 103 <xsl:param name="dir" /> 103 104 <xsl:param name="mod" /> 105 <xsl:param name="utf8str" select="'no'" /> 104 106 105 107 <xsl:choose> … … 110 112 <xsl:with-param name="safearray" select="''" /> 111 113 <xsl:with-param name="dir" select="'in'" /> 114 <xsl:with-param name="utf8str" select="$utf8str" /> 112 115 </xsl:call-template> 113 116 </xsl:variable> … … 131 134 <xsl:when test="(($type='wstring') or ($type='uuid'))"> 132 135 <xsl:choose> 133 <xsl:when test="$param and ($dir='in') ">136 <xsl:when test="$param and ($dir='in') and ($utf8str!='yes')"> 134 137 <xsl:value-of select="'CBSTR'"/> 138 </xsl:when> 139 <xsl:when test="$param and ($dir='in') and ($utf8str='yes')"> 140 <xsl:value-of select="'const Utf8Str &'"/> 135 141 </xsl:when> 136 142 <xsl:when test="$param and ($dir='out')"> 137 143 <xsl:value-of select="'BSTR'"/> 144 </xsl:when> 145 <xsl:when test="$param and ($dir='out') and ($utf8str='yes')"> 146 <xsl:value-of select="'Utf8Str &'"/> 138 147 </xsl:when> 139 148 <xsl:otherwise> … … 194 203 </xsl:choose> 195 204 205 </xsl:template> 206 207 <!-- Checks if interface $name has any string attributes, producing '1' for each string attrib. 208 No output if no string attributes --> 209 <xsl:template name="hasStringAttributes"> 210 <xsl:param name="name" /> 211 212 <!-- Recurse into parent interfaces: --> 213 <xsl:variable name="extends"> 214 <xsl:value-of select="key('G_keyInterfacesByName', $name)/@extends" /> 215 </xsl:variable> 216 <xsl:choose> 217 <xsl:when test="$extends='IEvent'"> 218 </xsl:when> 219 <xsl:when test="$extends='IReusableEvent'"> 220 </xsl:when> 221 <xsl:when test="count(key('G_keyInterfacesByName', $extends)) > 0"> 222 <xsl:call-template name="hasStringAttributes"> 223 <xsl:with-param name="name" select="$extends" /> 224 </xsl:call-template> 225 </xsl:when> 226 <xsl:otherwise> 227 <xsl:call-template name="fatalError"> 228 <xsl:with-param name="msg" select="concat('No idea how to process it: ', $name)" /> 229 </xsl:call-template> 230 </xsl:otherwise> 231 </xsl:choose> 232 233 <!-- Find immediate string and uuid attributes and output '1' for each one: --> 234 <xsl:for-each select="key('G_keyInterfacesByName', $name)/attribute[(@type = 'wstring' or @type = 'uuid') and (@name != 'midlDoesNotLikeEmptyInterfaces')]"> 235 <xsl:text>1</xsl:text> 236 </xsl:for-each> 196 237 </xsl:template> 197 238 … … 264 305 <xsl:template name="genFormalParams"> 265 306 <xsl:param name="name" /> 307 <xsl:param name="utf8str" /> 266 308 <xsl:variable name="extends"> 267 309 <xsl:value-of select="key('G_keyInterfacesByName', $name)/@extends" /> … … 276 318 <xsl:call-template name="genFormalParams"> 277 319 <xsl:with-param name="name" select="$extends" /> 320 <xsl:with-param name="utf8str" select="$utf8str" /> 278 321 </xsl:call-template> 279 322 </xsl:when> … … 294 337 <xsl:with-param name="dir" select="'in'" /> 295 338 <xsl:with-param name="mod" select="@mod" /> 339 <xsl:with-param name="utf8str" select="$utf8str" /> 296 340 </xsl:call-template> 297 341 </xsl:variable> … … 534 578 </xsl:call-template> 535 579 <xsl:value-of select=" ' } '" /> 580 581 <xsl:if test="(@type='wstring') or (@type = 'uuid')"> 582 <xsl:text> inline HRESULT set_</xsl:text><xsl:value-of select="@name"/><xsl:text>(const Utf8Str &a_rString) </xsl:text> 583 <xsl:text> { </xsl:text> 584 <xsl:text> return </xsl:text><xsl:value-of select="$mName"/><xsl:text>.assignEx(a_rString); </xsl:text> 585 <xsl:text> } </xsl:text> 586 </xsl:if> 587 536 588 </xsl:for-each> 537 589 … … 559 611 </xsl:otherwise> 560 612 </xsl:choose> 613 </xsl:template> 614 615 <xsl:template name="genReinitFunction"> 616 <xsl:param name="name"/> 617 <xsl:param name="evname"/> 618 <xsl:param name="ifname"/> 619 <xsl:param name="implName"/> 620 <xsl:param name="utf8str"/> 621 622 <xsl:value-of select="concat('DECLHIDDEN(HRESULT) Reinit', $evname, '(IEvent *aEvent')"/> 623 <xsl:call-template name="genFormalParams"> 624 <xsl:with-param name="name" select="$ifname" /> 625 <xsl:with-param name="utf8str" select="'no'" /> 626 </xsl:call-template> 627 <xsl:text>) </xsl:text> 628 <xsl:text>{ </xsl:text> 629 <xsl:text> </xsl:text><xsl:value-of select="$implName"/><xsl:text> *pEvtImpl = dynamic_cast<</xsl:text> 630 <xsl:value-of select="$implName"/><xsl:text> *>(aEvent); </xsl:text> 631 <xsl:text> if (pEvtImpl) </xsl:text> 632 <xsl:text> { </xsl:text> 633 <xsl:text> pEvtImpl->Reuse(); </xsl:text> 634 <xsl:text> HRESULT hrc = S_OK; </xsl:text> 635 <xsl:call-template name="genAttrInitCode"> 636 <xsl:with-param name="name" select="$name" /> 637 <xsl:with-param name="obj" select="'pEvtImpl'" /> 638 </xsl:call-template> 639 <xsl:text> return hrc; </xsl:text> 640 <xsl:text> } </xsl:text> 641 <xsl:text> return E_INVALIDARG; </xsl:text> 642 <xsl:text>} </xsl:text> 643 <xsl:text> </xsl:text> 644 </xsl:template> 645 646 <xsl:template name="genCreateFunction"> 647 <xsl:param name="name"/> 648 <xsl:param name="evname"/> 649 <xsl:param name="ifname"/> 650 <xsl:param name="implName"/> 651 <xsl:param name="waitable"/> 652 <xsl:param name="evid"/> 653 <xsl:param name="utf8str"/> 654 655 <xsl:value-of select="concat('DECLHIDDEN(HRESULT) Create', $evname, '(IEvent **aEvent, IEventSource *aSource')"/> 656 <xsl:call-template name="genFormalParams"> 657 <xsl:with-param name="name" select="$ifname" /> 658 <xsl:with-param name="utf8str" select="$utf8str" /> 659 </xsl:call-template> 660 <xsl:text>) </xsl:text> 661 <xsl:text>{ </xsl:text> 662 <xsl:text> ComObjPtr<</xsl:text><xsl:value-of select="$implName"/><xsl:text>> EvtObj; </xsl:text> 663 <xsl:text> HRESULT hrc = EvtObj.createObject(); </xsl:text> 664 <xsl:text> if (SUCCEEDED(hrc)) </xsl:text> 665 <xsl:text> { </xsl:text> 666 <xsl:text> hrc = EvtObj->init(aSource, VBoxEventType_</xsl:text><xsl:value-of select="$evid"/> 667 <xsl:text>, </xsl:text><xsl:value-of select="$waitable" /><xsl:text> /*waitable*/); </xsl:text> 668 <xsl:call-template name="genAttrInitCode"> 669 <xsl:with-param name="name" select="$name" /> 670 <xsl:with-param name="obj" select="'EvtObj'" /> 671 </xsl:call-template> 672 <xsl:text> if (SUCCEEDED(hrc)) </xsl:text> 673 <xsl:text> { </xsl:text> 674 <xsl:text> hrc = EvtObj.queryInterfaceTo(aEvent); </xsl:text> 675 <xsl:text> if (SUCCEEDED(hrc)) </xsl:text> 676 <xsl:text> return hrc; </xsl:text> 677 <xsl:text> } </xsl:text> 678 <xsl:text> } </xsl:text> 679 <xsl:text> *aEvent = NULL; </xsl:text> 680 <xsl:text> return hrc; </xsl:text> 681 <xsl:text>} </xsl:text> 682 <xsl:text> </xsl:text> 683 </xsl:template> 684 685 <xsl:template name="genFireFunction"> 686 <xsl:param name="evname"/> 687 <xsl:param name="ifname"/> 688 <xsl:param name="utf8str"/> 689 690 <xsl:value-of select="concat('DECLHIDDEN(HRESULT) Fire', $evname, '(IEventSource *aSource')"/> 691 <xsl:call-template name="genFormalParams"> 692 <xsl:with-param name="name" select="$ifname" /> 693 <xsl:with-param name="utf8str" select="$utf8str" /> 694 </xsl:call-template> 695 <xsl:text>) </xsl:text> 696 <xsl:text>{ </xsl:text> 697 <xsl:text> AssertReturn(aSource, E_INVALIDARG); </xsl:text> 698 <xsl:text> ComPtr<IEvent> ptrEvent; </xsl:text> 699 <xsl:text> HRESULT hrc = </xsl:text> 700 <xsl:value-of select="concat('Create', $evname, '(ptrEvent.asOutParam(), aSource')"/> 701 <xsl:call-template name="genCallParams"> 702 <xsl:with-param name="name" select="$ifname" /> 703 </xsl:call-template> 704 <xsl:text>); </xsl:text> 705 <xsl:text> if (SUCCEEDED(hrc)) </xsl:text> 706 <xsl:text> { </xsl:text> 707 <xsl:text> BOOL fDeliveredIgnored = FALSE; </xsl:text> 708 <xsl:text> hrc = aSource->FireEvent(ptrEvent, /* do not wait for delivery */ 0, &fDeliveredIgnored); </xsl:text> 709 <xsl:text> AssertComRC(hrc); </xsl:text> 710 <xsl:text> } </xsl:text> 711 <xsl:text> return hrc; </xsl:text> 712 <xsl:text>} </xsl:text> 713 <xsl:text> </xsl:text> 561 714 </xsl:template> 562 715 … … 716 869 </xsl:call-template> 717 870 718 <!-- Split off the remainer into separate template?-->871 <!-- Associate public functions. --> 719 872 <xsl:variable name="evname"> 720 873 <xsl:value-of select="substring(@name, 2)" /> … … 736 889 </xsl:choose> 737 890 </xsl:variable> 891 <xsl:variable name="hasStringAttribs"> 892 <xsl:call-template name="hasStringAttributes"> 893 <xsl:with-param name="name" select="@name"/> 894 </xsl:call-template> 895 </xsl:variable> 738 896 739 897 <!-- Generate ReinitXxxxEvent functions if reusable. --> 740 898 <xsl:if test="$isReusable='yes'"> 741 <xsl:value-of select="concat('DECLHIDDEN(HRESULT) Reinit', $evname, '(IEvent *aEvent')"/> 742 <xsl:call-template name="genFormalParams"> 743 <xsl:with-param name="name" select="$ifname" /> 899 <xsl:call-template name="genReinitFunction"> 900 <xsl:with-param name="name" select="@name"/> 901 <xsl:with-param name="evname" select="$evname"/> 902 <xsl:with-param name="ifname" select="$ifname"/> 903 <xsl:with-param name="implName" select="$implName"/> 904 <xsl:with-param name="utf8str" select="'yes'"/> 744 905 </xsl:call-template> 745 <xsl:text>) </xsl:text> 746 <xsl:text>{ </xsl:text> 747 <xsl:text> </xsl:text><xsl:value-of select="$implName"/><xsl:text> *pEvtImpl = dynamic_cast<</xsl:text> 748 <xsl:value-of select="$implName"/><xsl:text> *>(aEvent); </xsl:text> 749 <xsl:text> if (pEvtImpl) </xsl:text> 750 <xsl:text> { </xsl:text> 751 <xsl:text> pEvtImpl->Reuse(); </xsl:text> 752 <xsl:text> HRESULT hrc = S_OK; </xsl:text> 753 <xsl:call-template name="genAttrInitCode"> 754 <xsl:with-param name="name" select="@name" /> 755 <xsl:with-param name="obj" select="'pEvtImpl'" /> 906 907 <xsl:if test="($hasStringAttribs != '') and ($G_generateBstrVariants = 'yes')"> 908 <xsl:call-template name="genReinitFunction"> 909 <xsl:with-param name="name" select="@name"/> 910 <xsl:with-param name="evname" select="$evname"/> 911 <xsl:with-param name="ifname" select="$ifname"/> 912 <xsl:with-param name="implName" select="$implName"/> 913 <xsl:with-param name="utf8str" select="'no'"/> 914 </xsl:call-template> 915 </xsl:if> 916 </xsl:if> 917 918 <!-- Generate the CreateXxxxEvent function. --> 919 <xsl:call-template name="genCreateFunction"> 920 <xsl:with-param name="name" select="@name"/> 921 <xsl:with-param name="evname" select="$evname"/> 922 <xsl:with-param name="ifname" select="$ifname"/> 923 <xsl:with-param name="implName" select="$implName"/> 924 <xsl:with-param name="waitable" select="$waitable"/> 925 <xsl:with-param name="evid" select="$evid"/> 926 <xsl:with-param name="utf8str" select="'yes'"/> 927 </xsl:call-template> 928 929 <xsl:if test="($hasStringAttribs != '') and ($G_generateBstrVariants = 'yes')"> 930 <xsl:call-template name="genCreateFunction"> 931 <xsl:with-param name="name" select="@name"/> 932 <xsl:with-param name="evname" select="$evname"/> 933 <xsl:with-param name="ifname" select="$ifname"/> 934 <xsl:with-param name="implName" select="$implName"/> 935 <xsl:with-param name="waitable" select="$waitable"/> 936 <xsl:with-param name="evid" select="$evid"/> 937 <xsl:with-param name="utf8str" select="'no'"/> 756 938 </xsl:call-template> 757 <xsl:text> return hrc; </xsl:text>758 <xsl:text> } </xsl:text>759 <xsl:text> return E_INVALIDARG; </xsl:text>760 <xsl:text>} </xsl:text>761 <xsl:text> </xsl:text>762 939 </xsl:if> 763 940 764 <!-- Generate the CreateXxxxEvent function. -->765 <xsl:value-of select="concat('DECLHIDDEN(HRESULT) Create', $evname, '(IEvent **aEvent, IEventSource *aSource')"/>766 <xsl:call-template name="genFormalParams">767 <xsl:with-param name="name" select="$ifname" />768 </xsl:call-template>769 <xsl:text>) </xsl:text>770 <xsl:text>{ </xsl:text>771 <xsl:text> ComObjPtr<</xsl:text><xsl:value-of select="$implName"/><xsl:text>> EvtObj; </xsl:text>772 <xsl:text> HRESULT hrc = EvtObj.createObject(); </xsl:text>773 <xsl:text> if (SUCCEEDED(hrc)) </xsl:text>774 <xsl:text> { </xsl:text>775 <xsl:text> hrc = EvtObj->init(aSource, VBoxEventType_</xsl:text><xsl:value-of select="$evid"/>776 <xsl:text>, </xsl:text><xsl:value-of select="$waitable" /><xsl:text> /*waitable*/); </xsl:text>777 <xsl:call-template name="genAttrInitCode">778 <xsl:with-param name="name" select="@name" />779 <xsl:with-param name="obj" select="'EvtObj'" />780 </xsl:call-template>781 <xsl:text> if (SUCCEEDED(hrc)) </xsl:text>782 <xsl:text> { </xsl:text>783 <xsl:text> hrc = EvtObj.queryInterfaceTo(aEvent); </xsl:text>784 <xsl:text> if (SUCCEEDED(hrc)) </xsl:text>785 <xsl:text> return hrc; </xsl:text>786 <xsl:text> } </xsl:text>787 <xsl:text> } </xsl:text>788 <xsl:text> *aEvent = NULL; </xsl:text>789 <xsl:text> return hrc; </xsl:text>790 <xsl:text>} </xsl:text>791 <xsl:text> </xsl:text>792 793 941 <!-- Generate the FireXxxxEvent function. --> 794 <xsl:value-of select="concat('DECLHIDDEN(HRESULT) Fire', $evname, '(IEventSource *aSource')"/> 795 <xsl:call-template name="genFormalParams"> 796 <xsl:with-param name="name" select="$ifname" /> 797 </xsl:call-template> 798 <xsl:text>) </xsl:text> 799 <xsl:text>{ </xsl:text> 800 <xsl:text> AssertReturn(aSource, E_INVALIDARG); </xsl:text> 801 <xsl:text> ComPtr<IEvent> ptrEvent; </xsl:text> 802 <xsl:text> HRESULT hrc = </xsl:text> 803 <xsl:value-of select="concat('Create', $evname, '(ptrEvent.asOutParam(), aSource')"/> 804 <xsl:call-template name="genCallParams"> 805 <xsl:with-param name="name" select="$ifname" /> 806 </xsl:call-template> 807 <xsl:text>); </xsl:text> 808 <xsl:text> if (SUCCEEDED(hrc)) </xsl:text> 809 <xsl:text> { </xsl:text> 810 <xsl:text> BOOL fDeliveredIgnored = FALSE; </xsl:text> 811 <xsl:text> hrc = aSource->FireEvent(ptrEvent, /* do not wait for delivery */ 0, &fDeliveredIgnored); </xsl:text> 812 <xsl:text> AssertComRC(hrc); </xsl:text> 813 <xsl:text> } </xsl:text> 814 <xsl:text> return hrc; </xsl:text> 815 <xsl:text>} </xsl:text> 816 <xsl:text> </xsl:text> 942 <xsl:call-template name="genFireFunction"> 943 <xsl:with-param name="evname" select="$evname"/> 944 <xsl:with-param name="ifname" select="$ifname"/> 945 <xsl:with-param name="utf8str" select="'yes'"/> 946 </xsl:call-template> 947 948 <xsl:if test="($hasStringAttribs != '') and ($G_generateBstrVariants = 'yes')"> 949 <xsl:call-template name="genFireFunction"> 950 <xsl:with-param name="evname" select="$evname"/> 951 <xsl:with-param name="ifname" select="$ifname"/> 952 <xsl:with-param name="utf8str" select="'no'"/> 953 </xsl:call-template> 954 </xsl:if> 817 955 818 956 </xsl:template> … … 892 1030 <xsl:value-of select="@name" /> 893 1031 </xsl:variable> 1032 <xsl:variable name="hasStringAttribs"> 1033 <xsl:call-template name="hasStringAttributes"> 1034 <xsl:with-param name="name" select="@name"/> 1035 </xsl:call-template> 1036 </xsl:variable> 894 1037 895 1038 <xsl:value-of select="concat('DECLHIDDEN(HRESULT) Fire', $evname, '(IEventSource *aSource')"/> 896 1039 <xsl:call-template name="genFormalParams"> 897 1040 <xsl:with-param name="name" select="$ifname" /> 1041 <xsl:with-param name="utf8str" select="'yes'" /> 898 1042 </xsl:call-template> 899 1043 <xsl:text>); </xsl:text> 1044 1045 <xsl:if test="($hasStringAttribs != '') and ($G_generateBstrVariants = 'yes')"> 1046 <xsl:value-of select="concat('DECLHIDDEN(HRESULT) Fire', $evname, '(IEventSource *aSource')"/> 1047 <xsl:call-template name="genFormalParams"> 1048 <xsl:with-param name="name" select="$ifname" /> 1049 <xsl:with-param name="utf8str" select="'no'" /> 1050 </xsl:call-template> 1051 <xsl:text>); </xsl:text> 1052 </xsl:if> 900 1053 </xsl:for-each> 901 1054 <xsl:text>/** @} */ </xsl:text> … … 912 1065 <xsl:value-of select="@name" /> 913 1066 </xsl:variable> 1067 <xsl:variable name="hasStringAttribs"> 1068 <xsl:call-template name="hasStringAttributes"> 1069 <xsl:with-param name="name" select="@name"/> 1070 </xsl:call-template> 1071 </xsl:variable> 914 1072 915 1073 <xsl:value-of select="concat('DECLHIDDEN(HRESULT) Create', $evname, '(IEvent **aEvent, IEventSource *aSource')"/> 916 1074 <xsl:call-template name="genFormalParams"> 917 1075 <xsl:with-param name="name" select="$ifname" /> 1076 <xsl:with-param name="utf8str" select="'yes'" /> 918 1077 </xsl:call-template> 919 1078 <xsl:text>); </xsl:text> 1079 1080 <xsl:if test="($hasStringAttribs != '') and ($G_generateBstrVariants = 'yes')"> 1081 <xsl:value-of select="concat('DECLHIDDEN(HRESULT) Create', $evname, '(IEvent **aEvent, IEventSource *aSource')"/> 1082 <xsl:call-template name="genFormalParams"> 1083 <xsl:with-param name="name" select="$ifname" /> 1084 <xsl:with-param name="utf8str" select="'no'" /> 1085 </xsl:call-template> 1086 <xsl:text>); </xsl:text> 1087 </xsl:if> 920 1088 </xsl:for-each> 921 1089 <xsl:text>/** @} */ </xsl:text> … … 934 1102 <xsl:value-of select="@name" /> 935 1103 </xsl:variable> 1104 <xsl:variable name="hasStringAttribs"> 1105 <xsl:call-template name="hasStringAttributes"> 1106 <xsl:with-param name="name" select="@name"/> 1107 </xsl:call-template> 1108 </xsl:variable> 936 1109 937 1110 <xsl:value-of select="concat('DECLHIDDEN(HRESULT) Reinit', $evname, '(IEvent *aEvent')"/> 938 1111 <xsl:call-template name="genFormalParams"> 939 1112 <xsl:with-param name="name" select="$ifname" /> 1113 <xsl:with-param name="utf8str" select="'yes'" /> 940 1114 </xsl:call-template> 941 1115 <xsl:text>); </xsl:text> 1116 1117 <xsl:if test="($hasStringAttribs != '') and ($G_generateBstrVariants = 'yes')"> 1118 <xsl:value-of select="concat('DECLHIDDEN(HRESULT) Reinit', $evname, '(IEvent *aEvent')"/> 1119 <xsl:call-template name="genFormalParams"> 1120 <xsl:with-param name="name" select="$ifname" /> 1121 <xsl:with-param name="utf8str" select="'no'" /> 1122 </xsl:call-template> 1123 <xsl:text>); </xsl:text> 1124 </xsl:if> 942 1125 </xsl:if> 943 1126 </xsl:for-each> -
trunk/src/VBox/Main/include/VirtualBoxImpl.h
r85304 r85306 169 169 void i_onMachineStateChanged(const Guid &aId, MachineState_T aState); 170 170 void i_onMachineDataChanged(const Guid &aId, BOOL aTemporary = FALSE); 171 BOOL i_onExtraDataCanChange(const Guid &aId, IN_BSTR aKey, IN_BSTR aValue, 172 Bstr &aError); 173 void i_onExtraDataChanged(const Guid &aId, IN_BSTR aKey, IN_BSTR aValue); 171 BOOL i_onExtraDataCanChange(const Guid &aId, const Utf8Str &aKey, const Utf8Str &aValue, Bstr &aError); 172 void i_onExtraDataChanged(const Guid &aId, const Utf8Str &aKey, const Utf8Str &aValue); 174 173 void i_onMachineRegistered(const Guid &aId, BOOL aRegistered); 175 174 void i_onSessionStateChanged(const Guid &aId, SessionState_T aState); … … 192 191 #endif /* VBOX_WITH_SHARED_CLIPBOARD_TRANSFERS */ 193 192 194 void i_onGuestPropertyChanged(const Guid &aMachineId, IN_BSTR aName, IN_BSTR aValue, IN_BSTRaFlags);193 void i_onGuestPropertyChanged(const Guid &aMachineId, const Utf8Str &aName, const Utf8Str &aValue, const Utf8Str &aFlags); 195 194 void i_onNatRedirectChanged(const Guid &aMachineId, ULONG ulSlot, bool fRemove, IN_BSTR aName, 196 195 NATProtocol_T aProto, IN_BSTR aHostIp, uint16_t aHostPort, -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r85304 r85306 4698 4698 // i_onExtraDataCanChange() only briefly requests the VirtualBox 4699 4699 // lock to copy the list of callbacks to invoke 4700 Bstr error; 4701 Bstr bstrValue(aValue); 4702 4703 if (!mParent->i_onExtraDataCanChange(mData->mUuid, Bstr(aKey).raw(), bstrValue.raw(), error)) 4704 { 4705 const char *sep = error.isEmpty() ? "" : ": "; 4706 Log1WarningFunc(("Someone vetoed! Change refused%s%ls\n", sep, error.raw())); 4700 Bstr bstrError; 4701 if (!mParent->i_onExtraDataCanChange(mData->mUuid, aKey, aValue, bstrError)) 4702 { 4703 const char *sep = bstrError.isEmpty() ? "" : ": "; 4704 Log1WarningFunc(("Someone vetoed! Change refused%s%ls\n", sep, bstrError.raw())); 4707 4705 return setError(E_ACCESSDENIED, 4708 4706 tr("Could not set extra data because someone refused the requested change of '%s' to '%s'%s%ls"), … … 4710 4708 aValue.c_str(), 4711 4709 sep, 4712 error.raw());4710 bstrError.raw()); 4713 4711 } 4714 4712 … … 4739 4737 // fire notification outside the lock 4740 4738 if (fChanged) 4741 mParent->i_onExtraDataChanged(mData->mUuid, Bstr(aKey).raw(), Bstr(aValue).raw());4739 mParent->i_onExtraDataChanged(mData->mUuid, aKey, aValue); 4742 4740 4743 4741 return S_OK; … … 5523 5521 alock.release(); 5524 5522 5525 mParent->i_onGuestPropertyChanged(mData->mUuid, Bstr(aName).raw(), Bstr(aValue).raw(), Bstr(aFlags).raw());5523 mParent->i_onGuestPropertyChanged(mData->mUuid, aName, aValue, aFlags); 5526 5524 } 5527 5525 } … … 13536 13534 alock.release(); 13537 13535 13538 mParent->i_onGuestPropertyChanged(mData->mUuid, Bstr(aName).raw(), Bstr(aValue).raw(), Bstr(aFlags).raw());13536 mParent->i_onGuestPropertyChanged(mData->mUuid, aName, aValue, aFlags); 13539 13537 } 13540 13538 catch (...) -
trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp
r85304 r85306 3246 3246 ComPtr<IEvent> ptrEvent; 3247 3247 HRESULT hrc = ::CreateMediumRegisteredEvent(ptrEvent.asOutParam(), m->pEventSource, 3248 aMediumId.to Utf16().raw(), aDevType, aRegistered);3248 aMediumId.toString(), aDevType, aRegistered); 3249 3249 AssertComRCReturnVoid(hrc); 3250 3250 i_postEvent(new AsyncEvent(this, ptrEvent)); … … 3274 3274 ComPtr<IEvent> ptrEvent; 3275 3275 HRESULT hrc = ::CreateStorageControllerChangedEvent(ptrEvent.asOutParam(), m->pEventSource, 3276 aMachineId.to Utf16().raw(), Bstr(aControllerName).raw());3276 aMachineId.toString(), aControllerName); 3277 3277 AssertComRCReturnVoid(hrc); 3278 3278 i_postEvent(new AsyncEvent(this, ptrEvent)); … … 3293 3293 { 3294 3294 ComPtr<IEvent> ptrEvent; 3295 HRESULT hrc = ::CreateMachineStateChangedEvent(ptrEvent.asOutParam(), m->pEventSource, aId.to Utf16().raw(), aState);3295 HRESULT hrc = ::CreateMachineStateChangedEvent(ptrEvent.asOutParam(), m->pEventSource, aId.toString(), aState); 3296 3296 AssertComRCReturnVoid(hrc); 3297 3297 i_postEvent(new AsyncEvent(this, ptrEvent)); … … 3304 3304 { 3305 3305 ComPtr<IEvent> ptrEvent; 3306 HRESULT hrc = ::CreateMachineDataChangedEvent(ptrEvent.asOutParam(), m->pEventSource, aId.to Utf16().raw(), aTemporary);3306 HRESULT hrc = ::CreateMachineDataChangedEvent(ptrEvent.asOutParam(), m->pEventSource, aId.toString(), aTemporary); 3307 3307 AssertComRCReturnVoid(hrc); 3308 3308 i_postEvent(new AsyncEvent(this, ptrEvent)); … … 3312 3312 * @note Locks this object for reading. 3313 3313 */ 3314 BOOL VirtualBox::i_onExtraDataCanChange(const Guid &aId, IN_BSTR aKey, IN_BSTR aValue, 3315 Bstr &aError) 3316 { 3317 LogFlowThisFunc(("machine={%RTuuid} aKey={%ls} aValue={%ls}\n", aId.raw(), aKey, aValue)); 3314 BOOL VirtualBox::i_onExtraDataCanChange(const Guid &aId, const Utf8Str &aKey, const Utf8Str &aValue, Bstr &aError) 3315 { 3316 LogFlowThisFunc(("machine={%RTuuid} aKey={%s} aValue={%s}\n", aId.raw(), aKey.c_str(), aValue.c_str())); 3318 3317 3319 3318 AutoCaller autoCaller(this); … … 3321 3320 3322 3321 ComPtr<IEvent> ptrEvent; 3323 HRESULT hrc = ::CreateExtraDataCanChangeEvent(ptrEvent.asOutParam(), m->pEventSource, aId.to Utf16().raw(), aKey, aValue);3322 HRESULT hrc = ::CreateExtraDataCanChangeEvent(ptrEvent.asOutParam(), m->pEventSource, aId.toString(), aKey, aValue); 3324 3323 AssertComRCReturn(hrc, TRUE); 3325 3324 … … 3353 3352 * @note Doesn't lock any object. 3354 3353 */ 3355 void VirtualBox::i_onExtraDataChanged(const Guid &aId, IN_BSTR aKey, IN_BSTRaValue)3354 void VirtualBox::i_onExtraDataChanged(const Guid &aId, const Utf8Str &aKey, const Utf8Str &aValue) 3356 3355 { 3357 3356 ComPtr<IEvent> ptrEvent; 3358 HRESULT hrc = ::CreateExtraDataChangedEvent(ptrEvent.asOutParam(), m->pEventSource, aId.to Utf16().raw(), aKey, aValue);3357 HRESULT hrc = ::CreateExtraDataChangedEvent(ptrEvent.asOutParam(), m->pEventSource, aId.toString(), aKey, aValue); 3359 3358 AssertComRCReturnVoid(hrc); 3360 3359 i_postEvent(new AsyncEvent(this, ptrEvent)); … … 3367 3366 { 3368 3367 ComPtr<IEvent> ptrEvent; 3369 HRESULT hrc = ::CreateMachineRegisteredEvent(ptrEvent.asOutParam(), m->pEventSource, aId.to Utf16().raw(), aRegistered);3368 HRESULT hrc = ::CreateMachineRegisteredEvent(ptrEvent.asOutParam(), m->pEventSource, aId.toString(), aRegistered); 3370 3369 AssertComRCReturnVoid(hrc); 3371 3370 i_postEvent(new AsyncEvent(this, ptrEvent)); … … 3378 3377 { 3379 3378 ComPtr<IEvent> ptrEvent; 3380 HRESULT hrc = ::CreateSessionStateChangedEvent(ptrEvent.asOutParam(), m->pEventSource, aId.to Utf16().raw(), aState);3379 HRESULT hrc = ::CreateSessionStateChangedEvent(ptrEvent.asOutParam(), m->pEventSource, aId.toString(), aState); 3381 3380 AssertComRCReturnVoid(hrc); 3382 3381 i_postEvent(new AsyncEvent(this, ptrEvent)); … … 3390 3389 ComPtr<IEvent> ptrEvent; 3391 3390 HRESULT hrc = ::CreateSnapshotTakenEvent(ptrEvent.asOutParam(), m->pEventSource, 3392 aMachineId.to Utf16().raw(), aSnapshotId.toUtf16().raw());3391 aMachineId.toString(), aSnapshotId.toString()); 3393 3392 AssertComRCReturnVoid(hrc); 3394 3393 i_postEvent(new AsyncEvent(this, ptrEvent)); … … 3402 3401 ComPtr<IEvent> ptrEvent; 3403 3402 HRESULT hrc = ::CreateSnapshotDeletedEvent(ptrEvent.asOutParam(), m->pEventSource, 3404 aMachineId.to Utf16().raw(), aSnapshotId.toUtf16().raw());3403 aMachineId.toString(), aSnapshotId.toString()); 3405 3404 AssertComRCReturnVoid(hrc); 3406 3405 i_postEvent(new AsyncEvent(this, ptrEvent)); … … 3414 3413 ComPtr<IEvent> ptrEvent; 3415 3414 HRESULT hrc = ::CreateSnapshotRestoredEvent(ptrEvent.asOutParam(), m->pEventSource, 3416 aMachineId.to Utf16().raw(), aSnapshotId.toUtf16().raw());3415 aMachineId.toString(), aSnapshotId.toString()); 3417 3416 AssertComRCReturnVoid(hrc); 3418 3417 i_postEvent(new AsyncEvent(this, ptrEvent)); … … 3426 3425 ComPtr<IEvent> ptrEvent; 3427 3426 HRESULT hrc = ::CreateSnapshotChangedEvent(ptrEvent.asOutParam(), m->pEventSource, 3428 aMachineId.to Utf16().raw(), aSnapshotId.toUtf16().raw());3427 aMachineId.toString(), aSnapshotId.toString()); 3429 3428 AssertComRCReturnVoid(hrc); 3430 3429 i_postEvent(new AsyncEvent(this, ptrEvent)); … … 3711 3710 * @note Doesn't lock any object. 3712 3711 */ 3713 void VirtualBox::i_onGuestPropertyChanged(const Guid &aMachineId, IN_BSTR aName, IN_BSTR aValue, IN_BSTR aFlags) 3712 void VirtualBox::i_onGuestPropertyChanged(const Guid &aMachineId, const Utf8Str &aName, const Utf8Str &aValue, 3713 const Utf8Str &aFlags) 3714 3714 { 3715 3715 ComPtr<IEvent> ptrEvent; 3716 3716 HRESULT hrc = ::CreateGuestPropertyChangedEvent(ptrEvent.asOutParam(), m->pEventSource, 3717 aMachineId.to Utf16().raw(), aName, aValue, aFlags);3717 aMachineId.toString(), aName, aValue, aFlags); 3718 3718 AssertComRCReturnVoid(hrc); 3719 3719 i_postEvent(new AsyncEvent(this, ptrEvent));
Note:
See TracChangeset
for help on using the changeset viewer.

