fix: license issue in blob disk feature

This commit is contained in:
andyzhangx
2020-07-06 12:19:51 +00:00
parent dd649bb7ef
commit a552c7640f
8 changed files with 22 additions and 28 deletions

View File

@@ -1,13 +1,10 @@
package vhd
import (
"encoding/binary"
"encoding/hex"
"fmt"
"os"
"strings"
"unicode/utf16"
"unicode/utf8"
)
// https://groups.google.com/forum/#!msg/golang-nuts/d0nF_k4dSx4/rPGgfXv6QCoJ
@@ -55,19 +52,3 @@ func uuidToBytes(uuid string) []byte {
return h
}
/*
utf16BytesToString converts UTF-16 encoded bytes, in big or
little endian byte order, to a UTF-8 encoded string.
http://stackoverflow.com/a/15794113
*/
func utf16BytesToString(b []byte, o binary.ByteOrder) string {
utf := make([]uint16, (len(b)+(2-1))/2)
for i := 0; i+(2-1) < len(b); i += 2 {
utf[i/2] = o.Uint16(b[i:])
}
if len(b)/2 < len(utf) {
utf[len(utf)-1] = utf8.RuneError
}
return string(utf16.Decode(utf))
}