@@ -217,7 +217,7 @@ pub mod reader {
217217 }
218218
219219 priv impl Decoder {
220- fn _check_label ( lbl : & str ) {
220+ fn _check_label ( & self , lbl : & str ) {
221221 if self . pos < self . parent . end {
222222 let TaggedDoc { tag : r_tag, doc : r_doc } =
223223 doc_at ( self . parent . data , self . pos ) ;
@@ -233,7 +233,7 @@ pub mod reader {
233233 }
234234 }
235235
236- fn next_doc ( exp_tag : EbmlEncoderTag ) -> Doc {
236+ fn next_doc ( & self , exp_tag : EbmlEncoderTag ) -> Doc {
237237 debug ! ( ". next_doc(exp_tag=%?)" , exp_tag) ;
238238 if self . pos >= self . parent . end {
239239 fail ! ( ~"no more documents in current node!");
@@ -255,7 +255,7 @@ pub mod reader {
255255 r_doc
256256 }
257257
258- fn push_doc<T>(d: Doc, f: fn() -> T) -> T {
258+ fn push_doc<T>(&self, d: Doc, f: fn() -> T) -> T {
259259 let old_parent = self.parent;
260260 let old_pos = self.pos;
261261 self.parent = d;
@@ -266,7 +266,7 @@ pub mod reader {
266266 r
267267 }
268268
269- fn _next_uint(exp_tag: EbmlEncoderTag) -> uint {
269+ fn _next_uint(&self, exp_tag: EbmlEncoderTag) -> uint {
270270 let r = doc_as_u32(self.next_doc(exp_tag));
271271 debug!(" _next_uint exp_tag=%? result=%?", exp_tag, r);
272272 r as uint
@@ -446,7 +446,7 @@ pub mod writer {
446446
447447 // FIXME (#2741): Provide a function to write the standard ebml header.
448448 pub impl Encoder {
449- fn start_tag(tag_id: uint) {
449+ fn start_tag(&self, tag_id: uint) {
450450 debug!(" Start tag %u", tag_id);
451451
452452 // Write the enum ID:
@@ -458,7 +458,7 @@ pub mod writer {
458458 self.writer.write(zeroes);
459459 }
460460
461- fn end_tag() {
461+ fn end_tag(&self ) {
462462 let last_size_pos = self.size_positions.pop();
463463 let cur_pos = self.writer.tell();
464464 self.writer.seek(last_size_pos as int, io::SeekSet);
@@ -469,72 +469,72 @@ pub mod writer {
469469 debug!(" End tag ( size = %u) ", size);
470470 }
471471
472- fn wr_tag(tag_id: uint, blk: fn()) {
472+ fn wr_tag(&self, tag_id: uint, blk: fn()) {
473473 self.start_tag(tag_id);
474474 blk();
475475 self.end_tag();
476476 }
477477
478- fn wr_tagged_bytes(tag_id: uint, b: &[u8]) {
478+ fn wr_tagged_bytes(&self, tag_id: uint, b: &[u8]) {
479479 write_vuint(self.writer, tag_id);
480480 write_vuint(self.writer, vec::len(b));
481481 self.writer.write(b);
482482 }
483483
484- fn wr_tagged_u64(tag_id: uint, v: u64) {
484+ fn wr_tagged_u64(&self, tag_id: uint, v: u64) {
485485 do io::u64_to_be_bytes(v, 8u) |v| {
486486 self.wr_tagged_bytes(tag_id, v);
487487 }
488488 }
489489
490- fn wr_tagged_u32(tag_id: uint, v: u32) {
490+ fn wr_tagged_u32(&self, tag_id: uint, v: u32) {
491491 do io::u64_to_be_bytes(v as u64, 4u) |v| {
492492 self.wr_tagged_bytes(tag_id, v);
493493 }
494494 }
495495
496- fn wr_tagged_u16(tag_id: uint, v: u16) {
496+ fn wr_tagged_u16(&self, tag_id: uint, v: u16) {
497497 do io::u64_to_be_bytes(v as u64, 2u) |v| {
498498 self.wr_tagged_bytes(tag_id, v);
499499 }
500500 }
501501
502- fn wr_tagged_u8(tag_id: uint, v: u8) {
502+ fn wr_tagged_u8(&self, tag_id: uint, v: u8) {
503503 self.wr_tagged_bytes(tag_id, &[v]);
504504 }
505505
506- fn wr_tagged_i64(tag_id: uint, v: i64) {
506+ fn wr_tagged_i64(&self, tag_id: uint, v: i64) {
507507 do io::u64_to_be_bytes(v as u64, 8u) |v| {
508508 self.wr_tagged_bytes(tag_id, v);
509509 }
510510 }
511511
512- fn wr_tagged_i32(tag_id: uint, v: i32) {
512+ fn wr_tagged_i32(&self, tag_id: uint, v: i32) {
513513 do io::u64_to_be_bytes(v as u64, 4u) |v| {
514514 self.wr_tagged_bytes(tag_id, v);
515515 }
516516 }
517517
518- fn wr_tagged_i16(tag_id: uint, v: i16) {
518+ fn wr_tagged_i16(&self, tag_id: uint, v: i16) {
519519 do io::u64_to_be_bytes(v as u64, 2u) |v| {
520520 self.wr_tagged_bytes(tag_id, v);
521521 }
522522 }
523523
524- fn wr_tagged_i8(tag_id: uint, v: i8) {
524+ fn wr_tagged_i8(&self, tag_id: uint, v: i8) {
525525 self.wr_tagged_bytes(tag_id, &[v as u8]);
526526 }
527527
528- fn wr_tagged_str(tag_id: uint, v: &str) {
528+ fn wr_tagged_str(&self, tag_id: uint, v: &str) {
529529 str::byte_slice(v, |b| self.wr_tagged_bytes(tag_id, b));
530530 }
531531
532- fn wr_bytes(b: &[u8]) {
532+ fn wr_bytes(&self, b: &[u8]) {
533533 debug!(" Write %u bytes", vec::len(b));
534534 self.writer.write(b);
535535 }
536536
537- fn wr_str(s: &str) {
537+ fn wr_str(&self, s: &str) {
538538 debug!(" Write str : %?", s);
539539 self.writer.write(str::to_bytes(s));
540540 }
@@ -549,12 +549,12 @@ pub mod writer {
549549
550550 priv impl Encoder {
551551 // used internally to emit things like the vector length and so on
552- fn _emit_tagged_uint(t: EbmlEncoderTag, v: uint) {
552+ fn _emit_tagged_uint(&self, t: EbmlEncoderTag, v: uint) {
553553 assert v <= 0xFFFF_FFFF_u;
554554 self.wr_tagged_u32(t as uint, v as u32);
555555 }
556556
557- fn _emit_label(label: &str) {
557+ fn _emit_label(&self, label: &str) {
558558 // There are various strings that we have access to, such as
559559 // the name of a record field, which do not actually appear in
560560 // the encoded EBML (normally). This is just for
0 commit comments