summaryrefslogtreecommitdiff
path: root/vendor/modernc.org/libc/printf.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2022-11-28 11:19:39 +0100
committerLibravatar GitHub <noreply@github.com>2022-11-28 11:19:39 +0100
commitdaf44ac2b709922512cfee3cde686b84b4868775 (patch)
tree2967df466f8d4515d32c05cf520ba3e7a19d4fae /vendor/modernc.org/libc/printf.go
parent[chore]: Bump codeberg.org/gruf/go-store/v2 from 2.0.9 to 2.0.10 (#1160) (diff)
downloadgotosocial-daf44ac2b709922512cfee3cde686b84b4868775.tar.xz
[chore] Bump database dependencies (#1164)
github.com/uptrace/bun v1.1.8 -> v1.1.9 github.com/uptrace/bun/pgdialect v1.1.8 -> v1.1.9 github.com/uptrace/bun/sqlitedialect v1.1.8 -> v1.1.9 modernc.org/sqlite v1.18.2 -> v1.19.5
Diffstat (limited to 'vendor/modernc.org/libc/printf.go')
-rw-r--r--vendor/modernc.org/libc/printf.go31
1 files changed, 26 insertions, 5 deletions
diff --git a/vendor/modernc.org/libc/printf.go b/vendor/modernc.org/libc/printf.go
index b8200add2..a26ad40e4 100644
--- a/vendor/modernc.org/libc/printf.go
+++ b/vendor/modernc.org/libc/printf.go
@@ -7,6 +7,7 @@ package libc // import "modernc.org/libc"
import (
"bytes"
"fmt"
+ "runtime"
"strconv"
"strings"
"unsafe"
@@ -136,14 +137,17 @@ more:
// the output is empty.
format++
var arg int64
+ if isWindows && mod == modL {
+ mod = modNone
+ }
switch mod {
- case modNone, modL, modLL, mod64:
+ case modL, modLL, mod64:
arg = VaInt64(args)
case modH:
arg = int64(int16(VaInt32(args)))
case modHH:
arg = int64(int8(VaInt32(args)))
- case mod32:
+ case mod32, modNone:
arg = int64(VaInt32(args))
default:
panic(todo("", mod))
@@ -167,6 +171,9 @@ more:
// precision 0, the output is empty.
format++
var arg uint64
+ if isWindows && mod == modL {
+ mod = modNone
+ }
switch mod {
case modNone:
arg = uint64(VaUint32(args))
@@ -200,6 +207,9 @@ more:
// precision 0, the output is empty.
format++
var arg uint64
+ if isWindows && mod == modL {
+ mod = modNone
+ }
switch mod {
case modNone:
arg = uint64(VaUint32(args))
@@ -284,6 +294,9 @@ more:
// printed with an explicit precision 0, the output is empty.
format++
var arg uint64
+ if isWindows && mod == modL {
+ mod = modNone
+ }
switch mod {
case modNone:
arg = uint64(VaUint32(args))
@@ -406,9 +419,17 @@ more:
// The void * pointer argument is printed in hexadecimal (as if by %#x or
// %#lx).
format++
- arg := VaUintptr(args)
- buf.WriteString("0x")
- buf.WriteString(strconv.FormatInt(int64(arg), 16))
+ switch runtime.GOOS {
+ case "windows":
+ switch runtime.GOARCH {
+ case "386", "arm":
+ fmt.Fprintf(buf, "%08X", VaUintptr(args))
+ default:
+ fmt.Fprintf(buf, "%016X", VaUintptr(args))
+ }
+ default:
+ fmt.Fprintf(buf, "%#0x", VaUintptr(args))
+ }
case 'c':
// If no l modifier is present, the int argument is converted to an unsigned
// char, and the resulting character is written. If an l modifier is present,