Re: nsString
On 12月6日, 上午2时18分, Igor Tandetnik wrote: > On 12/4/2011 9:23 PM, FrAnk Alvin wrote: > > > nsString attributeName > > char* attrName = NS_ConvertUTF16toUTF8(attributeName).get(); > > This creates a temporary instance of NS_ConvertUTF16toUTF8. At the > semicolon, this temporary is destroyed, deallocating the memory and > leaving attrName a dangling reference. > -- > Igor Tandetnik thanks for you point out mistakes so that they can be corrected. tks~~~ alvin ___ dev-embedding mailing list [email protected] https://lists.mozilla.org/listinfo/dev-embedding
Re: nsString
On 12/4/2011 9:23 PM, FrAnk Alvin wrote: nsString attributeName char* attrName = NS_ConvertUTF16toUTF8(attributeName).get(); This creates a temporary instance of NS_ConvertUTF16toUTF8. At the semicolon, this temporary is destroyed, deallocating the memory and leaving attrName a dangling reference. -- Igor Tandetnik ___ dev-embedding mailing list [email protected] https://lists.mozilla.org/listinfo/dev-embedding
Re: nsString
On 11月28日, 下午6时36分, philippe wrote: > Hello. > > I built a browser with gecko 1.8 . It worked fine. > Now I try to use gecko 1.9.2.23. I get some conversions problems > > For example: > > __ > > nsString attributeName > > char* attrName=ToNewCString(attributeName); causes an error : cannot > convert parameter 1 from 'nsString_external' to 'const nsACString &' > ___ > > Is there a doc about such conversions in 1.9.2. > > Could you help me ? > > Thank's > > philippe - nsString attributeName char* attrName = NS_ConvertUTF16toUTF8(attributeName).get(); ___ dev-embedding mailing list [email protected] https://lists.mozilla.org/listinfo/dev-embedding
Re: nsString
On 11/28/2011 5:36 AM, philippe wrote: Hello. I built a browser with gecko 1.8 . It worked fine. Now I try to use gecko 1.9.2.23. I get some conversions problems For example: __ nsString attributeName char* attrName=ToNewCString(attributeName); causes an error : cannot convert parameter 1 from 'nsString_external' to 'const nsACString&' ___ Is there a doc about such conversions in 1.9.2. The "ToNewCString" version which took a wide string "in" and produced a narrow string "out" didn't have an identified character set, and so was removed at some point along the way. Assuming you want a UTF8 narrow string allocated, you'd need something like: ToNewCString(NS_ConvertUTF16toUTF8(attributeName)); --BDS ___ dev-embedding mailing list [email protected] https://lists.mozilla.org/listinfo/dev-embedding
