Skip to content

Commit

Permalink
remove used variables from parser, use strict mode fixes tjfontaine#20
Browse files Browse the repository at this point in the history
  • Loading branch information
tjfontaine committed Jul 7, 2012
1 parent 0e46639 commit 92f4e5a
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 2 deletions.
25 changes: 23 additions & 2 deletions lib/parser.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
// Copyright 2011 Timothy J Fontaine <tjfontaine@gmail.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE

'use strict';

var name_unpack = require('./fields').name_unpack;
var ipaddr = require('./ipaddr');
var BufferCursor = require('./buffercursor');
Expand All @@ -18,7 +40,7 @@ var Parser = module.exports = function (msg, socket) {

var packet = new Packet(socket);

pos = label_pos = 0;
pos = 0;
state = "HEADER";

msg = BufferCursor(msg);
Expand Down Expand Up @@ -133,7 +155,6 @@ var Parser = module.exports = function (msg, socket) {
case "SOA":
pos = msg.tell();
msg.seek(pos - rdata_len + rdata.tell());
pos2 = msg.tell();
val.primary = name_unpack(msg, label_index);
val.admin = name_unpack(msg, label_index);
rdata.seek(msg.tell() - (pos - rdata_len + rdata.tell()));
Expand Down
22 changes: 22 additions & 0 deletions lib/writer.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
// Copyright 2011 Timothy J Fontaine <tjfontaine@gmail.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE

'use strict';

var BufferCursor = require('./buffercursor');
var ipaddr = require('./ipaddr');
var name_pack = require('./fields').name_pack;
Expand Down

0 comments on commit 92f4e5a

Please sign in to comment.