On 7/21/17 9:44 AM, nmago wrote:
Yes, I needed nsACString copy of data to use it as nsACString argument for
other function.
Assuming "cname" is a char[N] or char*, you should be able to do:
nsCString str(cname, N);
This will make a copy of the first N bytes of cname and add a
null-termina
воскресенье, 9 июля 2017 г., 4:10:43 UTC+3 пользователь Boris Zbarsky написал:
> On 7/5/17 5:41 AM, nmago wrote:
> > char* cname = new char[N];
> > memcpy(cname, &name, N);
> > nsACString strName(cname, N, 0);
>
> This copies the data twice, and leaks it once, as far as I can tell.
>
> What, exac
On 7/5/17 5:41 AM, nmago wrote:
char* cname = new char[N];
memcpy(cname, &name, N);
nsACString strName(cname, N, 0);
This copies the data twice, and leaks it once, as far as I can tell.
What, exactly, are you trying to accomplish? For example, do you need
an nsACString that has a copy of you
Why do you need a copy?
Could you just cast the name to char*?
2017年7月5日 下午5:45,"nmago" 寫道:
Thank you, Honza Bambas and smaug!
Found solution:
char* cname = new char[N];
memcpy(cname, &name, N);
nsACString strName(cname, N, 0);
___
dev-platform mailin
Thank you, Honza Bambas and smaug!
Found solution:
char* cname = new char[N];
memcpy(cname, &name, N);
nsACString strName(cname, N, 0);
___
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform
On 07/04/2017 04:47 PM, Dexter wrote:
Hi everyone!
Could you tell me please, how I can clearly convert char (&name)[N] to
nsACString?
I tried this:
char* cname = new char[N];
memcpy(cname, &name, N);
nsAutoString strName;
strName.AssignWithConversion(cname, N);
I can't find out how to get ns
Use NS_NAMED_LITERAL_CSTRING, see [1] for plenty of examples.
-hb-
[1]
https://dxr.mozilla.org/mozilla-central/search?q=NS_NAMED_LITERAL_CSTRING&case=false
On 7/4/17 3:47 PM, Dexter wrote:
Hi everyone!
Could you tell me please, how I can clearly convert char (&name)[N] to
nsACString?
I t
Hi everyone!
Could you tell me please, how I can clearly convert char (&name)[N] to
nsACString?
I tried this:
char* cname = new char[N];
memcpy(cname, &name, N);
nsAutoString strName;
strName.AssignWithConversion(cname, N);
I can't find out how to get nsACString. I could use nsACString instead
8 matches
Mail list logo