mirror of
https://github.com/PrismarineJS/node-minecraft-protocol.git
synced 2024-11-14 19:04:59 -05:00
Merge pull request #178 from roblabla/feature-remove-ustring
Remove ustring
This commit is contained in:
commit
c9a740f989
3 changed files with 4 additions and 16 deletions
|
@ -32,7 +32,7 @@
|
|||
"fields": [
|
||||
{
|
||||
"name": "response",
|
||||
"type": "ustring"
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -231,7 +231,7 @@
|
|||
"fields": [
|
||||
{
|
||||
"name": "message",
|
||||
"type": "ustring"
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "position",
|
||||
|
@ -1741,7 +1741,7 @@
|
|||
},
|
||||
{
|
||||
"name": "value",
|
||||
"type": "ustring"
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "isSigned",
|
||||
|
@ -1751,7 +1751,7 @@
|
|||
"name": "signature",
|
||||
"type": "condition",
|
||||
"typeArgs": {
|
||||
"type": "ustring",
|
||||
"type": "string",
|
||||
"field": "isSigned",
|
||||
"values": [
|
||||
true
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
var assert = require('assert');
|
||||
|
||||
var STRING_MAX_LENGTH = 240;
|
||||
var SRV_STRING_MAX_LENGTH = 32767;
|
||||
var getField = require("../utils").getField;
|
||||
|
||||
module.exports = {
|
||||
'varint': [readVarInt, writeVarInt, sizeOfVarInt],
|
||||
'bool': [readBool, writeBool, 1],
|
||||
'string': [readString, writeString, sizeOfString],
|
||||
'ustring': [readString, writeString, sizeOfUString], // TODO : remove ustring
|
||||
'buffer': [readBuffer, writeBuffer, sizeOfBuffer]
|
||||
};
|
||||
|
||||
|
@ -81,7 +78,6 @@ function writeString(value, buffer, offset) {
|
|||
|
||||
function sizeOfString(value) {
|
||||
var length = Buffer.byteLength(value, 'utf8');
|
||||
assert.ok(length < STRING_MAX_LENGTH, "string greater than max length");
|
||||
return sizeOfVarInt(length) + length;
|
||||
}
|
||||
|
||||
|
@ -116,10 +112,3 @@ function writeBuffer(value, buffer, offset) {
|
|||
function sizeOfBuffer(value) {
|
||||
return value.length;
|
||||
}
|
||||
|
||||
|
||||
function sizeOfUString(value) {
|
||||
var length = Buffer.byteLength(value, 'utf8');
|
||||
assert.ok(length < SRV_STRING_MAX_LENGTH, "string greater than max length");
|
||||
return sizeOfVarInt(length) + length;
|
||||
}
|
||||
|
|
|
@ -59,7 +59,6 @@ var values = {
|
|||
'byte': -10,
|
||||
'ubyte': 8,
|
||||
'string': "hi hi this is my client string",
|
||||
'ustring': "hi hi this is my server string",
|
||||
'buffer': new Buffer(8),
|
||||
'array': function(typeArgs) {
|
||||
if(typeof values[typeArgs.type] === "undefined") {
|
||||
|
|
Loading…
Reference in a new issue