func (x *XMLLLSDParser) parseBinary(encoding string) []byte { for { token, err := x.decoder.Token() if err != nil { panic(err) } switch t := token.(type) { case xml.StartElement: panic("Unexpected start element in <binary>") case xml.CharData: defer x.decoder.Skip() switch encoding { case "base64", "": b64, _ := base64.StdEncoding.DecodeString(string(t)) return b64 case "base85": b85 := make([]byte, ascii85.MaxEncodedLen(len(t))) n, _, _ := ascii85.Decode(b85, t, true) return b85[:n] case "base16": output := make([]byte, len(t)/2) for i := 0; i < len(t); i += 2 { n, _ := strconv.ParseInt(string(t[i:i+2]), 16, 8) output[i/2] = byte(n) } return output } case xml.EndElement: return make([]byte, 0) } } panic("unreachable") }
func main(aaa string, rd io.Reader, err error) (ok, ok) { b, ok := rd.(*io.Reader) fmt.Sprintln("Hello", "oghet") sql.DB() const aaa = iota var bbb = iota switch { case 1 == 2: return 1, 1 } go foo() for 1; 1; 1 { } if ascii85.Decode() { } return 1, 1 }
func (e *Engine) unascii85() error { b := e.stack.Pop() dec := make([]byte, len(b)) sz, _, err := ascii85.Decode(dec, b, true) if err == nil { e.stack.Push(dec[0:sz]) } return err }
func (x *DNSTransportDownstreamCodec) Decode(msg string) ([]byte, DNSCodecHeader) { src := []byte(msg) var header DNSCodecHeader var header_bytes [4]byte ndst, _, err := ascii85.Decode(header_bytes[:], src[0:5], true) if ndst != 4 || err != nil { return nil, header } x.header_codec.DecodeFromBytes(header_bytes[:], &header) ret := make([]byte, len(msg)/5*4) ndst, _, err = ascii85.Decode(ret, src[5:], true) if err != nil { return nil, header } return ret[:ndst], header }
func (_ UUIDCtrl) fromA85(s string) ([]byte, error) { if len(s) == 24 { s = s[2:22] } if len(s) != 20 { return []byte{}, errors.New("string of UUID ASCII 85 is wrong length") } dst, src := make([]byte, 16), make([]byte, 16) src = []byte(s) _, _, err := ascii85.Decode(dst, src, true) if err != nil { return []byte{}, err } return dst, nil }