ACString can be used to implement this sort of thing. It has the property that elements of the array can be 0, so it can be used to pass "byte array" values. When converting an ACString to a JS string, XPConnect inflates each byte to a double-byte value, setting the upper byte to zero. When converting the other direction, the upper byte is truncated. If the JS consumer treats each element of the JS string as a byte of binary data, then it can be made to work pretty well.

-Darin


Murilo Camões Perrone wrote:
In my XPCOM component, I must use an single-parameter "byte array" , because I must reproduce an existent COM interface whose methods use managed arrays (sngle-parameter arrays are present on those interfaces). The XPIDL language defines that, for conventional arrays, an extra parameter indicating the array length should be used, and this is a problem for me. Exemple: In XPIDL I can define: void BinaryStringToByteArray ( in string BinaryString, _out unsigned long length, [array, size_is (length), retval] out octet data_ ); but I need this: _byte[]_ BinaryStringToByteArray ( in string BinaryString ); I need to use a byte[] compatible with Java and JavaScript native byte arrays. Currently the only solution I found is to use the wrappedJSObject property of an JavaScript defined component, but this does only work if the XPCom client is JavaScript too... Any ideas ? ------
Murilo Perrone
CertiSign
------------------------------------------------------------------------

_______________________________________________
dev-tech-xpcom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xpcom

_______________________________________________
dev-tech-xpcom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xpcom

Reply via email to