B2G/gecko/dom/mobilemessage/src/ril/MmsPduHelper.jsm
/**
   * @param data
   *        A wrapped object to store encoded raw data.
   * @param value
   *        A Address-value or null for MMS Proxy-Relay Insert-Address mode.
   */
@param data
A wrapped object to store encoded raw data.
@param value
A Address-value or null for MMS Proxy-Relay Insert-Address mode.
@param data A wrapped object to store encoded raw data . @param value A Address - value or null for MMS Proxy - Relay Insert - Address mode .
function encode(data, value) {
    if (!value) {
      WSP.ValueLength.encode(data, 1);
      WSP.Octet.encode(data, 129);
      return;
    }
    let begin = data.offset;
    Address.encode(data, value);
    let len = data.offset - begin;
    data.offset = begin;
    WSP.ValueLength.encode(data, len + 1);
    WSP.Octet.encode(data, 128);
    Address.encode(data, value);
  }
function encode ( data , value ) { if ( ! value ) { WSP . ValueLength . encode ( data , 1 ) ; WSP . Octet . encode ( data , 129 ) ; return ; } let begin = data . offset ; Address . encode ( data , value ) ; let len = data . offset - begin ; data . offset = begin ; WSP . ValueLength . encode ( data , len + 1 ) ; WSP . Octet . encode ( data , 128 ) ; Address . encode ( data , value ) ; }
@param data
        A wrapped object to store encoded raw data.
@param data A wrapped object to store encoded raw data .
// Calculate how much octets will be written and seek back. // TODO: use memmove, see bug 730873