Merge pull request #178 from roblabla/feature-remove-ustring

Remove ustring
This commit is contained in:
Robin Lambertz 2015-05-23 15:27:26 +02:00
commit c9a740f989
3 changed files with 4 additions and 16 deletions

View file

@ -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

View file

@ -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;
}

View file

@ -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") {