mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-05 08:35:26 +00:00
e368dc9c85
This patch was generated by a script. Here's the source of the script for future reference: function convert() { echo "Converting $1 to $2..." find . ! -wholename "*nsprpub*" \ ! -wholename "*security/nss*" \ ! -wholename "*/.hg*" \ ! -wholename "obj-ff-dbg*" \ ! -name nsXPCOMCID.h \ ! -name prtypes.h \ -type f \ \( -iname "*.cpp" \ -o -iname "*.h" \ -o -iname "*.c" \ -o -iname "*.cc" \ -o -iname "*.idl" \ -o -iname "*.ipdl" \ -o -iname "*.ipdlh" \ -o -iname "*.mm" \) | \ xargs -n 1 sed -i -e "s/\b$1\b/$2/g" } convert PRInt8 int8_t convert PRUint8 uint8_t convert PRInt16 int16_t convert PRUint16 uint16_t convert PRInt32 int32_t convert PRUint32 uint32_t convert PRInt64 int64_t convert PRUint64 uint64_t convert PRIntn int convert PRUintn unsigned convert PRSize size_t convert PROffset32 int32_t convert PROffset64 int64_t convert PRPtrdiff ptrdiff_t convert PRFloat64 double
92 lines
2.8 KiB
Plaintext
92 lines
2.8 KiB
Plaintext
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "nsIOutputStream.idl"
|
|
#include "nsrootidl.idl"
|
|
|
|
/**
|
|
* This interface allows writing of primitive data types (integers,
|
|
* floating-point values, booleans, etc.) to a stream in a binary, untagged,
|
|
* fixed-endianness format. This might be used, for example, to implement
|
|
* network protocols or to produce architecture-neutral binary disk files,
|
|
* i.e. ones that can be read and written by both big-endian and little-endian
|
|
* platforms. Output is written in big-endian order (high-order byte first),
|
|
* as this is traditional network order.
|
|
*
|
|
* @See nsIBinaryInputStream
|
|
*/
|
|
|
|
[scriptable, uuid(204ee610-8765-11d3-90cf-0040056a906e)]
|
|
interface nsIBinaryOutputStream : nsIOutputStream {
|
|
void setOutputStream(in nsIOutputStream aOutputStream);
|
|
|
|
/**
|
|
* Write a boolean as an 8-bit char to the stream.
|
|
*/
|
|
void writeBoolean(in boolean aBoolean);
|
|
|
|
void write8(in uint8_t aByte);
|
|
void write16(in uint16_t a16);
|
|
void write32(in uint32_t a32);
|
|
void write64(in uint64_t a64);
|
|
|
|
void writeFloat(in float aFloat);
|
|
void writeDouble(in double aDouble);
|
|
|
|
/**
|
|
* Write an 8-bit pascal style string to the stream.
|
|
* 32-bit length field, followed by length 8-bit chars.
|
|
*/
|
|
void writeStringZ(in string aString);
|
|
|
|
/**
|
|
* Write a 16-bit pascal style string to the stream.
|
|
* 32-bit length field, followed by length PRUnichars.
|
|
*/
|
|
void writeWStringZ(in wstring aString);
|
|
|
|
/**
|
|
* Write an 8-bit pascal style string (UTF8-encoded) to the stream.
|
|
* 32-bit length field, followed by length 8-bit chars.
|
|
*/
|
|
void writeUtf8Z(in wstring aString);
|
|
|
|
/**
|
|
* Write an opaque byte array to the stream.
|
|
*/
|
|
void writeBytes([size_is(aLength)] in string aString, in uint32_t aLength);
|
|
|
|
/**
|
|
* Write an opaque byte array to the stream.
|
|
*/
|
|
void writeByteArray([array, size_is(aLength)] in uint8_t aBytes,
|
|
in uint32_t aLength);
|
|
|
|
};
|
|
|
|
%{C++
|
|
|
|
inline nsresult
|
|
NS_WriteOptionalStringZ(nsIBinaryOutputStream* aStream, const char* aString)
|
|
{
|
|
bool nonnull = (aString != nullptr);
|
|
nsresult rv = aStream->WriteBoolean(nonnull);
|
|
if (NS_SUCCEEDED(rv) && nonnull)
|
|
rv = aStream->WriteStringZ(aString);
|
|
return rv;
|
|
}
|
|
|
|
inline nsresult
|
|
NS_WriteOptionalWStringZ(nsIBinaryOutputStream* aStream, const PRUnichar* aString)
|
|
{
|
|
bool nonnull = (aString != nullptr);
|
|
nsresult rv = aStream->WriteBoolean(nonnull);
|
|
if (NS_SUCCEEDED(rv) && nonnull)
|
|
rv = aStream->WriteWStringZ(aString);
|
|
return rv;
|
|
}
|
|
|
|
%}
|