mirror of
https://github.com/rwinkhart/sys.git
synced 2026-09-05 08:37:31 -04:00
go.sys/windows: use syscall.Errno for windows errors
If we use a local type, it won't compare properly with errors from the rest of the standard library. Errors are the one type from syscall that propagates through the system, so it's important to have only one type for them. mkerrors_windows.sh is gone, so: - rename zerrors_windows.go and delete its DO NOT EDIT mark - delete the contentless zerrors_windows_*.go files LGTM=rsc R=rsc CC=alex.brainman, golang-codereviews https://golang.org/cl/122600043
This commit is contained in:
+2
-18
@@ -17,21 +17,10 @@
|
||||
// For details of the functions and data types in this package consult
|
||||
// the manuals for the appropriate operating system.
|
||||
// These calls return err == nil to indicate success; otherwise
|
||||
// err is an operating system error describing the failure.
|
||||
// That error has type windows.Errno.
|
||||
// err represents an operating system error describing the failure and
|
||||
// holds a value of type syscall.Errno.
|
||||
package windows
|
||||
|
||||
// StringByteSlice is deprecated. Use ByteSliceFromString instead.
|
||||
// If s contains a NUL byte this function panics instead of
|
||||
// returning an error.
|
||||
func StringByteSlice(s string) []byte {
|
||||
a, err := ByteSliceFromString(s)
|
||||
if err != nil {
|
||||
panic("windows: string with NUL passed to StringByteSlice")
|
||||
}
|
||||
return a
|
||||
}
|
||||
|
||||
// ByteSliceFromString returns a NUL-terminated slice of bytes
|
||||
// containing the text of s. If s contains a NUL byte at any
|
||||
// location, it returns (nil, EINVAL).
|
||||
@@ -46,11 +35,6 @@ func ByteSliceFromString(s string) ([]byte, error) {
|
||||
return a, nil
|
||||
}
|
||||
|
||||
// StringBytePtr is deprecated. Use BytePtrFromString instead.
|
||||
// If s contains a NUL byte this function panics instead of
|
||||
// returning an error.
|
||||
func StringBytePtr(s string) *byte { return &StringByteSlice(s)[0] }
|
||||
|
||||
// BytePtrFromString returns a pointer to a NUL-terminated array of
|
||||
// bytes containing the text of s. If s contains a NUL byte at any
|
||||
// location, it returns (nil, EINVAL).
|
||||
|
||||
Reference in New Issue
Block a user