MCPcopy Index your code
hub / github.com/PokemonGoF/PokemonGo-Bot / writeLength

Function writeLength

map-chat/javascript/browserMqtt.js:1926–1940  ·  view source on GitHub ↗

* writeLength - write an MQTT style length field to the buffer * * @param buffer - destination * @param pos - offset * @param length - length (>0) * @returns number of bytes written * * @api private

(buffer, pos, length)

Source from the content-addressed store, hash-verified

1924 */
1925
1926function writeLength(buffer, pos, length) {
1927 var digit = 0
1928 , origPos = pos
1929
1930 do {
1931 digit = length % 128 | 0
1932 length = length / 128 | 0
1933 if (length > 0) {
1934 digit = digit | 0x80
1935 }
1936 buffer.writeUInt8(digit, pos++)
1937 } while (length > 0)
1938
1939 return pos - origPos
1940}
1941
1942/**
1943 * writeString - write a utf8 string to the buffer

Callers 7

connectFunction · 0.85
connackFunction · 0.85
publishFunction · 0.85
confirmationFunction · 0.85
subscribeFunction · 0.85
subackFunction · 0.85
unsubscribeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected