@@ -14,7 +14,7 @@ var NOT_QU_MASK = ~QU_MASK
14
14
var name = exports . txt = exports . name = { }
15
15
16
16
name . encode = function ( str , buf , offset ) {
17
- if ( ! buf ) buf = Buffer . allocUnsafe ( name . encodingLength ( str ) )
17
+ if ( ! buf ) buf = Buffer . alloc ( name . encodingLength ( str ) )
18
18
if ( ! offset ) offset = 0
19
19
var oldOffset = offset
20
20
@@ -81,7 +81,7 @@ name.encodingLength = function (n) {
81
81
var string = { }
82
82
83
83
string . encode = function ( s , buf , offset ) {
84
- if ( ! buf ) buf = Buffer . allocUnsafe ( string . encodingLength ( s ) )
84
+ if ( ! buf ) buf = Buffer . alloc ( string . encodingLength ( s ) )
85
85
if ( ! offset ) offset = 0
86
86
87
87
var len = buf . write ( s , offset + 1 )
@@ -163,7 +163,7 @@ header.encodingLength = function () {
163
163
var runknown = exports . unknown = { }
164
164
165
165
runknown . encode = function ( data , buf , offset ) {
166
- if ( ! buf ) buf = Buffer . allocUnsafe ( runknown . encodingLength ( data ) )
166
+ if ( ! buf ) buf = Buffer . alloc ( runknown . encodingLength ( data ) )
167
167
if ( ! offset ) offset = 0
168
168
169
169
buf . writeUInt16BE ( data . length , offset )
@@ -193,7 +193,7 @@ runknown.encodingLength = function (data) {
193
193
var rns = exports . ns = { }
194
194
195
195
rns . encode = function ( data , buf , offset ) {
196
- if ( ! buf ) buf = Buffer . allocUnsafe ( rns . encodingLength ( data ) )
196
+ if ( ! buf ) buf = Buffer . alloc ( rns . encodingLength ( data ) )
197
197
if ( ! offset ) offset = 0
198
198
199
199
name . encode ( data , buf , offset + 2 )
@@ -223,7 +223,7 @@ rns.encodingLength = function (data) {
223
223
var rsoa = exports . soa = { }
224
224
225
225
rsoa . encode = function ( data , buf , offset ) {
226
- if ( ! buf ) buf = Buffer . allocUnsafe ( rsoa . encodingLength ( data ) )
226
+ if ( ! buf ) buf = Buffer . alloc ( rsoa . encodingLength ( data ) )
227
227
if ( ! offset ) offset = 0
228
228
229
229
var oldOffset = offset
@@ -286,11 +286,11 @@ var rtxt = exports.txt = exports.null = {}
286
286
var rnull = rtxt
287
287
288
288
rtxt . encode = function ( data , buf , offset ) {
289
- if ( ! buf ) buf = Buffer . allocUnsafe ( rtxt . encodingLength ( data ) )
289
+ if ( ! buf ) buf = Buffer . alloc ( rtxt . encodingLength ( data ) )
290
290
if ( ! offset ) offset = 0
291
291
292
292
if ( typeof data === 'string' ) data = Buffer . from ( data )
293
- if ( ! data ) data = Buffer . allocUnsafe ( 0 )
293
+ if ( ! data ) data = Buffer . alloc ( 0 )
294
294
295
295
var oldOffset = offset
296
296
offset += 2
@@ -330,7 +330,7 @@ rtxt.encodingLength = function (data) {
330
330
var rhinfo = exports . hinfo = { }
331
331
332
332
rhinfo . encode = function ( data , buf , offset ) {
333
- if ( ! buf ) buf = Buffer . allocUnsafe ( rhinfo . encodingLength ( data ) )
333
+ if ( ! buf ) buf = Buffer . alloc ( rhinfo . encodingLength ( data ) )
334
334
if ( ! offset ) offset = 0
335
335
336
336
var oldOffset = offset
@@ -372,7 +372,7 @@ var rcname = exports.cname = rptr
372
372
var rdname = exports . dname = rptr
373
373
374
374
rptr . encode = function ( data , buf , offset ) {
375
- if ( ! buf ) buf = Buffer . allocUnsafe ( rptr . encodingLength ( data ) )
375
+ if ( ! buf ) buf = Buffer . alloc ( rptr . encodingLength ( data ) )
376
376
if ( ! offset ) offset = 0
377
377
378
378
name . encode ( data , buf , offset + 2 )
@@ -400,7 +400,7 @@ rptr.encodingLength = function (data) {
400
400
var rsrv = exports . srv = { }
401
401
402
402
rsrv . encode = function ( data , buf , offset ) {
403
- if ( ! buf ) buf = Buffer . allocUnsafe ( rsrv . encodingLength ( data ) )
403
+ if ( ! buf ) buf = Buffer . alloc ( rsrv . encodingLength ( data ) )
404
404
if ( ! offset ) offset = 0
405
405
406
406
buf . writeUInt16BE ( data . priority || 0 , offset + 2 )
@@ -445,7 +445,7 @@ rcaa.ISSUER_CRITICAL = 1 << 7
445
445
rcaa . encode = function ( data , buf , offset ) {
446
446
var len = rcaa . encodingLength ( data )
447
447
448
- if ( ! buf ) buf = Buffer . allocUnsafe ( rcaa . encodingLength ( data ) )
448
+ if ( ! buf ) buf = Buffer . alloc ( rcaa . encodingLength ( data ) )
449
449
if ( ! offset ) offset = 0
450
450
451
451
if ( data . issuerCritical ) {
@@ -497,7 +497,7 @@ rcaa.encodingLength = function (data) {
497
497
var ra = exports . a = { }
498
498
499
499
ra . encode = function ( host , buf , offset ) {
500
- if ( ! buf ) buf = Buffer . allocUnsafe ( ra . encodingLength ( host ) )
500
+ if ( ! buf ) buf = Buffer . alloc ( ra . encodingLength ( host ) )
501
501
if ( ! offset ) offset = 0
502
502
503
503
buf . writeUInt16BE ( 4 , offset )
@@ -527,7 +527,7 @@ ra.encodingLength = function () {
527
527
var raaaa = exports . aaaa = { }
528
528
529
529
raaaa . encode = function ( host , buf , offset ) {
530
- if ( ! buf ) buf = Buffer . allocUnsafe ( raaaa . encodingLength ( host ) )
530
+ if ( ! buf ) buf = Buffer . alloc ( raaaa . encodingLength ( host ) )
531
531
if ( ! offset ) offset = 0
532
532
533
533
buf . writeUInt16BE ( 16 , offset )
@@ -575,7 +575,7 @@ var renc = exports.record = function (type) {
575
575
var answer = exports . answer = { }
576
576
577
577
answer . encode = function ( a , buf , offset ) {
578
- if ( ! buf ) buf = Buffer . allocUnsafe ( answer . encodingLength ( a ) )
578
+ if ( ! buf ) buf = Buffer . alloc ( answer . encodingLength ( a ) )
579
579
if ( ! offset ) offset = 0
580
580
581
581
var oldOffset = offset
@@ -633,7 +633,7 @@ answer.encodingLength = function (a) {
633
633
var question = exports . question = { }
634
634
635
635
question . encode = function ( q , buf , offset ) {
636
- if ( ! buf ) buf = Buffer . allocUnsafe ( question . encodingLength ( q ) )
636
+ if ( ! buf ) buf = Buffer . alloc ( question . encodingLength ( q ) )
637
637
if ( ! offset ) offset = 0
638
638
639
639
var oldOffset = offset
@@ -690,7 +690,7 @@ exports.CHECKING_DISABLED = 1 << 4
690
690
691
691
exports . encode = function ( result , buf , offset ) {
692
692
var allocing = ! buf
693
- if ( allocing ) buf = Buffer . allocUnsafe ( exports . encodingLength ( result ) )
693
+ if ( allocing ) buf = Buffer . alloc ( exports . encodingLength ( result ) )
694
694
if ( ! offset ) offset = 0
695
695
696
696
var oldOffset = offset
0 commit comments