From 6a3fc713978a0c1c9290a4afd08b47886b49b635 Mon Sep 17 00:00:00 2001 From: Wim Date: Sat, 13 Aug 2022 16:14:26 +0200 Subject: Update dependencies and go1.18 (#1873) * Update dependencies and go1.18 * Exclude unnecessary linters and update build to go1.18 --- vendor/modernc.org/libc/printf.go | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'vendor/modernc.org/libc/printf.go') diff --git a/vendor/modernc.org/libc/printf.go b/vendor/modernc.org/libc/printf.go index ce580daf..b8200add 100644 --- a/vendor/modernc.org/libc/printf.go +++ b/vendor/modernc.org/libc/printf.go @@ -18,6 +18,7 @@ const ( modH modL modLL + modLD modQ modCapitalL modJ @@ -167,7 +168,9 @@ more: format++ var arg uint64 switch mod { - case modNone, modL, modLL, mod64: + case modNone: + arg = uint64(VaUint32(args)) + case modL, modLL, mod64: arg = VaUint64(args) case modH: arg = uint64(uint16(VaInt32(args))) @@ -198,7 +201,9 @@ more: format++ var arg uint64 switch mod { - case modNone, modL, modLL, mod64: + case modNone: + arg = uint64(VaUint32(args)) + case modL, modLL, mod64: arg = VaUint64(args) case modH: arg = uint64(uint16(VaInt32(args))) @@ -280,7 +285,9 @@ more: format++ var arg uint64 switch mod { - case modNone, modL, modLL, mod64: + case modNone: + arg = uint64(VaUint32(args)) + case modL, modLL, mod64: arg = VaUint64(args) case modH: arg = uint64(uint16(VaInt32(args))) @@ -335,7 +342,7 @@ more: prec = 6 } f := fmt.Sprintf("%s.%d%c", spec, prec, c) - str = fmt.Sprintf(f, arg) + str = fixNanInf(fmt.Sprintf(f, arg)) case 'G': fallthrough case 'g': @@ -356,7 +363,7 @@ more: } f := fmt.Sprintf("%s.%d%c", spec, prec, c) - str = fmt.Sprintf(f, arg) + str = fixNanInf(fmt.Sprintf(f, arg)) case 's': // If no l modifier is present: the const char * argument is expected to be a // pointer to an array of character type (pointer to a string). Characters @@ -577,7 +584,9 @@ func parseLengthModifier(format uintptr) (_ uintptr, n int) { case 'q': panic(todo("")) case 'L': - panic(todo("")) + format++ + n = modLD + return format, n case 'j': panic(todo("")) case 'z': @@ -590,3 +599,14 @@ func parseLengthModifier(format uintptr) (_ uintptr, n int) { return format, 0 } } + +func fixNanInf(s string) string { + switch s { + case "NaN": + return "nan" + case "+Inf", "-Inf": + return "inf" + default: + return s + } +} -- cgit v1.2.3