зеркало из https://github.com/mozilla/gecko-dev.git
updating string example/test to include an example of [shared]
This commit is contained in:
Родитель
c59b3c8f0b
Коммит
d0965e0a9d
|
@ -108,4 +108,5 @@ interface nsIXPCTestNoisy : nsISupports {
|
||||||
interface nsIXPCTestString : nsISupports {
|
interface nsIXPCTestString : nsISupports {
|
||||||
string GetStringA();
|
string GetStringA();
|
||||||
void GetStringB(out string s);
|
void GetStringB(out string s);
|
||||||
|
void GetStringC([shared,retval] out string s);
|
||||||
};
|
};
|
||||||
|
|
|
@ -31,6 +31,9 @@ public:
|
||||||
/* void GetStringB (out string s); */
|
/* void GetStringB (out string s); */
|
||||||
NS_IMETHOD GetStringB(char **s);
|
NS_IMETHOD GetStringB(char **s);
|
||||||
|
|
||||||
|
/* void GetStringC ([shared, retval] out string s); */
|
||||||
|
NS_IMETHOD GetStringC(const char **s);
|
||||||
|
|
||||||
xpcstringtest();
|
xpcstringtest();
|
||||||
virtual ~xpcstringtest();
|
virtual ~xpcstringtest();
|
||||||
};
|
};
|
||||||
|
@ -57,10 +60,10 @@ xpcstringtest::GetStringA(char **_retval)
|
||||||
if(!_retval)
|
if(!_retval)
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
|
|
||||||
*_retval = (char*) nsAllocator::Clone(myResult,
|
*_retval = (char*) nsAllocator::Clone(myResult,
|
||||||
sizeof(char)*(strlen(myResult)+1));
|
sizeof(char)*(strlen(myResult)+1));
|
||||||
return *_retval ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
return *_retval ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* void GetStringB (out string s); */
|
/* void GetStringB (out string s); */
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
@ -71,11 +74,23 @@ xpcstringtest::GetStringB(char **s)
|
||||||
if(!s)
|
if(!s)
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
|
|
||||||
*s = (char*) nsAllocator::Clone(myResult,
|
*s = (char*) nsAllocator::Clone(myResult,
|
||||||
sizeof(char)*(strlen(myResult)+1));
|
sizeof(char)*(strlen(myResult)+1));
|
||||||
|
|
||||||
return *s ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
return *s ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* void GetStringC ([shared, retval] out string s); */
|
||||||
|
NS_IMETHODIMP
|
||||||
|
xpcstringtest::GetStringC(const char **s)
|
||||||
|
{
|
||||||
|
static const char myResult[] = "result of xpcstringtest::GetStringC";
|
||||||
|
if(!s)
|
||||||
|
return NS_ERROR_NULL_POINTER;
|
||||||
|
*s = myResult;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче