MCPcopy Index your code
hub / github.com/g3n/engine / decStringSequence

Function decStringSequence

loader/collada/common.go:382–402  ·  view source on GitHub ↗

decStringSequence receives a byte slice with strings separated by spaces and a preallocated destination slice. It reads strings from the source byte slice and stores in the destination array.

(cdata []byte, dest []string)

Source from the content-addressed store, hash-verified

380// It reads strings from the source byte slice and
381// stores in the destination array.
382func decStringSequence(cdata []byte, dest []string) error {
383
384 var br bytesReader
385 br.Init(cdata)
386 idx := 0
387 for {
388 tok := br.TokenNext()
389 if tok == nil {
390 break
391 }
392 if idx >= len(dest) {
393 return fmt.Errorf("To many string array data")
394 }
395 dest[idx] = string(tok)
396 idx++
397 }
398 if idx < len(dest)-1 {
399 return fmt.Errorf("Expected %d strings, got %d", len(dest), idx)
400 }
401 return nil
402}
403
404func f32sToString(a []float32, max int) string {
405

Callers 1

decNameArrayMethod · 0.85

Calls 2

InitMethod · 0.95
TokenNextMethod · 0.95

Tested by

no test coverage detected