fix: license issue in blob disk feature
This commit is contained in:
4
vendor/github.com/rubiojr/go-vhd/vhd/BUILD
generated
vendored
4
vendor/github.com/rubiojr/go-vhd/vhd/BUILD
generated
vendored
@@ -9,6 +9,10 @@ go_library(
|
||||
importmap = "k8s.io/kubernetes/vendor/github.com/rubiojr/go-vhd/vhd",
|
||||
importpath = "github.com/rubiojr/go-vhd/vhd",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//vendor/golang.org/x/text/encoding/unicode:go_default_library",
|
||||
"//vendor/golang.org/x/text/transform:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
filegroup(
|
||||
|
19
vendor/github.com/rubiojr/go-vhd/vhd/util.go
generated
vendored
19
vendor/github.com/rubiojr/go-vhd/vhd/util.go
generated
vendored
@@ -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))
|
||||
}
|
||||
|
13
vendor/github.com/rubiojr/go-vhd/vhd/vhd.go
generated
vendored
13
vendor/github.com/rubiojr/go-vhd/vhd/vhd.go
generated
vendored
@@ -11,6 +11,9 @@ import (
|
||||
"os"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"golang.org/x/text/encoding/unicode"
|
||||
"golang.org/x/text/transform"
|
||||
)
|
||||
|
||||
const VHD_COOKIE = "636f6e6563746978" // conectix
|
||||
@@ -324,8 +327,14 @@ func (vhd *VHD) PrintExtraHeader() {
|
||||
fmtField("Parent timestamp", fmt.Sprintf("%s", t))
|
||||
|
||||
fmtField("Reserved", hexs(header.Reserved[:]))
|
||||
parentName := utf16BytesToString(header.ParentUnicodeName[:],
|
||||
binary.BigEndian)
|
||||
parentNameBytes, _, err := transform.Bytes(
|
||||
unicode.UTF16(unicode.BigEndian, unicode.IgnoreBOM).NewDecoder(),
|
||||
header.ParentUnicodeName[:],
|
||||
)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
parentName := string(parentNameBytes)
|
||||
fmtField("Parent Name", parentName)
|
||||
// Parent locator entries ignored since it's a dynamic disk
|
||||
sum := 0
|
||||
|
Reference in New Issue
Block a user