MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / readComment

Method readComment

xmlparser/decoder.go:492–516  ·  view source on GitHub ↗

readComment reads a comment (until `-->`).

()

Source from the content-addressed store, hash-verified

490
491// readComment reads a comment (until `-->`).
492func (d *Decoder) readComment() ([]byte, bool) {
493 if !d.checkAndDiscardPrefix(commentStart) {
494 if d.err == nil {
495 d.setSyntaxErrorf("invalid sequence <!- not part of <!--")
496 }
497 return nil, false
498 }
499
500 d.buf.Reset()
501
502 for {
503 if !d.mustReadUntil('>') {
504 return nil, false
505 }
506
507 if d.buf.HasSuffix(commentEnd) {
508 break
509 }
510 }
511
512 // Trim the trailing '-->'
513 d.buf.Remove(len(commentEnd))
514
515 return d.buf.Bytes(), true
516}
517
518// readCData reads a CDATA section (until `]]>`).
519func (d *Decoder) readCData() ([]byte, bool) {

Callers 1

TokenMethod · 0.95

Calls 7

checkAndDiscardPrefixMethod · 0.95
setSyntaxErrorfMethod · 0.95
mustReadUntilMethod · 0.95
ResetMethod · 0.80
HasSuffixMethod · 0.80
RemoveMethod · 0.80
BytesMethod · 0.80

Tested by

no test coverage detected