From 9c31e213ca6592bde5656bc1d497166fdcae52c5 Mon Sep 17 00:00:00 2001 From: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Date: Mon, 31 Mar 2025 18:58:09 +0000 Subject: [PATCH 01/15] add a security.md stub, until (if) we determine a fancier security process :waves hands like a ghost: (#3955) --- SECURITY.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 SECURITY.md diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 000000000..39e425bfe --- /dev/null +++ b/SECURITY.md @@ -0,0 +1 @@ +Please email security issues to: admin@gotosocial.org From fdf23a91de791b813f65c244fd75e3262171f1b0 Mon Sep 17 00:00:00 2001 From: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Date: Tue, 1 Apr 2025 15:24:11 +0000 Subject: [PATCH 02/15] update modernc.org/sqlite to v1.37.0-concurrrency-workaround (#3958) --- go.mod | 12 +- go.sum | 36 +- vendor/golang.org/x/exp/LICENSE | 4 +- .../x/exp/constraints/constraints.go | 10 +- .../x/tools/go/ast/astutil/rewrite.go | 2 +- .../golang.org/x/tools/go/ast/astutil/util.go | 2 + .../x/tools/go/packages/packages.go | 12 +- .../x/tools/go/types/typeutil/map.go | 9 +- .../x/tools/internal/event/keys/keys.go | 6 +- .../x/tools/internal/event/label/label.go | 6 +- .../x/tools/internal/gcimporter/bimport.go | 2 +- .../x/tools/internal/gcimporter/iexport.go | 6 +- .../x/tools/internal/gcimporter/iimport.go | 2 +- .../tools/internal/gcimporter/ureader_yes.go | 2 +- .../x/tools/internal/gopathwalk/walk.go | 4 +- .../x/tools/internal/imports/fix.go | 4 +- .../internal/packagesinternal/packages.go | 2 +- .../x/tools/internal/stdlib/deps.go | 359 + .../x/tools/internal/stdlib/import.go | 89 + .../x/tools/internal/stdlib/manifest.go | 20 +- .../x/tools/internal/stdlib/stdlib.go | 2 +- .../x/tools/internal/typeparams/normalize.go | 2 +- .../x/tools/internal/typesinternal/types.go | 6 +- vendor/modernc.org/libc/CONTRIBUTORS | 3 +- vendor/modernc.org/libc/build_all_targets.sh | 2 +- vendor/modernc.org/libc/ccgo_linux_arm64.go | 212 +- vendor/modernc.org/libc/ccgo_linux_loong64.go | 7 +- vendor/modernc.org/libc/etc.go | 26 - vendor/modernc.org/libc/libc_all.go | 18 + vendor/modernc.org/libc/libc_musl.go | 23 - vendor/modernc.org/libc/mem.go | 19 + vendor/modernc.org/libc/mem_brk.go | 11 + vendor/modernc.org/libc/mem_brk_musl.go | 11 + vendor/modernc.org/libc/mem_expvar.go | 12 + vendor/modernc.org/libc/mem_musl.go | 19 + vendor/modernc.org/libc/memgrind.go | 11 + vendor/modernc.org/libc/memgrind_musl.go | 11 + vendor/modernc.org/libc/musl_linux_amd64.go | 7205 ----------------- vendor/modernc.org/libc/pthread_musl.go | 131 +- vendor/modernc.org/memory/LICENSE-LOGO | 1 + vendor/modernc.org/memory/Makefile | 29 + vendor/modernc.org/memory/README.md | 4 +- vendor/modernc.org/memory/logo.png | Bin 0 -> 11369 bytes vendor/modernc.org/memory/memory.go | 20 +- vendor/modernc.org/memory/mmap_darwin.go | 19 - vendor/modernc.org/memory/mmap_freebsd_32.go | 22 - vendor/modernc.org/memory/mmap_freebsd_64.go | 22 - .../modernc.org/memory/mmap_illumos_amd64.go | 91 - vendor/modernc.org/memory/mmap_linux_32.go | 35 - vendor/modernc.org/memory/mmap_linux_64.go | 26 - vendor/modernc.org/memory/mmap_linux_s390x.go | 23 - vendor/modernc.org/memory/mmap_netbsd_32.go | 22 - vendor/modernc.org/memory/mmap_netbsd_64.go | 22 - vendor/modernc.org/memory/mmap_openbsd.go | 97 - vendor/modernc.org/memory/mmap_unix.go | 22 +- vendor/modernc.org/memory/mmap_windows.go | 2 +- vendor/modernc.org/sqlite/Makefile | 4 +- vendor/modernc.org/sqlite/lib/mutex.go | 249 +- .../sqlite/lib/sqlite_freebsd_386.go | 4 +- .../sqlite/lib/sqlite_freebsd_arm.go | 4 +- .../sqlite/lib/sqlite_linux_arm64.go | 220 +- .../sqlite/lib/sqlite_openbsd_amd64.go | 4 +- .../sqlite/lib/sqlite_openbsd_arm64.go | 4 +- vendor/modules.txt | 24 +- 64 files changed, 1070 insertions(+), 8220 deletions(-) create mode 100644 vendor/golang.org/x/tools/internal/stdlib/deps.go create mode 100644 vendor/golang.org/x/tools/internal/stdlib/import.go create mode 100644 vendor/modernc.org/libc/mem_expvar.go delete mode 100644 vendor/modernc.org/libc/musl_linux_amd64.go create mode 100644 vendor/modernc.org/memory/LICENSE-LOGO create mode 100644 vendor/modernc.org/memory/logo.png delete mode 100644 vendor/modernc.org/memory/mmap_darwin.go delete mode 100644 vendor/modernc.org/memory/mmap_freebsd_32.go delete mode 100644 vendor/modernc.org/memory/mmap_freebsd_64.go delete mode 100644 vendor/modernc.org/memory/mmap_illumos_amd64.go delete mode 100644 vendor/modernc.org/memory/mmap_linux_32.go delete mode 100644 vendor/modernc.org/memory/mmap_linux_64.go delete mode 100644 vendor/modernc.org/memory/mmap_linux_s390x.go delete mode 100644 vendor/modernc.org/memory/mmap_netbsd_32.go delete mode 100644 vendor/modernc.org/memory/mmap_netbsd_64.go delete mode 100644 vendor/modernc.org/memory/mmap_openbsd.go diff --git a/go.mod b/go.mod index 51d5954a6..93799e7cc 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ toolchain go1.23.3 replace github.com/go-swagger/go-swagger => codeberg.org/superseriousbusiness/go-swagger v0.31.0-gts-go1.23-fix // Replace modernc/sqlite with our version that fixes the concurrency INTERRUPT issue -replace modernc.org/sqlite => gitlab.com/NyaaaWhatsUpDoc/sqlite v1.36.2-concurrency-workaround +replace modernc.org/sqlite => gitlab.com/NyaaaWhatsUpDoc/sqlite v1.37.0-concurrency-workaround require ( codeberg.org/gruf/go-bytes v1.0.2 @@ -211,16 +211,16 @@ require ( go.opentelemetry.io/proto/otlp v1.5.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/arch v0.13.0 // indirect - golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect - golang.org/x/mod v0.23.0 // indirect + golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 // indirect + golang.org/x/mod v0.24.0 // indirect golang.org/x/sync v0.12.0 // indirect - golang.org/x/tools v0.30.0 // indirect + golang.org/x/tools v0.31.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20250218202821-56aae31c358a // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a // indirect google.golang.org/grpc v1.71.0 // indirect google.golang.org/protobuf v1.36.5 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - modernc.org/libc v1.61.13 // indirect + modernc.org/libc v1.62.1 // indirect modernc.org/mathutil v1.7.1 // indirect - modernc.org/memory v1.8.2 // indirect + modernc.org/memory v1.9.1 // indirect ) diff --git a/go.sum b/go.sum index 18e1f2f4a..4f38aa932 100644 --- a/go.sum +++ b/go.sum @@ -483,8 +483,8 @@ github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDf github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yuin/goldmark v1.7.8 h1:iERMLn0/QJeHFhxSt3p6PeN9mGnvIKSpG9YYorDMnic= github.com/yuin/goldmark v1.7.8/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= -gitlab.com/NyaaaWhatsUpDoc/sqlite v1.36.2-concurrency-workaround h1:1NAPhEPvJJbD+qwXi+IWtfvntCZRWF9frtqeQLtf+TE= -gitlab.com/NyaaaWhatsUpDoc/sqlite v1.36.2-concurrency-workaround/go.mod h1:ADySlx7K4FdY5MaJcEv86hTJ0PjedAloTUuif0YS3ws= +gitlab.com/NyaaaWhatsUpDoc/sqlite v1.37.0-concurrency-workaround h1:QbfrBqNKgAFSSK89fYf547vxDQuz8p6iJUzzAMrusNk= +gitlab.com/NyaaaWhatsUpDoc/sqlite v1.37.0-concurrency-workaround/go.mod h1:5YiWv+YviqGMuGw4V+PNplcyaJ5v+vQd7TQOgkACoJM= go.mongodb.org/mongo-driver v1.14.0 h1:P98w8egYRjYe3XDjxhYJagTokP/H6HzlsnojRgZRd80= go.mongodb.org/mongo-driver v1.14.0/go.mod h1:Vzb0Mk/pa7e6cWw85R4F/endUC3u0U9jGcNU603k65c= go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= @@ -527,8 +527,8 @@ golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= -golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 h1:LfspQV/FYTatPTr/3HzIcmiUFH7PGP+OQ6mgDYo3yuQ= -golang.org/x/exp v0.0.0-20240222234643-814bf88cf225/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc= +golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 h1:nDVHiLt8aIbd/VzvPWN6kSOPE7+F/fNFDSXLVYkE/Iw= +golang.org/x/exp v0.0.0-20250305212735-054e65f0b394/go.mod h1:sIifuuw/Yco/y6yb6+bDNfyeQ/MdPUy/hKEMYQV17cM= golang.org/x/image v0.24.0 h1:AN7zRgVsbvmTfNyqIbbOraYL8mSwcKncEj8ofjgzcMQ= golang.org/x/image v0.24.0/go.mod h1:4b/ITuLfqYq1hqZcjofwctIhi7sZh2WaCjvsBNjjya8= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= @@ -536,8 +536,8 @@ golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/mod v0.23.0 h1:Zb7khfcRGKk+kqfxFaP5tZqCnDZMjC5VtUBs87Hr6QM= -golang.org/x/mod v0.23.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= +golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU= +golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -616,8 +616,8 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= -golang.org/x/tools v0.30.0 h1:BgcpHewrV5AUp2G9MebG4XPFI1E2W41zU1SaqVA9vJY= -golang.org/x/tools v0.30.0/go.mod h1:c347cR/OJfw5TI+GfX7RUPNMdDRRbjvYTS0jPyvsVtY= +golang.org/x/tools v0.31.0 h1:0EedkvKDbh+qistFTd0Bcwe/YLh4vHwWEkiI0toFIBU= +golang.org/x/tools v0.31.0/go.mod h1:naFTU+Cev749tSJRXJlna0T3WxKvb1kWEx15xA4SdmQ= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/api v0.0.0-20250218202821-56aae31c358a h1:nwKuGPlUAt+aR+pcrkfFRrTU1BVrSmYyYMxYbUIVHr0= google.golang.org/genproto/googleapis/api v0.0.0-20250218202821-56aae31c358a/go.mod h1:3kWAYMk1I75K4vykHtKt2ycnOgpA6974V7bREqbsenU= @@ -640,20 +640,20 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -modernc.org/cc/v4 v4.24.4 h1:TFkx1s6dCkQpd6dKurBNmpo+G8Zl4Sq/ztJ+2+DEsh0= -modernc.org/cc/v4 v4.24.4/go.mod h1:uVtb5OGqUKpoLWhqwNQo/8LwvoiEBLvZXIQ/SmO6mL0= -modernc.org/ccgo/v4 v4.23.16 h1:Z2N+kk38b7SfySC1ZkpGLN2vthNJP1+ZzGZIlH7uBxo= -modernc.org/ccgo/v4 v4.23.16/go.mod h1:nNma8goMTY7aQZQNTyN9AIoJfxav4nvTnvKThAeMDdo= +modernc.org/cc/v4 v4.25.2 h1:T2oH7sZdGvTaie0BRNFbIYsabzCxUQg8nLqCdQ2i0ic= +modernc.org/cc/v4 v4.25.2/go.mod h1:uVtb5OGqUKpoLWhqwNQo/8LwvoiEBLvZXIQ/SmO6mL0= +modernc.org/ccgo/v4 v4.25.1 h1:TFSzPrAGmDsdnhT9X2UrcPMI3N/mJ9/X9ykKXwLhDsU= +modernc.org/ccgo/v4 v4.25.1/go.mod h1:njjuAYiPflywOOrm3B7kCB444ONP5pAVr8PIEoE0uDw= modernc.org/fileutil v1.3.0 h1:gQ5SIzK3H9kdfai/5x41oQiKValumqNTDXMvKo62HvE= modernc.org/fileutil v1.3.0/go.mod h1:XatxS8fZi3pS8/hKG2GH/ArUogfxjpEKs3Ku3aK4JyQ= -modernc.org/gc/v2 v2.6.3 h1:aJVhcqAte49LF+mGveZ5KPlsp4tdGdAOT4sipJXADjw= -modernc.org/gc/v2 v2.6.3/go.mod h1:YgIahr1ypgfe7chRuJi2gD7DBQiKSLMPgBQe9oIiito= -modernc.org/libc v1.61.13 h1:3LRd6ZO1ezsFiX1y+bHd1ipyEHIJKvuprv0sLTBwLW8= -modernc.org/libc v1.61.13/go.mod h1:8F/uJWL/3nNil0Lgt1Dpz+GgkApWh04N3el3hxJcA6E= +modernc.org/gc/v2 v2.6.5 h1:nyqdV8q46KvTpZlsw66kWqwXRHdjIlJOhG6kxiV/9xI= +modernc.org/gc/v2 v2.6.5/go.mod h1:YgIahr1ypgfe7chRuJi2gD7DBQiKSLMPgBQe9oIiito= +modernc.org/libc v1.62.1 h1:s0+fv5E3FymN8eJVmnk0llBe6rOxCu/DEU+XygRbS8s= +modernc.org/libc v1.62.1/go.mod h1:iXhATfJQLjG3NWy56a6WVU73lWOcdYVxsvwCgoPljuo= modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU= modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg= -modernc.org/memory v1.8.2 h1:cL9L4bcoAObu4NkxOlKWBWtNHIsnnACGF/TbqQ6sbcI= -modernc.org/memory v1.8.2/go.mod h1:ZbjSvMO5NQ1A2i3bWeDiVMxIorXwdClKE/0SZ+BMotU= +modernc.org/memory v1.9.1 h1:V/Z1solwAVmMW1yttq3nDdZPJqV1rM05Ccq6KMSZ34g= +modernc.org/memory v1.9.1/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw= modernc.org/opt v0.1.4 h1:2kNGMRiUjrp4LcaPuLY2PzUfqM/w9N23quVwhKt5Qm8= modernc.org/opt v0.1.4/go.mod h1:03fq9lsNfvkYSfxrfUhZCWPk1lm4cq4N+Bh//bEtgns= modernc.org/sortutil v1.2.1 h1:+xyoGf15mM3NMlPDnFqrteY07klSFxLElE2PVuWIJ7w= diff --git a/vendor/golang.org/x/exp/LICENSE b/vendor/golang.org/x/exp/LICENSE index 6a66aea5e..2a7cf70da 100644 --- a/vendor/golang.org/x/exp/LICENSE +++ b/vendor/golang.org/x/exp/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2009 The Go Authors. All rights reserved. +Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer. copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of Google Inc. nor the names of its + * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. diff --git a/vendor/golang.org/x/exp/constraints/constraints.go b/vendor/golang.org/x/exp/constraints/constraints.go index 2c033dff4..9d260bab1 100644 --- a/vendor/golang.org/x/exp/constraints/constraints.go +++ b/vendor/golang.org/x/exp/constraints/constraints.go @@ -6,6 +6,8 @@ // with type parameters. package constraints +import "cmp" + // Signed is a constraint that permits any signed integer type. // If future releases of Go add new predeclared signed integer types, // this constraint will be modified to include them. @@ -45,6 +47,8 @@ type Complex interface { // that supports the operators < <= >= >. // If future releases of Go add new ordered types, // this constraint will be modified to include them. -type Ordered interface { - Integer | Float | ~string -} +// +// This type is redundant since Go 1.21 introduced [cmp.Ordered]. +// +//go:fix inline +type Ordered = cmp.Ordered diff --git a/vendor/golang.org/x/tools/go/ast/astutil/rewrite.go b/vendor/golang.org/x/tools/go/ast/astutil/rewrite.go index 58934f766..5c8dbbb7a 100644 --- a/vendor/golang.org/x/tools/go/ast/astutil/rewrite.go +++ b/vendor/golang.org/x/tools/go/ast/astutil/rewrite.go @@ -183,7 +183,7 @@ type application struct { func (a *application) apply(parent ast.Node, name string, iter *iterator, n ast.Node) { // convert typed nil into untyped nil - if v := reflect.ValueOf(n); v.Kind() == reflect.Ptr && v.IsNil() { + if v := reflect.ValueOf(n); v.Kind() == reflect.Pointer && v.IsNil() { n = nil } diff --git a/vendor/golang.org/x/tools/go/ast/astutil/util.go b/vendor/golang.org/x/tools/go/ast/astutil/util.go index ca71e3e10..c820b2084 100644 --- a/vendor/golang.org/x/tools/go/ast/astutil/util.go +++ b/vendor/golang.org/x/tools/go/ast/astutil/util.go @@ -8,4 +8,6 @@ import "go/ast" // Unparen returns e with any enclosing parentheses stripped. // Deprecated: use [ast.Unparen]. +// +//go:fix inline func Unparen(e ast.Expr) ast.Expr { return ast.Unparen(e) } diff --git a/vendor/golang.org/x/tools/go/packages/packages.go b/vendor/golang.org/x/tools/go/packages/packages.go index c3a59b8eb..6665a04c1 100644 --- a/vendor/golang.org/x/tools/go/packages/packages.go +++ b/vendor/golang.org/x/tools/go/packages/packages.go @@ -141,6 +141,8 @@ const ( LoadAllSyntax = LoadSyntax | NeedDeps // Deprecated: NeedExportsFile is a historical misspelling of NeedExportFile. + // + //go:fix inline NeedExportsFile = NeedExportFile ) @@ -161,7 +163,7 @@ type Config struct { // If the user provides a logger, debug logging is enabled. // If the GOPACKAGESDEBUG environment variable is set to true, // but the logger is nil, default to log.Printf. - Logf func(format string, args ...interface{}) + Logf func(format string, args ...any) // Dir is the directory in which to run the build system's query tool // that provides information about the packages. @@ -564,13 +566,13 @@ type ModuleError struct { } func init() { - packagesinternal.GetDepsErrors = func(p interface{}) []*packagesinternal.PackageError { + packagesinternal.GetDepsErrors = func(p any) []*packagesinternal.PackageError { return p.(*Package).depsErrors } - packagesinternal.SetModFile = func(config interface{}, value string) { + packagesinternal.SetModFile = func(config any, value string) { config.(*Config).modFile = value } - packagesinternal.SetModFlag = func(config interface{}, value string) { + packagesinternal.SetModFlag = func(config any, value string) { config.(*Config).modFlag = value } packagesinternal.TypecheckCgo = int(typecheckCgo) @@ -739,7 +741,7 @@ func newLoader(cfg *Config) *loader { if debug { ld.Config.Logf = log.Printf } else { - ld.Config.Logf = func(format string, args ...interface{}) {} + ld.Config.Logf = func(format string, args ...any) {} } } if ld.Config.Mode == 0 { diff --git a/vendor/golang.org/x/tools/go/types/typeutil/map.go b/vendor/golang.org/x/tools/go/types/typeutil/map.go index 43261147c..b6d542c64 100644 --- a/vendor/golang.org/x/tools/go/types/typeutil/map.go +++ b/vendor/golang.org/x/tools/go/types/typeutil/map.go @@ -389,8 +389,13 @@ func (hasher) hashTypeName(tname *types.TypeName) uint32 { // path, and whether or not it is a package-level typename. It // is rare for a package to define multiple local types with // the same name.) - hash := uintptr(unsafe.Pointer(tname)) - return uint32(hash ^ (hash >> 32)) + ptr := uintptr(unsafe.Pointer(tname)) + if unsafe.Sizeof(ptr) == 8 { + hash := uint64(ptr) + return uint32(hash ^ (hash >> 32)) + } else { + return uint32(ptr) + } } // shallowHash computes a hash of t without looking at any of its diff --git a/vendor/golang.org/x/tools/internal/event/keys/keys.go b/vendor/golang.org/x/tools/internal/event/keys/keys.go index a02206e30..4cfa51b61 100644 --- a/vendor/golang.org/x/tools/internal/event/keys/keys.go +++ b/vendor/golang.org/x/tools/internal/event/keys/keys.go @@ -32,7 +32,7 @@ func (k *Value) Format(w io.Writer, buf []byte, l label.Label) { } // Get can be used to get a label for the key from a label.Map. -func (k *Value) Get(lm label.Map) interface{} { +func (k *Value) Get(lm label.Map) any { if t := lm.Find(k); t.Valid() { return k.From(t) } @@ -40,10 +40,10 @@ func (k *Value) Get(lm label.Map) interface{} { } // From can be used to get a value from a Label. -func (k *Value) From(t label.Label) interface{} { return t.UnpackValue() } +func (k *Value) From(t label.Label) any { return t.UnpackValue() } // Of creates a new Label with this key and the supplied value. -func (k *Value) Of(value interface{}) label.Label { return label.OfValue(k, value) } +func (k *Value) Of(value any) label.Label { return label.OfValue(k, value) } // Tag represents a key for tagging labels that have no value. // These are used when the existence of the label is the entire information it diff --git a/vendor/golang.org/x/tools/internal/event/label/label.go b/vendor/golang.org/x/tools/internal/event/label/label.go index 0f526e1f9..7c00ca2a6 100644 --- a/vendor/golang.org/x/tools/internal/event/label/label.go +++ b/vendor/golang.org/x/tools/internal/event/label/label.go @@ -32,7 +32,7 @@ type Key interface { type Label struct { key Key packed uint64 - untyped interface{} + untyped any } // Map is the interface to a collection of Labels indexed by key. @@ -76,13 +76,13 @@ type mapChain struct { // OfValue creates a new label from the key and value. // This method is for implementing new key types, label creation should // normally be done with the Of method of the key. -func OfValue(k Key, value interface{}) Label { return Label{key: k, untyped: value} } +func OfValue(k Key, value any) Label { return Label{key: k, untyped: value} } // UnpackValue assumes the label was built using LabelOfValue and returns the value // that was passed to that constructor. // This method is for implementing new key types, for type safety normal // access should be done with the From method of the key. -func (t Label) UnpackValue() interface{} { return t.untyped } +func (t Label) UnpackValue() any { return t.untyped } // Of64 creates a new label from a key and a uint64. This is often // used for non uint64 values that can be packed into a uint64. diff --git a/vendor/golang.org/x/tools/internal/gcimporter/bimport.go b/vendor/golang.org/x/tools/internal/gcimporter/bimport.go index d79a605ed..734c46198 100644 --- a/vendor/golang.org/x/tools/internal/gcimporter/bimport.go +++ b/vendor/golang.org/x/tools/internal/gcimporter/bimport.go @@ -14,7 +14,7 @@ import ( "sync" ) -func errorf(format string, args ...interface{}) { +func errorf(format string, args ...any) { panic(fmt.Sprintf(format, args...)) } diff --git a/vendor/golang.org/x/tools/internal/gcimporter/iexport.go b/vendor/golang.org/x/tools/internal/gcimporter/iexport.go index 7dfc31a37..253d6493c 100644 --- a/vendor/golang.org/x/tools/internal/gcimporter/iexport.go +++ b/vendor/golang.org/x/tools/internal/gcimporter/iexport.go @@ -310,7 +310,7 @@ func IImportShallow(fset *token.FileSet, getPackages GetPackagesFunc, data []byt } // ReportFunc is the type of a function used to report formatted bugs. -type ReportFunc = func(string, ...interface{}) +type ReportFunc = func(string, ...any) // Current bundled export format version. Increase with each format change. // 0: initial implementation @@ -597,7 +597,7 @@ type filePositions struct { needed []uint64 // unordered list of needed file offsets } -func (p *iexporter) trace(format string, args ...interface{}) { +func (p *iexporter) trace(format string, args ...any) { if !trace { // Call sites should also be guarded, but having this check here allows // easily enabling/disabling debug trace statements. @@ -1583,6 +1583,6 @@ func (e internalError) Error() string { return "gcimporter: " + string(e) } // "internalErrorf" as the former is used for bugs, whose cause is // internal inconsistency, whereas the latter is used for ordinary // situations like bad input, whose cause is external. -func internalErrorf(format string, args ...interface{}) error { +func internalErrorf(format string, args ...any) error { return internalError(fmt.Sprintf(format, args...)) } diff --git a/vendor/golang.org/x/tools/internal/gcimporter/iimport.go b/vendor/golang.org/x/tools/internal/gcimporter/iimport.go index 129439271..bc6c9741e 100644 --- a/vendor/golang.org/x/tools/internal/gcimporter/iimport.go +++ b/vendor/golang.org/x/tools/internal/gcimporter/iimport.go @@ -400,7 +400,7 @@ type iimporter struct { indent int // for tracing support } -func (p *iimporter) trace(format string, args ...interface{}) { +func (p *iimporter) trace(format string, args ...any) { if !trace { // Call sites should also be guarded, but having this check here allows // easily enabling/disabling debug trace statements. diff --git a/vendor/golang.org/x/tools/internal/gcimporter/ureader_yes.go b/vendor/golang.org/x/tools/internal/gcimporter/ureader_yes.go index 522287d18..37b4a39e9 100644 --- a/vendor/golang.org/x/tools/internal/gcimporter/ureader_yes.go +++ b/vendor/golang.org/x/tools/internal/gcimporter/ureader_yes.go @@ -574,7 +574,7 @@ func (pr *pkgReader) objIdx(idx pkgbits.Index) (*types.Package, string) { recv := types.NewVar(fn.Pos(), fn.Pkg(), "", named) typesinternal.SetVarKind(recv, typesinternal.RecvVar) - methods[i] = types.NewFunc(fn.Pos(), fn.Pkg(), fn.Name(), types.NewSignature(recv, sig.Params(), sig.Results(), sig.Variadic())) + methods[i] = types.NewFunc(fn.Pos(), fn.Pkg(), fn.Name(), types.NewSignatureType(recv, nil, nil, sig.Params(), sig.Results(), sig.Variadic())) } embeds := make([]types.Type, iface.NumEmbeddeds()) diff --git a/vendor/golang.org/x/tools/internal/gopathwalk/walk.go b/vendor/golang.org/x/tools/internal/gopathwalk/walk.go index 836151551..984b79c2a 100644 --- a/vendor/golang.org/x/tools/internal/gopathwalk/walk.go +++ b/vendor/golang.org/x/tools/internal/gopathwalk/walk.go @@ -22,7 +22,7 @@ import ( // Options controls the behavior of a Walk call. type Options struct { // If Logf is non-nil, debug logging is enabled through this function. - Logf func(format string, args ...interface{}) + Logf func(format string, args ...any) // Search module caches. Also disables legacy goimports ignore rules. ModulesEnabled bool @@ -81,7 +81,7 @@ func WalkSkip(roots []Root, add func(root Root, dir string), skip func(root Root // walkDir creates a walker and starts fastwalk with this walker. func walkDir(root Root, add func(Root, string), skip func(root Root, dir string) bool, opts Options) { if opts.Logf == nil { - opts.Logf = func(format string, args ...interface{}) {} + opts.Logf = func(format string, args ...any) {} } if _, err := os.Stat(root.Path); os.IsNotExist(err) { opts.Logf("skipping nonexistent directory: %v", root.Path) diff --git a/vendor/golang.org/x/tools/internal/imports/fix.go b/vendor/golang.org/x/tools/internal/imports/fix.go index bf6b0aadd..737a9bfae 100644 --- a/vendor/golang.org/x/tools/internal/imports/fix.go +++ b/vendor/golang.org/x/tools/internal/imports/fix.go @@ -559,7 +559,7 @@ func fixImportsDefault(fset *token.FileSet, f *ast.File, filename string, env *P return err } apply(fset, f, fixes) - return err + return nil } // getFixes gets the import fixes that need to be made to f in order to fix the imports. @@ -1030,7 +1030,7 @@ func (e *ProcessEnv) GetResolver() (Resolver, error) { // // For gopls, we can optionally explicitly choose a resolver type, since we // already know the view type. - if len(e.Env["GOMOD"]) == 0 && len(e.Env["GOWORK"]) == 0 { + if e.Env["GOMOD"] == "" && (e.Env["GOWORK"] == "" || e.Env["GOWORK"] == "off") { e.resolver = newGopathResolver(e) e.logf("created gopath resolver") } else if r, err := newModuleResolver(e, e.ModCache); err != nil { diff --git a/vendor/golang.org/x/tools/internal/packagesinternal/packages.go b/vendor/golang.org/x/tools/internal/packagesinternal/packages.go index 784605914..25ebab663 100644 --- a/vendor/golang.org/x/tools/internal/packagesinternal/packages.go +++ b/vendor/golang.org/x/tools/internal/packagesinternal/packages.go @@ -17,4 +17,4 @@ var TypecheckCgo int var DepsErrors int // must be set as a LoadMode to call GetDepsErrors var SetModFlag = func(config any, value string) {} -var SetModFile = func(config interface{}, value string) {} +var SetModFile = func(config any, value string) {} diff --git a/vendor/golang.org/x/tools/internal/stdlib/deps.go b/vendor/golang.org/x/tools/internal/stdlib/deps.go new file mode 100644 index 000000000..7cca431cd --- /dev/null +++ b/vendor/golang.org/x/tools/internal/stdlib/deps.go @@ -0,0 +1,359 @@ +// Copyright 2025 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Code generated by generate.go. DO NOT EDIT. + +package stdlib + +type pkginfo struct { + name string + deps string // list of indices of dependencies, as varint-encoded deltas +} + +var deps = [...]pkginfo{ + {"archive/tar", "\x03k\x03E5\x01\v\x01#\x01\x01\x02\x05\t\x02\x01\x02\x02\v"}, + {"archive/zip", "\x02\x04a\a\x16\x0205\x01+\x05\x01\x10\x03\x02\r\x04"}, + {"bufio", "\x03k}E\x13"}, + {"bytes", "n+R\x03\fG\x02\x02"}, + {"cmp", ""}, + {"compress/bzip2", "\x02\x02\xe7\x01B"}, + {"compress/flate", "\x02l\x03z\r\x024\x01\x03"}, + {"compress/gzip", "\x02\x04a\a\x03\x15eT"}, + {"compress/lzw", "\x02l\x03z"}, + {"compress/zlib", "\x02\x04a\a\x03\x13\x01f"}, + {"container/heap", "\xae\x02"}, + {"container/list", ""}, + {"container/ring", ""}, + {"context", "n\\h\x01\f"}, + {"crypto", "\x84\x01gD"}, + {"crypto/aes", "\x10\n\a\x8e\x02"}, + {"crypto/cipher", "\x03\x1e\x01\x01\x1d\x11\x1d,Q"}, + {"crypto/des", "\x10\x13\x1d.,\x95\x01\x03"}, + {"crypto/dsa", "@\x04*}\x0e"}, + {"crypto/ecdh", "\x03\v\f\x0e\x04\x14\x04\r\x1d}"}, + {"crypto/ecdsa", "\x0e\x05\x03\x04\x01\x0e\x16\x01\x04\f\x01\x1d}\x0e\x04K\x01"}, + {"crypto/ed25519", "\x0e\x1c\x16\n\a\x1d}D"}, + {"crypto/elliptic", "0>}\x0e9"}, + {"crypto/fips140", " \x05\x91\x01"}, + {"crypto/hkdf", "-\x12\x01.\x16"}, + {"crypto/hmac", "\x1a\x14\x11\x01\x113"}, + {"crypto/internal/boring", "\x0e\x02\rg"}, + {"crypto/internal/boring/bbig", "\x1a\xdf\x01L"}, + {"crypto/internal/boring/bcache", "\xb3\x02\x12"}, + {"crypto/internal/boring/sig", ""}, + {"crypto/internal/cryptotest", "\x03\r\n)\x0e\x1a\x06\x13\x12#\a\t\x11\x11\x11\x1b\x01\f\f\x05\n"}, + {"crypto/internal/entropy", "E"}, + {"crypto/internal/fips140", ">0}9\f\x15"}, + {"crypto/internal/fips140/aes", "\x03\x1d\x03\x02\x13\x04\x01\x01\x05+\x8c\x015"}, + {"crypto/internal/fips140/aes/gcm", " \x01\x02\x02\x02\x11\x04\x01\x06+\x8a\x01"}, + {"crypto/internal/fips140/alias", "\xc5\x02"}, + {"crypto/internal/fips140/bigmod", "%\x17\x01\x06+\x8c\x01"}, + {"crypto/internal/fips140/check", " \x0e\x06\b\x02\xad\x01Z"}, + {"crypto/internal/fips140/check/checktest", "%\xff\x01!"}, + {"crypto/internal/fips140/drbg", "\x03\x1c\x01\x01\x04\x13\x04\b\x01)}\x0f8"}, + {"crypto/internal/fips140/ecdh", "\x03\x1d\x05\x02\t\f2}\x0f8"}, + {"crypto/internal/fips140/ecdsa", "\x03\x1d\x04\x01\x02\a\x02\x068}G"}, + {"crypto/internal/fips140/ed25519", "\x03\x1d\x05\x02\x04\v8\xc1\x01\x03"}, + {"crypto/internal/fips140/edwards25519", "%\a\f\x042\x8c\x018"}, + {"crypto/internal/fips140/edwards25519/field", "%\x13\x042\x8c\x01"}, + {"crypto/internal/fips140/hkdf", "\x03\x1d\x05\t\x06:"}, + {"crypto/internal/fips140/hmac", "\x03\x1d\x14\x01\x018"}, + {"crypto/internal/fips140/mlkem", "\x03\x1d\x05\x02\x0e\x03\x042"}, + {"crypto/internal/fips140/nistec", "%\f\a\x042\x8c\x01*\x0e\x13"}, + {"crypto/internal/fips140/nistec/fiat", "%\x136\x8c\x01"}, + {"crypto/internal/fips140/pbkdf2", "\x03\x1d\x05\t\x06:"}, + {"crypto/internal/fips140/rsa", "\x03\x1d\x04\x01\x02\r\x01\x01\x026}G"}, + {"crypto/internal/fips140/sha256", "\x03\x1d\x1c\x01\x06+\x8c\x01"}, + {"crypto/internal/fips140/sha3", "\x03\x1d\x18\x04\x011\x8c\x01K"}, + {"crypto/internal/fips140/sha512", "\x03\x1d\x1c\x01\x06+\x8c\x01"}, + {"crypto/internal/fips140/ssh", " \x05"}, + {"crypto/internal/fips140/subtle", "#\x19\xbe\x01"}, + {"crypto/internal/fips140/tls12", "\x03\x1d\x05\t\x06\x028"}, + {"crypto/internal/fips140/tls13", "\x03\x1d\x05\b\a\b2"}, + {"crypto/internal/fips140deps", ""}, + {"crypto/internal/fips140deps/byteorder", "\x9a\x01"}, + {"crypto/internal/fips140deps/cpu", "\xae\x01\a"}, + {"crypto/internal/fips140deps/godebug", "\xb6\x01"}, + {"crypto/internal/fips140hash", "5\x1a5\xc1\x01"}, + {"crypto/internal/fips140only", "'\r\x01\x01N25"}, + {"crypto/internal/fips140test", ""}, + {"crypto/internal/hpke", "\x0e\x01\x01\x03\x1a\x1d$,`M"}, + {"crypto/internal/impl", "\xb0\x02"}, + {"crypto/internal/randutil", "\xeb\x01\x12"}, + {"crypto/internal/sysrand", "\xd7\x01@\x1b\x01\f\x06"}, + {"crypto/internal/sysrand/internal/seccomp", "n"}, + {"crypto/md5", "\x0e2.\x16\x16`"}, + {"crypto/mlkem", "/"}, + {"crypto/pbkdf2", "2\r\x01.\x16"}, + {"crypto/rand", "\x1a\x06\a\x19\x04\x01)}\x0eL"}, + {"crypto/rc4", "#\x1d.\xc1\x01"}, + {"crypto/rsa", "\x0e\f\x01\t\x0f\f\x01\x04\x06\a\x1d\x03\x1325\r\x01"}, + {"crypto/sha1", "\x0e\f&.\x16\x16\x14L"}, + {"crypto/sha256", "\x0e\f\x1aP"}, + {"crypto/sha3", "\x0e'O\xc1\x01"}, + {"crypto/sha512", "\x0e\f\x1cN"}, + {"crypto/subtle", "8\x98\x01T"}, + {"crypto/tls", "\x03\b\x02\x01\x01\x01\x01\x02\x01\x01\x01\x03\x01\a\x01\v\x02\n\x01\b\x05\x03\x01\x01\x01\x01\x02\x01\x02\x01\x18\x02\x03\x13\x16\x14\b5\x16\x16\r\t\x01\x01\x01\x02\x01\f\x06\x02\x01"}, + {"crypto/tls/internal/fips140tls", " \x93\x02"}, + {"crypto/x509", "\x03\v\x01\x01\x01\x01\x01\x01\x01\x011\x03\x02\x01\x01\x02\x05\x01\x0e\x06\x02\x02\x03E5\x03\t\x01\x01\x01\a\x10\x05\t\x05\v\x01\x02\r\x02\x01\x01\x02\x03\x01"}, + {"crypto/x509/internal/macos", "\x03k'\x8f\x01\v\x10\x06"}, + {"crypto/x509/pkix", "d\x06\a\x88\x01F"}, + {"database/sql", "\x03\nK\x16\x03z\f\x06\"\x05\t\x02\x03\x01\f\x02\x02\x02"}, + {"database/sql/driver", "\ra\x03\xae\x01\x10\x10"}, + {"debug/buildinfo", "\x03X\x02\x01\x01\b\a\x03`\x18\x02\x01+\x10\x1e"}, + {"debug/dwarf", "\x03d\a\x03z1\x12\x01\x01"}, + {"debug/elf", "\x03\x06Q\r\a\x03`\x19\x01,\x18\x01\x15"}, + {"debug/gosym", "\x03d\n\xbd\x01\x01\x01\x02"}, + {"debug/macho", "\x03\x06Q\r\n`\x1a,\x18\x01"}, + {"debug/pe", "\x03\x06Q\r\a\x03`\x1a,\x18\x01\x15"}, + {"debug/plan9obj", "g\a\x03`\x1a,"}, + {"embed", "n+:\x18\x01S"}, + {"embed/internal/embedtest", ""}, + {"encoding", ""}, + {"encoding/ascii85", "\xeb\x01D"}, + {"encoding/asn1", "\x03k\x03\x87\x01\x01&\x0e\x02\x01\x0f\x03\x01"}, + {"encoding/base32", "\xeb\x01B\x02"}, + {"encoding/base64", "\x9a\x01QB\x02"}, + {"encoding/binary", "n}\r'\x0e\x05"}, + {"encoding/csv", "\x02\x01k\x03zE\x11\x02"}, + {"encoding/gob", "\x02`\x05\a\x03`\x1a\f\x01\x02\x1d\b\x13\x01\x0e\x02"}, + {"encoding/hex", "n\x03zB\x03"}, + {"encoding/json", "\x03\x01^\x04\b\x03z\r'\x0e\x02\x01\x02\x0f\x01\x01\x02"}, + {"encoding/pem", "\x03c\b}B\x03"}, + {"encoding/xml", "\x02\x01_\f\x03z4\x05\v\x01\x02\x0f\x02"}, + {"errors", "\xca\x01{"}, + {"expvar", "kK9\t\n\x15\r\t\x02\x03\x01\x10"}, + {"flag", "b\f\x03z,\b\x05\t\x02\x01\x0f"}, + {"fmt", "nE8\r\x1f\b\x0e\x02\x03\x11"}, + {"go/ast", "\x03\x01m\x0f\x01j\x03)\b\x0e\x02\x01"}, + {"go/ast/internal/tests", ""}, + {"go/build", "\x02\x01k\x03\x01\x03\x02\a\x02\x01\x17\x1e\x04\x02\t\x14\x12\x01+\x01\x04\x01\a\t\x02\x01\x11\x02\x02"}, + {"go/build/constraint", "n\xc1\x01\x01\x11\x02"}, + {"go/constant", "q\x10w\x01\x015\x01\x02\x11"}, + {"go/doc", "\x04m\x01\x06\t=-1\x11\x02\x01\x11\x02"}, + {"go/doc/comment", "\x03n\xbc\x01\x01\x01\x01\x11\x02"}, + {"go/format", "\x03n\x01\f\x01\x02jE"}, + {"go/importer", "t\a\x01\x01\x04\x01i9"}, + {"go/internal/gccgoimporter", "\x02\x01X\x13\x03\x05\v\x01g\x02,\x01\x05\x12\x01\v\b"}, + {"go/internal/gcimporter", "\x02o\x10\x01/\x05\x0e',\x16\x03\x02"}, + {"go/internal/srcimporter", "q\x01\x02\n\x03\x01i,\x01\x05\x13\x02\x13"}, + {"go/parser", "\x03k\x03\x01\x03\v\x01j\x01+\x06\x13"}, + {"go/printer", "q\x01\x03\x03\tj\r\x1f\x16\x02\x01\x02\n\x05\x02"}, + {"go/scanner", "\x03n\x10j2\x11\x01\x12\x02"}, + {"go/token", "\x04m\xbc\x01\x02\x03\x01\x0e\x02"}, + {"go/types", "\x03\x01\x06d\x03\x01\x04\b\x03\x02\x15\x1e\x06+\x04\x03\n%\a\t\x01\x01\x01\x02\x01\x0e\x02\x02"}, + {"go/version", "\xbb\x01u"}, + {"hash", "\xeb\x01"}, + {"hash/adler32", "n\x16\x16"}, + {"hash/crc32", "n\x16\x16\x14\x84\x01\x01"}, + {"hash/crc64", "n\x16\x16\x98\x01"}, + {"hash/fnv", "n\x16\x16`"}, + {"hash/maphash", "\x95\x01\x05\x1b\x03@M"}, + {"html", "\xb0\x02\x02\x11"}, + {"html/template", "\x03h\x06\x19,5\x01\v \x05\x01\x02\x03\r\x01\x02\v\x01\x03\x02"}, + {"image", "\x02l\x1f^\x0f5\x03\x01"}, + {"image/color", ""}, + {"image/color/palette", "\x8d\x01"}, + {"image/draw", "\x8c\x01\x01\x04"}, + {"image/gif", "\x02\x01\x05f\x03\x1b\x01\x01\x01\vQ"}, + {"image/internal/imageutil", "\x8c\x01"}, + {"image/jpeg", "\x02l\x1e\x01\x04Z"}, + {"image/png", "\x02\a^\n\x13\x02\x06\x01^D"}, + {"index/suffixarray", "\x03d\a}\r*\v\x01"}, + {"internal/abi", "\xb5\x01\x90\x01"}, + {"internal/asan", "\xc5\x02"}, + {"internal/bisect", "\xa4\x02\x0e\x01"}, + {"internal/buildcfg", "qG_\x06\x02\x05\v\x01"}, + {"internal/bytealg", "\xae\x01\x97\x01"}, + {"internal/byteorder", ""}, + {"internal/cfg", ""}, + {"internal/chacha8rand", "\x9a\x01\x1b\x90\x01"}, + {"internal/copyright", ""}, + {"internal/coverage", ""}, + {"internal/coverage/calloc", ""}, + {"internal/coverage/cfile", "k\x06\x17\x16\x01\x02\x01\x01\x01\x01\x01\x01\x01$\x01\x1e,\x06\a\v\x01\x03\f\x06"}, + {"internal/coverage/cformat", "\x04m-\x04I\f6\x01\x02\f"}, + {"internal/coverage/cmerge", "q-Z"}, + {"internal/coverage/decodecounter", "g\n-\v\x02@,\x18\x16"}, + {"internal/coverage/decodemeta", "\x02e\n\x17\x16\v\x02@,"}, + {"internal/coverage/encodecounter", "\x02e\n-\f\x01\x02>\f \x16"}, + {"internal/coverage/encodemeta", "\x02\x01d\n\x13\x04\x16\r\x02>,."}, + {"internal/coverage/pods", "\x04m-y\x06\x05\v\x02\x01"}, + {"internal/coverage/rtcov", "\xc5\x02"}, + {"internal/coverage/slicereader", "g\nzZ"}, + {"internal/coverage/slicewriter", "qz"}, + {"internal/coverage/stringtab", "q8\x04>"}, + {"internal/coverage/test", ""}, + {"internal/coverage/uleb128", ""}, + {"internal/cpu", "\xc5\x02"}, + {"internal/dag", "\x04m\xbc\x01\x03"}, + {"internal/diff", "\x03n\xbd\x01\x02"}, + {"internal/exportdata", "\x02\x01k\x03\x03]\x1a,\x01\x05\x12\x01\x02"}, + {"internal/filepathlite", "n+:\x19A"}, + {"internal/fmtsort", "\x04\x9b\x02\x0e"}, + {"internal/fuzz", "\x03\nA\x19\x04\x03\x03\x01\f\x0355\r\x02\x1d\x01\x05\x02\x05\v\x01\x02\x01\x01\v\x04\x02"}, + {"internal/goarch", ""}, + {"internal/godebug", "\x97\x01 {\x01\x12"}, + {"internal/godebugs", ""}, + {"internal/goexperiment", ""}, + {"internal/goos", ""}, + {"internal/goroot", "\x97\x02\x01\x05\x13\x02"}, + {"internal/gover", "\x04"}, + {"internal/goversion", ""}, + {"internal/itoa", ""}, + {"internal/lazyregexp", "\x97\x02\v\x0e\x02"}, + {"internal/lazytemplate", "\xeb\x01,\x19\x02\v"}, + {"internal/msan", "\xc5\x02"}, + {"internal/nettrace", ""}, + {"internal/obscuretestdata", "f\x85\x01,"}, + {"internal/oserror", "n"}, + {"internal/pkgbits", "\x03K\x19\a\x03\x05\vj\x0e\x1e\r\v\x01"}, + {"internal/platform", ""}, + {"internal/poll", "nO\x1a\x149\x0e\x01\x01\v\x06"}, + {"internal/profile", "\x03\x04g\x03z7\f\x01\x01\x0f"}, + {"internal/profilerecord", ""}, + {"internal/race", "\x95\x01\xb0\x01"}, + {"internal/reflectlite", "\x95\x01 3\x01P\x0e\x13\x12"}, + {"unsafe", ""}, + {"vendor/golang.org/x/crypto/chacha20", "\x10W\a\x8c\x01*&"}, + {"vendor/golang.org/x/crypto/chacha20poly1305", "\x10W\a\xd8\x01\x04\x01"}, + {"vendor/golang.org/x/crypto/cryptobyte", "d\n\x03\x88\x01& \n"}, + {"vendor/golang.org/x/crypto/cryptobyte/asn1", ""}, + {"vendor/golang.org/x/crypto/internal/alias", "\xc5\x02"}, + {"vendor/golang.org/x/crypto/internal/poly1305", "Q\x16\x93\x01"}, + {"vendor/golang.org/x/net/dns/dnsmessage", "n"}, + {"vendor/golang.org/x/net/http/httpguts", "\x81\x02\x14\x1b\x13\r"}, + {"vendor/golang.org/x/net/http/httpproxy", "n\x03\x90\x01\x15\x01\x19\x13\r"}, + {"vendor/golang.org/x/net/http2/hpack", "\x03k\x03zG"}, + {"vendor/golang.org/x/net/idna", "q\x87\x018\x13\x10\x02\x01"}, + {"vendor/golang.org/x/net/nettest", "\x03d\a\x03z\x11\x05\x16\x01\f\v\x01\x02\x02\x01\n"}, + {"vendor/golang.org/x/sys/cpu", "\x97\x02\r\v\x01\x15"}, + {"vendor/golang.org/x/text/secure/bidirule", "n\xd5\x01\x11\x01"}, + {"vendor/golang.org/x/text/transform", "\x03k}X"}, + {"vendor/golang.org/x/text/unicode/bidi", "\x03\bf~?\x15"}, + {"vendor/golang.org/x/text/unicode/norm", "g\nzG\x11\x11"}, + {"weak", "\x95\x01\x8f\x01!"}, +} diff --git a/vendor/golang.org/x/tools/internal/stdlib/import.go b/vendor/golang.org/x/tools/internal/stdlib/import.go new file mode 100644 index 000000000..f6909878a --- /dev/null +++ b/vendor/golang.org/x/tools/internal/stdlib/import.go @@ -0,0 +1,89 @@ +// Copyright 2025 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package stdlib + +// This file provides the API for the import graph of the standard library. +// +// Be aware that the compiler-generated code for every package +// implicitly depends on package "runtime" and a handful of others +// (see runtimePkgs in GOROOT/src/cmd/internal/objabi/pkgspecial.go). + +import ( + "encoding/binary" + "iter" + "slices" + "strings" +) + +// Imports returns the sequence of packages directly imported by the +// named standard packages, in name order. +// The imports of an unknown package are the empty set. +// +// The graph is built into the application and may differ from the +// graph in the Go source tree being analyzed by the application. +func Imports(pkgs ...string) iter.Seq[string] { + return func(yield func(string) bool) { + for _, pkg := range pkgs { + if i, ok := find(pkg); ok { + var depIndex uint64 + for data := []byte(deps[i].deps); len(data) > 0; { + delta, n := binary.Uvarint(data) + depIndex += delta + if !yield(deps[depIndex].name) { + return + } + data = data[n:] + } + } + } + } +} + +// Dependencies returns the set of all dependencies of the named +// standard packages, including the initial package, +// in a deterministic topological order. +// The dependencies of an unknown package are the empty set. +// +// The graph is built into the application and may differ from the +// graph in the Go source tree being analyzed by the application. +func Dependencies(pkgs ...string) iter.Seq[string] { + return func(yield func(string) bool) { + for _, pkg := range pkgs { + if i, ok := find(pkg); ok { + var seen [1 + len(deps)/8]byte // bit set of seen packages + var visit func(i int) bool + visit = func(i int) bool { + bit := byte(1) << (i % 8) + if seen[i/8]&bit == 0 { + seen[i/8] |= bit + var depIndex uint64 + for data := []byte(deps[i].deps); len(data) > 0; { + delta, n := binary.Uvarint(data) + depIndex += delta + if !visit(int(depIndex)) { + return false + } + data = data[n:] + } + if !yield(deps[i].name) { + return false + } + } + return true + } + if !visit(i) { + return + } + } + } + } +} + +// find returns the index of pkg in the deps table. +func find(pkg string) (int, bool) { + return slices.BinarySearchFunc(deps[:], pkg, func(p pkginfo, n string) int { + return strings.Compare(p.name, n) + }) +} diff --git a/vendor/golang.org/x/tools/internal/stdlib/manifest.go b/vendor/golang.org/x/tools/internal/stdlib/manifest.go index 9f0b871ff..00776a31b 100644 --- a/vendor/golang.org/x/tools/internal/stdlib/manifest.go +++ b/vendor/golang.org/x/tools/internal/stdlib/manifest.go @@ -1,4 +1,4 @@ -// Copyright 2024 The Go Authors. All rights reserved. +// Copyright 2025 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. @@ -2151,6 +2151,8 @@ var PackageSymbols = map[string][]Symbol{ {"(Type).String", Method, 0}, {"(Version).GoString", Method, 0}, {"(Version).String", Method, 0}, + {"(VersionIndex).Index", Method, 24}, + {"(VersionIndex).IsHidden", Method, 24}, {"ARM_MAGIC_TRAMP_NUMBER", Const, 0}, {"COMPRESS_HIOS", Const, 6}, {"COMPRESS_HIPROC", Const, 6}, @@ -3834,6 +3836,7 @@ var PackageSymbols = map[string][]Symbol{ {"SymType", Type, 0}, {"SymVis", Type, 0}, {"Symbol", Type, 0}, + {"Symbol.HasVersion", Field, 24}, {"Symbol.Info", Field, 0}, {"Symbol.Library", Field, 13}, {"Symbol.Name", Field, 0}, @@ -3843,18 +3846,12 @@ var PackageSymbols = map[string][]Symbol{ {"Symbol.Value", Field, 0}, {"Symbol.Version", Field, 13}, {"Symbol.VersionIndex", Field, 24}, - {"Symbol.VersionScope", Field, 24}, - {"SymbolVersionScope", Type, 24}, {"Type", Type, 0}, {"VER_FLG_BASE", Const, 24}, {"VER_FLG_INFO", Const, 24}, {"VER_FLG_WEAK", Const, 24}, {"Version", Type, 0}, - {"VersionScopeGlobal", Const, 24}, - {"VersionScopeHidden", Const, 24}, - {"VersionScopeLocal", Const, 24}, - {"VersionScopeNone", Const, 24}, - {"VersionScopeSpecific", Const, 24}, + {"VersionIndex", Type, 24}, }, "debug/gosym": { {"(*DecodingError).Error", Method, 0}, @@ -7122,6 +7119,7 @@ var PackageSymbols = map[string][]Symbol{ {"FormatFileInfo", Func, 21}, {"Glob", Func, 16}, {"GlobFS", Type, 16}, + {"Lstat", Func, 25}, {"ModeAppend", Const, 16}, {"ModeCharDevice", Const, 16}, {"ModeDevice", Const, 16}, @@ -7146,6 +7144,8 @@ var PackageSymbols = map[string][]Symbol{ {"ReadDirFile", Type, 16}, {"ReadFile", Func, 16}, {"ReadFileFS", Type, 16}, + {"ReadLink", Func, 25}, + {"ReadLinkFS", Type, 25}, {"SkipAll", Var, 20}, {"SkipDir", Var, 16}, {"Stat", Func, 16}, @@ -9149,6 +9149,8 @@ var PackageSymbols = map[string][]Symbol{ {"(*ProcessState).SysUsage", Method, 0}, {"(*ProcessState).SystemTime", Method, 0}, {"(*ProcessState).UserTime", Method, 0}, + {"(*Root).Chmod", Method, 25}, + {"(*Root).Chown", Method, 25}, {"(*Root).Close", Method, 24}, {"(*Root).Create", Method, 24}, {"(*Root).FS", Method, 24}, @@ -16757,9 +16759,11 @@ var PackageSymbols = map[string][]Symbol{ }, "testing/fstest": { {"(MapFS).Glob", Method, 16}, + {"(MapFS).Lstat", Method, 25}, {"(MapFS).Open", Method, 16}, {"(MapFS).ReadDir", Method, 16}, {"(MapFS).ReadFile", Method, 16}, + {"(MapFS).ReadLink", Method, 25}, {"(MapFS).Stat", Method, 16}, {"(MapFS).Sub", Method, 16}, {"MapFS", Type, 16}, diff --git a/vendor/golang.org/x/tools/internal/stdlib/stdlib.go b/vendor/golang.org/x/tools/internal/stdlib/stdlib.go index 98904017f..3d96d3bf6 100644 --- a/vendor/golang.org/x/tools/internal/stdlib/stdlib.go +++ b/vendor/golang.org/x/tools/internal/stdlib/stdlib.go @@ -6,7 +6,7 @@ // Package stdlib provides a table of all exported symbols in the // standard library, along with the version at which they first -// appeared. +// appeared. It also provides the import graph of std packages. package stdlib import ( diff --git a/vendor/golang.org/x/tools/internal/typeparams/normalize.go b/vendor/golang.org/x/tools/internal/typeparams/normalize.go index 93c80fdc9..f49802b8e 100644 --- a/vendor/golang.org/x/tools/internal/typeparams/normalize.go +++ b/vendor/golang.org/x/tools/internal/typeparams/normalize.go @@ -120,7 +120,7 @@ type termSet struct { terms termlist } -func indentf(depth int, format string, args ...interface{}) { +func indentf(depth int, format string, args ...any) { fmt.Fprintf(os.Stderr, strings.Repeat(".", depth)+format+"\n", args...) } diff --git a/vendor/golang.org/x/tools/internal/typesinternal/types.go b/vendor/golang.org/x/tools/internal/typesinternal/types.go index 345348796..edf0347ec 100644 --- a/vendor/golang.org/x/tools/internal/typesinternal/types.go +++ b/vendor/golang.org/x/tools/internal/typesinternal/types.go @@ -32,12 +32,14 @@ func SetUsesCgo(conf *types.Config) bool { return true } -// ReadGo116ErrorData extracts additional information from types.Error values +// ErrorCodeStartEnd extracts additional information from types.Error values // generated by Go version 1.16 and later: the error code, start position, and // end position. If all positions are valid, start <= err.Pos <= end. // // If the data could not be read, the final result parameter will be false. -func ReadGo116ErrorData(err types.Error) (code ErrorCode, start, end token.Pos, ok bool) { +// +// TODO(adonovan): eliminate start/end when proposal #71803 is accepted. +func ErrorCodeStartEnd(err types.Error) (code ErrorCode, start, end token.Pos, ok bool) { var data [3]int // By coincidence all of these fields are ints, which simplifies things. v := reflect.ValueOf(err) diff --git a/vendor/modernc.org/libc/CONTRIBUTORS b/vendor/modernc.org/libc/CONTRIBUTORS index ae506d9de..a750cf7d3 100644 --- a/vendor/modernc.org/libc/CONTRIBUTORS +++ b/vendor/modernc.org/libc/CONTRIBUTORS @@ -16,7 +16,8 @@ Jason DeBettencourt Koichi Shiraishi Marius Orcsik Patricio Whittingslow +Roman Khafizianov Scot C Bontrager Steffen Butzer W. Michael Petullo -ZHU Zijia +ZHU Zijia \ No newline at end of file diff --git a/vendor/modernc.org/libc/build_all_targets.sh b/vendor/modernc.org/libc/build_all_targets.sh index c682fae2b..f0b66aa00 100644 --- a/vendor/modernc.org/libc/build_all_targets.sh +++ b/vendor/modernc.org/libc/build_all_targets.sh @@ -1,5 +1,5 @@ set -e -for tag in none libc.dmesg libc.membrk libc.memgrind libc.strace +for tag in none libc.dmesg libc.membrk libc.memgrind libc.strace libc.memexpvar do echo "-tags=$tag" echo "GOOS=darwin GOARCH=amd64" diff --git a/vendor/modernc.org/libc/ccgo_linux_arm64.go b/vendor/modernc.org/libc/ccgo_linux_arm64.go index e62081955..dd003c214 100644 --- a/vendor/modernc.org/libc/ccgo_linux_arm64.go +++ b/vendor/modernc.org/libc/ccgo_linux_arm64.go @@ -13867,7 +13867,7 @@ func X__ctype_get_mb_cur_max(tls *TLS) (r Tsize_t) { } var v1 int32 _ = v1 - if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale)) != 0) { + if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale)) != 0) { v1 = int32(4) } else { v1 = int32(1) @@ -24948,7 +24948,7 @@ func X__reset_tls(tls *TLS) { var mem, p uintptr var self Tpthread_t _, _, _, _, _ = i, mem, n, p, self - self = ___get_tp(tls) + self = uintptr(___get_tp(tls)) n = *(*Tuintptr_t)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(self)).Fdtv)) if n != 0 { p = X__libc.Ftls_head @@ -24984,7 +24984,7 @@ func X__init_ssp(tls *TLS, entropy uintptr) { * still be detected. Endianness is taken care of * automatically. */ *(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&X__stack_chk_guard)) + 1)) = uint8(0) - (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Fcanary = X__stack_chk_guard + (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Fcanary = X__stack_chk_guard } func X__stack_chk_fail(tls *TLS) { @@ -25593,7 +25593,7 @@ func Xstrerror(tls *TLS, e int32) (r uintptr) { trc("tls=%v e=%v, (%v:)", tls, e, origin(2)) defer func() { trc("-> %v", r) }() } - return X__strerror_l(tls, e, (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale) + return X__strerror_l(tls, e, (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale) } func Xstrerror_l(tls *TLS, e int32, loc Tlocale_t) (r uintptr) { @@ -31053,7 +31053,7 @@ func X__lctrans_cur(tls *TLS, msg uintptr) (r uintptr) { trc("tls=%v msg=%v, (%v:)", tls, msg, origin(2)) defer func() { trc("-> %v", r) }() } - return X__lctrans_impl(tls, msg, *(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale + 5*8))) + return X__lctrans_impl(tls, msg, *(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale + 5*8))) } func _swapc(tls *TLS, x Tuint32_t, c int32) (r Tuint32_t) { @@ -31654,7 +31654,7 @@ func Xdcngettext(tls *TLS, domainname uintptr, msgid1 uintptr, msgid2 uintptr, n var _ /* z at bp+8 */ uintptr _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ = alt_modlen, catlen, catname, csp, dirlen, dirname, domlen, l, lm, loc, loclen, locname, locp, map1, modlen, modname, name, np, old, old_cats, old_errno, p3, plural, q, r, r1, rem, rule, trans, v, v10, v11, v12, v14, v15, v17, v18, v21, v23, v26, v3, v5, v6, v8, v9 defer func() { Xrealloc(tls, name, 0) }() - loc = (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale + loc = (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale old_errno = *(*int32)(unsafe.Pointer(X__errno_location(tls))) /* match gnu gettext behaviour */ if !(msgid1 != 0) { @@ -98326,7 +98326,7 @@ func Xiconv(tls *TLS, cd Ticonv_t, in uintptr, inb uintptr, out uintptr, outb ui *(*Tmbstate_t)(unsafe.Pointer(bp + 24)) = Tmbstate_t{} type1 = *(*uint8)(unsafe.Pointer(map1 + uintptr(-Int32FromInt32(1)))) totype = *(*uint8)(unsafe.Pointer(tomap + uintptr(-Int32FromInt32(1)))) - ploc = ___get_tp(tls) + 152 + ploc = uintptr(___get_tp(tls)) + 152 loc = *(*Tlocale_t)(unsafe.Pointer(ploc)) if !(in != 0) || !(*(*uintptr)(unsafe.Pointer(in)) != 0) || !(*(*Tsize_t)(unsafe.Pointer(inb)) != 0) { return uint64(0) @@ -99360,7 +99360,7 @@ func X__nl_langinfo(tls *TLS, item Tnl_item) (r uintptr) { trc("tls=%v item=%v, (%v:)", tls, item, origin(2)) defer func() { trc("-> %v", r) }() } - return X__nl_langinfo_l(tls, item, (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale) + return X__nl_langinfo_l(tls, item, (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale) } func Xnl_langinfo(tls *TLS, item Tnl_item) (r uintptr) { @@ -100078,7 +100078,7 @@ func Xstrcoll(tls *TLS, l uintptr, r uintptr) (r1 int32) { trc("tls=%v l=%v r=%v, (%v:)", tls, l, r, origin(2)) defer func() { trc("-> %v", r1) }() } - return X__strcoll_l(tls, l, r, (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale) + return X__strcoll_l(tls, l, r, (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale) } func Xstrcoll_l(tls *TLS, l uintptr, r uintptr, loc Tlocale_t) (r1 int32) { @@ -100244,7 +100244,7 @@ func Xstrfmon(tls *TLS, s uintptr, n Tsize_t, fmt uintptr, va uintptr) (r Tssize var ret Tssize_t _, _ = ap, ret ap = va - ret = _vstrfmon_l(tls, s, n, (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale, fmt, ap) + ret = _vstrfmon_l(tls, s, n, (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale, fmt, ap) _ = ap return ret } @@ -100319,7 +100319,7 @@ func Xstrxfrm(tls *TLS, dest uintptr, src uintptr, n Tsize_t) (r Tsize_t) { trc("tls=%v dest=%v src=%v n=%v, (%v:)", tls, dest, src, n, origin(2)) defer func() { trc("-> %v", r) }() } - return X__strxfrm_l(tls, dest, src, n, (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale) + return X__strxfrm_l(tls, dest, src, n, (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale) } // C documentation @@ -100408,7 +100408,7 @@ func X__uselocale(tls *TLS, new1 Tlocale_t) (r Tlocale_t) { var global, old, v1, v2 Tlocale_t var self Tpthread_t _, _, _, _, _ = global, old, self, v1, v2 - self = ___get_tp(tls) + self = uintptr(___get_tp(tls)) old = (*t__pthread)(unsafe.Pointer(self)).Flocale global = uintptr(unsafe.Pointer(&X__libc)) + 56 if new1 != 0 { @@ -100451,7 +100451,7 @@ func Xwcscoll(tls *TLS, l uintptr, r uintptr) (r1 int32) { trc("tls=%v l=%v r=%v, (%v:)", tls, l, r, origin(2)) defer func() { trc("-> %v", r1) }() } - return X__wcscoll_l(tls, l, r, (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale) + return X__wcscoll_l(tls, l, r, (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale) } // C documentation @@ -100492,7 +100492,7 @@ func Xwcsxfrm(tls *TLS, dest uintptr, src uintptr, n Tsize_t) (r Tsize_t) { trc("tls=%v dest=%v src=%v n=%v, (%v:)", tls, dest, src, n, origin(2)) defer func() { trc("-> %v", r) }() } - return X__wcsxfrm_l(tls, dest, src, n, (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale) + return X__wcsxfrm_l(tls, dest, src, n, (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale) } // C documentation @@ -102254,7 +102254,7 @@ func Xasinh(tls *TLS, x3 float64) (r float64) { if uint64(8) == uint64(8) { y1 = x3 + Float64FromFloat32(1.329227995784916e+36) } else { - y2 = x3 + Float64FromFloat32(1.329227995784916e+36) + y2 = float64(x3 + Float64FromFloat32(1.329227995784916e+36)) } } } @@ -103035,7 +103035,7 @@ func Xcbrt(tls *TLS, x float64) (r1 float64) { hx = hx/uint32(3) + _B1 } p1 = bp - *(*Tuint64_t)(unsafe.Pointer(p1)) = *(*Tuint64_t)(unsafe.Pointer(p1)) & (Uint64FromUint64(1) << Int32FromInt32(63)) + *(*Tuint64_t)(unsafe.Pointer(p1)) = Tuint64_t(*(*Tuint64_t)(unsafe.Pointer(p1)) & (Uint64FromUint64(1) << Int32FromInt32(63))) *(*Tuint64_t)(unsafe.Pointer(bp)) |= uint64(hx) << int32(32) t = *(*float64)(unsafe.Pointer(bp)) /* @@ -103061,7 +103061,7 @@ func Xcbrt(tls *TLS, x float64) (r1 float64) { * before the final error is larger than 0.667 ulps. */ *(*float64)(unsafe.Pointer(bp)) = t - *(*Tuint64_t)(unsafe.Pointer(bp)) = (*(*Tuint64_t)(unsafe.Pointer(bp)) + Uint64FromUint32(0x80000000)) & uint64(0xffffffffc0000000) + *(*Tuint64_t)(unsafe.Pointer(bp)) = uint64(*(*Tuint64_t)(unsafe.Pointer(bp))+Uint64FromUint32(0x80000000)) & uint64(0xffffffffc0000000) t = *(*float64)(unsafe.Pointer(bp)) /* one step Newton iteration to 53 bits with error < 0.667 ulps */ s = t * t /* t*t is exact */ @@ -103313,9 +103313,9 @@ func Xcopysign(tls *TLS, x float64, y float64) (r float64) { }{} *(*float64)(unsafe.Pointer(bp + 8)) = y p1 = bp - *(*Tuint64_t)(unsafe.Pointer(p1)) = *(*Tuint64_t)(unsafe.Pointer(p1)) & (-Uint64FromUint64(1) / Uint64FromInt32(2)) + *(*Tuint64_t)(unsafe.Pointer(p1)) = Tuint64_t(*(*Tuint64_t)(unsafe.Pointer(p1)) & (-Uint64FromUint64(1) / Uint64FromInt32(2))) p2 = bp - *(*Tuint64_t)(unsafe.Pointer(p2)) = *(*Tuint64_t)(unsafe.Pointer(p2)) | *(*Tuint64_t)(unsafe.Pointer(bp + 8))&(Uint64FromUint64(1)< 0, the exponent of scale might have overflowed by <= 460. */ - sbits = sbits - Uint64FromUint64(1009)< 0, the exponent of scale might have overflowed by 1. */ - sbits = sbits - Uint64FromUint64(1)<> Int32FromInt32(12)) - uxi = uxi | Uint64FromUint64(1)<> Int32FromInt32(12))) + uxi = Tuint64_t(uxi | Uint64FromUint64(1)<> Int32FromInt32(12)) + *(*Tuint64_t)(unsafe.Pointer(p6)) = Tuint64_t(*(*Tuint64_t)(unsafe.Pointer(p6)) & (-Uint64FromUint64(1) >> Int32FromInt32(12))) p7 = bp + 16 - *(*Tuint64_t)(unsafe.Pointer(p7)) = *(*Tuint64_t)(unsafe.Pointer(p7)) | Uint64FromUint64(1)< 0 { - uxi = uxi - Uint64FromUint64(1)<>= Uint64FromInt32(-ex + int32(1)) @@ -106064,9 +106064,9 @@ func Xfrexp(tls *TLS, x float64, e uintptr) (r float64) { } *(*int32)(unsafe.Pointer(e)) = ee - int32(0x3fe) p1 = bp - *(*Tuint64_t)(unsafe.Pointer(p1)) = *(*Tuint64_t)(unsafe.Pointer(p1)) & Uint64FromUint64(0x800fffffffffffff) + *(*Tuint64_t)(unsafe.Pointer(p1)) = Tuint64_t(*(*Tuint64_t)(unsafe.Pointer(p1)) & Uint64FromUint64(0x800fffffffffffff)) p2 = bp - *(*Tuint64_t)(unsafe.Pointer(p2)) = *(*Tuint64_t)(unsafe.Pointer(p2)) | Uint64FromUint64(0x3fe0000000000000) + *(*Tuint64_t)(unsafe.Pointer(p2)) = Tuint64_t(*(*Tuint64_t)(unsafe.Pointer(p2)) | Uint64FromUint64(0x3fe0000000000000)) return *(*float64)(unsafe.Pointer(bp)) } @@ -106179,9 +106179,9 @@ func Xhypot(tls *TLS, x float64, y float64) (r float64) { *(*float64)(unsafe.Pointer(bp + 8)) = y /* arrange |x| >= |y| */ p1 = bp - *(*Tuint64_t)(unsafe.Pointer(p1)) = *(*Tuint64_t)(unsafe.Pointer(p1)) & (-Uint64FromUint64(1) >> Int32FromInt32(1)) + *(*Tuint64_t)(unsafe.Pointer(p1)) = Tuint64_t(*(*Tuint64_t)(unsafe.Pointer(p1)) & (-Uint64FromUint64(1) >> Int32FromInt32(1))) p2 = bp + 8 - *(*Tuint64_t)(unsafe.Pointer(p2)) = *(*Tuint64_t)(unsafe.Pointer(p2)) & (-Uint64FromUint64(1) >> Int32FromInt32(1)) + *(*Tuint64_t)(unsafe.Pointer(p2)) = Tuint64_t(*(*Tuint64_t)(unsafe.Pointer(p2)) & (-Uint64FromUint64(1) >> Int32FromInt32(1))) if *(*Tuint64_t)(unsafe.Pointer(bp)) < *(*Tuint64_t)(unsafe.Pointer(bp + 8)) { ut = *(*struct { Fi [0]Tuint64_t @@ -109056,7 +109056,7 @@ func Xlog(tls *TLS, x1 float64) (r1 float64) { /* x is subnormal, normalize it. */ v9 = x1 * float64(4.503599627370496e+15) ix = *(*Tuint64_t)(unsafe.Pointer(&v9)) - ix = ix - Uint64FromUint64(52)<> (Int32FromInt32(52) - Int32FromInt32(LOG_TABLE_BITS)) % Uint64FromInt32(Int32FromInt32(1)<> int32(52)) /* arithmetic shift */ - iz = ix - tmp&(Uint64FromUint64(0xfff)<> (Int32FromInt32(52) - Int32FromInt32(LOG2_TABLE_BITS)) % Uint64FromInt32(Int32FromInt32(1)<> int32(52)) /* arithmetic shift */ - iz = ix - tmp&(Uint64FromUint64(0xfff)<> Int32FromInt32(12) >> e + mask = uint64(-Uint64FromUint64(1) >> Int32FromInt32(12) >> e) if *(*Tuint64_t)(unsafe.Pointer(bp))&mask == uint64(0) { *(*float64)(unsafe.Pointer(iptr)) = x p3 = bp - *(*Tuint64_t)(unsafe.Pointer(p3)) = *(*Tuint64_t)(unsafe.Pointer(p3)) & (Uint64FromUint64(1) << Int32FromInt32(63)) + *(*Tuint64_t)(unsafe.Pointer(p3)) = Tuint64_t(*(*Tuint64_t)(unsafe.Pointer(p3)) & (Uint64FromUint64(1) << Int32FromInt32(63))) return *(*float64)(unsafe.Pointer(bp)) } *(*Tuint64_t)(unsafe.Pointer(bp)) &= ^mask @@ -110170,13 +110170,13 @@ _2: if *(*Tuint64_t)(unsafe.Pointer(bp + 8)) == *(*Tuint64_t)(unsafe.Pointer(bp + 16)) { return y3 } - ax = *(*Tuint64_t)(unsafe.Pointer(bp + 8)) & (-Uint64FromUint64(1) / Uint64FromInt32(2)) - ay = *(*Tuint64_t)(unsafe.Pointer(bp + 16)) & (-Uint64FromUint64(1) / Uint64FromInt32(2)) + ax = uint64(*(*Tuint64_t)(unsafe.Pointer(bp + 8)) & (-Uint64FromUint64(1) / Uint64FromInt32(2))) + ay = uint64(*(*Tuint64_t)(unsafe.Pointer(bp + 16)) & (-Uint64FromUint64(1) / Uint64FromInt32(2))) if ax == uint64(0) { if ay == uint64(0) { return y3 } - *(*Tuint64_t)(unsafe.Pointer(bp + 8)) = *(*Tuint64_t)(unsafe.Pointer(bp + 16))&(Uint64FromUint64(1)< ay || (*(*Tuint64_t)(unsafe.Pointer(bp + 8))^*(*Tuint64_t)(unsafe.Pointer(bp + 16)))&(Uint64FromUint64(1)<> (Int32FromInt32(52) - Int32FromInt32(POW_LOG_TABLE_BITS)) % Uint64FromInt32(Int32FromInt32(1)<> int32(52)) /* arithmetic shift */ - iz = ix - tmp&(Uint64FromUint64(0xfff)< 0, the exponent of scale might have overflowed by <= 460. */ - sbits = sbits - Uint64FromUint64(1009)<> Int32FromInt32(12)) - uxi = uxi | Uint64FromUint64(1)<> Int32FromInt32(12))) + uxi = Tuint64_t(uxi | Uint64FromUint64(1)<> Int32FromInt32(12)) + *(*Tuint64_t)(unsafe.Pointer(p6)) = Tuint64_t(*(*Tuint64_t)(unsafe.Pointer(p6)) & (-Uint64FromUint64(1) >> Int32FromInt32(12))) p7 = bp + 16 - *(*Tuint64_t)(unsafe.Pointer(p7)) = *(*Tuint64_t)(unsafe.Pointer(p7)) | Uint64FromUint64(1)< 0 { - uxi = uxi - Uint64FromUint64(1)<>= Uint64FromInt32(-ex + int32(1)) @@ -111611,7 +111611,7 @@ func Xround(tls *TLS, x3 float64) (r float64) { if uint64(8) == uint64(8) { y1 = x3 + _toint6 } else { - y2 = x3 + _toint6 + y2 = float64(x3 + _toint6) } } return Float64FromInt32(0) * *(*float64)(unsafe.Pointer(bp)) @@ -113368,7 +113368,7 @@ func Xtrunc(tls *TLS, x3 float64) (r float64) { if e < int32(12) { e = int32(1) } - m = -Uint64FromUint64(1) >> e + m = uint64(-Uint64FromUint64(1) >> e) if *(*Tuint64_t)(unsafe.Pointer(bp))&m == uint64(0) { return x3 } @@ -113378,7 +113378,7 @@ func Xtrunc(tls *TLS, x3 float64) (r float64) { if uint64(8) == uint64(8) { y1 = x3 + Float64FromFloat32(1.329227995784916e+36) } else { - y2 = x3 + Float64FromFloat32(1.329227995784916e+36) + y2 = float64(x3 + Float64FromFloat32(1.329227995784916e+36)) } } *(*Tuint64_t)(unsafe.Pointer(bp)) &= ^m @@ -116571,7 +116571,7 @@ func Xbtowc(tls *TLS, c int32) (r Twint_t) { if Uint32FromInt32(b) < uint32(128) { v1 = Uint32FromInt32(b) } else { - if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale)) != 0) { + if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale)) != 0) { v3 = int32(4) } else { v3 = int32(1) @@ -116772,7 +116772,7 @@ func Xmbrtowc(tls *TLS, wc uintptr, src uintptr, n Tsize_t, st uintptr) (r Tsize *(*Twchar_t)(unsafe.Pointer(wc)) = v1 return BoolUint64(!!(v1 != 0)) } - if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale)) != 0) { + if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale)) != 0) { v2 = int32(4) } else { v2 = int32(1) @@ -116943,7 +116943,7 @@ func Xmbsrtowcs(tls *TLS, ws uintptr, src uintptr, wn Tsize_t, st uintptr) (r Ts goto resume0 } } - if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale)) != 0) { + if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale)) != 0) { v3 = int32(4) } else { v3 = int32(1) @@ -117171,7 +117171,7 @@ func Xmbtowc(tls *TLS, wc uintptr, src uintptr, n Tsize_t) (r int32) { *(*Twchar_t)(unsafe.Pointer(wc)) = v1 return BoolInt32(!!(v1 != 0)) } - if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale)) != 0) { + if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale)) != 0) { v2 = int32(4) } else { v2 = int32(1) @@ -117241,7 +117241,7 @@ func Xwcrtomb(tls *TLS, s uintptr, wc Twchar_t, st uintptr) (r Tsize_t) { *(*uint8)(unsafe.Pointer(s)) = uint8(wc) return uint64(1) } else { - if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale)) != 0) { + if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale)) != 0) { v1 = int32(4) } else { v1 = int32(1) @@ -117448,7 +117448,7 @@ func Xwctob(tls *TLS, c Twint_t) (r int32) { if c < uint32(128) { return Int32FromUint32(c) } - if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale)) != 0) { + if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale)) != 0) { v1 = int32(4) } else { v1 = int32(1) @@ -121074,10 +121074,10 @@ func X__h_errno_location(tls *TLS) (r uintptr) { trc("tls=%v, (%v:)", tls, origin(2)) defer func() { trc("-> %v", r) }() } - if !((*t__pthread)(unsafe.Pointer(___get_tp(tls))).Fstack != 0) { + if !((*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Fstack != 0) { return uintptr(unsafe.Pointer(&Xh_errno)) } - return ___get_tp(tls) + 144 + return uintptr(___get_tp(tls)) + 144 } func Xherror(tls *TLS, msg uintptr) { @@ -127885,7 +127885,7 @@ func _fnmatch_internal(tls *TLS, pat uintptr, m Tsize_t, str uintptr, n Tsize_t, break } if v9 = uint32(*(*uint8)(unsafe.Pointer(s + uintptr(-Int32FromInt32(1))))) < uint32(128); !v9 { - if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale)) != 0) { + if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale)) != 0) { v8 = int32(4) } else { v8 = int32(1) @@ -134350,7 +134350,7 @@ func Xraise(tls *TLS, sig int32) (r int32) { var _ /* set at bp+0 */ Tsigset_t _ = ret X__block_app_sigs(tls, bp) - ret = int32(X__syscall_ret(tls, Uint64FromInt64(X__syscall2(tls, int64(SYS_tkill), int64((*t__pthread)(unsafe.Pointer(___get_tp(tls))).Ftid), int64(sig))))) + ret = int32(X__syscall_ret(tls, Uint64FromInt64(X__syscall2(tls, int64(SYS_tkill), int64((*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Ftid), int64(sig))))) X__restore_sigs(tls, bp) return ret } @@ -135144,13 +135144,13 @@ func _fstatat_statx(tls *TLS, fd int32, path uintptr, st uintptr, flag int32) (r return ret } *(*Tstat)(unsafe.Pointer(st)) = Tstat{ - Fst_dev: uint64((*(*Tstatx1)(unsafe.Pointer(bp))).Fstx_dev_major)&Uint64FromUint64(0xfffff000)<= 0 { v1 = ___lockfile(tls, f) @@ -137853,7 +137853,7 @@ func X__do_orphaned_stdio_locks(tls *TLS) { } var f uintptr _ = f - f = (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Fstdio_locks + f = (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Fstdio_locks for { if !(f != 0) { break @@ -137881,7 +137881,7 @@ func X__unlist_locked_file(tls *TLS, f uintptr) { if (*TFILE)(unsafe.Pointer(f)).Fprev_locked != 0 { (*TFILE)(unsafe.Pointer((*TFILE)(unsafe.Pointer(f)).Fprev_locked)).Fnext_locked = (*TFILE)(unsafe.Pointer(f)).Fnext_locked } else { - (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Fstdio_locks = (*TFILE)(unsafe.Pointer(f)).Fnext_locked + (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Fstdio_locks = (*TFILE)(unsafe.Pointer(f)).Fnext_locked } } } @@ -137909,7 +137909,7 @@ func Xftrylockfile(tls *TLS, f uintptr) (r1 int32) { var v10 bool var v2 uintptr _, _, _, _, _, _, _, _, _, _, _, _ = old, owner, r, self, tid, v, v1, v10, v2, v3, v6, v8 - self = ___get_tp(tls) + self = uintptr(___get_tp(tls)) tid = (*t__pthread)(unsafe.Pointer(self)).Ftid owner = AtomicLoadPInt32(f + 140) if owner & ^Int32FromInt32(MAYBE_WAITERS) == tid { @@ -137991,7 +137991,7 @@ func Xfwide(tls *TLS, f uintptr, mode int32) (r int32) { __need_unlock = v1 if mode != 0 { if !((*TFILE)(unsafe.Pointer(f)).Flocale != 0) { - if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale)) != 0) { + if !!(*(*uintptr)(unsafe.Pointer((*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale)) != 0) { v3 = int32(4) } else { v3 = int32(1) @@ -138228,7 +138228,7 @@ func Xgetc(tls *TLS, f1 uintptr) (r int32) { _, _, _, _, _, _ = l, v1, v2, v4, v5, v6 v1 = f1 l = AtomicLoadPInt32(v1 + 140) - if l < 0 || l != 0 && l & ^Int32FromInt32(MAYBE_WAITERS) == (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Ftid { + if l < 0 || l != 0 && l & ^Int32FromInt32(MAYBE_WAITERS) == (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Ftid { if (*TFILE)(unsafe.Pointer(v1)).Frpos != (*TFILE)(unsafe.Pointer(v1)).Frend { v6 = v1 + 8 v5 = *(*uintptr)(unsafe.Pointer(v6)) @@ -138383,7 +138383,7 @@ func Xgetchar(tls *TLS) (r int32) { _, _, _, _, _, _ = l, v1, v2, v4, v5, v6 v1 = uintptr(unsafe.Pointer(&X__stdin_FILE)) l = AtomicLoadPInt32(v1 + 140) - if l < 0 || l != 0 && l & ^Int32FromInt32(MAYBE_WAITERS) == (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Ftid { + if l < 0 || l != 0 && l & ^Int32FromInt32(MAYBE_WAITERS) == (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Ftid { if (*TFILE)(unsafe.Pointer(v1)).Frpos != (*TFILE)(unsafe.Pointer(v1)).Frend { v6 = v1 + 8 v5 = *(*uintptr)(unsafe.Pointer(v6)) @@ -139130,7 +139130,7 @@ func Xputc(tls *TLS, c1 int32, f1 uintptr) (r int32) { v1 = c1 v2 = f1 l = AtomicLoadPInt32(v2 + 140) - if l < 0 || l != 0 && l & ^Int32FromInt32(MAYBE_WAITERS) == (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Ftid { + if l < 0 || l != 0 && l & ^Int32FromInt32(MAYBE_WAITERS) == (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Ftid { if Int32FromUint8(Uint8FromInt32(v1)) != (*TFILE)(unsafe.Pointer(v2)).Flbf && (*TFILE)(unsafe.Pointer(v2)).Fwpos != (*TFILE)(unsafe.Pointer(v2)).Fwend { v6 = Uint8FromInt32(v1) v8 = v2 + 40 @@ -139295,7 +139295,7 @@ func Xputchar(tls *TLS, c1 int32) (r int32) { v1 = c1 v2 = uintptr(unsafe.Pointer(&X__stdout_FILE)) l = AtomicLoadPInt32(v2 + 140) - if l < 0 || l != 0 && l & ^Int32FromInt32(MAYBE_WAITERS) == (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Ftid { + if l < 0 || l != 0 && l & ^Int32FromInt32(MAYBE_WAITERS) == (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Ftid { if Int32FromUint8(Uint8FromInt32(v1)) != (*TFILE)(unsafe.Pointer(v2)).Flbf && (*TFILE)(unsafe.Pointer(v2)).Fwpos != (*TFILE)(unsafe.Pointer(v2)).Fwend { v6 = Uint8FromInt32(v1) v8 = v2 + 40 @@ -139822,7 +139822,7 @@ func Xungetwc(tls *TLS, c Twint_t, f uintptr) (r Twint_t) { var v3 bool var _ /* mbc at bp+0 */ [4]uint8 _, _, _, _, _, _, _, _, _, _ = __need_unlock, l, loc, ploc, v1, v2, v3, v4, v5, p6 - ploc = ___get_tp(tls) + 152 + ploc = uintptr(___get_tp(tls)) + 152 loc = *(*Tlocale_t)(unsafe.Pointer(ploc)) if AtomicLoadPInt32(f+140) >= 0 { v1 = ___lockfile(tls, f) @@ -140074,7 +140074,7 @@ func _pop_arg(tls *TLS, arg uintptr, type1 int32, ap uintptr) { case int32(_ULONG): (*Targ)(unsafe.Pointer(arg)).Fi = VaUint64(&*(*Tva_list)(unsafe.Pointer(ap))) case int32(_ULLONG): - (*Targ)(unsafe.Pointer(arg)).Fi = VaUint64(&*(*Tva_list)(unsafe.Pointer(ap))) + (*Targ)(unsafe.Pointer(arg)).Fi = uint64(VaUint64(&*(*Tva_list)(unsafe.Pointer(ap)))) case int32(_SHORT): (*Targ)(unsafe.Pointer(arg)).Fi = Uint64FromInt16(int16(VaInt32(&*(*Tva_list)(unsafe.Pointer(ap))))) case int32(_USHORT): @@ -140096,7 +140096,7 @@ func _pop_arg(tls *TLS, arg uintptr, type1 int32, ap uintptr) { case int32(_UIPTR): (*Targ)(unsafe.Pointer(arg)).Fi = uint64(VaUintptr(&*(*Tva_list)(unsafe.Pointer(ap)))) case int32(_DBL): - *(*float64)(unsafe.Pointer(arg)) = VaFloat64(&*(*Tva_list)(unsafe.Pointer(ap))) + *(*float64)(unsafe.Pointer(arg)) = float64(VaFloat64(&*(*Tva_list)(unsafe.Pointer(ap)))) case int32(_LDBL): *(*float64)(unsafe.Pointer(arg)) = VaFloat64(&*(*Tva_list)(unsafe.Pointer(ap))) } @@ -142251,7 +142251,7 @@ func _pop_arg1(tls *TLS, arg uintptr, type1 int32, ap uintptr) { case int32(_ULONG): (*Targ)(unsafe.Pointer(arg)).Fi = VaUint64(&*(*Tva_list)(unsafe.Pointer(ap))) case int32(_ULLONG): - (*Targ)(unsafe.Pointer(arg)).Fi = VaUint64(&*(*Tva_list)(unsafe.Pointer(ap))) + (*Targ)(unsafe.Pointer(arg)).Fi = uint64(VaUint64(&*(*Tva_list)(unsafe.Pointer(ap)))) case int32(_SHORT): (*Targ)(unsafe.Pointer(arg)).Fi = Uint64FromInt16(int16(VaInt32(&*(*Tva_list)(unsafe.Pointer(ap))))) case int32(_USHORT): @@ -142273,7 +142273,7 @@ func _pop_arg1(tls *TLS, arg uintptr, type1 int32, ap uintptr) { case int32(_UIPTR): (*Targ)(unsafe.Pointer(arg)).Fi = uint64(VaUintptr(&*(*Tva_list)(unsafe.Pointer(ap)))) case int32(_DBL): - *(*float64)(unsafe.Pointer(arg)) = VaFloat64(&*(*Tva_list)(unsafe.Pointer(ap))) + *(*float64)(unsafe.Pointer(arg)) = float64(VaFloat64(&*(*Tva_list)(unsafe.Pointer(ap)))) case int32(_LDBL): *(*float64)(unsafe.Pointer(arg)) = VaFloat64(&*(*Tva_list)(unsafe.Pointer(ap))) } @@ -144435,7 +144435,7 @@ func Xstrtoul(tls *TLS, s uintptr, p uintptr, base int32) (r uint64) { trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2)) defer func() { trc("-> %v", r) }() } - return _strtox1(tls, s, p, base, Uint64FromUint64(2)*Uint64FromInt64(0x7fffffffffffffff)+Uint64FromInt32(1)) + return _strtox1(tls, s, p, base, uint64(Uint64FromUint64(2)*Uint64FromInt64(0x7fffffffffffffff)+Uint64FromInt32(1))) } func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) (r int64) { @@ -144443,7 +144443,7 @@ func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) (r int64) { trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2)) defer func() { trc("-> %v", r) }() } - return Int64FromUint64(_strtox1(tls, s, p, base, Uint64FromUint64(0)+Uint64FromInt64(-Int64FromInt64(0x7fffffffffffffff)-Int64FromInt32(1)))) + return Int64FromUint64(_strtox1(tls, s, p, base, uint64(Uint64FromUint64(0)+Uint64FromInt64(-Int64FromInt64(0x7fffffffffffffff)-Int64FromInt32(1))))) } func Xstrtoimax(tls *TLS, s uintptr, p uintptr, base int32) (r Tintmax_t) { @@ -144715,7 +144715,7 @@ func Xwcstoul(tls *TLS, s uintptr, p uintptr, base int32) (r uint64) { trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2)) defer func() { trc("-> %v", r) }() } - return _wcstox1(tls, s, p, base, Uint64FromUint64(2)*Uint64FromInt64(0x7fffffffffffffff)+Uint64FromInt32(1)) + return _wcstox1(tls, s, p, base, uint64(Uint64FromUint64(2)*Uint64FromInt64(0x7fffffffffffffff)+Uint64FromInt32(1))) } func Xwcstol(tls *TLS, s uintptr, p uintptr, base int32) (r int64) { @@ -144723,7 +144723,7 @@ func Xwcstol(tls *TLS, s uintptr, p uintptr, base int32) (r int64) { trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2)) defer func() { trc("-> %v", r) }() } - return Int64FromUint64(_wcstox1(tls, s, p, base, Uint64FromUint64(0)+Uint64FromInt64(-Int64FromInt64(0x7fffffffffffffff)-Int64FromInt32(1)))) + return Int64FromUint64(_wcstox1(tls, s, p, base, uint64(Uint64FromUint64(0)+Uint64FromInt64(-Int64FromInt64(0x7fffffffffffffff)-Int64FromInt32(1))))) } func Xwcstoimax(tls *TLS, s uintptr, p uintptr, base int32) (r Tintmax_t) { @@ -148815,7 +148815,7 @@ func _scan_trans(tls *TLS, t int64, local int32, alt uintptr) (r Tsize_t) { if local != 0 { off = Int32FromUint32(_zi_read32(tls, _types+uintptr(int32(6)*Int32FromUint8(*(*uint8)(unsafe.Pointer(_index + uintptr(m-uint64(1)))))))) } - if t-int64(off) < Int64FromUint64(x) { + if t-int64(off) < int64(Int64FromUint64(x)) { n /= uint64(2) } else { a = m @@ -148855,7 +148855,7 @@ func _scan_trans(tls *TLS, t int64, local int32, alt uintptr) (r Tsize_t) { } /* If t is before first transition, use the above-found type * and the index-zero (after transition) type as the alt. */ - if t-int64(off) < Int64FromUint64(x) { + if t-int64(off) < int64(Int64FromUint64(x)) { if alt != 0 { *(*Tsize_t)(unsafe.Pointer(alt)) = uint64(*(*uint8)(unsafe.Pointer(_index))) } @@ -149975,7 +149975,7 @@ func Xstrftime(tls *TLS, s uintptr, n Tsize_t, f uintptr, tm uintptr) (r Tsize_t trc("tls=%v s=%v n=%v f=%v tm=%v, (%v:)", tls, s, n, f, tm, origin(2)) defer func() { trc("-> %v", r) }() } - return X__strftime_l(tls, s, n, f, tm, (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale) + return X__strftime_l(tls, s, n, f, tm, (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale) } func Xstrftime_l(tls *TLS, s uintptr, n Tsize_t, f uintptr, tm uintptr, loc Tlocale_t) (r Tsize_t) { @@ -150719,7 +150719,7 @@ func Xwcsftime(tls *TLS, wcs uintptr, n Tsize_t, f uintptr, tm uintptr) (r Tsize trc("tls=%v wcs=%v n=%v f=%v tm=%v, (%v:)", tls, wcs, n, f, tm, origin(2)) defer func() { trc("-> %v", r) }() } - return X__wcsftime_l(tls, wcs, n, f, tm, (*t__pthread)(unsafe.Pointer(___get_tp(tls))).Flocale) + return X__wcsftime_l(tls, wcs, n, f, tm, (*t__pthread)(unsafe.Pointer(uintptr(___get_tp(tls)))).Flocale) } func Xwcsftime_l(tls *TLS, s uintptr, n Tsize_t, f uintptr, tm uintptr, loc Tlocale_t) (r Tsize_t) { diff --git a/vendor/modernc.org/libc/ccgo_linux_loong64.go b/vendor/modernc.org/libc/ccgo_linux_loong64.go index f2d05a87e..419658922 100644 --- a/vendor/modernc.org/libc/ccgo_linux_loong64.go +++ b/vendor/modernc.org/libc/ccgo_linux_loong64.go @@ -318,8 +318,9 @@ const __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 = 1 const __GCC_IEC_559 = 2 const __GCC_IEC_559_COMPLEX = 2 const __GNUC_EXECUTION_CHARSET_NAME = "UTF-8" -const __GNUC_MINOR__ = 1 -const __GNUC_PATCHLEVEL__ = 0 +const __GNUC_MINOR__ = 2 +const __GNUC_PATCHLEVEL__ = 1 +const __GNUC_RH_RELEASE__ = 6 const __GNUC_STDC_INLINE__ = 1 const __GNUC_WIDE_EXECUTION_CHARSET_NAME = "UTF-32LE" const __GNUC__ = 14 @@ -530,7 +531,7 @@ const __UTA_FBIT__ = 64 const __UTA_IBIT__ = 64 const __UTQ_FBIT__ = 128 const __UTQ_IBIT__ = 0 -const __VERSION__ = "14.1.0 20240507 (Red Hat 14.1.0-1)" +const __VERSION__ = "14.2.1 20241104 (Red Hat 14.2.1-6)" const __WCHAR_MAX__ = 2147483647 const __WCHAR_MIN__ = -2147483648 const __WCHAR_TYPE__ = 0 diff --git a/vendor/modernc.org/libc/etc.go b/vendor/modernc.org/libc/etc.go index 9f12366fd..2d76cc499 100644 --- a/vendor/modernc.org/libc/etc.go +++ b/vendor/modernc.org/libc/etc.go @@ -592,32 +592,6 @@ func roundup(n, to uintptr) uintptr { return n } -func GoString(s uintptr) string { - if s == 0 { - return "" - } - - var buf []byte - for { - b := *(*byte)(unsafe.Pointer(s)) - if b == 0 { - return string(buf) - } - - buf = append(buf, b) - s++ - } -} - -// GoBytes returns a byte slice from a C char* having length len bytes. -func GoBytes(s uintptr, len int) []byte { - if len == 0 { - return nil - } - - return (*RawMem)(unsafe.Pointer(s))[:len:len] -} - func Bool(v bool) bool { return v } func Bool32(b bool) int32 { diff --git a/vendor/modernc.org/libc/libc_all.go b/vendor/modernc.org/libc/libc_all.go index 6e3b97764..7bc730b76 100644 --- a/vendor/modernc.org/libc/libc_all.go +++ b/vendor/modernc.org/libc/libc_all.go @@ -32,3 +32,21 @@ func X__sync_sub_and_fetch[T constraints.Integer](t *TLS, p uintptr, v T) T { panic(todo("")) } } + +// GoString returns the value of a C string at s. +func GoString(s uintptr) string { + if s == 0 { + return "" + } + + p := s + for *(*byte)(unsafe.Pointer(p)) != 0 { + p++ + } + return string(unsafe.Slice((*byte)(unsafe.Pointer(s)), p-s)) +} + +// GoBytes returns a byte slice from a C char* having length len bytes. +func GoBytes(s uintptr, len int) []byte { + return unsafe.Slice((*byte)(unsafe.Pointer(s)), len) +} diff --git a/vendor/modernc.org/libc/libc_musl.go b/vendor/modernc.org/libc/libc_musl.go index a385f7eef..e2d5220a0 100644 --- a/vendor/modernc.org/libc/libc_musl.go +++ b/vendor/modernc.org/libc/libc_musl.go @@ -229,29 +229,6 @@ func CString(s string) (uintptr, error) { return p, nil } -// GoBytes returns a byte slice from a C char* having length len bytes. -func GoBytes(s uintptr, len int) []byte { - return unsafe.Slice((*byte)(unsafe.Pointer(s)), len) -} - -// GoString returns the value of a C string at s. -func GoString(s uintptr) string { - if s == 0 { - return "" - } - - var buf []byte - for { - b := *(*byte)(unsafe.Pointer(s)) - if b == 0 { - return string(buf) - } - - buf = append(buf, b) - s++ - } -} - func mustMalloc(sz Tsize_t) (r uintptr) { if r = Xmalloc(nil, sz); r != 0 || sz == 0 { return r diff --git a/vendor/modernc.org/libc/mem.go b/vendor/modernc.org/libc/mem.go index cf4644edc..df852c2d6 100644 --- a/vendor/modernc.org/libc/mem.go +++ b/vendor/modernc.org/libc/mem.go @@ -121,6 +121,25 @@ func UsableSize(p uintptr) types.Size_t { return types.Size_t(memory.UintptrUsableSize(p)) } +type MemAllocatorStat struct { + Allocs int + Bytes int + Mmaps int +} + +// MemStat returns the global memory allocator statistics. +// should be compiled with the memory.counters build tag for the data to be available. +func MemStat() MemAllocatorStat { + allocMu.Lock() + defer allocMu.Unlock() + + return MemAllocatorStat{ + Allocs: allocator.Allocs, + Bytes: allocator.Bytes, + Mmaps: allocator.Mmaps, + } +} + // MemAuditStart locks the memory allocator, initializes and enables memory // auditing. Finaly it unlocks the memory allocator. // diff --git a/vendor/modernc.org/libc/mem_brk.go b/vendor/modernc.org/libc/mem_brk.go index 3881d8e88..eb2032dba 100644 --- a/vendor/modernc.org/libc/mem_brk.go +++ b/vendor/modernc.org/libc/mem_brk.go @@ -93,6 +93,17 @@ func UsableSize(p uintptr) types.Size_t { return types.Size_t(*(*uintptr)(unsafe.Pointer(p - uintptrSize))) } +type MemAllocatorStat struct { + Allocs int + Bytes int + Mmaps int +} + +// MemStat no-op for this build tag +func MemStat() MemAllocatorStat { + return MemAllocatorStat{} +} + // MemAuditStart locks the memory allocator, initializes and enables memory // auditing. Finaly it unlocks the memory allocator. // diff --git a/vendor/modernc.org/libc/mem_brk_musl.go b/vendor/modernc.org/libc/mem_brk_musl.go index c42fb7be1..c0a4ade52 100644 --- a/vendor/modernc.org/libc/mem_brk_musl.go +++ b/vendor/modernc.org/libc/mem_brk_musl.go @@ -281,6 +281,17 @@ func UsableSize(p uintptr) Tsize_t { return heapUsable[p] } +type MemAllocatorStat struct { + Allocs int + Bytes int + Mmaps int +} + +// MemStat no-op for this build tag +func MemStat() MemAllocatorStat { + return MemAllocatorStat{} +} + // MemAuditStart locks the memory allocator, initializes and enables memory // auditing. Finaly it unlocks the memory allocator. // diff --git a/vendor/modernc.org/libc/mem_expvar.go b/vendor/modernc.org/libc/mem_expvar.go new file mode 100644 index 000000000..e2c5aae7a --- /dev/null +++ b/vendor/modernc.org/libc/mem_expvar.go @@ -0,0 +1,12 @@ +//go:build libc.memexpvar + +package libc + +import "expvar" + +func init() { + // make sure to build with -tags=memory.counters to have the actual data accumulated in memory allocator + expvar.Publish("memory.allocator", expvar.Func(func() interface{} { + return MemStat() + })) +} diff --git a/vendor/modernc.org/libc/mem_musl.go b/vendor/modernc.org/libc/mem_musl.go index 1d43cff1e..20f6c18b9 100644 --- a/vendor/modernc.org/libc/mem_musl.go +++ b/vendor/modernc.org/libc/mem_musl.go @@ -127,6 +127,25 @@ func UsableSize(p uintptr) Tsize_t { return Tsize_t(memory.UintptrUsableSize(p)) } +type MemAllocatorStat struct { + Allocs int + Bytes int + Mmaps int +} + +// MemStat returns the global memory allocator statistics. +// should be compiled with the memory.counters build tag for the data to be available. +func MemStat() MemAllocatorStat { + allocatorMu.Lock() + defer allocatorMu.Unlock() + + return MemAllocatorStat{ + Allocs: allocator.Allocs, + Bytes: allocator.Bytes, + Mmaps: allocator.Mmaps, + } +} + // MemAuditStart locks the memory allocator, initializes and enables memory // auditing. Finaly it unlocks the memory allocator. // diff --git a/vendor/modernc.org/libc/memgrind.go b/vendor/modernc.org/libc/memgrind.go index e43357ae7..ccf5d8a3e 100644 --- a/vendor/modernc.org/libc/memgrind.go +++ b/vendor/modernc.org/libc/memgrind.go @@ -269,6 +269,17 @@ func UsableSize(p uintptr) types.Size_t { return types.Size_t(memory.UintptrUsableSize(p)) } +type MemAllocatorStat struct { + Allocs int + Bytes int + Mmaps int +} + +// MemStat no-op for this build tag +func MemStat() MemAllocatorStat { + return MemAllocatorStat{} +} + // MemAuditStart locks the memory allocator, initializes and enables memory // auditing. Finally it unlocks the memory allocator. // diff --git a/vendor/modernc.org/libc/memgrind_musl.go b/vendor/modernc.org/libc/memgrind_musl.go index 1ee38209d..1dc25ef2f 100644 --- a/vendor/modernc.org/libc/memgrind_musl.go +++ b/vendor/modernc.org/libc/memgrind_musl.go @@ -269,6 +269,17 @@ func UsableSize(p uintptr) Tsize_t { return Tsize_t(memory.UintptrUsableSize(p)) } +type MemAllocatorStat struct { + Allocs int + Bytes int + Mmaps int +} + +// MemStat no-op for this build tag +func MemStat() MemAllocatorStat { + return MemAllocatorStat{} +} + func Xmalloc_usable_size(tls *TLS, p uintptr) (r Tsize_t) { return UsableSize(p) } diff --git a/vendor/modernc.org/libc/musl_linux_amd64.go b/vendor/modernc.org/libc/musl_linux_amd64.go deleted file mode 100644 index 7d40d5f81..000000000 --- a/vendor/modernc.org/libc/musl_linux_amd64.go +++ /dev/null @@ -1,7205 +0,0 @@ -// Code generated by 'ccgo -export-externs X -hide __syscall0,__syscall1,__syscall2,__syscall3,__syscall4,__syscall5,__syscall6 -nostdinc -nostdlib -o ../musl_linux_amd64.go -pkgname libc -static-locals-prefix _s -Iarch/x86_64 -Iarch/generic -Iobj/src/internal -Isrc/include -Isrc/internal -Iobj/include -Iinclude copyright.c src/ctype/__ctype_b_loc.c src/ctype/isalnum.c src/ctype/isalpha.c src/ctype/isdigit.c src/ctype/islower.c src/ctype/isprint.c src/ctype/isupper.c src/ctype/isxdigit.c src/dirent/closedir.c src/dirent/opendir.c src/dirent/readdir.c src/internal/floatscan.c src/internal/intscan.c src/internal/shgetc.c src/locale/localeconv.c src/math/__fpclassify.c src/math/__fpclassifyf.c src/math/__fpclassifyl.c src/math/copysignl.c src/math/fabsl.c src/math/fmodl.c src/math/nanf.c src/math/rint.c src/math/scalbn.c src/math/scalbnl.c src/multibyte/internal.c src/multibyte/mbrtowc.c src/multibyte/mbsinit.c src/network/freeaddrinfo.c src/network/getaddrinfo.c src/network/gethostbyaddr.c src/network/gethostbyaddr_r.c src/network/gethostbyname.c src/network/gethostbyname2.c src/network/gethostbyname2_r.c src/network/gethostbyname_r.c src/network/getnameinfo.c src/network/h_errno.c src/network/inet_aton.c src/network/inet_ntop.c src/network/inet_pton.c src/network/lookup_ipliteral.c src/network/lookup_name.c src/network/lookup_serv.c src/prng/rand_r.c src/stdio/__lockfile.c src/stdio/__toread.c src/stdio/__uflow.c src/stdio/sscanf.c src/stdio/vfscanf.c src/stdio/vsscanf.c src/stdlib/bsearch.c src/stdlib/strtod.c src/stdlib/strtol.c src/string/strdup.c src/string/strlcat.c src/string/strlcpy.c src/string/strncasecmp.c src/string/strncat.c src/string/strnlen.c src/string/strspn.c src/string/strtok.c src/thread/pthread_attr_get.c src/thread/pthread_attr_setdetachstate.c src/thread/pthread_mutex_lock.c src/thread/pthread_mutexattr_destroy.c src/thread/pthread_mutexattr_init.c src/thread/pthread_mutexattr_settype.c', DO NOT EDIT. - -//go:build !(linux && amd64) - -package libc - -import ( - "math" - "reflect" - "sync/atomic" - "unsafe" -) - -var _ = math.Pi -var _ reflect.Kind -var _ atomic.Value -var _ unsafe.Pointer - -// musl as a whole is licensed under the following standard MIT license: -// -// ---------------------------------------------------------------------- -// Copyright © 2005-2020 Rich Felker, et al. -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// ---------------------------------------------------------------------- -// -// Authors/contributors include: -// -// A. Wilcox -// Ada Worcester -// Alex Dowad -// Alex Suykov -// Alexander Monakov -// Andre McCurdy -// Andrew Kelley -// Anthony G. Basile -// Aric Belsito -// Arvid Picciani -// Bartosz Brachaczek -// Benjamin Peterson -// Bobby Bingham -// Boris Brezillon -// Brent Cook -// Chris Spiegel -// Clément Vasseur -// Daniel Micay -// Daniel Sabogal -// Daurnimator -// David Carlier -// David Edelsohn -// Denys Vlasenko -// Dmitry Ivanov -// Dmitry V. Levin -// Drew DeVault -// Emil Renner Berthing -// Fangrui Song -// Felix Fietkau -// Felix Janda -// Gianluca Anzolin -// Hauke Mehrtens -// He X -// Hiltjo Posthuma -// Isaac Dunham -// Jaydeep Patil -// Jens Gustedt -// Jeremy Huntwork -// Jo-Philipp Wich -// Joakim Sindholt -// John Spencer -// Julien Ramseier -// Justin Cormack -// Kaarle Ritvanen -// Khem Raj -// Kylie McClain -// Leah Neukirchen -// Luca Barbato -// Luka Perkov -// M Farkas-Dyck (Strake) -// Mahesh Bodapati -// Markus Wichmann -// Masanori Ogino -// Michael Clark -// Michael Forney -// Mikhail Kremnyov -// Natanael Copa -// Nicholas J. Kain -// orc -// Pascal Cuoq -// Patrick Oppenlander -// Petr Hosek -// Petr Skocik -// Pierre Carrier -// Reini Urban -// Rich Felker -// Richard Pennington -// Ryan Fairfax -// Samuel Holland -// Segev Finer -// Shiz -// sin -// Solar Designer -// Stefan Kristiansson -// Stefan O'Rear -// Szabolcs Nagy -// Timo Teräs -// Trutz Behn -// Valentin Ochs -// Will Dietz -// William Haddon -// William Pitcock -// -// Portions of this software are derived from third-party works licensed -// under terms compatible with the above MIT license: -// -// The TRE regular expression implementation (src/regex/reg* and -// src/regex/tre*) is Copyright © 2001-2008 Ville Laurikari and licensed -// under a 2-clause BSD license (license text in the source files). The -// included version has been heavily modified by Rich Felker in 2012, in -// the interests of size, simplicity, and namespace cleanliness. -// -// Much of the math library code (src/math/* and src/complex/*) is -// Copyright © 1993,2004 Sun Microsystems or -// Copyright © 2003-2011 David Schultz or -// Copyright © 2003-2009 Steven G. Kargl or -// Copyright © 2003-2009 Bruce D. Evans or -// Copyright © 2008 Stephen L. Moshier or -// Copyright © 2017-2018 Arm Limited -// and labelled as such in comments in the individual source files. All -// have been licensed under extremely permissive terms. -// -// The ARM memcpy code (src/string/arm/memcpy.S) is Copyright © 2008 -// The Android Open Source Project and is licensed under a two-clause BSD -// license. It was taken from Bionic libc, used on Android. -// -// The AArch64 memcpy and memset code (src/string/aarch64/*) are -// Copyright © 1999-2019, Arm Limited. -// -// The implementation of DES for crypt (src/crypt/crypt_des.c) is -// Copyright © 1994 David Burren. It is licensed under a BSD license. -// -// The implementation of blowfish crypt (src/crypt/crypt_blowfish.c) was -// originally written by Solar Designer and placed into the public -// domain. The code also comes with a fallback permissive license for use -// in jurisdictions that may not recognize the public domain. -// -// The smoothsort implementation (src/stdlib/qsort.c) is Copyright © 2011 -// Valentin Ochs and is licensed under an MIT-style license. -// -// The x86_64 port was written by Nicholas J. Kain and is licensed under -// the standard MIT terms. -// -// The mips and microblaze ports were originally written by Richard -// Pennington for use in the ellcc project. The original code was adapted -// by Rich Felker for build system and code conventions during upstream -// integration. It is licensed under the standard MIT terms. -// -// The mips64 port was contributed by Imagination Technologies and is -// licensed under the standard MIT terms. -// -// The powerpc port was also originally written by Richard Pennington, -// and later supplemented and integrated by John Spencer. It is licensed -// under the standard MIT terms. -// -// All other files which have no copyright comments are original works -// produced specifically for use as part of this library, written either -// by Rich Felker, the main author of the library, or by one or more -// contibutors listed above. Details on authorship of individual files -// can be found in the git version control history of the project. The -// omission of copyright and license comments in each file is in the -// interest of source tree size. -// -// In addition, permission is hereby granted for all public header files -// (include/* and arch/*/bits/*) and crt files intended to be linked into -// applications (crt/*, ldso/dlstart.c, and arch/*/crt_arch.h) to omit -// the copyright notice and permission notice otherwise required by the -// license, and to use these files without any requirement of -// attribution. These files include substantial contributions from: -// -// Bobby Bingham -// John Spencer -// Nicholas J. Kain -// Rich Felker -// Richard Pennington -// Stefan Kristiansson -// Szabolcs Nagy -// -// all of whom have explicitly granted such permission. -// -// This file previously contained text expressing a belief that most of -// the files covered by the above exception were sufficiently trivial not -// to be subject to copyright, resulting in confusion over whether it -// negated the permissions granted in the license. In the spirit of -// permissive licensing, and of not having licensing issues being an -// obstacle to adoption, that text has been removed. -const ( /* copyright.c:194:1: */ - __musl__copyright__ = 0 -) - -const ( /* nameser.h:117:1: */ - ns_uop_delete = 0 - ns_uop_add = 1 - ns_uop_max = 2 -) - -const ( /* nameser.h:147:1: */ - ns_t_invalid = 0 - ns_t_a = 1 - ns_t_ns = 2 - ns_t_md = 3 - ns_t_mf = 4 - ns_t_cname = 5 - ns_t_soa = 6 - ns_t_mb = 7 - ns_t_mg = 8 - ns_t_mr = 9 - ns_t_null = 10 - ns_t_wks = 11 - ns_t_ptr = 12 - ns_t_hinfo = 13 - ns_t_minfo = 14 - ns_t_mx = 15 - ns_t_txt = 16 - ns_t_rp = 17 - ns_t_afsdb = 18 - ns_t_x25 = 19 - ns_t_isdn = 20 - ns_t_rt = 21 - ns_t_nsap = 22 - ns_t_nsap_ptr = 23 - ns_t_sig = 24 - ns_t_key = 25 - ns_t_px = 26 - ns_t_gpos = 27 - ns_t_aaaa = 28 - ns_t_loc = 29 - ns_t_nxt = 30 - ns_t_eid = 31 - ns_t_nimloc = 32 - ns_t_srv = 33 - ns_t_atma = 34 - ns_t_naptr = 35 - ns_t_kx = 36 - ns_t_cert = 37 - ns_t_a6 = 38 - ns_t_dname = 39 - ns_t_sink = 40 - ns_t_opt = 41 - ns_t_apl = 42 - ns_t_tkey = 249 - ns_t_tsig = 250 - ns_t_ixfr = 251 - ns_t_axfr = 252 - ns_t_mailb = 253 - ns_t_maila = 254 - ns_t_any = 255 - ns_t_zxfr = 256 - ns_t_max = 65536 -) - -const ( /* nameser.h:210:1: */ - ns_c_invalid = 0 - ns_c_in = 1 - ns_c_2 = 2 - ns_c_chaos = 3 - ns_c_hs = 4 - ns_c_none = 254 - ns_c_any = 255 - ns_c_max = 65536 -) - -const ( /* nameser.h:221:1: */ - ns_kt_rsa = 1 - ns_kt_dh = 2 - ns_kt_dsa = 3 - ns_kt_private = 254 -) - -const ( /* nameser.h:228:1: */ - cert_t_pkix = 1 - cert_t_spki = 2 - cert_t_pgp = 3 - cert_t_url = 253 - cert_t_oid = 254 -) - -const ( /* nameser.h:28:1: */ - ns_s_qd = 0 - ns_s_zn = 0 - ns_s_an = 1 - ns_s_pr = 1 - ns_s_ns = 2 - ns_s_ud = 2 - ns_s_ar = 3 - ns_s_max = 4 -) - -const ( /* nameser.h:75:1: */ - ns_f_qr = 0 - ns_f_opcode = 1 - ns_f_aa = 2 - ns_f_tc = 3 - ns_f_rd = 4 - ns_f_ra = 5 - ns_f_z = 6 - ns_f_ad = 7 - ns_f_cd = 8 - ns_f_rcode = 9 - ns_f_max = 10 -) - -const ( /* nameser.h:89:1: */ - ns_o_query = 0 - ns_o_iquery = 1 - ns_o_status = 2 - ns_o_notify = 4 - ns_o_update = 5 - ns_o_max = 6 -) - -const ( /* nameser.h:98:1: */ - ns_r_noerror = 0 - ns_r_formerr = 1 - ns_r_servfail = 2 - ns_r_nxdomain = 3 - ns_r_notimpl = 4 - ns_r_refused = 5 - ns_r_yxdomain = 6 - ns_r_yxrrset = 7 - ns_r_nxrrset = 8 - ns_r_notauth = 9 - ns_r_notzone = 10 - ns_r_max = 11 - ns_r_badvers = 16 - ns_r_badsig = 16 - ns_r_badkey = 17 - ns_r_badtime = 18 -) - -const ( /* pthread_impl.h:58:1: */ - DT_EXITING = 0 - DT_JOINABLE = 1 - DT_DETACHED = 2 -) - -type ptrdiff_t = int64 /* :3:26 */ - -type size_t = uint64 /* :9:23 */ - -type wchar_t = int32 /* :15:24 */ - -type uint16_t = uint16 /* alltypes.h:126:25 */ - -type uint32_t = uint32 /* alltypes.h:131:25 */ - -type uint64_t = uint64 /* alltypes.h:136:25 */ - -func __bswap32(tls *TLS, __x uint32_t) uint32_t { /* endian.h:24:26: */ - return __x>>24 | __x>>8&uint32_t(0xff00) | __x<<8&uint32_t(0xff0000) | __x<<24 -} - -var table = [384]uint16{ - uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), - uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), - uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), - uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), - uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), - uint16((0x200/256 | 0x200*256) % 65536), uint16((0x320/256 | 0x320*256) % 65536), uint16((0x220/256 | 0x220*256) % 65536), uint16((0x220/256 | 0x220*256) % 65536), uint16((0x220/256 | 0x220*256) % 65536), uint16((0x220/256 | 0x220*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), - uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), - uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), - uint16((0x160/256 | 0x160*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), - uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), - uint16((0x8d8/256 | 0x8d8*256) % 65536), uint16((0x8d8/256 | 0x8d8*256) % 65536), uint16((0x8d8/256 | 0x8d8*256) % 65536), uint16((0x8d8/256 | 0x8d8*256) % 65536), uint16((0x8d8/256 | 0x8d8*256) % 65536), uint16((0x8d8/256 | 0x8d8*256) % 65536), uint16((0x8d8/256 | 0x8d8*256) % 65536), uint16((0x8d8/256 | 0x8d8*256) % 65536), - uint16((0x8d8/256 | 0x8d8*256) % 65536), uint16((0x8d8/256 | 0x8d8*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), - uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x8d5/256 | 0x8d5*256) % 65536), uint16((0x8d5/256 | 0x8d5*256) % 65536), uint16((0x8d5/256 | 0x8d5*256) % 65536), uint16((0x8d5/256 | 0x8d5*256) % 65536), uint16((0x8d5/256 | 0x8d5*256) % 65536), uint16((0x8d5/256 | 0x8d5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), - uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), - uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), - uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x8c5/256 | 0x8c5*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), - uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x8d6/256 | 0x8d6*256) % 65536), uint16((0x8d6/256 | 0x8d6*256) % 65536), uint16((0x8d6/256 | 0x8d6*256) % 65536), uint16((0x8d6/256 | 0x8d6*256) % 65536), uint16((0x8d6/256 | 0x8d6*256) % 65536), uint16((0x8d6/256 | 0x8d6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), - uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), - uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), - uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x8c6/256 | 0x8c6*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x4c0/256 | 0x4c0*256) % 65536), uint16((0x200/256 | 0x200*256) % 65536), - uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), - uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), - uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), - uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), uint16(0), -} /* __ctype_b_loc.c:9:29 */ - -var ptable uintptr = 0 /* __ctype_b_loc.c:36:29 */ - -func X__ctype_b_loc(tls *TLS) uintptr { /* __ctype_b_loc.c:38:22: */ - if __ccgo_strace { - trc("tls=%v, (%v:)", tls, origin(2)) - } - return uintptr(unsafe.Pointer(&ptable)) -} - -func __isspace(tls *TLS, _c int32) int32 { /* ctype.h:26:21: */ - return Bool32(_c == ' ' || uint32(_c)-uint32('\t') < uint32(5)) -} - -type __locale_struct = struct{ cat [6]uintptr } /* alltypes.h:343:9 */ - -type locale_t = uintptr /* alltypes.h:343:32 */ - -func Xisalnum(tls *TLS, c int32) int32 { /* isalnum.c:3:5: */ - if __ccgo_strace { - trc("tls=%v c=%v, (%v:)", tls, c, origin(2)) - } - return Bool32(func() int32 { - if 0 != 0 { - return Xisalpha(tls, c) - } - return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26)) - }() != 0 || func() int32 { - if 0 != 0 { - return Xisdigit(tls, c) - } - return Bool32(uint32(c)-uint32('0') < uint32(10)) - }() != 0) -} - -func X__isalnum_l(tls *TLS, c int32, l locale_t) int32 { /* isalnum.c:8:5: */ - if __ccgo_strace { - trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2)) - } - return Xisalnum(tls, c) -} - -func Xisalpha(tls *TLS, c int32) int32 { /* isalpha.c:4:5: */ - if __ccgo_strace { - trc("tls=%v c=%v, (%v:)", tls, c, origin(2)) - } - return Bool32(uint32(c)|uint32(32)-uint32('a') < uint32(26)) -} - -func X__isalpha_l(tls *TLS, c int32, l locale_t) int32 { /* isalpha.c:9:5: */ - if __ccgo_strace { - trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2)) - } - return Xisalpha(tls, c) -} - -func Xisdigit(tls *TLS, c int32) int32 { /* isdigit.c:4:5: */ - if __ccgo_strace { - trc("tls=%v c=%v, (%v:)", tls, c, origin(2)) - } - return Bool32(uint32(c)-uint32('0') < uint32(10)) -} - -func X__isdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isdigit.c:9:5: */ - if __ccgo_strace { - trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2)) - } - return Xisdigit(tls, c) -} - -func Xislower(tls *TLS, c int32) int32 { /* islower.c:4:5: */ - if __ccgo_strace { - trc("tls=%v c=%v, (%v:)", tls, c, origin(2)) - } - return Bool32(uint32(c)-uint32('a') < uint32(26)) -} - -func X__islower_l(tls *TLS, c int32, l locale_t) int32 { /* islower.c:9:5: */ - if __ccgo_strace { - trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2)) - } - return Xislower(tls, c) -} - -func Xisprint(tls *TLS, c int32) int32 { /* isprint.c:4:5: */ - if __ccgo_strace { - trc("tls=%v c=%v, (%v:)", tls, c, origin(2)) - } - return Bool32(uint32(c)-uint32(0x20) < uint32(0x5f)) -} - -func X__builtin_isprint(tls *TLS, c int32) int32 { /* isprint.c:4:5: */ - if __ccgo_strace { - trc("tls=%v c=%v, (%v:)", tls, c, origin(2)) - } - return Bool32(uint32(c)-uint32(0x20) < uint32(0x5f)) -} - -func X__isprint_l(tls *TLS, c int32, l locale_t) int32 { /* isprint.c:9:5: */ - if __ccgo_strace { - trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2)) - } - return Xisprint(tls, c) -} - -func Xisupper(tls *TLS, c int32) int32 { /* isupper.c:4:5: */ - if __ccgo_strace { - trc("tls=%v c=%v, (%v:)", tls, c, origin(2)) - } - return Bool32(uint32(c)-uint32('A') < uint32(26)) -} - -func X__isupper_l(tls *TLS, c int32, l locale_t) int32 { /* isupper.c:9:5: */ - if __ccgo_strace { - trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2)) - } - return Xisupper(tls, c) -} - -func Xisxdigit(tls *TLS, c int32) int32 { /* isxdigit.c:3:5: */ - if __ccgo_strace { - trc("tls=%v c=%v, (%v:)", tls, c, origin(2)) - } - return Bool32(func() int32 { - if 0 != 0 { - return Xisdigit(tls, c) - } - return Bool32(uint32(c)-uint32('0') < uint32(10)) - }() != 0 || uint32(c)|uint32(32)-uint32('a') < uint32(6)) -} - -func X__isxdigit_l(tls *TLS, c int32, l locale_t) int32 { /* isxdigit.c:8:5: */ - if __ccgo_strace { - trc("tls=%v c=%v l=%v, (%v:)", tls, c, l, origin(2)) - } - return Xisxdigit(tls, c) -} - -type off_t = int64 /* alltypes.h:162:16 */ - -type ino_t = uint64 /* alltypes.h:167:25 */ - -type dirent = struct { - d_ino ino_t - d_off off_t - d_reclen uint16 - d_type uint8 - d_name [256]int8 - _ [5]byte -} /* dirent.h:5:1 */ - -type __dirstream = struct { - tell off_t - fd int32 - buf_pos int32 - buf_end int32 - lock [1]int32 - buf [2048]int8 -} /* dirent.h:20:9 */ - -type DIR = __dirstream /* dirent.h:20:28 */ - -type ssize_t = int64 /* alltypes.h:65:15 */ - -type intptr_t = int64 /* alltypes.h:70:15 */ - -type pid_t = int32 /* alltypes.h:235:13 */ - -type uid_t = uint32 /* alltypes.h:245:18 */ - -type gid_t = uint32 /* alltypes.h:250:18 */ - -type useconds_t = uint32 /* alltypes.h:260:18 */ - -type div_t = struct { - quot int32 - rem int32 -} /* stdlib.h:62:35 */ -type ldiv_t = struct { - quot int64 - rem int64 -} /* stdlib.h:63:36 */ -type lldiv_t = struct { - quot int64 - rem int64 -} /* stdlib.h:64:41 */ - -func Xclosedir(tls *TLS, dir uintptr) int32 { /* closedir.c:6:5: */ - if __ccgo_strace { - trc("tls=%v dir=%v, (%v:)", tls, dir, origin(2)) - } - var ret int32 = Xclose(tls, (*DIR)(unsafe.Pointer(dir)).fd) - Xfree(tls, dir) - return ret -} - -type mode_t = uint32 /* alltypes.h:152:18 */ - -type iovec = struct { - iov_base uintptr - iov_len size_t -} /* alltypes.h:355:1 */ - -type flock = struct { - l_type int16 - l_whence int16 - _ [4]byte - l_start off_t - l_len off_t - l_pid pid_t - _ [4]byte -} /* fcntl.h:24:1 */ - -type file_handle = struct { - _ [0]uint32 - handle_bytes uint32 - handle_type int32 -} /* fcntl.h:167:1 */ - -type f_owner_ex = struct { - __type int32 - pid pid_t -} /* fcntl.h:172:1 */ - -type syscall_arg_t = int64 /* syscall.h:22:14 */ - -func Xopendir(tls *TLS, name uintptr) uintptr { /* opendir.c:8:5: */ - if __ccgo_strace { - trc("tls=%v name=%v, (%v:)", tls, name, origin(2)) - } - var fd int32 - var dir uintptr - - if AssignInt32(&fd, Xopen(tls, name, 00|0200000|02000000, 0)) < 0 { - return uintptr(0) - } - if !(int32(AssignUintptr(&dir, Xcalloc(tls, uint64(1), uint64(unsafe.Sizeof(DIR{}))))) != 0) { - X__syscall1(tls, int64(3), int64(fd)) - return uintptr(0) - } - (*DIR)(unsafe.Pointer(dir)).fd = fd - return dir -} - -type max_align_t = struct { - __ll int64 - __ld float64 -} /* alltypes.h:41:54 */ - -type dirstream_buf_alignment_check = [1]int8 /* readdir.c:7:14 */ - -func Xreaddir(tls *TLS, dir uintptr) uintptr { /* readdir.c:10:15: */ - if __ccgo_strace { - trc("tls=%v dir=%v, (%v:)", tls, dir, origin(2)) - } - var de uintptr - - if (*DIR)(unsafe.Pointer(dir)).buf_pos >= (*DIR)(unsafe.Pointer(dir)).buf_end { - var len int32 = int32(X__syscall3(tls, int64(217), int64((*DIR)(unsafe.Pointer(dir)).fd), int64(dir+24), int64(unsafe.Sizeof([2048]int8{})))) - if len <= 0 { - if len < 0 && len != -2 { - *(*int32)(unsafe.Pointer(X___errno_location(tls))) = -len - } - return uintptr(0) - } - (*DIR)(unsafe.Pointer(dir)).buf_end = len - (*DIR)(unsafe.Pointer(dir)).buf_pos = 0 - } - de = dir + 24 + uintptr((*DIR)(unsafe.Pointer(dir)).buf_pos) - *(*int32)(unsafe.Pointer(dir + 12)) += int32((*dirent)(unsafe.Pointer(de)).d_reclen) - (*DIR)(unsafe.Pointer(dir)).tell = (*dirent)(unsafe.Pointer(de)).d_off - return de -} - -type uintptr_t = uint64 /* alltypes.h:55:24 */ - -type int8_t = int8 /* alltypes.h:96:25 */ - -type int16_t = int16 /* alltypes.h:101:25 */ - -type int32_t = int32 /* alltypes.h:106:25 */ - -type int64_t = int64 /* alltypes.h:111:25 */ - -type intmax_t = int64 /* alltypes.h:116:25 */ - -type uint8_t = uint8 /* alltypes.h:121:25 */ - -type uintmax_t = uint64 /* alltypes.h:146:25 */ - -type int_fast8_t = int8_t /* stdint.h:22:16 */ -type int_fast64_t = int64_t /* stdint.h:23:17 */ - -type int_least8_t = int8_t /* stdint.h:25:17 */ -type int_least16_t = int16_t /* stdint.h:26:17 */ -type int_least32_t = int32_t /* stdint.h:27:17 */ -type int_least64_t = int64_t /* stdint.h:28:17 */ - -type uint_fast8_t = uint8_t /* stdint.h:30:17 */ -type uint_fast64_t = uint64_t /* stdint.h:31:18 */ - -type uint_least8_t = uint8_t /* stdint.h:33:18 */ -type uint_least16_t = uint16_t /* stdint.h:34:18 */ -type uint_least32_t = uint32_t /* stdint.h:35:18 */ -type uint_least64_t = uint64_t /* stdint.h:36:18 */ - -type int_fast16_t = int32_t /* stdint.h:1:17 */ -type int_fast32_t = int32_t /* stdint.h:2:17 */ -type uint_fast16_t = uint32_t /* stdint.h:3:18 */ -type uint_fast32_t = uint32_t /* stdint.h:4:18 */ - -type _IO_FILE = struct { - flags uint32 - _ [4]byte - rpos uintptr - rend uintptr - close uintptr - wend uintptr - wpos uintptr - mustbezero_1 uintptr - wbase uintptr - read uintptr - write uintptr - seek uintptr - buf uintptr - buf_size size_t - prev uintptr - next uintptr - fd int32 - pipe_pid int32 - lockcount int64 - mode int32 - lock int32 - lbf int32 - _ [4]byte - cookie uintptr - off off_t - getln_buf uintptr - mustbezero_2 uintptr - shend uintptr - shlim off_t - shcnt off_t - prev_locked uintptr - next_locked uintptr - locale uintptr -} /* alltypes.h:320:9 */ - -type FILE = _IO_FILE /* alltypes.h:320:25 */ - -type va_list = uintptr /* alltypes.h:326:27 */ - -type _G_fpos64_t = struct { - _ [0]uint64 - __opaque [16]int8 -} /* stdio.h:54:9 */ - -type fpos_t = _G_fpos64_t /* stdio.h:58:3 */ - -type float_t = float32 /* alltypes.h:29:15 */ - -type double_t = float64 /* alltypes.h:34:16 */ - -func __FLOAT_BITS(tls *TLS, __f float32) uint32 { /* math.h:55:26: */ - bp := tls.Alloc(4) - defer tls.Free(4) - - // var __u struct {__f float32;} at bp, 4 - - *(*float32)(unsafe.Pointer(bp)) = __f - return *(*uint32)(unsafe.Pointer(bp)) -} - -func __DOUBLE_BITS(tls *TLS, __f float64) uint64 { /* math.h:61:36: */ - bp := tls.Alloc(8) - defer tls.Free(8) - - // var __u struct {__f float64;} at bp, 8 - - *(*float64)(unsafe.Pointer(bp)) = __f - return *(*uint64)(unsafe.Pointer(bp)) -} - -type __pthread = struct { - self uintptr - dtv uintptr - prev uintptr - next uintptr - sysinfo uintptr_t - canary uintptr_t - canary2 uintptr_t - tid int32 - errno_val int32 - detach_state int32 - cancel int32 - canceldisable uint8 - cancelasync uint8 - tsd_used uint8 /* unsigned char tsd_used: 1, unsigned char dlerror_flag: 1 */ - _ [5]byte - map_base uintptr - map_size size_t - stack uintptr - stack_size size_t - guard_size size_t - result uintptr - cancelbuf uintptr - tsd uintptr - robust_list struct { - head uintptr - off int64 - pending uintptr - } - timer_id int32 - _ [4]byte - locale locale_t - killlock [1]int32 - _ [4]byte - dlerror_buf uintptr - stdio_locks uintptr - canary_at_end uintptr_t - dtv_copy uintptr -} /* alltypes.h:273:9 */ - -func scanexp(tls *TLS, f uintptr, pok int32) int64 { /* floatscan.c:37:18: */ - var c int32 - var x int32 - var y int64 - var neg int32 = 0 - - c = func() int32 { - if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { - return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) - } - return X__shgetc(tls, f) - }() - if c == '+' || c == '-' { - neg = Bool32(c == '-') - c = func() int32 { - if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { - return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) - } - return X__shgetc(tls, f) - }() - if uint32(c-'0') >= 10 && pok != 0 { - if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { - (*FILE)(unsafe.Pointer(f)).rpos-- - } else { - } - } - } - if uint32(c-'0') >= 10 { - if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { - (*FILE)(unsafe.Pointer(f)).rpos-- - } else { - } - return -0x7fffffffffffffff - int64(1) - } - for x = 0; uint32(c-'0') < 10 && x < 0x7fffffff/10; c = func() int32 { - if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { - return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) - } - return X__shgetc(tls, f) - }() { - x = 10*x + c - '0' - } - for y = int64(x); uint32(c-'0') < 10 && y < 0x7fffffffffffffff/int64(100); c = func() int32 { - if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { - return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) - } - return X__shgetc(tls, f) - }() { - y = int64(10)*y + int64(c) - int64('0') - } - for ; uint32(c-'0') < 10; c = func() int32 { - if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { - return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) - } - return X__shgetc(tls, f) - }() { - } - if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { - (*FILE)(unsafe.Pointer(f)).rpos-- - } else { - } - if neg != 0 { - return -y - } - return y -} - -func decfloat(tls *TLS, f uintptr, c int32, bits int32, emin int32, sign int32, pok int32) float64 { /* floatscan.c:64:20: */ - bp := tls.Alloc(512) - defer tls.Free(512) - - // var x [128]uint32_t at bp, 512 - - var i int32 - var j int32 - var k int32 - var a int32 - var z int32 - var lrp int64 = int64(0) - var dc int64 = int64(0) - var e10 int64 = int64(0) - var lnz int32 = 0 - var gotdig int32 = 0 - var gotrad int32 = 0 - var rp int32 - var e2 int32 - var emax int32 = -emin - bits + 3 - var denormal int32 = 0 - var y float64 - var frac float64 = float64(0) - var bias float64 = float64(0) - - j = 0 - k = 0 - - // Don't let leading zeros consume buffer space - for ; c == '0'; c = func() int32 { - if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { - return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) - } - return X__shgetc(tls, f) - }() { - gotdig = 1 - } - if c == '.' { - gotrad = 1 - for c = func() int32 { - if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { - return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) - } - return X__shgetc(tls, f) - }(); c == '0'; c = func() int32 { - if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { - return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) - } - return X__shgetc(tls, f) - }() { - gotdig = 1 - lrp-- - } - } - - *(*uint32_t)(unsafe.Pointer(bp)) = uint32_t(0) - for ; uint32(c-'0') < 10 || c == '.'; c = func() int32 { - if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { - return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) - } - return X__shgetc(tls, f) - }() { - if c == '.' { - if gotrad != 0 { - break - } - gotrad = 1 - lrp = dc - } else if k < 128-3 { - dc++ - if c != '0' { - lnz = int32(dc) - } - if j != 0 { - *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))*uint32_t(10) + uint32_t(c) - uint32_t('0') - } else { - *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = uint32_t(c - '0') - } - if PreIncInt32(&j, 1) == 9 { - k++ - j = 0 - } - gotdig = 1 - } else { - dc++ - if c != '0' { - lnz = (128 - 4) * 9 - *(*uint32_t)(unsafe.Pointer(bp + 124*4)) |= uint32_t(1) - } - } - } - if !(gotrad != 0) { - lrp = dc - } - - if gotdig != 0 && c|32 == 'e' { - e10 = scanexp(tls, f, pok) - if e10 == -0x7fffffffffffffff-int64(1) { - if pok != 0 { - if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { - (*FILE)(unsafe.Pointer(f)).rpos-- - } else { - } - } else { - X__shlim(tls, f, int64(0)) - return float64(0) - } - e10 = int64(0) - } - lrp = lrp + e10 - } else if c >= 0 { - if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { - (*FILE)(unsafe.Pointer(f)).rpos-- - } else { - } - } - if !(gotdig != 0) { - *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22 - X__shlim(tls, f, int64(0)) - return float64(0) - } - - // Handle zero specially to avoid nasty special cases later - if !(int32(*(*uint32_t)(unsafe.Pointer(bp))) != 0) { - return float64(sign) * 0.0 - } - - // Optimize small integers (w/no exponent) and over/under-flow - if lrp == dc && dc < int64(10) && (bits > 30 || *(*uint32_t)(unsafe.Pointer(bp))>>bits == uint32_t(0)) { - return float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp))) - } - if lrp > int64(-emin/2) { - *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34 - return float64(sign) * 1.79769313486231570815e+308 * 1.79769313486231570815e+308 - } - if lrp < int64(emin-2*53) { - *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34 - return float64(sign) * 2.22507385850720138309e-308 * 2.22507385850720138309e-308 - } - - // Align incomplete final B1B digit - if j != 0 { - for ; j < 9; j++ { - *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) *= uint32_t(10) - } - k++ - j = 0 - } - - a = 0 - z = k - e2 = 0 - rp = int32(lrp) - - // Optimize small to mid-size integers (even in exp. notation) - if lnz < 9 && lnz <= rp && rp < 18 { - if rp == 9 { - return float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp))) - } - if rp < 9 { - return float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp))) / float64(_sp10s[8-rp]) - } - var bitlim int32 = bits - 3*(rp-9) - if bitlim > 30 || *(*uint32_t)(unsafe.Pointer(bp))>>bitlim == uint32_t(0) { - return float64(sign) * float64(*(*uint32_t)(unsafe.Pointer(bp))) * float64(_sp10s[rp-10]) - } - } - - // Drop trailing zeros - for ; !(int32(*(*uint32_t)(unsafe.Pointer(bp + uintptr(z-1)*4))) != 0); z-- { - } - - // Align radix point to B1B digit boundary - if rp%9 != 0 { - var rpm9 int32 - if rp >= 0 { - rpm9 = rp % 9 - } else { - rpm9 = rp%9 + 9 - } - var p10 int32 = _sp10s[8-rpm9] - var carry uint32_t = uint32_t(0) - for k = a; k != z; k++ { - var tmp uint32_t = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) % uint32_t(p10) - *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))/uint32_t(p10) + carry - carry = uint32_t(1000000000/p10) * tmp - if k == a && !(int32(*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))) != 0) { - a = (a + 1) & (128 - 1) - rp = rp - 9 - } - } - if carry != 0 { - *(*uint32_t)(unsafe.Pointer(bp + uintptr(PostIncInt32(&z, 1))*4)) = carry - } - rp = rp + (9 - rpm9) - } - - // Upscale until desired number of bits are left of radix point - for rp < 9*2 || rp == 9*2 && *(*uint32_t)(unsafe.Pointer(bp + uintptr(a)*4)) < _sth[0] { - var carry uint32_t = uint32_t(0) - e2 = e2 - 29 - for k = (z - 1) & (128 - 1); ; k = (k - 1) & (128 - 1) { - var tmp uint64_t = uint64_t(*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)))<<29 + uint64_t(carry) - if tmp > uint64(1000000000) { - carry = uint32_t(tmp / uint64(1000000000)) - *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = uint32_t(tmp % uint64(1000000000)) - } else { - carry = uint32_t(0) - *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) = uint32_t(tmp) - } - if k == (z-1)&(128-1) && k != a && !(int32(*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))) != 0) { - z = k - } - if k == a { - break - } - } - if carry != 0 { - rp = rp + 9 - a = (a - 1) & (128 - 1) - if a == z { - z = (z - 1) & (128 - 1) - *(*uint32_t)(unsafe.Pointer(bp + uintptr((z-1)&(128-1))*4)) |= *(*uint32_t)(unsafe.Pointer(bp + uintptr(z)*4)) - } - *(*uint32_t)(unsafe.Pointer(bp + uintptr(a)*4)) = carry - } - } - - // Downscale until exactly number of bits are left of radix point - for { - var carry uint32_t = uint32_t(0) - var sh int32 = 1 - for i = 0; i < 2; i++ { - k = (a + i) & (128 - 1) - if k == z || *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) < _sth[i] { - i = 2 - break - } - if *(*uint32_t)(unsafe.Pointer(bp + uintptr((a+i)&(128-1))*4)) > _sth[i] { - break - } - } - if i == 2 && rp == 9*2 { - break - } - // FIXME: find a way to compute optimal sh - if rp > 9+9*2 { - sh = 9 - } - e2 = e2 + sh - for k = a; k != z; k = (k + 1) & (128 - 1) { - var tmp uint32_t = *(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4)) & uint32_t(int32(1)<>sh + carry - carry = uint32_t(int32(1000000000)>>sh) * tmp - if k == a && !(int32(*(*uint32_t)(unsafe.Pointer(bp + uintptr(k)*4))) != 0) { - a = (a + 1) & (128 - 1) - i-- - rp = rp - 9 - } - } - if carry != 0 { - if (z+1)&(128-1) != a { - *(*uint32_t)(unsafe.Pointer(bp + uintptr(z)*4)) = carry - z = (z + 1) & (128 - 1) - } else { - *(*uint32_t)(unsafe.Pointer(bp + uintptr((z-1)&(128-1))*4)) |= uint32_t(1) - } - } - } - - // Assemble desired bits into floating point variable - for y = float64(AssignInt32(&i, 0)); i < 2; i++ { - if (a+i)&(128-1) == z { - *(*uint32_t)(unsafe.Pointer(bp + uintptr(AssignInt32(&z, (z+1)&(128-1))-1)*4)) = uint32_t(0) - } - y = 1000000000.0*y + float64(*(*uint32_t)(unsafe.Pointer(bp + uintptr((a+i)&(128-1))*4))) - } - - y = y * float64(sign) - - // Limit precision for denormal results - if bits > 53+e2-emin { - bits = 53 + e2 - emin - if bits < 0 { - bits = 0 - } - denormal = 1 - } - - // Calculate bias term to force rounding, move out lower bits - if bits < 53 { - bias = Xcopysignl(tls, Xscalbn(tls, float64(1), 2*53-bits-1), y) - frac = Xfmodl(tls, y, Xscalbn(tls, float64(1), 53-bits)) - y = y - frac - y = y + bias - } - - // Process tail of decimal input so it can affect rounding - if (a+i)&(128-1) != z { - var t uint32_t = *(*uint32_t)(unsafe.Pointer(bp + uintptr((a+i)&(128-1))*4)) - if t < uint32_t(500000000) && (t != 0 || (a+i+1)&(128-1) != z) { - frac = frac + 0.25*float64(sign) - } else if t > uint32_t(500000000) { - frac = frac + 0.75*float64(sign) - } else if t == uint32_t(500000000) { - if (a+i+1)&(128-1) == z { - frac = frac + 0.5*float64(sign) - } else { - frac = frac + 0.75*float64(sign) - } - } - if 53-bits >= 2 && !(Xfmodl(tls, frac, float64(1)) != 0) { - frac += 1 - } - } - - y = y + frac - y = y - bias - - if (e2+53)&0x7fffffff > emax-5 { - if Xfabsl(tls, y) >= float64(float64(2))/2.22044604925031308085e-16 { - if denormal != 0 && bits == 53+e2-emin { - denormal = 0 - } - y = y * 0.5 - e2++ - } - if e2+53 > emax || denormal != 0 && frac != 0 { - *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34 - } - } - - return Xscalbnl(tls, y, e2) -} - -var _sth = [2]uint32_t{uint32_t(9007199), uint32_t(254740991)} /* floatscan.c:67:24 */ -var _sp10s = [8]int32{10, 100, 1000, 10000, - 100000, 1000000, 10000000, 100000000} /* floatscan.c:80:19 */ - -func hexfloat(tls *TLS, f uintptr, bits int32, emin int32, sign int32, pok int32) float64 { /* floatscan.c:315:20: */ - var x uint32_t = uint32_t(0) - var y float64 = float64(0) - var scale float64 = float64(1) - var bias float64 = float64(0) - var gottail int32 = 0 - var gotrad int32 = 0 - var gotdig int32 = 0 - var rp int64 = int64(0) - var dc int64 = int64(0) - var e2 int64 = int64(0) - var d int32 - var c int32 - - c = func() int32 { - if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { - return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) - } - return X__shgetc(tls, f) - }() - - // Skip leading zeros - for ; c == '0'; c = func() int32 { - if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { - return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) - } - return X__shgetc(tls, f) - }() { - gotdig = 1 - } - - if c == '.' { - gotrad = 1 - c = func() int32 { - if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { - return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) - } - return X__shgetc(tls, f) - }() - // Count zeros after the radix point before significand - rp = int64(0) - __1: - if !(c == '0') { - goto __3 - } - gotdig = 1 - goto __2 - __2: - c = func() int32 { - if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { - return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) - } - return X__shgetc(tls, f) - }() - rp-- - goto __1 - goto __3 - __3: - } - - for ; uint32(c-'0') < 10 || uint32(c|32-'a') < 6 || c == '.'; c = func() int32 { - if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { - return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) - } - return X__shgetc(tls, f) - }() { - if c == '.' { - if gotrad != 0 { - break - } - rp = dc - gotrad = 1 - } else { - gotdig = 1 - if c > '9' { - d = c | 32 + 10 - 'a' - } else { - d = c - '0' - } - if dc < int64(8) { - x = x*uint32_t(16) + uint32_t(d) - } else if dc < int64(53/4+1) { - y = y + float64(d)*AssignDivFloat64(&scale, float64(16)) - } else if d != 0 && !(gottail != 0) { - y = y + 0.5*scale - gottail = 1 - } - dc++ - } - } - if !(gotdig != 0) { - if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { - (*FILE)(unsafe.Pointer(f)).rpos-- - } else { - } - if pok != 0 { - if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { - (*FILE)(unsafe.Pointer(f)).rpos-- - } else { - } - if gotrad != 0 { - if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { - (*FILE)(unsafe.Pointer(f)).rpos-- - } else { - } - } - } else { - X__shlim(tls, f, int64(0)) - } - return float64(sign) * 0.0 - } - if !(gotrad != 0) { - rp = dc - } - for dc < int64(8) { - x = x * uint32_t(16) - dc++ - } - if c|32 == 'p' { - e2 = scanexp(tls, f, pok) - if e2 == -0x7fffffffffffffff-int64(1) { - if pok != 0 { - if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { - (*FILE)(unsafe.Pointer(f)).rpos-- - } else { - } - } else { - X__shlim(tls, f, int64(0)) - return float64(0) - } - e2 = int64(0) - } - } else { - if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { - (*FILE)(unsafe.Pointer(f)).rpos-- - } else { - } - } - e2 = e2 + (int64(4)*rp - int64(32)) - - if !(x != 0) { - return float64(sign) * 0.0 - } - if e2 > int64(-emin) { - *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34 - return float64(sign) * 1.79769313486231570815e+308 * 1.79769313486231570815e+308 - } - if e2 < int64(emin-2*53) { - *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34 - return float64(sign) * 2.22507385850720138309e-308 * 2.22507385850720138309e-308 - } - - for x < 0x80000000 { - if y >= 0.5 { - x = x + (x + uint32_t(1)) - y = y + (y - float64(1)) - } else { - x = x + x - y = y + y - } - e2-- - } - - if int64(bits) > int64(32)+e2-int64(emin) { - bits = int32(int64(32) + e2 - int64(emin)) - if bits < 0 { - bits = 0 - } - } - - if bits < 53 { - bias = Xcopysignl(tls, Xscalbn(tls, float64(1), 32+53-bits-1), float64(sign)) - } - - if bits < 32 && y != 0 && !(x&uint32_t(1) != 0) { - x++ - y = float64(0) - } - - y = bias + float64(sign)*float64(x) + float64(sign)*y - y = y - bias - - if !(y != 0) { - *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34 - } - - return Xscalbnl(tls, y, int32(e2)) -} - -func X__floatscan(tls *TLS, f uintptr, prec int32, pok int32) float64 { /* floatscan.c:427:13: */ - if __ccgo_strace { - trc("tls=%v f=%v prec=%v pok=%v, (%v:)", tls, f, prec, pok, origin(2)) - } - var sign int32 = 1 - var i size_t - var bits int32 - var emin int32 - var c int32 - - switch prec { - case 0: - bits = 24 - emin = -125 - bits - break - case 1: - bits = 53 - emin = -1021 - bits - break - case 2: - bits = 53 - emin = -1021 - bits - break - default: - return float64(0) - } - - for __isspace(tls, AssignInt32(&c, func() int32 { - if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { - return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) - } - return X__shgetc(tls, f) - }())) != 0 { - } - - if c == '+' || c == '-' { - sign = sign - 2*Bool32(c == '-') - c = func() int32 { - if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { - return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) - } - return X__shgetc(tls, f) - }() - } - - for i = uint64(0); i < uint64(8) && c|32 == int32(*(*int8)(unsafe.Pointer(ts /* "infinity" */ + uintptr(i)))); i++ { - if i < uint64(7) { - c = func() int32 { - if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { - return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) - } - return X__shgetc(tls, f) - }() - } - } - if i == uint64(3) || i == uint64(8) || i > uint64(3) && pok != 0 { - if i != uint64(8) { - if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { - (*FILE)(unsafe.Pointer(f)).rpos-- - } else { - } - if pok != 0 { - for ; i > uint64(3); i-- { - if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { - (*FILE)(unsafe.Pointer(f)).rpos-- - } else { - } - } - } - } - return float64(float32(sign) * X__builtin_inff(tls)) - } - if !(i != 0) { - for i = uint64(0); i < uint64(3) && c|32 == int32(*(*int8)(unsafe.Pointer(ts + 9 /* "nan" */ + uintptr(i)))); i++ { - if i < uint64(2) { - c = func() int32 { - if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { - return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) - } - return X__shgetc(tls, f) - }() - } - } - } - if i == uint64(3) { - if func() int32 { - if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { - return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) - } - return X__shgetc(tls, f) - }() != '(' { - if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { - (*FILE)(unsafe.Pointer(f)).rpos-- - } else { - } - return float64(X__builtin_nanf(tls, ts+13)) - } - for i = uint64(1); ; i++ { - c = func() int32 { - if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { - return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) - } - return X__shgetc(tls, f) - }() - if uint32(c-'0') < 10 || uint32(c-'A') < 26 || uint32(c-'a') < 26 || c == '_' { - continue - } - if c == ')' { - return float64(X__builtin_nanf(tls, ts+13)) - } - if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { - (*FILE)(unsafe.Pointer(f)).rpos-- - } else { - } - if !(pok != 0) { - *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22 - X__shlim(tls, f, int64(0)) - return float64(0) - } - for PostDecUint64(&i, 1) != 0 { - if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { - (*FILE)(unsafe.Pointer(f)).rpos-- - } else { - } - } - return float64(X__builtin_nanf(tls, ts+13)) - } - return float64(X__builtin_nanf(tls, ts+13)) - } - - if i != 0 { - if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { - (*FILE)(unsafe.Pointer(f)).rpos-- - } else { - } - *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22 - X__shlim(tls, f, int64(0)) - return float64(0) - } - - if c == '0' { - c = func() int32 { - if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { - return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) - } - return X__shgetc(tls, f) - }() - if c|32 == 'x' { - return hexfloat(tls, f, bits, emin, sign, pok) - } - if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { - (*FILE)(unsafe.Pointer(f)).rpos-- - } else { - } - c = '0' - } - - return decfloat(tls, f, c, bits, emin, sign, pok) -} - -// Lookup table for digit values. -1==255>=36 -> invalid -var table1 = [257]uint8{Uint8FromInt32(-1), - Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), - Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), - Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), - uint8(0), uint8(1), uint8(2), uint8(3), uint8(4), uint8(5), uint8(6), uint8(7), uint8(8), uint8(9), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), - Uint8FromInt32(-1), uint8(10), uint8(11), uint8(12), uint8(13), uint8(14), uint8(15), uint8(16), uint8(17), uint8(18), uint8(19), uint8(20), uint8(21), uint8(22), uint8(23), uint8(24), - uint8(25), uint8(26), uint8(27), uint8(28), uint8(29), uint8(30), uint8(31), uint8(32), uint8(33), uint8(34), uint8(35), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), - Uint8FromInt32(-1), uint8(10), uint8(11), uint8(12), uint8(13), uint8(14), uint8(15), uint8(16), uint8(17), uint8(18), uint8(19), uint8(20), uint8(21), uint8(22), uint8(23), uint8(24), - uint8(25), uint8(26), uint8(27), uint8(28), uint8(29), uint8(30), uint8(31), uint8(32), uint8(33), uint8(34), uint8(35), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), - Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), - Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), - Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), - Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), - Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), - Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), - Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), - Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), Uint8FromInt32(-1), -} /* intscan.c:7:28 */ - -func X__intscan(tls *TLS, f uintptr, base uint32, pok int32, lim uint64) uint64 { /* intscan.c:26:20: */ - if __ccgo_strace { - trc("tls=%v f=%v base=%v pok=%v lim=%v, (%v:)", tls, f, base, pok, lim, origin(2)) - } - var val uintptr - var c int32 - var neg int32 - var x uint32 - var y uint64 - var bs int32 - val = uintptr(unsafe.Pointer(&table1)) + uintptr(1) - neg = 0 - if !(base > uint32(36) || base == uint32(1)) { - goto __1 - } - *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22 - return uint64(0) -__1: - ; -__2: - if !(__isspace(tls, AssignInt32(&c, func() int32 { - if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { - return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) - } - return X__shgetc(tls, f) - }())) != 0) { - goto __3 - } - goto __2 -__3: - ; - if !(c == '+' || c == '-') { - goto __4 - } - neg = -Bool32(c == '-') - c = func() int32 { - if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { - return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) - } - return X__shgetc(tls, f) - }() -__4: - ; - if !((base == uint32(0) || base == uint32(16)) && c == '0') { - goto __5 - } - c = func() int32 { - if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { - return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) - } - return X__shgetc(tls, f) - }() - if !(c|32 == 'x') { - goto __7 - } - c = func() int32 { - if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { - return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) - } - return X__shgetc(tls, f) - }() - if !(int32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) >= 16) { - goto __9 - } - if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { - (*FILE)(unsafe.Pointer(f)).rpos-- - } else { - } - if !(pok != 0) { - goto __10 - } - if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { - (*FILE)(unsafe.Pointer(f)).rpos-- - } else { - } - goto __11 -__10: - X__shlim(tls, f, int64(0)) -__11: - ; - return uint64(0) -__9: - ; - base = uint32(16) - goto __8 -__7: - if !(base == uint32(0)) { - goto __12 - } - base = uint32(8) -__12: - ; -__8: - ; - goto __6 -__5: - if !(base == uint32(0)) { - goto __13 - } - base = uint32(10) -__13: - ; - if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) >= base) { - goto __14 - } - if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { - (*FILE)(unsafe.Pointer(f)).rpos-- - } else { - } - X__shlim(tls, f, int64(0)) - *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 22 - return uint64(0) -__14: - ; -__6: - ; - if !(base == uint32(10)) { - goto __15 - } - x = uint32(0) -__17: - if !(uint32(c-'0') < 10 && x <= 0xffffffff/uint32(10)-uint32(1)) { - goto __19 - } - x = x*uint32(10) + uint32(c-'0') - goto __18 -__18: - c = func() int32 { - if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { - return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) - } - return X__shgetc(tls, f) - }() - goto __17 - goto __19 -__19: - ; - y = uint64(x) -__20: - if !(uint32(c-'0') < 10 && y <= (2*uint64(0x7fffffffffffffff)+uint64(1))/uint64(10) && uint64(10)*y <= 2*uint64(0x7fffffffffffffff)+uint64(1)-uint64(c-'0')) { - goto __22 - } - y = y*uint64(10) + uint64(c-'0') - goto __21 -__21: - c = func() int32 { - if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { - return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) - } - return X__shgetc(tls, f) - }() - goto __20 - goto __22 -__22: - ; - if !(uint32(c-'0') >= 10) { - goto __23 - } - goto done -__23: - ; - goto __16 -__15: - if !!(base&(base-uint32(1)) != 0) { - goto __24 - } - bs = int32(*(*int8)(unsafe.Pointer(ts + 14 + uintptr(uint32(0x17)*base>>5&uint32(7))))) - x = uint32(0) -__26: - if !(uint32(*(*uint8)(unsafe.Pointer(val + uintptr(c)))) < base && x <= 0xffffffff/uint32(32)) { - goto __28 - } - x = x<>bs) { - goto __31 - } - y = y<= int64(0) { - (*FILE)(unsafe.Pointer(f)).rpos-- - } else { - } - if !(y >= lim) { - goto __43 - } - if !(!(lim&uint64(1) != 0) && !(neg != 0)) { - goto __44 - } - *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34 - return lim - uint64(1) - goto __45 -__44: - if !(y > lim) { - goto __46 - } - *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 34 - return lim -__46: - ; -__45: - ; -__43: - ; - return y ^ uint64(neg) - uint64(neg) -} - -// The shcnt field stores the number of bytes read so far, offset by -// the value of buf-rpos at the last function call (__shlim or __shgetc), -// so that between calls the inline shcnt macro can add rpos-buf to get -// the actual count. - -func X__shlim(tls *TLS, f uintptr, lim off_t) { /* shgetc.c:8:6: */ - if __ccgo_strace { - trc("tls=%v f=%v lim=%v, (%v:)", tls, f, lim, origin(2)) - } - (*FILE)(unsafe.Pointer(f)).shlim = lim - (*FILE)(unsafe.Pointer(f)).shcnt = (int64((*FILE)(unsafe.Pointer(f)).buf) - int64((*FILE)(unsafe.Pointer(f)).rpos)) / 1 - // If lim is nonzero, rend must be a valid pointer. - if lim != 0 && (int64((*FILE)(unsafe.Pointer(f)).rend)-int64((*FILE)(unsafe.Pointer(f)).rpos))/1 > lim { - (*FILE)(unsafe.Pointer(f)).shend = (*FILE)(unsafe.Pointer(f)).rpos + uintptr(lim) - } else { - (*FILE)(unsafe.Pointer(f)).shend = (*FILE)(unsafe.Pointer(f)).rend - } -} - -func X__shgetc(tls *TLS, f uintptr) int32 { /* shgetc.c:19:5: */ - if __ccgo_strace { - trc("tls=%v f=%v, (%v:)", tls, f, origin(2)) - } - var c int32 - var cnt off_t = (*FILE)(unsafe.Pointer(f)).shcnt + (int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1 - if (*FILE)(unsafe.Pointer(f)).shlim != 0 && cnt >= (*FILE)(unsafe.Pointer(f)).shlim || AssignInt32(&c, X__uflow(tls, f)) < 0 { - (*FILE)(unsafe.Pointer(f)).shcnt = (int64((*FILE)(unsafe.Pointer(f)).buf)-int64((*FILE)(unsafe.Pointer(f)).rpos))/1 + cnt - (*FILE)(unsafe.Pointer(f)).shend = (*FILE)(unsafe.Pointer(f)).rpos - (*FILE)(unsafe.Pointer(f)).shlim = int64(-1) - return -1 - } - cnt++ - if (*FILE)(unsafe.Pointer(f)).shlim != 0 && (int64((*FILE)(unsafe.Pointer(f)).rend)-int64((*FILE)(unsafe.Pointer(f)).rpos))/1 > (*FILE)(unsafe.Pointer(f)).shlim-cnt { - (*FILE)(unsafe.Pointer(f)).shend = (*FILE)(unsafe.Pointer(f)).rpos + uintptr((*FILE)(unsafe.Pointer(f)).shlim-cnt) - } else { - (*FILE)(unsafe.Pointer(f)).shend = (*FILE)(unsafe.Pointer(f)).rend - } - (*FILE)(unsafe.Pointer(f)).shcnt = (int64((*FILE)(unsafe.Pointer(f)).buf)-int64((*FILE)(unsafe.Pointer(f)).rpos))/1 + cnt - if (*FILE)(unsafe.Pointer(f)).rpos <= (*FILE)(unsafe.Pointer(f)).buf { - *(*uint8)(unsafe.Pointer((*FILE)(unsafe.Pointer(f)).rpos + UintptrFromInt32(-1))) = uint8(c) - } - return c -} - -type lconv = struct { - decimal_point uintptr - thousands_sep uintptr - grouping uintptr - int_curr_symbol uintptr - currency_symbol uintptr - mon_decimal_point uintptr - mon_thousands_sep uintptr - mon_grouping uintptr - positive_sign uintptr - negative_sign uintptr - int_frac_digits int8 - frac_digits int8 - p_cs_precedes int8 - p_sep_by_space int8 - n_cs_precedes int8 - n_sep_by_space int8 - p_sign_posn int8 - n_sign_posn int8 - int_p_cs_precedes int8 - int_p_sep_by_space int8 - int_n_cs_precedes int8 - int_n_sep_by_space int8 - int_p_sign_posn int8 - int_n_sign_posn int8 - _ [2]byte -} /* locale.h:24:1 */ - -// Support signed or unsigned plain-char - -// Implementation choices... - -// Arbitrary numbers... - -// POSIX/SUS requirements follow. These numbers come directly -// from SUS and have nothing to do with the host system. - -var posix_lconv = lconv{decimal_point: ts + 23, thousands_sep: ts + 13, grouping: ts + 13, int_curr_symbol: ts + 13, currency_symbol: ts + 13, mon_decimal_point: ts + 13, mon_thousands_sep: ts + 13, mon_grouping: ts + 13, positive_sign: ts + 13, negative_sign: ts + 13, int_frac_digits: Int8FromInt32(255), frac_digits: Int8FromInt32(255), p_cs_precedes: Int8FromInt32(255), p_sep_by_space: Int8FromInt32(255), n_cs_precedes: Int8FromInt32(255), n_sep_by_space: Int8FromInt32(255), p_sign_posn: Int8FromInt32(255), n_sign_posn: Int8FromInt32(255), int_p_cs_precedes: Int8FromInt32(255), int_p_sep_by_space: Int8FromInt32(255), int_n_cs_precedes: Int8FromInt32(255), int_n_sep_by_space: Int8FromInt32(255), int_p_sign_posn: Int8FromInt32(255), int_n_sign_posn: Int8FromInt32(255)} /* localeconv.c:4:27 */ - -func Xlocaleconv(tls *TLS) uintptr { /* localeconv.c:31:14: */ - if __ccgo_strace { - trc("tls=%v, (%v:)", tls, origin(2)) - } - return uintptr(unsafe.Pointer(&posix_lconv)) -} - -func X__fpclassify(tls *TLS, x float64) int32 { /* __fpclassify.c:4:5: */ - if __ccgo_strace { - trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) - } - bp := tls.Alloc(8) - defer tls.Free(8) - - *(*struct{ f float64 })(unsafe.Pointer(bp)) = func() (r struct{ f float64 }) { - *(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer(&r)) + 0)) = x - return r - }() - var e int32 = int32(*(*uint64_t)(unsafe.Pointer(bp)) >> 52 & uint64(0x7ff)) - if !(e != 0) { - if *(*uint64_t)(unsafe.Pointer(bp))<<1 != 0 { - return 3 - } - return 2 - } - if e == 0x7ff { - if *(*uint64_t)(unsafe.Pointer(bp))<<12 != 0 { - return 0 - } - return 1 - } - return 4 -} - -func X__fpclassifyf(tls *TLS, x float32) int32 { /* __fpclassifyf.c:4:5: */ - if __ccgo_strace { - trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) - } - bp := tls.Alloc(4) - defer tls.Free(4) - - *(*struct{ f float32 })(unsafe.Pointer(bp)) = func() (r struct{ f float32 }) { - *(*float32)(unsafe.Pointer(uintptr(unsafe.Pointer(&r)) + 0)) = x - return r - }() - var e int32 = int32(*(*uint32_t)(unsafe.Pointer(bp)) >> 23 & uint32_t(0xff)) - if !(e != 0) { - if *(*uint32_t)(unsafe.Pointer(bp))<<1 != 0 { - return 3 - } - return 2 - } - if e == 0xff { - if *(*uint32_t)(unsafe.Pointer(bp))<<9 != 0 { - return 0 - } - return 1 - } - return 4 -} - -func X__fpclassifyl(tls *TLS, x float64) int32 { /* __fpclassifyl.c:4:5: */ - if __ccgo_strace { - trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) - } - return X__fpclassify(tls, x) -} - -func Xcopysignl(tls *TLS, x float64, y float64) float64 { /* copysignl.c:4:13: */ - if __ccgo_strace { - trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2)) - } - return Xcopysign(tls, x, y) -} - -func Xfabsl(tls *TLS, x float64) float64 { /* fabsl.c:3:13: */ - if __ccgo_strace { - trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) - } - return Xfabs(tls, x) -} - -func Xfmodl(tls *TLS, x float64, y float64) float64 { /* fmodl.c:4:13: */ - if __ccgo_strace { - trc("tls=%v x=%v y=%v, (%v:)", tls, x, y, origin(2)) - } - return Xfmod(tls, x, y) -} - -func Xnanf(tls *TLS, s uintptr) float32 { /* nanf.c:3:7: */ - if __ccgo_strace { - trc("tls=%v s=%v, (%v:)", tls, s, origin(2)) - } - return X__builtin_nanf(tls, ts+13) -} - -var toint double_t = float64(float64(1)) / 2.22044604925031308085e-16 /* rint.c:10:23 */ - -func Xrint(tls *TLS, x float64) float64 { /* rint.c:12:8: */ - if __ccgo_strace { - trc("tls=%v x=%v, (%v:)", tls, x, origin(2)) - } - bp := tls.Alloc(8) - defer tls.Free(8) - - *(*struct{ f float64 })(unsafe.Pointer(bp)) = func() (r struct{ f float64 }) { - *(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer(&r)) + 0)) = x - return r - }() - var e int32 = int32(*(*uint64_t)(unsafe.Pointer(bp)) >> 52 & uint64(0x7ff)) - var s int32 = int32(*(*uint64_t)(unsafe.Pointer(bp)) >> 63) - var y double_t - - if e >= 0x3ff+52 { - return x - } - if s != 0 { - y = x - toint + toint - } else { - y = x + toint - toint - } - if y == float64(0) { - if s != 0 { - return -Float64FromFloat64(0.0) - } - return float64(0) - } - return y -} - -func Xscalbn(tls *TLS, x float64, n int32) float64 { /* scalbn.c:4:8: */ - if __ccgo_strace { - trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2)) - } - bp := tls.Alloc(8) - defer tls.Free(8) - - // var u struct {f float64;} at bp, 8 - - var y double_t = x - - if n > 1023 { - y = y * 0x1p1023 - n = n - 1023 - if n > 1023 { - y = y * 0x1p1023 - n = n - 1023 - if n > 1023 { - n = 1023 - } - } - } else if n < -1022 { - // make sure final n < -53 to avoid double - // rounding in the subnormal range - y = y * (float64(0x1p-1022) * 0x1p53) - n = n + (1022 - 53) - if n < -1022 { - y = y * (float64(0x1p-1022) * 0x1p53) - n = n + (1022 - 53) - if n < -1022 { - n = -1022 - } - } - } - *(*uint64_t)(unsafe.Pointer(bp)) = uint64_t(0x3ff+n) << 52 - x = y * *(*float64)(unsafe.Pointer(bp)) - return x -} - -func Xscalbnl(tls *TLS, x float64, n int32) float64 { /* scalbnl.c:4:13: */ - if __ccgo_strace { - trc("tls=%v x=%v n=%v, (%v:)", tls, x, n, origin(2)) - } - return Xscalbn(tls, x, n) -} - -// Support signed or unsigned plain-char - -// Implementation choices... - -// Arbitrary numbers... - -// POSIX/SUS requirements follow. These numbers come directly -// from SUS and have nothing to do with the host system. - -type __locale_map = struct { - __map uintptr - map_size size_t - name [24]int8 - next uintptr -} /* alltypes.h:343:9 */ - -type tls_module = struct { - next uintptr - image uintptr - len size_t - size size_t - align size_t - offset size_t -} /* libc.h:14:1 */ - -type __libc = struct { - can_do_threads int8 - threaded int8 - secure int8 - need_locks int8 - threads_minus_1 int32 - auxv uintptr - tls_head uintptr - tls_size size_t - tls_align size_t - tls_cnt size_t - page_size size_t - global_locale struct{ cat [6]uintptr } -} /* libc.h:20:1 */ - -type time_t = int64 /* alltypes.h:85:16 */ - -type clockid_t = int32 /* alltypes.h:214:13 */ - -type timespec = struct { - tv_sec time_t - tv_nsec int64 -} /* alltypes.h:229:1 */ - -type pthread_t = uintptr /* alltypes.h:273:26 */ - -type pthread_once_t = int32 /* alltypes.h:279:13 */ - -type pthread_key_t = uint32 /* alltypes.h:284:18 */ - -type pthread_spinlock_t = int32 /* alltypes.h:289:13 */ - -type pthread_mutexattr_t = struct{ __attr uint32 } /* alltypes.h:294:37 */ - -type pthread_condattr_t = struct{ __attr uint32 } /* alltypes.h:299:37 */ - -type pthread_barrierattr_t = struct{ __attr uint32 } /* alltypes.h:304:37 */ - -type pthread_rwlockattr_t = struct{ __attr [2]uint32 } /* alltypes.h:309:40 */ - -type __sigset_t = struct{ __bits [16]uint64 } /* alltypes.h:349:9 */ - -type sigset_t = __sigset_t /* alltypes.h:349:71 */ - -type pthread_attr_t = struct { - __u struct { - _ [0]uint64 - __i [14]int32 - } -} /* alltypes.h:372:147 */ - -type pthread_mutex_t = struct { - __u struct { - _ [0]uint64 - __i [10]int32 - } -} /* alltypes.h:377:157 */ - -type pthread_cond_t = struct { - __u struct { - _ [0]uint64 - __i [12]int32 - } -} /* alltypes.h:387:112 */ - -type pthread_rwlock_t = struct { - __u struct { - _ [0]uint64 - __i [14]int32 - } -} /* alltypes.h:397:139 */ - -type pthread_barrier_t = struct { - __u struct { - _ [0]uint64 - __i [8]int32 - } -} /* alltypes.h:402:137 */ - -type sched_param = struct { - sched_priority int32 - __reserved1 int32 - __reserved2 [2]struct { - __reserved1 time_t - __reserved2 int64 - } - __reserved3 int32 - _ [4]byte -} /* sched.h:19:1 */ - -type timer_t = uintptr /* alltypes.h:209:14 */ - -type clock_t = int64 /* alltypes.h:219:14 */ - -type tm = struct { - tm_sec int32 - tm_min int32 - tm_hour int32 - tm_mday int32 - tm_mon int32 - tm_year int32 - tm_wday int32 - tm_yday int32 - tm_isdst int32 - _ [4]byte - tm_gmtoff int64 - tm_zone uintptr -} /* time.h:38:1 */ - -type itimerspec = struct { - it_interval struct { - tv_sec time_t - tv_nsec int64 - } - it_value struct { - tv_sec time_t - tv_nsec int64 - } -} /* time.h:80:1 */ - -type sigevent = struct { - sigev_value struct { - _ [0]uint64 - sival_int int32 - _ [4]byte - } - sigev_signo int32 - sigev_notify int32 - sigev_notify_function uintptr - sigev_notify_attributes uintptr - __pad [32]int8 -} /* time.h:107:1 */ - -type __ptcb = struct { - __f uintptr - __x uintptr - __next uintptr -} /* alltypes.h:273:9 */ - -type sigaltstack = struct { - ss_sp uintptr - ss_flags int32 - _ [4]byte - ss_size size_t -} /* signal.h:44:9 */ - -type stack_t = sigaltstack /* signal.h:44:28 */ - -type greg_t = int64 /* signal.h:59:19 */ -type gregset_t = [23]int64 /* signal.h:59:27 */ -type _fpstate = struct { - cwd uint16 - swd uint16 - ftw uint16 - fop uint16 - rip uint64 - rdp uint64 - mxcsr uint32 - mxcr_mask uint32 - _st [8]struct { - significand [4]uint16 - exponent uint16 - padding [3]uint16 - } - _xmm [16]struct{ element [4]uint32 } - padding [24]uint32 -} /* signal.h:60:9 */ - -type fpregset_t = uintptr /* signal.h:71:3 */ -type sigcontext = struct { - r8 uint64 - r9 uint64 - r10 uint64 - r11 uint64 - r12 uint64 - r13 uint64 - r14 uint64 - r15 uint64 - rdi uint64 - rsi uint64 - rbp uint64 - rbx uint64 - rdx uint64 - rax uint64 - rcx uint64 - rsp uint64 - rip uint64 - eflags uint64 - cs uint16 - gs uint16 - fs uint16 - __pad0 uint16 - err uint64 - trapno uint64 - oldmask uint64 - cr2 uint64 - fpstate uintptr - __reserved1 [8]uint64 -} /* signal.h:72:1 */ - -type mcontext_t = struct { - gregs gregset_t - fpregs fpregset_t - __reserved1 [8]uint64 -} /* signal.h:84:3 */ - -type __ucontext = struct { - uc_flags uint64 - uc_link uintptr - uc_stack stack_t - uc_mcontext mcontext_t - uc_sigmask sigset_t - __fpregs_mem [64]uint64 -} /* signal.h:97:9 */ - -type ucontext_t = __ucontext /* signal.h:104:3 */ - -type sigval = struct { - _ [0]uint64 - sival_int int32 - _ [4]byte -} /* time.h:107:1 */ - -type siginfo_t = struct { - si_signo int32 - si_errno int32 - si_code int32 - _ [4]byte - __si_fields struct { - _ [0]uint64 - __pad [112]int8 - } -} /* signal.h:145:3 */ - -type sigaction = struct { - __sa_handler struct{ sa_handler uintptr } - sa_mask sigset_t - sa_flags int32 - _ [4]byte - sa_restorer uintptr -} /* signal.h:167:1 */ - -type sig_t = uintptr /* signal.h:251:14 */ - -type sig_atomic_t = int32 /* signal.h:269:13 */ - -func a_cas(tls *TLS, p uintptr, t int32, s int32) int32 { /* atomic_arch.h:2:19: */ - panic(`arch/x86_64/atomic_arch.h:4:2: assembler statements not supported`) - return t -} - -func a_swap(tls *TLS, p uintptr, v int32) int32 { /* atomic_arch.h:20:19: */ - panic(`arch/x86_64/atomic_arch.h:22:2: assembler statements not supported`) - return v -} - -func a_or(tls *TLS, p uintptr, v int32) { /* atomic_arch.h:46:20: */ - panic(`arch/x86_64/atomic_arch.h:48:2: assembler statements not supported`) -} - -func a_or_64(tls *TLS, p uintptr, v uint64_t) { /* atomic_arch.h:62:20: */ - panic(`arch/x86_64/atomic_arch.h:64:2: assembler statements not supported`) -} - -func a_ctz_64(tls *TLS, x uint64_t) int32 { /* atomic_arch.h:112:19: */ - panic(`arch/x86_64/atomic_arch.h:114:2: assembler statements not supported`) - return int32(x) -} - -func a_ctz_32(tls *TLS, x uint32_t) int32 { /* atomic.h:256:19: */ - return int32(_sdebruijn328[x&-x*uint32_t(0x076be629)>>27]) -} - -var _sdebruijn328 = [32]int8{ - int8(0), int8(1), int8(23), int8(2), int8(29), int8(24), int8(19), int8(3), int8(30), int8(27), int8(25), int8(11), int8(20), int8(8), int8(4), int8(13), - int8(31), int8(22), int8(28), int8(18), int8(26), int8(10), int8(7), int8(12), int8(21), int8(17), int8(9), int8(6), int8(16), int8(5), int8(15), int8(14), -} /* atomic.h:261:20 */ - -type __timer = struct { - timerid int32 - _ [4]byte - thread pthread_t -} /* pthread_impl.h:64:1 */ - -func __pthread_self(tls *TLS) uintptr { /* pthread_arch.h:1:30: */ - var self uintptr - panic(`arch/x86_64/pthread_arch.h:4:2: assembler statements not supported`) - return self -} - -func __wake(tls *TLS, addr uintptr, cnt int32, priv int32) { /* pthread_impl.h:155:20: */ - if priv != 0 { - priv = 128 - } - if cnt < 0 { - cnt = 0x7fffffff - } - _ = Bool32(X__syscall3(tls, int64(202), int64(addr), int64(1|priv), int64(cnt)) != int64(-38) || X__syscall3(tls, int64(202), int64(addr), int64(1), int64(cnt)) != 0) -} - -func __futexwait(tls *TLS, addr uintptr, val int32, priv int32) { /* pthread_impl.h:162:20: */ - if priv != 0 { - priv = 128 - } - _ = Bool32(X__syscall4(tls, int64(202), int64(addr), int64(0|priv), int64(val), int64(0)) != int64(-38) || X__syscall4(tls, int64(202), int64(addr), int64(0), int64(val), int64(0)) != 0) -} - -var X__fsmu8 = [51]uint32_t{ - func() uint32 { - if 0x2 < 2 { - return Uint32FromInt32(-1) - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23 | uint32_t(0x2) - }(), func() uint32 { - if 0x3 < 2 { - return Uint32FromInt32(-1) - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23 | uint32_t(0x3) - }(), func() uint32 { - if 0x4 < 2 { - return Uint32FromInt32(-1) - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23 | uint32_t(0x4) - }(), func() uint32 { - if 0x5 < 2 { - return Uint32FromInt32(-1) - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23 | uint32_t(0x5) - }(), func() uint32 { - if 0x6 < 2 { - return Uint32FromInt32(-1) - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23 | uint32_t(0x6) - }(), func() uint32 { - if 0x7 < 2 { - return Uint32FromInt32(-1) - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23 | uint32_t(0x7) - }(), - func() uint32 { - if 0x8 < 2 { - return Uint32FromInt32(-1) - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23 | uint32_t(0x8) - }(), func() uint32 { - if 0x9 < 2 { - return Uint32FromInt32(-1) - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23 | uint32_t(0x9) - }(), func() uint32 { - if 0xa < 2 { - return Uint32FromInt32(-1) - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23 | uint32_t(0xa) - }(), func() uint32 { - if 0xb < 2 { - return Uint32FromInt32(-1) - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23 | uint32_t(0xb) - }(), func() uint32 { - if 0xc < 2 { - return Uint32FromInt32(-1) - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23 | uint32_t(0xc) - }(), func() uint32 { - if 0xd < 2 { - return Uint32FromInt32(-1) - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23 | uint32_t(0xd) - }(), func() uint32 { - if 0xe < 2 { - return Uint32FromInt32(-1) - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23 | uint32_t(0xe) - }(), func() uint32 { - if 0xf < 2 { - return Uint32FromInt32(-1) - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23 | uint32_t(0xf) - }(), - func() uint32 { - if 0x0+16 < 2 { - return Uint32FromInt32(-1) - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23 | uint32_t(0x0+16) - }(), func() uint32 { - if 0x1+16 < 2 { - return Uint32FromInt32(-1) - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23 | uint32_t(0x1+16) - }(), func() uint32 { - if 0x2+16 < 2 { - return Uint32FromInt32(-1) - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23 | uint32_t(0x2+16) - }(), func() uint32 { - if 0x3+16 < 2 { - return Uint32FromInt32(-1) - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23 | uint32_t(0x3+16) - }(), func() uint32 { - if 0x4+16 < 2 { - return Uint32FromInt32(-1) - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23 | uint32_t(0x4+16) - }(), func() uint32 { - if 0x5+16 < 2 { - return Uint32FromInt32(-1) - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23 | uint32_t(0x5+16) - }(), func() uint32 { - if 0x6+16 < 2 { - return Uint32FromInt32(-1) - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23 | uint32_t(0x6+16) - }(), func() uint32 { - if 0x7+16 < 2 { - return Uint32FromInt32(-1) - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23 | uint32_t(0x7+16) - }(), - func() uint32 { - if 0x8+16 < 2 { - return Uint32FromInt32(-1) - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23 | uint32_t(0x8+16) - }(), func() uint32 { - if 0x9+16 < 2 { - return Uint32FromInt32(-1) - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23 | uint32_t(0x9+16) - }(), func() uint32 { - if 0xa+16 < 2 { - return Uint32FromInt32(-1) - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23 | uint32_t(0xa+16) - }(), func() uint32 { - if 0xb+16 < 2 { - return Uint32FromInt32(-1) - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23 | uint32_t(0xb+16) - }(), func() uint32 { - if 0xc+16 < 2 { - return Uint32FromInt32(-1) - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23 | uint32_t(0xc+16) - }(), func() uint32 { - if 0xd+16 < 2 { - return Uint32FromInt32(-1) - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23 | uint32_t(0xd+16) - }(), func() uint32 { - if 0xe+16 < 2 { - return Uint32FromInt32(-1) - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23 | uint32_t(0xe+16) - }(), func() uint32 { - if 0xf+16 < 2 { - return Uint32FromInt32(-1) - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23 | uint32_t(0xf+16) - }(), - func() uint32 { - if 0x0 == 0 { - return func() uint32 { - if Int32(0xa0) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) - }() << 23 - } - return func() uint32 { - if 0x0 == 0xd { - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - }() - }() | uint32_t(func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23)>>6 | uint32_t(0x0), func() uint32 { - if 0x1 == 0 { - return func() uint32 { - if Int32(0xa0) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) - }() << 23 - } - return func() uint32 { - if 0x1 == 0xd { - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - }() - }() | uint32_t(func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23)>>6 | uint32_t(0x1), func() uint32 { - if 0x2 == 0 { - return func() uint32 { - if Int32(0xa0) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) - }() << 23 - } - return func() uint32 { - if 0x2 == 0xd { - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - }() - }() | uint32_t(func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23)>>6 | uint32_t(0x2), func() uint32 { - if 0x3 == 0 { - return func() uint32 { - if Int32(0xa0) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) - }() << 23 - } - return func() uint32 { - if 0x3 == 0xd { - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - }() - }() | uint32_t(func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23)>>6 | uint32_t(0x3), func() uint32 { - if 0x4 == 0 { - return func() uint32 { - if Int32(0xa0) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) - }() << 23 - } - return func() uint32 { - if 0x4 == 0xd { - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - }() - }() | uint32_t(func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23)>>6 | uint32_t(0x4), func() uint32 { - if 0x5 == 0 { - return func() uint32 { - if Int32(0xa0) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) - }() << 23 - } - return func() uint32 { - if 0x5 == 0xd { - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - }() - }() | uint32_t(func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23)>>6 | uint32_t(0x5), func() uint32 { - if 0x6 == 0 { - return func() uint32 { - if Int32(0xa0) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) - }() << 23 - } - return func() uint32 { - if 0x6 == 0xd { - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - }() - }() | uint32_t(func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23)>>6 | uint32_t(0x6), func() uint32 { - if 0x7 == 0 { - return func() uint32 { - if Int32(0xa0) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) - }() << 23 - } - return func() uint32 { - if 0x7 == 0xd { - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - }() - }() | uint32_t(func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23)>>6 | uint32_t(0x7), - func() uint32 { - if 0x8 == 0 { - return func() uint32 { - if Int32(0xa0) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) - }() << 23 - } - return func() uint32 { - if 0x8 == 0xd { - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - }() - }() | uint32_t(func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23)>>6 | uint32_t(0x8), func() uint32 { - if 0x9 == 0 { - return func() uint32 { - if Int32(0xa0) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) - }() << 23 - } - return func() uint32 { - if 0x9 == 0xd { - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - }() - }() | uint32_t(func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23)>>6 | uint32_t(0x9), func() uint32 { - if 0xa == 0 { - return func() uint32 { - if Int32(0xa0) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) - }() << 23 - } - return func() uint32 { - if 0xa == 0xd { - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - }() - }() | uint32_t(func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23)>>6 | uint32_t(0xa), func() uint32 { - if 0xb == 0 { - return func() uint32 { - if Int32(0xa0) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) - }() << 23 - } - return func() uint32 { - if 0xb == 0xd { - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - }() - }() | uint32_t(func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23)>>6 | uint32_t(0xb), func() uint32 { - if 0xc == 0 { - return func() uint32 { - if Int32(0xa0) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) - }() << 23 - } - return func() uint32 { - if 0xc == 0xd { - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - }() - }() | uint32_t(func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23)>>6 | uint32_t(0xc), func() uint32 { - if 0xd == 0 { - return func() uint32 { - if Int32(0xa0) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) - }() << 23 - } - return func() uint32 { - if 0xd == 0xd { - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - }() - }() | uint32_t(func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23)>>6 | uint32_t(0xd), func() uint32 { - if 0xe == 0 { - return func() uint32 { - if Int32(0xa0) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) - }() << 23 - } - return func() uint32 { - if 0xe == 0xd { - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - }() - }() | uint32_t(func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23)>>6 | uint32_t(0xe), func() uint32 { - if 0xf == 0 { - return func() uint32 { - if Int32(0xa0) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0xa0)) - }() << 23 - } - return func() uint32 { - if 0xf == 0xd { - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xa0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - }() - }() | uint32_t(func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23)>>6 | uint32_t(0xf), - func() uint32 { - if 0x0 >= 5 { - return uint32(0) - } - return func() uint32 { - if 0x0 == 0 { - return func() uint32 { - if Int32(0x90) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x90)) - }() << 23 - } - return func() uint32 { - if 0x0 == 4 { - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0x90)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - }() - }() - }() | uint32_t(func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23)>>6 | uint32_t(func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23)>>12 | uint32_t(0x0), func() uint32 { - if 0x1 >= 5 { - return uint32(0) - } - return func() uint32 { - if 0x1 == 0 { - return func() uint32 { - if Int32(0x90) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x90)) - }() << 23 - } - return func() uint32 { - if 0x1 == 4 { - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0x90)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - }() - }() - }() | uint32_t(func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23)>>6 | uint32_t(func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23)>>12 | uint32_t(0x1), func() uint32 { - if 0x2 >= 5 { - return uint32(0) - } - return func() uint32 { - if 0x2 == 0 { - return func() uint32 { - if Int32(0x90) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x90)) - }() << 23 - } - return func() uint32 { - if 0x2 == 4 { - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0x90)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - }() - }() - }() | uint32_t(func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23)>>6 | uint32_t(func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23)>>12 | uint32_t(0x2), func() uint32 { - if 0x3 >= 5 { - return uint32(0) - } - return func() uint32 { - if 0x3 == 0 { - return func() uint32 { - if Int32(0x90) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x90)) - }() << 23 - } - return func() uint32 { - if 0x3 == 4 { - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0x90)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - }() - }() - }() | uint32_t(func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23)>>6 | uint32_t(func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23)>>12 | uint32_t(0x3), func() uint32 { - if 0x4 >= 5 { - return uint32(0) - } - return func() uint32 { - if 0x4 == 0 { - return func() uint32 { - if Int32(0x90) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x90)) - }() << 23 - } - return func() uint32 { - if 0x4 == 4 { - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0x90)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - } - return func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }() << 23 - }() - }() - }() | uint32_t(func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23)>>6 | uint32_t(func() uint32 { - if Int32(0x80) == Int32(0x80) { - return Uint32(Uint32(0x40) - Uint32FromInt32(0xc0)) - } - return Uint32(Uint32(0) - Uint32FromInt32(0x80)) - }()<<23)>>12 | uint32_t(0x4), -} /* internal.c:18:16 */ - -type wint_t = uint32 /* alltypes.h:198:18 */ - -type wctype_t = uint64 /* alltypes.h:203:23 */ - -type __mbstate_t = struct { - __opaque1 uint32 - __opaque2 uint32 -} /* alltypes.h:337:9 */ - -type mbstate_t = __mbstate_t /* alltypes.h:337:63 */ - -func Xmbrtowc(tls *TLS, wc uintptr, src uintptr, n size_t, st uintptr) size_t { /* mbrtowc.c:6:8: */ - if __ccgo_strace { - trc("tls=%v wc=%v src=%v n=%v st=%v, (%v:)", tls, wc, src, n, st, origin(2)) - } - bp := tls.Alloc(4) - defer tls.Free(4) - - var c uint32 - var s uintptr - var N uint32 - // var dummy wchar_t at bp, 4 - s = src - N = uint32(n) - - if !!(st != 0) { - goto __1 - } - st = uintptr(unsafe.Pointer(&_sinternal_state)) -__1: - ; - c = *(*uint32)(unsafe.Pointer(st)) - - if !!(s != 0) { - goto __2 - } - if !(c != 0) { - goto __4 - } - goto ilseq -__4: - ; - return uint64(0) - goto __3 -__2: - if !!(wc != 0) { - goto __5 - } - wc = bp /* &dummy */ -__5: - ; -__3: - ; - - if !!(n != 0) { - goto __6 - } - return Uint64FromInt32(-2) -__6: - ; - if !!(c != 0) { - goto __7 - } - if !(int32(*(*uint8)(unsafe.Pointer(s))) < 0x80) { - goto __8 - } - return BoolUint64(!!(AssignPtrInt32(wc, wchar_t(*(*uint8)(unsafe.Pointer(s)))) != 0)) -__8: - ; - if !(func() int32 { - if !!(int32(*(*uintptr)(unsafe.Pointer((*__pthread)(unsafe.Pointer(__pthread_self(tls))).locale))) != 0) { - return 4 - } - return 1 - }() == 1) { - goto __9 - } - *(*wchar_t)(unsafe.Pointer(wc)) = 0xdfff & int32(int8(*(*uint8)(unsafe.Pointer(s)))) - return 1 -__9: - ; - if !(uint32(*(*uint8)(unsafe.Pointer(s)))-0xc2 > 0xf4-0xc2) { - goto __10 - } - goto ilseq -__10: - ; - c = X__fsmu8[uint32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))))-0xc2] - n-- -__7: - ; - - if !(n != 0) { - goto __11 - } - if !((int32(*(*uint8)(unsafe.Pointer(s)))>>3-0x10|(int32(*(*uint8)(unsafe.Pointer(s)))>>3+int32_t(c)>>26))&CplInt32(7) != 0) { - goto __12 - } - goto ilseq -__12: - ; -loop: - c = c<<6 | uint32(int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&s, 1))))-0x80) - n-- - if !!(c&(uint32(1)<<31) != 0) { - goto __13 - } - *(*uint32)(unsafe.Pointer(st)) = uint32(0) - *(*wchar_t)(unsafe.Pointer(wc)) = wchar_t(c) - return size_t(N) - n -__13: - ; - if !(n != 0) { - goto __14 - } - if !(uint32(*(*uint8)(unsafe.Pointer(s)))-0x80 >= uint32(0x40)) { - goto __15 - } - goto ilseq -__15: - ; - goto loop -__14: - ; -__11: - ; - - *(*uint32)(unsafe.Pointer(st)) = c - return Uint64FromInt32(-2) -ilseq: - *(*uint32)(unsafe.Pointer(st)) = uint32(0) - *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 84 - return Uint64FromInt32(-1) -} - -var _sinternal_state uint32 /* mbrtowc.c:8:18: */ - -func Xmbsinit(tls *TLS, st uintptr) int32 { /* mbsinit.c:3:5: */ - if __ccgo_strace { - trc("tls=%v st=%v, (%v:)", tls, st, origin(2)) - } - return Bool32(!(st != 0) || !(int32(*(*uint32)(unsafe.Pointer(st))) != 0)) -} - -type imaxdiv_t = struct { - quot intmax_t - rem intmax_t -} /* inttypes.h:14:40 */ - -type socklen_t = uint32 /* alltypes.h:361:18 */ - -type sa_family_t = uint16 /* alltypes.h:366:24 */ - -type msghdr = struct { - msg_name uintptr - msg_namelen socklen_t - _ [4]byte - msg_iov uintptr - msg_iovlen int32 - __pad1 int32 - msg_control uintptr - msg_controllen socklen_t - __pad2 int32 - msg_flags int32 - _ [4]byte -} /* socket.h:22:1 */ - -type cmsghdr = struct { - cmsg_len socklen_t - __pad1 int32 - cmsg_level int32 - cmsg_type int32 -} /* socket.h:44:1 */ - -type linger = struct { - l_onoff int32 - l_linger int32 -} /* socket.h:74:1 */ - -type sockaddr = struct { - sa_family sa_family_t - sa_data [14]int8 -} /* socket.h:367:1 */ - -type sockaddr_storage = struct { - ss_family sa_family_t - __ss_padding [118]int8 - __ss_align uint64 -} /* socket.h:372:1 */ - -type in_port_t = uint16_t /* in.h:12:18 */ -type in_addr_t = uint32_t /* in.h:13:18 */ -type in_addr = struct{ s_addr in_addr_t } /* in.h:14:1 */ - -type sockaddr_in = struct { - sin_family sa_family_t - sin_port in_port_t - sin_addr struct{ s_addr in_addr_t } - sin_zero [8]uint8_t -} /* in.h:16:1 */ - -type in6_addr = struct { - __in6_union struct { - _ [0]uint32 - __s6_addr [16]uint8_t - } -} /* in.h:23:1 */ - -type sockaddr_in6 = struct { - sin6_family sa_family_t - sin6_port in_port_t - sin6_flowinfo uint32_t - sin6_addr struct { - __in6_union struct { - _ [0]uint32 - __s6_addr [16]uint8_t - } - } - sin6_scope_id uint32_t -} /* in.h:34:1 */ - -type ipv6_mreq = struct { - ipv6mr_multiaddr struct { - __in6_union struct { - _ [0]uint32 - __s6_addr [16]uint8_t - } - } - ipv6mr_interface uint32 -} /* in.h:42:1 */ - -type ip_opts = struct { - ip_dst struct{ s_addr in_addr_t } - ip_opts [40]int8 -} /* in.h:229:1 */ - -type ip_mreq = struct { - imr_multiaddr struct{ s_addr in_addr_t } - imr_interface struct{ s_addr in_addr_t } -} /* in.h:247:1 */ - -type ip_mreqn = struct { - imr_multiaddr struct{ s_addr in_addr_t } - imr_address struct{ s_addr in_addr_t } - imr_ifindex int32 -} /* in.h:252:1 */ - -type ip_mreq_source = struct { - imr_multiaddr struct{ s_addr in_addr_t } - imr_interface struct{ s_addr in_addr_t } - imr_sourceaddr struct{ s_addr in_addr_t } -} /* in.h:258:1 */ - -type ip_msfilter = struct { - imsf_multiaddr struct{ s_addr in_addr_t } - imsf_interface struct{ s_addr in_addr_t } - imsf_fmode uint32_t - imsf_numsrc uint32_t - imsf_slist [1]struct{ s_addr in_addr_t } -} /* in.h:264:1 */ - -type group_req = struct { - gr_interface uint32_t - _ [4]byte - gr_group struct { - ss_family sa_family_t - __ss_padding [118]int8 - __ss_align uint64 - } -} /* in.h:275:1 */ - -type group_source_req = struct { - gsr_interface uint32_t - _ [4]byte - gsr_group struct { - ss_family sa_family_t - __ss_padding [118]int8 - __ss_align uint64 - } - gsr_source struct { - ss_family sa_family_t - __ss_padding [118]int8 - __ss_align uint64 - } -} /* in.h:280:1 */ - -type group_filter = struct { - gf_interface uint32_t - _ [4]byte - gf_group struct { - ss_family sa_family_t - __ss_padding [118]int8 - __ss_align uint64 - } - gf_fmode uint32_t - gf_numsrc uint32_t - gf_slist [1]struct { - ss_family sa_family_t - __ss_padding [118]int8 - __ss_align uint64 - } -} /* in.h:286:1 */ - -type in_pktinfo = struct { - ipi_ifindex int32 - ipi_spec_dst struct{ s_addr in_addr_t } - ipi_addr struct{ s_addr in_addr_t } -} /* in.h:297:1 */ - -type in6_pktinfo = struct { - ipi6_addr struct { - __in6_union struct { - _ [0]uint32 - __s6_addr [16]uint8_t - } - } - ipi6_ifindex uint32 -} /* in.h:303:1 */ - -type ip6_mtuinfo = struct { - ip6m_addr struct { - sin6_family sa_family_t - sin6_port in_port_t - sin6_flowinfo uint32_t - sin6_addr struct { - __in6_union struct { - _ [0]uint32 - __s6_addr [16]uint8_t - } - } - sin6_scope_id uint32_t - } - ip6m_mtu uint32_t -} /* in.h:308:1 */ - -type addrinfo = struct { - ai_flags int32 - ai_family int32 - ai_socktype int32 - ai_protocol int32 - ai_addrlen socklen_t - _ [4]byte - ai_addr uintptr - ai_canonname uintptr - ai_next uintptr -} /* netdb.h:16:1 */ - -// Legacy functions follow (marked OBsolete in SUS) - -type netent = struct { - n_name uintptr - n_aliases uintptr - n_addrtype int32 - n_net uint32_t -} /* netdb.h:62:1 */ - -type hostent = struct { - h_name uintptr - h_aliases uintptr - h_addrtype int32 - h_length int32 - h_addr_list uintptr -} /* netdb.h:69:1 */ - -type servent = struct { - s_name uintptr - s_aliases uintptr - s_port int32 - _ [4]byte - s_proto uintptr -} /* netdb.h:78:1 */ - -type protoent = struct { - p_name uintptr - p_aliases uintptr - p_proto int32 - _ [4]byte -} /* netdb.h:85:1 */ - -type aibuf = struct { - ai struct { - ai_flags int32 - ai_family int32 - ai_socktype int32 - ai_protocol int32 - ai_addrlen socklen_t - _ [4]byte - ai_addr uintptr - ai_canonname uintptr - ai_next uintptr - } - sa struct { - sin struct { - sin_family sa_family_t - sin_port in_port_t - sin_addr struct{ s_addr in_addr_t } - sin_zero [8]uint8_t - } - _ [12]byte - } - lock [1]int32 - slot int16 - ref int16 - _ [4]byte -} /* lookup.h:10:1 */ - -type sa = struct { - sin struct { - sin_family sa_family_t - sin_port in_port_t - sin_addr struct{ s_addr in_addr_t } - sin_zero [8]uint8_t - } - _ [12]byte -} /* lookup.h:10:1 */ - -type address = struct { - family int32 - scopeid uint32 - addr [16]uint8_t - sortkey int32 -} /* lookup.h:20:1 */ - -type service = struct { - port uint16_t - proto uint8 - socktype uint8 -} /* lookup.h:27:1 */ - -type resolvconf = struct { - ns [3]struct { - family int32 - scopeid uint32 - addr [16]uint8_t - sortkey int32 - } - nns uint32 - attempts uint32 - ndots uint32 - timeout uint32 -} /* lookup.h:34:1 */ - -func Xfreeaddrinfo(tls *TLS, p uintptr) { /* freeaddrinfo.c:7:6: */ - if __ccgo_strace { - trc("tls=%v p=%v, (%v:)", tls, p, origin(2)) - } - var cnt size_t - cnt = uint64(1) -__1: - if !((*addrinfo)(unsafe.Pointer(p)).ai_next != 0) { - goto __3 - } - goto __2 -__2: - cnt++ - p = (*addrinfo)(unsafe.Pointer(p)).ai_next - goto __1 - goto __3 -__3: - ; - var b uintptr = p - uintptr(uint64(uintptr(0))) - b -= 88 * uintptr((*aibuf)(unsafe.Pointer(b)).slot) - //TODO LOCK(b->lock); - if !(int32(AssignSubPtrInt16(b+82, int16(cnt))) != 0) { - Xfree(tls, b) - } - //TODO else UNLOCK(b->lock); -} - -func Xgetaddrinfo(tls *TLS, host uintptr, serv uintptr, hint uintptr, res uintptr) int32 { /* getaddrinfo.c:12:5: */ - if __ccgo_strace { - trc("tls=%v host=%v serv=%v hint=%v res=%v, (%v:)", tls, host, serv, hint, res, origin(2)) - } - bp := tls.Alloc(1608) - defer tls.Free(1608) - - // var ports [2]service at bp, 8 - - // var addrs [48]address at bp+8, 1344 - - // var canon [256]int8 at bp+1352, 256 - - var outcanon uintptr - var nservs int32 - var naddrs int32 - var nais int32 - var canon_len int32 - var i int32 - var j int32 - var k int32 - var family int32 = 0 - var flags int32 = 0 - var proto int32 = 0 - var socktype int32 = 0 - var out uintptr - - if !(host != 0) && !(serv != 0) { - return -2 - } - - if hint != 0 { - family = (*addrinfo)(unsafe.Pointer(hint)).ai_family - flags = (*addrinfo)(unsafe.Pointer(hint)).ai_flags - proto = (*addrinfo)(unsafe.Pointer(hint)).ai_protocol - socktype = (*addrinfo)(unsafe.Pointer(hint)).ai_socktype - - var mask int32 = 0x01 | 0x02 | 0x04 | 0x08 | 0x10 | 0x20 | 0x400 - if flags&mask != flags { - return -1 - } - - switch family { - case 2: - fallthrough - case 10: - fallthrough - case 0: - break - fallthrough - default: - return -6 - } - } - - if flags&0x20 != 0 { - Xabort(tls) //TODO- - // /* Define the "an address is configured" condition for address - // * families via ability to create a socket for the family plus - // * routability of the loopback address for the family. */ - // static const struct sockaddr_in lo4 = { - // .sin_family = AF_INET, .sin_port = 65535, - // .sin_addr.s_addr = __BYTE_ORDER == __BIG_ENDIAN - // ? 0x7f000001 : 0x0100007f - // }; - // static const struct sockaddr_in6 lo6 = { - // .sin6_family = AF_INET6, .sin6_port = 65535, - // .sin6_addr = IN6ADDR_LOOPBACK_INIT - // }; - // int tf[2] = { AF_INET, AF_INET6 }; - // const void *ta[2] = { &lo4, &lo6 }; - // socklen_t tl[2] = { sizeof lo4, sizeof lo6 }; - // for (i=0; i<2; i++) { - // if (family==tf[1-i]) continue; - // int s = socket(tf[i], SOCK_CLOEXEC|SOCK_DGRAM, - // IPPROTO_UDP); - // if (s>=0) { - // int cs; - // pthread_setcancelstate( - // PTHREAD_CANCEL_DISABLE, &cs); - // int r = connect(s, ta[i], tl[i]); - // pthread_setcancelstate(cs, 0); - // close(s); - // if (!r) continue; - // } - // switch (errno) { - // case EADDRNOTAVAIL: - // case EAFNOSUPPORT: - // case EHOSTUNREACH: - // case ENETDOWN: - // case ENETUNREACH: - // break; - // default: - // return EAI_SYSTEM; - // } - // if (family == tf[i]) return EAI_NONAME; - // family = tf[1-i]; - // } - } - - nservs = X__lookup_serv(tls, bp, serv, proto, socktype, flags) - if nservs < 0 { - return nservs - } - - naddrs = X__lookup_name(tls, bp+8, bp+1352, host, family, flags) - if naddrs < 0 { - return naddrs - } - - nais = nservs * naddrs - canon_len = int32(Xstrlen(tls, bp+1352)) - out = Xcalloc(tls, uint64(1), uint64(nais)*uint64(unsafe.Sizeof(aibuf{}))+uint64(canon_len)+uint64(1)) - if !(out != 0) { - return -10 - } - - if canon_len != 0 { - outcanon = out + uintptr(nais)*88 - Xmemcpy(tls, outcanon, bp+1352, uint64(canon_len+1)) - } else { - outcanon = uintptr(0) - } - - for k = AssignInt32(&i, 0); i < naddrs; i++ { - j = 0 - __1: - if !(j < nservs) { - goto __3 - } - { - (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).slot = int16(k) - //TODO out[k].ai = (struct addrinfo){ - //TODO .ai_family = addrs[i].family, - //TODO .ai_socktype = ports[j].socktype, - //TODO .ai_protocol = ports[j].proto, - //TODO .ai_addrlen = addrs[i].family == AF_INET - //TODO ? sizeof(struct sockaddr_in) - //TODO : sizeof(struct sockaddr_in6), - //TODO .ai_addr = (void *)&out[k].sa, - //TODO .ai_canonname = outcanon }; - (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_family = (*address)(unsafe.Pointer(bp + 8 + uintptr(i)*28)).family - (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_socktype = int32((*service)(unsafe.Pointer(bp + uintptr(j)*4)).socktype) - (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_protocol = int32((*service)(unsafe.Pointer(bp + uintptr(j)*4)).proto) - (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_addrlen = func() uint32 { - if (*address)(unsafe.Pointer(bp+8+uintptr(i)*28)).family == 2 { - return uint32(unsafe.Sizeof(sockaddr_in{})) - } - return uint32(unsafe.Sizeof(sockaddr_in6{})) - }() - (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_addr = out + uintptr(k)*88 + 48 - (*aibuf)(unsafe.Pointer(out + uintptr(k)*88)).ai.ai_canonname = outcanon - if k != 0 { - (*aibuf)(unsafe.Pointer(out + uintptr(k-1)*88)).ai.ai_next = out + uintptr(k)*88 - } - switch (*address)(unsafe.Pointer(bp + 8 + uintptr(i)*28)).family { - case 2: - (*sockaddr_in)(unsafe.Pointer(out + uintptr(k)*88 + 48)).sin_family = sa_family_t(2) - (*sockaddr_in)(unsafe.Pointer(out + uintptr(k)*88 + 48)).sin_port = Xhtons(tls, (*service)(unsafe.Pointer(bp+uintptr(j)*4)).port) - Xmemcpy(tls, out+uintptr(k)*88+48+4, bp+8+uintptr(i)*28+8, uint64(4)) - break - case 10: - (*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*88 + 48)).sin6_family = sa_family_t(10) - (*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*88 + 48)).sin6_port = Xhtons(tls, (*service)(unsafe.Pointer(bp+uintptr(j)*4)).port) - (*sockaddr_in6)(unsafe.Pointer(out + uintptr(k)*88 + 48)).sin6_scope_id = (*address)(unsafe.Pointer(bp + 8 + uintptr(i)*28)).scopeid - Xmemcpy(tls, out+uintptr(k)*88+48+8, bp+8+uintptr(i)*28+8, uint64(16)) - break - } - - } - goto __2 - __2: - j++ - k++ - goto __1 - goto __3 - __3: - } - (*aibuf)(unsafe.Pointer(out)).ref = int16(nais) - *(*uintptr)(unsafe.Pointer(res)) = out - return 0 -} - -type ucred = struct { - pid pid_t - uid uid_t - gid gid_t -} /* socket.h:57:1 */ - -type mmsghdr = struct { - msg_hdr struct { - msg_name uintptr - msg_namelen socklen_t - _ [4]byte - msg_iov uintptr - msg_iovlen int32 - __pad1 int32 - msg_control uintptr - msg_controllen socklen_t - __pad2 int32 - msg_flags int32 - _ [4]byte - } - msg_len uint32 - _ [4]byte -} /* socket.h:63:1 */ - -func Xgethostbyaddr(tls *TLS, a uintptr, l socklen_t, af int32) uintptr { /* gethostbyaddr.c:7:16: */ - if __ccgo_strace { - trc("tls=%v a=%v l=%v af=%v, (%v:)", tls, a, l, af, origin(2)) - } - bp := tls.Alloc(8) - defer tls.Free(8) - - var size size_t = uint64(63) - // var res uintptr at bp, 8 - - var err int32 - for __ccgo := true; __ccgo; __ccgo = err == 34 { - Xfree(tls, _sh) - _sh = Xmalloc(tls, AssignAddUint64(&size, size+uint64(1))) - if !(_sh != 0) { - *(*int32)(unsafe.Pointer(X__h_errno_location(tls))) = 3 - return uintptr(0) - } - err = Xgethostbyaddr_r(tls, a, l, af, _sh, - _sh+uintptr(1)*32, size-size_t(unsafe.Sizeof(hostent{})), bp, X__h_errno_location(tls)) - } - if err != 0 { - return uintptr(0) - } - return _sh -} - -var _sh uintptr /* gethostbyaddr.c:9:24: */ - -func Xgethostbyaddr_r(tls *TLS, a uintptr, l socklen_t, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyaddr_r.c:10:5: */ - if __ccgo_strace { - trc("tls=%v a=%v l=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, a, l, af, h, buf, buflen, res, err, origin(2)) - } - bp := tls.Alloc(28) - defer tls.Free(28) - - //TODO union { - //TODO struct sockaddr_in sin; - //TODO struct sockaddr_in6 sin6; - //TODO } sa = { .sin.sin_family = af }; - *(*struct { - sin sockaddr_in - _ [12]byte - })(unsafe.Pointer(bp)) = struct { - sin sockaddr_in - _ [12]byte - }{} //TODO- - (*sockaddr_in)(unsafe.Pointer(bp)).sin_family = sa_family_t(af) //TODO- - var sl socklen_t - if af == 10 { - sl = uint32(unsafe.Sizeof(sockaddr_in6{})) - } else { - sl = uint32(unsafe.Sizeof(sockaddr_in{})) - } - var i int32 - - *(*uintptr)(unsafe.Pointer(res)) = uintptr(0) - - // Load address argument into sockaddr structure - if af == 10 && l == socklen_t(16) { - Xmemcpy(tls, bp+8, a, uint64(16)) - } else if af == 2 && l == socklen_t(4) { - Xmemcpy(tls, bp+4, a, uint64(4)) - } else { - *(*int32)(unsafe.Pointer(err)) = 3 - return 22 - } - - // Align buffer and check for space for pointers and ip address - i = int32(uintptr_t(buf) & (uint64(unsafe.Sizeof(uintptr(0))) - uint64(1))) - if !(i != 0) { - i = int32(unsafe.Sizeof(uintptr(0))) - } - if buflen <= uint64(5)*uint64(unsafe.Sizeof(uintptr(0)))-uint64(i)+uint64(l) { - return 34 - } - buf += uintptr(uint64(unsafe.Sizeof(uintptr(0))) - uint64(i)) - buflen = buflen - (uint64(5)*uint64(unsafe.Sizeof(uintptr(0))) - uint64(i) + uint64(l)) - - (*hostent)(unsafe.Pointer(h)).h_addr_list = buf - buf += uintptr(uint64(2) * uint64(unsafe.Sizeof(uintptr(0)))) - (*hostent)(unsafe.Pointer(h)).h_aliases = buf - buf += uintptr(uint64(2) * uint64(unsafe.Sizeof(uintptr(0)))) - - *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list)) = buf - Xmemcpy(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list)), a, uint64(l)) - buf += uintptr(l) - *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list + 1*8)) = uintptr(0) - *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases)) = buf - *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8)) = uintptr(0) - - switch Xgetnameinfo(tls, bp, sl, buf, uint32(buflen), uintptr(0), uint32(0), 0) { - case -3: - *(*int32)(unsafe.Pointer(err)) = 2 - return 11 - case -12: - return 34 - default: - fallthrough - case -10: - fallthrough - case -11: - fallthrough - case -4: - *(*int32)(unsafe.Pointer(err)) = 3 - return *(*int32)(unsafe.Pointer(X___errno_location(tls))) - case 0: - break - } - - (*hostent)(unsafe.Pointer(h)).h_addrtype = af - (*hostent)(unsafe.Pointer(h)).h_length = int32(l) - (*hostent)(unsafe.Pointer(h)).h_name = *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases)) - *(*uintptr)(unsafe.Pointer(res)) = h - return 0 -} - -func Xgethostbyname(tls *TLS, name uintptr) uintptr { /* gethostbyname.c:8:16: */ - if __ccgo_strace { - trc("tls=%v name=%v, (%v:)", tls, name, origin(2)) - } - return Xgethostbyname2(tls, name, 2) -} - -func Xgethostbyname2(tls *TLS, name uintptr, af int32) uintptr { /* gethostbyname2.c:8:16: */ - if __ccgo_strace { - trc("tls=%v name=%v af=%v, (%v:)", tls, name, af, origin(2)) - } - bp := tls.Alloc(8) - defer tls.Free(8) - - var size size_t = uint64(63) - // var res uintptr at bp, 8 - - var err int32 - for __ccgo := true; __ccgo; __ccgo = err == 34 { - Xfree(tls, _sh1) - _sh1 = Xmalloc(tls, AssignAddUint64(&size, size+uint64(1))) - if !(_sh1 != 0) { - *(*int32)(unsafe.Pointer(X__h_errno_location(tls))) = 3 - return uintptr(0) - } - err = Xgethostbyname2_r(tls, name, af, _sh1, - _sh1+uintptr(1)*32, size-size_t(unsafe.Sizeof(hostent{})), bp, X__h_errno_location(tls)) - } - if err != 0 { - return uintptr(0) - } - return _sh1 -} - -var _sh1 uintptr /* gethostbyname2.c:10:24: */ - -func Xgethostbyname2_r(tls *TLS, name uintptr, af int32, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname2_r.c:11:5: */ - if __ccgo_strace { - trc("tls=%v name=%v af=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, name, af, h, buf, buflen, res, err, origin(2)) - } - bp := tls.Alloc(1600) - defer tls.Free(1600) - - // var addrs [48]address at bp, 1344 - - // var canon [256]int8 at bp+1344, 256 - - var i int32 - var cnt int32 - var align size_t - var need size_t - - *(*uintptr)(unsafe.Pointer(res)) = uintptr(0) - cnt = X__lookup_name(tls, bp, bp+1344, name, af, 0x02) - if cnt < 0 { - switch cnt { - case -2: - *(*int32)(unsafe.Pointer(err)) = 1 - return 2 - fallthrough - case -3: - *(*int32)(unsafe.Pointer(err)) = 2 - return 11 - fallthrough - default: - fallthrough - case -4: - *(*int32)(unsafe.Pointer(err)) = 3 - return 74 - fallthrough - case -10: - fallthrough - case -11: - *(*int32)(unsafe.Pointer(err)) = 3 - return *(*int32)(unsafe.Pointer(X___errno_location(tls))) - } - } - - (*hostent)(unsafe.Pointer(h)).h_addrtype = af - (*hostent)(unsafe.Pointer(h)).h_length = func() int32 { - if af == 10 { - return 16 - } - return 4 - }() - - // Align buffer - align = -uintptr_t(buf) & (uint64(unsafe.Sizeof(uintptr(0))) - uint64(1)) - - need = uint64(4) * uint64(unsafe.Sizeof(uintptr(0))) - need = need + uint64(cnt+1)*(uint64(unsafe.Sizeof(uintptr(0)))+uint64((*hostent)(unsafe.Pointer(h)).h_length)) - need = need + (Xstrlen(tls, name) + uint64(1)) - need = need + (Xstrlen(tls, bp+1344) + uint64(1)) - need = need + align - - if need > buflen { - return 34 - } - - buf += uintptr(align) - (*hostent)(unsafe.Pointer(h)).h_aliases = buf - buf += uintptr(uint64(3) * uint64(unsafe.Sizeof(uintptr(0)))) - (*hostent)(unsafe.Pointer(h)).h_addr_list = buf - buf += uintptr(uint64(cnt+1) * uint64(unsafe.Sizeof(uintptr(0)))) - - for i = 0; i < cnt; i++ { - *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list + uintptr(i)*8)) = buf - buf += uintptr((*hostent)(unsafe.Pointer(h)).h_length) - Xmemcpy(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list + uintptr(i)*8)), bp+uintptr(i)*28+8, uint64((*hostent)(unsafe.Pointer(h)).h_length)) - } - *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_addr_list + uintptr(i)*8)) = uintptr(0) - - (*hostent)(unsafe.Pointer(h)).h_name = AssignPtrUintptr((*hostent)(unsafe.Pointer(h)).h_aliases, buf) - Xstrcpy(tls, (*hostent)(unsafe.Pointer(h)).h_name, bp+1344) - buf += uintptr(Xstrlen(tls, (*hostent)(unsafe.Pointer(h)).h_name) + uint64(1)) - - if Xstrcmp(tls, (*hostent)(unsafe.Pointer(h)).h_name, name) != 0 { - *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8)) = buf - Xstrcpy(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8)), name) - buf += uintptr(Xstrlen(tls, *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8))) + uint64(1)) - } else { - *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 1*8)) = uintptr(0) - } - - *(*uintptr)(unsafe.Pointer((*hostent)(unsafe.Pointer(h)).h_aliases + 2*8)) = uintptr(0) - - *(*uintptr)(unsafe.Pointer(res)) = h - return 0 -} - -func Xgethostbyname_r(tls *TLS, name uintptr, h uintptr, buf uintptr, buflen size_t, res uintptr, err uintptr) int32 { /* gethostbyname_r.c:6:5: */ - if __ccgo_strace { - trc("tls=%v name=%v h=%v buf=%v buflen=%v res=%v err=%v, (%v:)", tls, name, h, buf, buflen, res, err, origin(2)) - } - return Xgethostbyname2_r(tls, name, 2, h, buf, buflen, res, err) -} - -type if_nameindex = struct { - if_index uint32 - _ [4]byte - if_name uintptr -} /* if.h:12:1 */ - -type ifaddr = struct { - ifa_addr struct { - sa_family sa_family_t - sa_data [14]int8 - } - ifa_ifu struct { - ifu_broadaddr struct { - sa_family sa_family_t - sa_data [14]int8 - } - } - ifa_ifp uintptr - ifa_next uintptr -} /* if.h:51:1 */ - -type ifmap = struct { - mem_start uint64 - mem_end uint64 - base_addr uint16 - irq uint8 - dma uint8 - port uint8 - _ [3]byte -} /* if.h:64:1 */ - -type ifreq = struct { - ifr_ifrn struct{ ifrn_name [16]int8 } - ifr_ifru struct { - _ [0]uint64 - ifru_addr struct { - sa_family sa_family_t - sa_data [14]int8 - } - _ [8]byte - } -} /* if.h:76:1 */ - -type ifconf = struct { - ifc_len int32 - _ [4]byte - ifc_ifcu struct{ ifcu_buf uintptr } -} /* if.h:116:1 */ - -type ns_sect = uint32 /* nameser.h:37:3 */ - -type __ns_msg = struct { - _msg uintptr - _eom uintptr - _id uint16_t - _flags uint16_t - _counts [4]uint16_t - _ [4]byte - _sections [4]uintptr - _sect ns_sect - _rrnum int32 - _msg_ptr uintptr -} /* nameser.h:39:9 */ - -type ns_msg = __ns_msg /* nameser.h:46:3 */ - -type _ns_flagdata = struct { - mask int32 - shift int32 -} /* nameser.h:48:1 */ - -type __ns_rr = struct { - name [1025]int8 - _ [1]byte - __type uint16_t - rr_class uint16_t - _ [2]byte - ttl uint32_t - rdlength uint16_t - _ [2]byte - rdata uintptr -} /* nameser.h:59:9 */ - -type ns_rr = __ns_rr /* nameser.h:66:3 */ - -type ns_flag = uint32 /* nameser.h:87:3 */ - -type ns_opcode = uint32 /* nameser.h:96:3 */ - -type ns_rcode = uint32 /* nameser.h:115:3 */ - -type ns_update_operation = uint32 /* nameser.h:121:3 */ - -type ns_tsig_key1 = struct { - name [1025]int8 - alg [1025]int8 - _ [6]byte - data uintptr - len int32 - _ [4]byte -} /* nameser.h:123:1 */ - -type ns_tsig_key = ns_tsig_key1 /* nameser.h:128:28 */ - -type ns_tcp_tsig_state1 = struct { - counter int32 - _ [4]byte - key uintptr - ctx uintptr - sig [512]uint8 - siglen int32 - _ [4]byte -} /* nameser.h:130:1 */ - -type ns_tcp_tsig_state = ns_tcp_tsig_state1 /* nameser.h:137:34 */ - -type ns_type = uint32 /* nameser.h:200:3 */ - -type ns_class = uint32 /* nameser.h:219:3 */ - -type ns_key_types = uint32 /* nameser.h:226:3 */ - -type ns_cert_types = uint32 /* nameser.h:234:3 */ - -type HEADER = struct { - _ [0]uint32 - id uint32 /* unsigned id: 16, unsigned rd: 1, unsigned tc: 1, unsigned aa: 1, unsigned opcode: 4, unsigned qr: 1, unsigned rcode: 4, unsigned cd: 1, unsigned ad: 1, unsigned unused: 1, unsigned ra: 1 */ - qdcount uint32 /* unsigned qdcount: 16, unsigned ancount: 16 */ - nscount uint32 /* unsigned nscount: 16, unsigned arcount: 16 */ -} /* nameser.h:353:3 */ - -// unused; purely for broken apps -type __res_state = struct { - retrans int32 - retry int32 - options uint64 - nscount int32 - nsaddr_list [3]struct { - sin_family sa_family_t - sin_port in_port_t - sin_addr struct{ s_addr in_addr_t } - sin_zero [8]uint8_t - } - id uint16 - _ [2]byte - dnsrch [7]uintptr - defdname [256]int8 - pfcode uint64 - ndots uint32 /* unsigned ndots: 4, unsigned nsort: 4, unsigned ipv6_unavail: 1, unsigned unused: 23 */ - _ [4]byte - sort_list [10]struct { - addr struct{ s_addr in_addr_t } - mask uint32_t - } - qhook uintptr - rhook uintptr - res_h_errno int32 - _vcsock int32 - _flags uint32 - _ [4]byte - _u struct { - _ [0]uint64 - pad [52]int8 - _ [4]byte - } -} /* resolv.h:26:9 */ - -// unused; purely for broken apps -type res_state = uintptr /* resolv.h:62:3 */ - -type res_sym = struct { - number int32 - _ [4]byte - name uintptr - humanname uintptr -} /* resolv.h:70:1 */ - -func itoa(tls *TLS, p uintptr, x uint32) uintptr { /* getnameinfo.c:18:13: */ - p += uintptr(uint64(3) * uint64(unsafe.Sizeof(int32(0)))) - *(*int8)(unsafe.Pointer(PreDecUintptr(&p, 1))) = int8(0) - for __ccgo := true; __ccgo; __ccgo = x != 0 { - *(*int8)(unsafe.Pointer(PreDecUintptr(&p, 1))) = int8(uint32('0') + x%uint32(10)) - x = x / uint32(10) - } - return p -} - -func mkptr4(tls *TLS, s uintptr, ip uintptr) { /* getnameinfo.c:28:13: */ - bp := tls.Alloc(32) - defer tls.Free(32) - - Xsprintf(tls, s, ts+25, - VaList(bp, int32(*(*uint8)(unsafe.Pointer(ip + 3))), int32(*(*uint8)(unsafe.Pointer(ip + 2))), int32(*(*uint8)(unsafe.Pointer(ip + 1))), int32(*(*uint8)(unsafe.Pointer(ip))))) -} - -func mkptr6(tls *TLS, s uintptr, ip uintptr) { /* getnameinfo.c:34:13: */ - var i int32 - for i = 15; i >= 0; i-- { - *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = _sxdigits[int32(*(*uint8)(unsafe.Pointer(ip + uintptr(i))))&15] - *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = int8('.') - *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = _sxdigits[int32(*(*uint8)(unsafe.Pointer(ip + uintptr(i))))>>4] - *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) = int8('.') - } - Xstrcpy(tls, s, ts+50) -} - -var _sxdigits = *(*[17]int8)(unsafe.Pointer(ts + 59)) /* getnameinfo.c:36:20 */ - -func reverse_hosts(tls *TLS, buf uintptr, a uintptr, scopeid uint32, family int32) { /* getnameinfo.c:45:13: */ - bp := tls.Alloc(556) - defer tls.Free(556) - - // var line [512]int8 at bp+16, 512 - - var p uintptr - var z uintptr - var _buf [1032]uint8 - _ = _buf - // var atmp [16]uint8 at bp, 16 - - // var iplit address at bp+528, 28 - - //TODO FILE _f, *f = __fopen_rb_ca("/etc/hosts", &_f, _buf, sizeof _buf); - var f uintptr = Xfopen(tls, ts+76, ts+87) - if !(f != 0) { - return - } - if family == 2 { - Xmemcpy(tls, bp+uintptr(12), a, uint64(4)) - Xmemcpy(tls, bp, ts+90, uint64(12)) - a = bp /* &atmp[0] */ - } - for Xfgets(tls, bp+16, int32(unsafe.Sizeof([512]int8{})), f) != 0 { - if AssignUintptr(&p, Xstrchr(tls, bp+16, '#')) != 0 { - *(*int8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = int8('\n') - *(*int8)(unsafe.Pointer(p)) = int8(0) - } - - for p = bp + 16; /* &line[0] */ *(*int8)(unsafe.Pointer(p)) != 0 && !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(p)))) != 0); p++ { - } - *(*int8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = int8(0) - if X__lookup_ipliteral(tls, bp+528, bp+16, 0) <= 0 { - continue - } - - if (*address)(unsafe.Pointer(bp+528)).family == 2 { - Xmemcpy(tls, bp+528+8+uintptr(12), bp+528+8, uint64(4)) - Xmemcpy(tls, bp+528+8, ts+90, uint64(12)) - (*address)(unsafe.Pointer(bp + 528 /* &iplit */)).scopeid = uint32(0) - } - - if Xmemcmp(tls, a, bp+528+8, uint64(16)) != 0 || (*address)(unsafe.Pointer(bp+528)).scopeid != scopeid { - continue - } - - for ; *(*int8)(unsafe.Pointer(p)) != 0 && __isspace(tls, int32(*(*int8)(unsafe.Pointer(p)))) != 0; p++ { - } - for z = p; *(*int8)(unsafe.Pointer(z)) != 0 && !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(z)))) != 0); z++ { - } - *(*int8)(unsafe.Pointer(z)) = int8(0) - if (int64(z)-int64(p))/1 < int64(256) { - Xmemcpy(tls, buf, p, uint64((int64(z)-int64(p))/1+int64(1))) - break - } - } - //TODO __fclose_ca(f); - Xfclose(tls, f) -} - -func reverse_services(tls *TLS, buf uintptr, port int32, dgram int32) { /* getnameinfo.c:87:13: */ - Xabort(tls) //TODO- - // unsigned long svport; - // char line[128], *p, *z; - // unsigned char _buf[1032]; - // FILE _f, *f = __fopen_rb_ca("/etc/services", &_f, _buf, sizeof _buf); - // if (!f) return; - // while (fgets(line, sizeof line, f)) { - // if ((p=strchr(line, '#'))) *p++='\n', *p=0; - - // for (p=line; *p && !isspace(*p); p++); - // if (!*p) continue; - // *p++ = 0; - // svport = strtoul(p, &z, 10); - - // if (svport != port || z==p) continue; - // if (dgram && strncmp(z, "/udp", 4)) continue; - // if (!dgram && strncmp(z, "/tcp", 4)) continue; - // if (p-line > 32) continue; - - // memcpy(buf, line, p-line); - // break; - // } - // __fclose_ca(f); -} - -func Xgetnameinfo(tls *TLS, sa1 uintptr, sl socklen_t, node uintptr, nodelen socklen_t, serv uintptr, servlen socklen_t, flags int32) int32 { /* getnameinfo.c:125:5: */ - if __ccgo_strace { - trc("tls=%v sa1=%v sl=%v node=%v nodelen=%v serv=%v servlen=%v flags=%v, (%v:)", tls, sa1, sl, node, nodelen, serv, servlen, flags, origin(2)) - } - bp := tls.Alloc(347) - defer tls.Free(347) - - // var ptr [78]int8 at bp, 78 - - // var buf [256]int8 at bp+78, 256 - - // var num [13]int8 at bp+334, 13 - - var af int32 = int32((*sockaddr)(unsafe.Pointer(sa1)).sa_family) - var a uintptr - var scopeid uint32 - - switch af { - case 2: - a = sa1 + 4 - if uint64(sl) < uint64(unsafe.Sizeof(sockaddr_in{})) { - return -6 - } - mkptr4(tls, bp, a) - scopeid = uint32(0) - break - case 10: - a = sa1 + 8 - if uint64(sl) < uint64(unsafe.Sizeof(sockaddr_in6{})) { - return -6 - } - if Xmemcmp(tls, a, ts+90, uint64(12)) != 0 { - mkptr6(tls, bp, a) - } else { - mkptr4(tls, bp, a+uintptr(12)) - } - scopeid = (*sockaddr_in6)(unsafe.Pointer(sa1)).sin6_scope_id - break - default: - return -6 - } - - if node != 0 && nodelen != 0 { - *(*int8)(unsafe.Pointer(bp + 78)) = int8(0) - if !(flags&0x01 != 0) { - reverse_hosts(tls, bp+78, a, scopeid, af) - } - if !(int32(*(*int8)(unsafe.Pointer(bp + 78))) != 0) && !(flags&0x01 != 0) { - Xabort(tls) //TODO- - // unsigned char query[18+PTR_MAX], reply[512]; - // int qlen = __res_mkquery(0, ptr, 1, RR_PTR, - // 0, 0, 0, query, sizeof query); - // query[3] = 0; /* don't need AD flag */ - // int rlen = __res_send(query, qlen, reply, sizeof reply); - // buf[0] = 0; - // if (rlen > 0) - // __dns_parse(reply, rlen, dns_parse_callback, buf); - } - if !(int32(*(*int8)(unsafe.Pointer(bp + 78))) != 0) { - if flags&0x08 != 0 { - return -2 - } - Xinet_ntop(tls, af, a, bp+78, uint32(unsafe.Sizeof([256]int8{}))) - if scopeid != 0 { - Xabort(tls) //TODO- - // char *p = 0, tmp[IF_NAMESIZE+1]; - // if (!(flags & NI_NUMERICSCOPE) && - // (IN6_IS_ADDR_LINKLOCAL(a) || - // IN6_IS_ADDR_MC_LINKLOCAL(a))) - // p = if_indextoname(scopeid, tmp+1); - // if (!p) - // p = itoa(num, scopeid); - // *--p = '%'; - // strcat(buf, p); - } - } - if Xstrlen(tls, bp+78) >= size_t(nodelen) { - return -12 - } - Xstrcpy(tls, node, bp+78) - } - - if serv != 0 && servlen != 0 { - var p uintptr = bp + 78 /* buf */ - var port int32 = int32(Xntohs(tls, (*sockaddr_in)(unsafe.Pointer(sa1)).sin_port)) - *(*int8)(unsafe.Pointer(bp + 78)) = int8(0) - if !(flags&0x02 != 0) { - reverse_services(tls, bp+78, port, flags&0x10) - } - if !(int32(*(*int8)(unsafe.Pointer(p))) != 0) { - p = itoa(tls, bp+334, uint32(port)) - } - if Xstrlen(tls, p) >= size_t(servlen) { - return -12 - } - Xstrcpy(tls, serv, p) - } - - return 0 -} - -var Xh_errno int32 /* h_errno.c:4:5: */ - -func X__h_errno_location(tls *TLS) uintptr { /* h_errno.c:6:5: */ - if __ccgo_strace { - trc("tls=%v, (%v:)", tls, origin(2)) - } - return uintptr(unsafe.Pointer(&Xh_errno)) -} - -func X__inet_aton(tls *TLS, s0 uintptr, dest uintptr) int32 { /* inet_aton.c:7:5: */ - if __ccgo_strace { - trc("tls=%v s0=%v dest=%v, (%v:)", tls, s0, dest, origin(2)) - } - bp := tls.Alloc(40) - defer tls.Free(40) - - var s uintptr = s0 - var d uintptr = dest - *(*[4]uint64)(unsafe.Pointer(bp /* a */)) = [4]uint64{0: uint64(0)} - // var z uintptr at bp+32, 8 - - var i int32 - - for i = 0; i < 4; i++ { - *(*uint64)(unsafe.Pointer(bp + uintptr(i)*8)) = Xstrtoul(tls, s, bp+32, 0) - if *(*uintptr)(unsafe.Pointer(bp + 32)) == s || *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32)))) != 0 && int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32))))) != '.' || !(func() int32 { - if 0 != 0 { - return Xisdigit(tls, int32(*(*int8)(unsafe.Pointer(s)))) - } - return Bool32(uint32(*(*int8)(unsafe.Pointer(s)))-uint32('0') < uint32(10)) - }() != 0) { - return 0 - } - if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 32))))) != 0) { - break - } - s = *(*uintptr)(unsafe.Pointer(bp + 32)) + uintptr(1) - } - if i == 4 { - return 0 - } - switch i { - case 0: - *(*uint64)(unsafe.Pointer(bp + 1*8)) = *(*uint64)(unsafe.Pointer(bp)) & uint64(0xffffff) - AssignShrPtrUint64(bp, int(24)) - fallthrough - case 1: - *(*uint64)(unsafe.Pointer(bp + 2*8)) = *(*uint64)(unsafe.Pointer(bp + 1*8)) & uint64(0xffff) - AssignShrPtrUint64(bp+1*8, int(16)) - fallthrough - case 2: - *(*uint64)(unsafe.Pointer(bp + 3*8)) = *(*uint64)(unsafe.Pointer(bp + 2*8)) & uint64(0xff) - AssignShrPtrUint64(bp+2*8, int(8)) - } - for i = 0; i < 4; i++ { - if *(*uint64)(unsafe.Pointer(bp + uintptr(i)*8)) > uint64(255) { - return 0 - } - *(*uint8)(unsafe.Pointer(d + uintptr(i))) = uint8(*(*uint64)(unsafe.Pointer(bp + uintptr(i)*8))) - } - return 1 -} - -func Xinet_ntop(tls *TLS, af int32, a0 uintptr, s uintptr, l socklen_t) uintptr { /* inet_ntop.c:7:12: */ - if __ccgo_strace { - trc("tls=%v af=%v a0=%v s=%v l=%v, (%v:)", tls, af, a0, s, l, origin(2)) - } - bp := tls.Alloc(276) - defer tls.Free(276) - - var a uintptr = a0 - var i int32 - var j int32 - var max int32 - var best int32 - // var buf [100]int8 at bp+176, 100 - - switch af { - case 2: - if socklen_t(Xsnprintf(tls, s, uint64(l), ts+103, VaList(bp, int32(*(*uint8)(unsafe.Pointer(a))), int32(*(*uint8)(unsafe.Pointer(a + 1))), int32(*(*uint8)(unsafe.Pointer(a + 2))), int32(*(*uint8)(unsafe.Pointer(a + 3)))))) < l { - return s - } - break - case 10: - if Xmemcmp(tls, a, ts+90, uint64(12)) != 0 { - Xsnprintf(tls, bp+176, uint64(unsafe.Sizeof([100]int8{})), - ts+115, - VaList(bp+32, 256*int32(*(*uint8)(unsafe.Pointer(a)))+int32(*(*uint8)(unsafe.Pointer(a + 1))), 256*int32(*(*uint8)(unsafe.Pointer(a + 2)))+int32(*(*uint8)(unsafe.Pointer(a + 3))), - 256*int32(*(*uint8)(unsafe.Pointer(a + 4)))+int32(*(*uint8)(unsafe.Pointer(a + 5))), 256*int32(*(*uint8)(unsafe.Pointer(a + 6)))+int32(*(*uint8)(unsafe.Pointer(a + 7))), - 256*int32(*(*uint8)(unsafe.Pointer(a + 8)))+int32(*(*uint8)(unsafe.Pointer(a + 9))), 256*int32(*(*uint8)(unsafe.Pointer(a + 10)))+int32(*(*uint8)(unsafe.Pointer(a + 11))), - 256*int32(*(*uint8)(unsafe.Pointer(a + 12)))+int32(*(*uint8)(unsafe.Pointer(a + 13))), 256*int32(*(*uint8)(unsafe.Pointer(a + 14)))+int32(*(*uint8)(unsafe.Pointer(a + 15))))) - } else { - Xsnprintf(tls, bp+176, uint64(unsafe.Sizeof([100]int8{})), - ts+139, - VaList(bp+96, 256*int32(*(*uint8)(unsafe.Pointer(a)))+int32(*(*uint8)(unsafe.Pointer(a + 1))), 256*int32(*(*uint8)(unsafe.Pointer(a + 2)))+int32(*(*uint8)(unsafe.Pointer(a + 3))), - 256*int32(*(*uint8)(unsafe.Pointer(a + 4)))+int32(*(*uint8)(unsafe.Pointer(a + 5))), 256*int32(*(*uint8)(unsafe.Pointer(a + 6)))+int32(*(*uint8)(unsafe.Pointer(a + 7))), - 256*int32(*(*uint8)(unsafe.Pointer(a + 8)))+int32(*(*uint8)(unsafe.Pointer(a + 9))), 256*int32(*(*uint8)(unsafe.Pointer(a + 10)))+int32(*(*uint8)(unsafe.Pointer(a + 11))), - int32(*(*uint8)(unsafe.Pointer(a + 12))), int32(*(*uint8)(unsafe.Pointer(a + 13))), int32(*(*uint8)(unsafe.Pointer(a + 14))), int32(*(*uint8)(unsafe.Pointer(a + 15))))) - } - // Replace longest /(^0|:)[:0]{2,}/ with "::" - i = AssignInt32(&best, 0) - max = 2 - for ; *(*int8)(unsafe.Pointer(bp + 176 + uintptr(i))) != 0; i++ { - if i != 0 && int32(*(*int8)(unsafe.Pointer(bp + 176 + uintptr(i)))) != ':' { - continue - } - j = int32(Xstrspn(tls, bp+176+uintptr(i), ts+169)) - if j > max { - best = i - max = j - } - } - if max > 3 { - *(*int8)(unsafe.Pointer(bp + 176 + uintptr(best))) = AssignPtrInt8(bp+176+uintptr(best+1), int8(':')) - Xmemmove(tls, bp+176+uintptr(best)+uintptr(2), bp+176+uintptr(best)+uintptr(max), uint64(i-best-max+1)) - } - if Xstrlen(tls, bp+176) < size_t(l) { - Xstrcpy(tls, s, bp+176) - return s - } - break - default: - *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 97 - return uintptr(0) - } - *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 28 - return uintptr(0) -} - -func hexval(tls *TLS, c uint32) int32 { /* inet_pton.c:7:12: */ - if c-uint32('0') < uint32(10) { - return int32(c - uint32('0')) - } - c = c | uint32(32) - if c-uint32('a') < uint32(6) { - return int32(c - uint32('a') + uint32(10)) - } - return -1 -} - -func Xinet_pton(tls *TLS, af int32, s uintptr, a0 uintptr) int32 { /* inet_pton.c:15:5: */ - if __ccgo_strace { - trc("tls=%v af=%v s=%v a0=%v, (%v:)", tls, af, s, a0, origin(2)) - } - bp := tls.Alloc(16) - defer tls.Free(16) - - // var ip [8]uint16_t at bp, 16 - - var a uintptr = a0 - var i int32 - var j int32 - var v int32 - var d int32 - var brk int32 = -1 - var need_v4 int32 = 0 - - if af == 2 { - for i = 0; i < 4; i++ { - for v = AssignInt32(&j, 0); j < 3 && func() int32 { - if 0 != 0 { - return Xisdigit(tls, int32(*(*int8)(unsafe.Pointer(s + uintptr(j))))) - } - return Bool32(uint32(*(*int8)(unsafe.Pointer(s + uintptr(j))))-uint32('0') < uint32(10)) - }() != 0; j++ { - v = 10*v + int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) - '0' - } - if j == 0 || j > 1 && int32(*(*int8)(unsafe.Pointer(s))) == '0' || v > 255 { - return 0 - } - *(*uint8)(unsafe.Pointer(a + uintptr(i))) = uint8(v) - if int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) == 0 && i == 3 { - return 1 - } - if int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) != '.' { - return 0 - } - s += uintptr(j + 1) - } - return 0 - } else if af != 10 { - *(*int32)(unsafe.Pointer(X___errno_location(tls))) = 97 - return -1 - } - - if int32(*(*int8)(unsafe.Pointer(s))) == ':' && int32(*(*int8)(unsafe.Pointer(PreIncUintptr(&s, 1)))) != ':' { - return 0 - } - - for i = 0; ; i++ { - if int32(*(*int8)(unsafe.Pointer(s))) == ':' && brk < 0 { - brk = i - *(*uint16_t)(unsafe.Pointer(bp + uintptr(i&7)*2)) = uint16_t(0) - if !(int32(*(*int8)(unsafe.Pointer(PreIncUintptr(&s, 1)))) != 0) { - break - } - if i == 7 { - return 0 - } - continue - } - for v = AssignInt32(&j, 0); j < 4 && AssignInt32(&d, hexval(tls, uint32(*(*int8)(unsafe.Pointer(s + uintptr(j)))))) >= 0; j++ { - v = 16*v + d - } - if j == 0 { - return 0 - } - *(*uint16_t)(unsafe.Pointer(bp + uintptr(i&7)*2)) = uint16_t(v) - if !(int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) != 0) && (brk >= 0 || i == 7) { - break - } - if i == 7 { - return 0 - } - if int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) != ':' { - if int32(*(*int8)(unsafe.Pointer(s + uintptr(j)))) != '.' || i < 6 && brk < 0 { - return 0 - } - need_v4 = 1 - i++ - break - } - s += uintptr(j + 1) - } - if brk >= 0 { - Xmemmove(tls, bp+uintptr(brk)*2+uintptr(7)*2-uintptr(i)*2, bp+uintptr(brk)*2, uint64(2*(i+1-brk))) - for j = 0; j < 7-i; j++ { - *(*uint16_t)(unsafe.Pointer(bp + uintptr(brk+j)*2)) = uint16_t(0) - } - } - for j = 0; j < 8; j++ { - *(*uint8)(unsafe.Pointer(PostIncUintptr(&a, 1))) = uint8(int32(*(*uint16_t)(unsafe.Pointer(bp + uintptr(j)*2))) >> 8) - *(*uint8)(unsafe.Pointer(PostIncUintptr(&a, 1))) = uint8(*(*uint16_t)(unsafe.Pointer(bp + uintptr(j)*2))) - } - if need_v4 != 0 && Xinet_pton(tls, 2, s, a-uintptr(4)) <= 0 { - return 0 - } - return 1 -} - -func X__lookup_ipliteral(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_ipliteral.c:12:5: */ - if __ccgo_strace { - trc("tls=%v buf=%v name=%v family=%v, (%v:)", tls, buf, name, family, origin(2)) - } - bp := tls.Alloc(96) - defer tls.Free(96) - - // var a4 in_addr at bp, 4 - - // var a6 in6_addr at bp+68, 16 - - if X__inet_aton(tls, name, bp) > 0 { - if family == 10 { // wrong family - return -2 - } - Xmemcpy(tls, buf+8, bp, uint64(unsafe.Sizeof(in_addr{}))) - (*address)(unsafe.Pointer(buf)).family = 2 - (*address)(unsafe.Pointer(buf)).scopeid = uint32(0) - return 1 - } - // var tmp [64]int8 at bp+4, 64 - - var p uintptr = Xstrchr(tls, name, '%') - // var z uintptr at bp+88, 8 - - var scopeid uint64 = uint64(0) - if p != 0 && (int64(p)-int64(name))/1 < int64(64) { - Xmemcpy(tls, bp+4, name, uint64((int64(p)-int64(name))/1)) - *(*int8)(unsafe.Pointer(bp + 4 + uintptr((int64(p)-int64(name))/1))) = int8(0) - name = bp + 4 /* &tmp[0] */ - } - - if Xinet_pton(tls, 10, name, bp+68) <= 0 { - return 0 - } - if family == 2 { // wrong family - return -2 - } - - Xmemcpy(tls, buf+8, bp+68, uint64(unsafe.Sizeof(in6_addr{}))) - (*address)(unsafe.Pointer(buf)).family = 10 - if p != 0 { - if func() int32 { - if 0 != 0 { - return Xisdigit(tls, int32(*(*int8)(unsafe.Pointer(PreIncUintptr(&p, 1))))) - } - return Bool32(uint32(*(*int8)(unsafe.Pointer(PreIncUintptr(&p, 1))))-uint32('0') < uint32(10)) - }() != 0 { - scopeid = Xstrtoull(tls, p, bp+88, 10) - } else { - *(*uintptr)(unsafe.Pointer(bp + 88 /* z */)) = p - uintptr(1) - } - if *(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp + 88)))) != 0 { - Xabort(tls) //TODO- - // if (!IN6_IS_ADDR_LINKLOCAL(&a6) && - // !IN6_IS_ADDR_MC_LINKLOCAL(&a6)) - // return EAI_NONAME; - // scopeid = if_nametoindex(p); - // if (!scopeid) return EAI_NONAME; - } - if scopeid > uint64(0xffffffff) { - return -2 - } - } - (*address)(unsafe.Pointer(buf)).scopeid = uint32(scopeid) - return 1 -} - -func is_valid_hostname(tls *TLS, host uintptr) int32 { /* lookup_name.c:18:12: */ - var s uintptr - //TODO if (strnlen(host, 255)-1 >= 254 || mbstowcs(0, host, 0) == -1) return 0; - if Xstrnlen(tls, host, uint64(255))-uint64(1) >= uint64(254) { - return 0 - } - for s = host; int32(*(*uint8)(unsafe.Pointer(s))) >= 0x80 || int32(*(*uint8)(unsafe.Pointer(s))) == '.' || int32(*(*uint8)(unsafe.Pointer(s))) == '-' || Xisalnum(tls, int32(*(*uint8)(unsafe.Pointer(s)))) != 0; s++ { - } - return BoolInt32(!(*(*uint8)(unsafe.Pointer(s)) != 0)) -} - -var Xzero_struct_address address /* lookup_name.c:27:16: */ - -func name_from_null(tls *TLS, buf uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:29:12: */ - var cnt int32 = 0 - if name != 0 { - return 0 - } - if flags&0x01 != 0 { - //TODO if (family != AF_INET6) - //TODO buf[cnt++] = (struct address){ .family = AF_INET }; - if family != 10 { - var x = Xzero_struct_address - x.family = 2 - *(*address)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*28)) = x - } - //TODO if (family != AF_INET) - //TODO buf[cnt++] = (struct address){ .family = AF_INET6 }; - if family != 2 { - var x = Xzero_struct_address - x.family = 10 - *(*address)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*28)) = x - } - } else { - Xabort(tls) //TODO- - // if (family != AF_INET6) - // buf[cnt++] = (struct address){ .family = AF_INET, .addr = { 127,0,0,1 } }; - // if (family != AF_INET) - // buf[cnt++] = (struct address){ .family = AF_INET6, .addr = { [15] = 1 } }; - } - return cnt -} - -func name_from_numeric(tls *TLS, buf uintptr, name uintptr, family int32) int32 { /* lookup_name.c:58:12: */ - return X__lookup_ipliteral(tls, buf, name, family) -} - -func name_from_hosts(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32) int32 { /* lookup_name.c:63:12: */ - bp := tls.Alloc(512) - defer tls.Free(512) - - // var line [512]int8 at bp, 512 - - var l size_t = Xstrlen(tls, name) - var cnt int32 = 0 - var badfam int32 = 0 - var _buf [1032]uint8 - _ = _buf - //TODO FILE _f, *f = __fopen_rb_ca("/etc/hosts", &_f, _buf, sizeof _buf); - var _f FILE - _ = _f - var f uintptr = Xfopen(tls, ts+76, ts+87) - if !(f != 0) { - switch *(*int32)(unsafe.Pointer(X___errno_location(tls))) { - case 2: - fallthrough - case 20: - fallthrough - case 13: - return 0 - fallthrough - default: - return -11 - } - } - for Xfgets(tls, bp, int32(unsafe.Sizeof([512]int8{})), f) != 0 && cnt < 48 { - var p uintptr - var z uintptr - - if AssignUintptr(&p, Xstrchr(tls, bp, '#')) != 0 { - *(*int8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = int8('\n') - *(*int8)(unsafe.Pointer(p)) = int8(0) - } - for p = bp + uintptr(1); AssignUintptr(&p, Xstrstr(tls, p, name)) != 0 && (!(__isspace(tls, int32(*(*int8)(unsafe.Pointer(p + UintptrFromInt32(-1))))) != 0) || !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(p + uintptr(l))))) != 0)); p++ { - } - if !(p != 0) { - continue - } - - // Isolate IP address to parse - for p = bp; /* &line[0] */ *(*int8)(unsafe.Pointer(p)) != 0 && !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(p)))) != 0); p++ { - } - *(*int8)(unsafe.Pointer(PostIncUintptr(&p, 1))) = int8(0) - switch name_from_numeric(tls, buf+uintptr(cnt)*28, bp, family) { - case 1: - cnt++ - break - case 0: - continue - default: - badfam = -2 - continue - } - - // Extract first name as canonical name - for ; *(*int8)(unsafe.Pointer(p)) != 0 && __isspace(tls, int32(*(*int8)(unsafe.Pointer(p)))) != 0; p++ { - } - for z = p; *(*int8)(unsafe.Pointer(z)) != 0 && !(__isspace(tls, int32(*(*int8)(unsafe.Pointer(z)))) != 0); z++ { - } - *(*int8)(unsafe.Pointer(z)) = int8(0) - if is_valid_hostname(tls, p) != 0 { - Xmemcpy(tls, canon, p, uint64((int64(z)-int64(p))/1+int64(1))) - } - } - //TODO __fclose_ca(f); - Xfclose(tls, f) - if cnt != 0 { - return cnt - } - return badfam -} - -type dpc_ctx = struct { - addrs uintptr - canon uintptr - cnt int32 - _ [4]byte -} /* lookup_name.c:112:1 */ - -func name_from_dns_search(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32) int32 { /* lookup_name.c:191:12: */ - return -1 //TODO- - Xabort(tls) - return int32(0) //TODO- - // char search[256]; - // struct resolvconf conf; - // size_t l, dots; - // char *p, *z; - - // if (__get_resolv_conf(&conf, search, sizeof search) < 0) return -1; - - // /* Count dots, suppress search when >=ndots or name ends in - // * a dot, which is an explicit request for global scope. */ - // for (dots=l=0; name[l]; l++) if (name[l]=='.') dots++; - // if (dots >= conf.ndots || name[l-1]=='.') *search = 0; - - // /* Strip final dot for canon, fail if multiple trailing dots. */ - // if (name[l-1]=='.') l--; - // if (!l || name[l-1]=='.') return EAI_NONAME; - - // /* This can never happen; the caller already checked length. */ - // if (l >= 256) return EAI_NONAME; - - // /* Name with search domain appended is setup in canon[]. This both - // * provides the desired default canonical name (if the requested - // * name is not a CNAME record) and serves as a buffer for passing - // * the full requested name to name_from_dns. */ - // memcpy(canon, name, l); - // canon[l] = '.'; - - // for (p=search; *p; p=z) { - // for (; isspace(*p); p++); - // for (z=p; *z && !isspace(*z); z++); - // if (z==p) break; - // if (z-p < 256 - l - 1) { - // memcpy(canon+l+1, p, z-p); - // canon[z-p+1+l] = 0; - // int cnt = name_from_dns(buf, canon, canon, family, &conf); - // if (cnt) return cnt; - // } - // } - - // canon[l] = 0; - // return name_from_dns(buf, canon, name, family, &conf); -} - -type policy = struct { - addr [16]uint8 - len uint8 - mask uint8 - prec uint8 - label uint8 -} /* lookup_name.c:237:14 */ - -var defpolicy = [6]policy{ - {addr: *(*[16]uint8)(unsafe.Pointer(ts + 172)), len: uint8(15), mask: uint8(0xff), prec: uint8(50)}, - {addr: *(*[16]uint8)(unsafe.Pointer(ts + 189)), len: uint8(11), mask: uint8(0xff), prec: uint8(35), label: uint8(4)}, - {addr: *(*[16]uint8)(unsafe.Pointer(ts + 205)), len: uint8(1), mask: uint8(0xff), prec: uint8(30), label: uint8(2)}, - {addr: *(*[16]uint8)(unsafe.Pointer(ts + 221)), len: uint8(3), mask: uint8(0xff), prec: uint8(5), label: uint8(5)}, - {addr: *(*[16]uint8)(unsafe.Pointer(ts + 237)), mask: uint8(0xfe), prec: uint8(3), label: uint8(13)}, - // Last rule must match all addresses to stop loop. - {addr: *(*[16]uint8)(unsafe.Pointer(ts + 253)), prec: uint8(40), label: uint8(1)}, -} /* lookup_name.c:241:3 */ - -func policyof(tls *TLS, a uintptr) uintptr { /* lookup_name.c:259:28: */ - var i int32 - for i = 0; ; i++ { - if Xmemcmp(tls, a, uintptr(unsafe.Pointer(&defpolicy))+uintptr(i)*20, uint64(defpolicy[i].len)) != 0 { - continue - } - if int32(*(*uint8_t)(unsafe.Pointer(a + uintptr(defpolicy[i].len))))&int32(defpolicy[i].mask) != - int32(*(*uint8)(unsafe.Pointer(uintptr(unsafe.Pointer(&defpolicy)) + uintptr(i)*20 + uintptr(defpolicy[i].len)))) { - continue - } - return uintptr(unsafe.Pointer(&defpolicy)) + uintptr(i)*20 - } - return uintptr(0) -} - -func labelof(tls *TLS, a uintptr) int32 { /* lookup_name.c:272:12: */ - return int32((*policy)(unsafe.Pointer(policyof(tls, a))).label) -} - -func scopeof(tls *TLS, a uintptr) int32 { /* lookup_name.c:277:12: */ - if int32(*(*uint8_t)(unsafe.Pointer(a))) == 0xff { - return int32(*(*uint8_t)(unsafe.Pointer(a + 1))) & 15 - } - if int32(*(*uint8_t)(unsafe.Pointer(a))) == 0xfe && int32(*(*uint8_t)(unsafe.Pointer(a + 1)))&0xc0 == 0x80 { - return 2 - } - if *(*uint32_t)(unsafe.Pointer(a)) == uint32_t(0) && *(*uint32_t)(unsafe.Pointer(a + 1*4)) == uint32_t(0) && *(*uint32_t)(unsafe.Pointer(a + 2*4)) == uint32_t(0) && int32(*(*uint8_t)(unsafe.Pointer(a + 12))) == 0 && int32(*(*uint8_t)(unsafe.Pointer(a + 13))) == 0 && int32(*(*uint8_t)(unsafe.Pointer(a + 14))) == 0 && int32(*(*uint8_t)(unsafe.Pointer(a + 15))) == 1 { - return 2 - } - if int32(*(*uint8_t)(unsafe.Pointer(a))) == 0xfe && int32(*(*uint8_t)(unsafe.Pointer(a + 1)))&0xc0 == 0xc0 { - return 5 - } - return 14 -} - -func prefixmatch(tls *TLS, s uintptr, d uintptr) int32 { /* lookup_name.c:286:12: */ - // FIXME: The common prefix length should be limited to no greater - // than the nominal length of the prefix portion of the source - // address. However the definition of the source prefix length is - // not clear and thus this limiting is not yet implemented. - var i uint32 - for i = uint32(0); i < uint32(128) && !((int32(*(*uint8_t)(unsafe.Pointer(s /* &.__in6_union */ /* &.__s6_addr */ + uintptr(i/uint32(8)))))^int32(*(*uint8_t)(unsafe.Pointer(d /* &.__in6_union */ /* &.__s6_addr */ + uintptr(i/uint32(8))))))&(int32(128)>>(i%uint32(8))) != 0); i++ { - } - return int32(i) -} - -func addrcmp(tls *TLS, _a uintptr, _b uintptr) int32 { /* lookup_name.c:305:12: */ - var a uintptr = _a - var b uintptr = _b - return (*address)(unsafe.Pointer(b)).sortkey - (*address)(unsafe.Pointer(a)).sortkey -} - -func X__lookup_name(tls *TLS, buf uintptr, canon uintptr, name uintptr, family int32, flags int32) int32 { /* lookup_name.c:311:5: */ - if __ccgo_strace { - trc("tls=%v buf=%v canon=%v name=%v family=%v flags=%v, (%v:)", tls, buf, canon, name, family, flags, origin(2)) - } - bp := tls.Alloc(92) - defer tls.Free(92) - - var cnt int32 = 0 - var i int32 - var j int32 - _ = j - - *(*int8)(unsafe.Pointer(canon)) = int8(0) - if name != 0 { - // reject empty name and check len so it fits into temp bufs - var l size_t = Xstrnlen(tls, name, uint64(255)) - if l-uint64(1) >= uint64(254) { - return -2 - } - Xmemcpy(tls, canon, name, l+uint64(1)) - } - - // Procedurally, a request for v6 addresses with the v4-mapped - // flag set is like a request for unspecified family, followed - // by filtering of the results. - if flags&0x08 != 0 { - if family == 10 { - family = 0 - } else { - flags = flags - 0x08 - } - } - - // Try each backend until there's at least one result. - cnt = name_from_null(tls, buf, name, family, flags) - if !(cnt != 0) { - cnt = name_from_numeric(tls, buf, name, family) - } - if !(cnt != 0) && !(flags&0x04 != 0) { - cnt = name_from_hosts(tls, buf, canon, name, family) - if !(cnt != 0) { - cnt = name_from_dns_search(tls, buf, canon, name, family) - } - } - if cnt <= 0 { - if cnt != 0 { - return cnt - } - return -2 - } - - // Filter/transform results for v4-mapped lookup, if requested. - if flags&0x08 != 0 { - Xabort(tls) //TODO- - // if (!(flags & AI_ALL)) { - // /* If any v6 results exist, remove v4 results. */ - // for (i=0; i= 0 { - if !(Xconnect(tls, fd, da, dalen) != 0) { - key = key | 0x40000000 - if !(Xgetsockname(tls, fd, sa1, bp+88) != 0) { - if family == 2 { - Xmemcpy(tls, - bp+28+8+uintptr(12), - bp+72+4, uint64(4)) - } - if dscope == scopeof(tls, bp+28+8) { - key = key | 0x20000000 - } - if dlabel == labelof(tls, bp+28+8) { - key = key | 0x10000000 - } - prefixlen = prefixmatch(tls, bp+28+8, - bp+8) - } - } - Xclose(tls, fd) - } - key = key | dprec<<20 - key = key | (15-dscope)<<16 - key = key | prefixlen<<8 - key = key | (48-i)<<0 - (*address)(unsafe.Pointer(buf + uintptr(i)*28)).sortkey = key - } - Xqsort(tls, buf, uint64(cnt), uint64(unsafe.Sizeof(address{})), *(*uintptr)(unsafe.Pointer(&struct { - f func(*TLS, uintptr, uintptr) int32 - }{addrcmp}))) - - //TODO pthread_setcancelstate(cs, 0); - - return cnt -} - -func X__lookup_serv(tls *TLS, buf uintptr, name uintptr, proto int32, socktype int32, flags int32) int32 { /* lookup_serv.c:12:5: */ - if __ccgo_strace { - trc("tls=%v buf=%v name=%v proto=%v socktype=%v flags=%v, (%v:)", tls, buf, name, proto, socktype, flags, origin(2)) - } - bp := tls.Alloc(8) - defer tls.Free(8) - - var line [128]int8 - _ = line - var cnt int32 = 0 - var p uintptr - _ = p - *(*uintptr)(unsafe.Pointer(bp /* z */)) = ts + 13 /* "" */ - var port uint64 = uint64(0) - - switch socktype { - case 1: - switch proto { - case 0: - proto = 6 - fallthrough - case 6: - break - default: - return -8 - } - break - case 2: - switch proto { - case 0: - proto = 17 - fallthrough - case 17: - break - default: - return -8 - } - fallthrough - case 0: - break - default: - if name != 0 { - return -8 - } - (*service)(unsafe.Pointer(buf)).port = uint16_t(0) - (*service)(unsafe.Pointer(buf)).proto = uint8(proto) - (*service)(unsafe.Pointer(buf)).socktype = uint8(socktype) - return 1 - } - - if name != 0 { - if !(int32(*(*int8)(unsafe.Pointer(name))) != 0) { - return -8 - } - port = Xstrtoul(tls, name, bp, 10) - } - if !(int32(*(*int8)(unsafe.Pointer(*(*uintptr)(unsafe.Pointer(bp))))) != 0) { - if port > uint64(65535) { - return -8 - } - if proto != 17 { - (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).port = uint16_t(port) - (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).socktype = uint8(1) - (*service)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*4)).proto = uint8(6) - } - if proto != 6 { - (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).port = uint16_t(port) - (*service)(unsafe.Pointer(buf + uintptr(cnt)*4)).socktype = uint8(2) - (*service)(unsafe.Pointer(buf + uintptr(PostIncInt32(&cnt, 1))*4)).proto = uint8(17) - } - return cnt - } - - if flags&0x400 != 0 { - return -2 - } - - var l size_t = Xstrlen(tls, name) - _ = l - - Xabort(tls) //TODO- - // unsigned char _buf[1032]; - // FILE _f, *f = __fopen_rb_ca("/etc/services", &_f, _buf, sizeof _buf); - // if (!f) switch (errno) { - // case ENOENT: - // case ENOTDIR: - // case EACCES: - // return EAI_SERVICE; - // default: - // return EAI_SYSTEM; - // } - - Xabort(tls) //TODO- - // while (fgets(line, sizeof line, f) && cnt < MAXSERVS) { - // if ((p=strchr(line, '#'))) *p++='\n', *p=0; - - // /* Find service name */ - // for(p=line; (p=strstr(p, name)); p++) { - // if (p>line && !isspace(p[-1])) continue; - // if (p[l] && !isspace(p[l])) continue; - // break; - // } - // if (!p) continue; - - // /* Skip past canonical name at beginning of line */ - // for (p=line; *p && !isspace(*p); p++); - - // port = strtoul(p, &z, 10); - // if (port > 65535 || z==p) continue; - // if (!strncmp(z, "/udp", 4)) { - // if (proto == IPPROTO_TCP) continue; - // buf[cnt].port = port; - // buf[cnt].socktype = SOCK_DGRAM; - // buf[cnt++].proto = IPPROTO_UDP; - // } - // if (!strncmp(z, "/tcp", 4)) { - // if (proto == IPPROTO_UDP) continue; - // buf[cnt].port = port; - // buf[cnt].socktype = SOCK_STREAM; - // buf[cnt++].proto = IPPROTO_TCP; - // } - // } - // __fclose_ca(f); - // return cnt > 0 ? cnt : EAI_SERVICE; - Xabort(tls) - return int32(0) //TODO- -} - -func temper(tls *TLS, x uint32) uint32 { /* rand_r.c:3:17: */ - x = x ^ x>>11 - x = x ^ x<<7&0x9D2C5680 - x = x ^ x<<15&0xEFC60000 - x = x ^ x>>18 - return x -} - -func Xrand_r(tls *TLS, seed uintptr) int32 { /* rand_r.c:12:5: */ - if __ccgo_strace { - trc("tls=%v seed=%v, (%v:)", tls, seed, origin(2)) - } - return int32(temper(tls, AssignPtrUint32(seed, *(*uint32)(unsafe.Pointer(seed))*uint32(1103515245)+uint32(12345))) / uint32(2)) -} - -func X__lockfile(tls *TLS, f uintptr) int32 { /* __lockfile.c:4:5: */ - if __ccgo_strace { - trc("tls=%v f=%v, (%v:)", tls, f, origin(2)) - } - var owner int32 = (*FILE)(unsafe.Pointer(f)).lock - var tid int32 = (*__pthread)(unsafe.Pointer(__pthread_self(tls))).tid - if owner&CplInt32(0x40000000) == tid { - return 0 - } - owner = a_cas(tls, f+140, 0, tid) - if !(owner != 0) { - return 1 - } - for AssignInt32(&owner, a_cas(tls, f+140, 0, tid|0x40000000)) != 0 { - if owner&0x40000000 != 0 || a_cas(tls, f+140, owner, owner|0x40000000) == owner { - __futexwait(tls, f+140, owner|0x40000000, 1) - } - } - return 1 -} - -func X__unlockfile(tls *TLS, f uintptr) { /* __lockfile.c:19:6: */ - if __ccgo_strace { - trc("tls=%v f=%v, (%v:)", tls, f, origin(2)) - } - if a_swap(tls, f+140, 0)&0x40000000 != 0 { - __wake(tls, f+140, 1, 1) - } -} - -func X__toread(tls *TLS, f uintptr) int32 { /* __toread.c:3:5: */ - if __ccgo_strace { - trc("tls=%v f=%v, (%v:)", tls, f, origin(2)) - } - *(*int32)(unsafe.Pointer(f + 136)) |= (*FILE)(unsafe.Pointer(f)).mode - 1 - if (*FILE)(unsafe.Pointer(f)).wpos != (*FILE)(unsafe.Pointer(f)).wbase { - (*struct { - f func(*TLS, uintptr, uintptr, size_t) size_t - })(unsafe.Pointer(&struct{ uintptr }{(*FILE)(unsafe.Pointer(f)).write})).f(tls, f, uintptr(0), uint64(0)) - } - (*FILE)(unsafe.Pointer(f)).wpos = AssignPtrUintptr(f+56, AssignPtrUintptr(f+32, uintptr(0))) - if (*FILE)(unsafe.Pointer(f)).flags&uint32(4) != 0 { - *(*uint32)(unsafe.Pointer(f)) |= uint32(32) - return -1 - } - (*FILE)(unsafe.Pointer(f)).rpos = AssignPtrUintptr(f+16, (*FILE)(unsafe.Pointer(f)).buf+uintptr((*FILE)(unsafe.Pointer(f)).buf_size)) - if (*FILE)(unsafe.Pointer(f)).flags&uint32(16) != 0 { - return -1 - } - return 0 -} - -func X__toread_needs_stdio_exit(tls *TLS) { /* __toread.c:16:13: */ - if __ccgo_strace { - trc("tls=%v, (%v:)", tls, origin(2)) - } - X__builtin_abort(tls) //TODO- - // __stdio_exit_needed(); -} - -// This function assumes it will never be called if there is already -// data buffered for reading. - -func X__uflow(tls *TLS, f uintptr) int32 { /* __uflow.c:6:5: */ - if __ccgo_strace { - trc("tls=%v f=%v, (%v:)", tls, f, origin(2)) - } - bp := tls.Alloc(1) - defer tls.Free(1) - - // var c uint8 at bp, 1 - - if !(X__toread(tls, f) != 0) && (*struct { - f func(*TLS, uintptr, uintptr, size_t) size_t - })(unsafe.Pointer(&struct{ uintptr }{(*FILE)(unsafe.Pointer(f)).read})).f(tls, f, bp, uint64(1)) == uint64(1) { - return int32(*(*uint8)(unsafe.Pointer(bp))) - } - return -1 -} - -func Xsscanf(tls *TLS, s uintptr, fmt uintptr, va uintptr) int32 { /* sscanf.c:4:5: */ - if __ccgo_strace { - trc("tls=%v s=%v fmt=%v va=%v, (%v:)", tls, s, fmt, va, origin(2)) - } - var ret int32 - var ap va_list - _ = ap - ap = va - ret = Xvsscanf(tls, s, fmt, ap) - _ = ap - return ret -} - -type wctrans_t = uintptr /* wctype.h:20:19 */ - -func store_int(tls *TLS, dest uintptr, size int32, i uint64) { /* vfscanf.c:22:13: */ - if !(dest != 0) { - return - } - switch size { - case -2: - *(*int8)(unsafe.Pointer(dest)) = int8(i) - break - case -1: - *(*int16)(unsafe.Pointer(dest)) = int16(i) - break - case 0: - *(*int32)(unsafe.Pointer(dest)) = int32(i) - break - case 1: - *(*int64)(unsafe.Pointer(dest)) = int64(i) - break - case 3: - *(*int64)(unsafe.Pointer(dest)) = int64(i) - break - } -} - -func arg_n(tls *TLS, ap va_list, n uint32) uintptr { /* vfscanf.c:44:13: */ - var p uintptr - var i uint32 - var ap2 va_list - _ = ap2 - ap2 = ap - for i = n; i > uint32(1); i-- { - VaUintptr(&ap2) - } - p = VaUintptr(&ap2) - _ = ap2 - return p -} - -func Xvfscanf(tls *TLS, f uintptr, fmt uintptr, ap va_list) int32 { /* vfscanf.c:56:5: */ - if __ccgo_strace { - trc("tls=%v f=%v fmt=%v ap=%v, (%v:)", tls, f, fmt, ap, origin(2)) - } - bp := tls.Alloc(276) - defer tls.Free(276) - - var width int32 - var size int32 - var alloc int32 - var base int32 - var p uintptr - var c int32 - var t int32 - var s uintptr - var wcs uintptr - // var st mbstate_t at bp+268, 8 - - var dest uintptr - var invert int32 - var matches int32 - var x uint64 - var y float64 - var pos off_t - // var scanset [257]uint8 at bp, 257 - - var i size_t - var k size_t - // var wc wchar_t at bp+260, 4 - - var __need_unlock int32 - var tmp uintptr - var tmp1 uintptr - alloc = 0 - dest = uintptr(0) - matches = 0 - pos = int64(0) - __need_unlock = 0 - - if !!(int32((*FILE)(unsafe.Pointer(f)).rpos) != 0) { - goto __1 - } - X__toread(tls, f) -__1: - ; - if !!(int32((*FILE)(unsafe.Pointer(f)).rpos) != 0) { - goto __2 - } - goto input_fail -__2: - ; - - p = fmt -__3: - if !(*(*uint8)(unsafe.Pointer(p)) != 0) { - goto __5 - } - - alloc = 0 - - if !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(p)))) != 0) { - goto __6 - } -__7: - if !(__isspace(tls, int32(*(*uint8)(unsafe.Pointer(p + 1)))) != 0) { - goto __8 - } - p++ - goto __7 -__8: - ; - X__shlim(tls, f, int64(0)) -__9: - if !(__isspace(tls, func() int32 { - if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { - return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) - } - return X__shgetc(tls, f) - }()) != 0) { - goto __10 - } - goto __9 -__10: - ; - if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { - (*FILE)(unsafe.Pointer(f)).rpos-- - } else { - } - pos = pos + ((*FILE)(unsafe.Pointer(f)).shcnt + (int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1) - goto __4 -__6: - ; - if !(int32(*(*uint8)(unsafe.Pointer(p))) != '%' || int32(*(*uint8)(unsafe.Pointer(p + 1))) == '%') { - goto __11 - } - X__shlim(tls, f, int64(0)) - if !(int32(*(*uint8)(unsafe.Pointer(p))) == '%') { - goto __12 - } - p++ -__14: - if !(__isspace(tls, AssignInt32(&c, func() int32 { - if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { - return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) - } - return X__shgetc(tls, f) - }())) != 0) { - goto __15 - } - goto __14 -__15: - ; - goto __13 -__12: - c = func() int32 { - if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { - return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) - } - return X__shgetc(tls, f) - }() -__13: - ; - if !(c != int32(*(*uint8)(unsafe.Pointer(p)))) { - goto __16 - } - if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { - (*FILE)(unsafe.Pointer(f)).rpos-- - } else { - } - if !(c < 0) { - goto __17 - } - goto input_fail -__17: - ; - goto match_fail -__16: - ; - pos = pos + ((*FILE)(unsafe.Pointer(f)).shcnt + (int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1) - goto __4 -__11: - ; - - p++ - if !(int32(*(*uint8)(unsafe.Pointer(p))) == '*') { - goto __18 - } - dest = uintptr(0) - p++ - goto __19 -__18: - if !(func() int32 { - if 0 != 0 { - return Xisdigit(tls, int32(*(*uint8)(unsafe.Pointer(p)))) - } - return Bool32(uint32(*(*uint8)(unsafe.Pointer(p)))-uint32('0') < uint32(10)) - }() != 0 && int32(*(*uint8)(unsafe.Pointer(p + 1))) == '$') { - goto __20 - } - dest = arg_n(tls, ap, uint32(int32(*(*uint8)(unsafe.Pointer(p)))-'0')) - p += uintptr(2) - goto __21 -__20: - dest = VaUintptr(&ap) -__21: - ; -__19: - ; - - width = 0 -__22: - if !(func() int32 { - if 0 != 0 { - return Xisdigit(tls, int32(*(*uint8)(unsafe.Pointer(p)))) - } - return Bool32(uint32(*(*uint8)(unsafe.Pointer(p)))-uint32('0') < uint32(10)) - }() != 0) { - goto __24 - } - width = 10*width + int32(*(*uint8)(unsafe.Pointer(p))) - '0' - goto __23 -__23: - p++ - goto __22 - goto __24 -__24: - ; - - if !(int32(*(*uint8)(unsafe.Pointer(p))) == 'm') { - goto __25 - } - wcs = uintptr(0) - s = uintptr(0) - alloc = BoolInt32(!!(dest != 0)) - p++ - goto __26 -__25: - alloc = 0 -__26: - ; - - size = 0 - switch int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1)))) { - case 'h': - goto __28 - case 'l': - goto __29 - case 'j': - goto __30 - case 'z': - goto __31 - case 't': - goto __32 - case 'L': - goto __33 - case 'd': - goto __34 - case 'i': - goto __35 - case 'o': - goto __36 - case 'u': - goto __37 - case 'x': - goto __38 - case 'a': - goto __39 - case 'e': - goto __40 - case 'f': - goto __41 - case 'g': - goto __42 - case 'A': - goto __43 - case 'E': - goto __44 - case 'F': - goto __45 - case 'G': - goto __46 - case 'X': - goto __47 - case 's': - goto __48 - case 'c': - goto __49 - case '[': - goto __50 - case 'S': - goto __51 - case 'C': - goto __52 - case 'p': - goto __53 - case 'n': - goto __54 - default: - goto __55 - } - goto __27 -__28: - if !(int32(*(*uint8)(unsafe.Pointer(p))) == 'h') { - goto __56 - } - p++ - size = -2 - goto __57 -__56: - size = -1 -__57: - ; - goto __27 -__29: - if !(int32(*(*uint8)(unsafe.Pointer(p))) == 'l') { - goto __58 - } - p++ - size = 3 - goto __59 -__58: - size = 1 -__59: - ; - goto __27 -__30: - size = 3 - goto __27 -__31: -__32: - size = 1 - goto __27 -__33: - size = 2 - goto __27 -__34: -__35: -__36: -__37: -__38: -__39: -__40: -__41: -__42: -__43: -__44: -__45: -__46: -__47: -__48: -__49: -__50: -__51: -__52: -__53: -__54: - p-- - goto __27 -__55: - goto fmt_fail -__27: - ; - - t = int32(*(*uint8)(unsafe.Pointer(p))) - - // C or S - if !(t&0x2f == 3) { - goto __60 - } - t = t | 32 - size = 1 -__60: - ; - - switch t { - case 'c': - goto __62 - case '[': - goto __63 - case 'n': - goto __64 - default: - goto __65 - } - goto __61 -__62: - if !(width < 1) { - goto __66 - } - width = 1 -__66: - ; -__63: - goto __61 -__64: - store_int(tls, dest, size, uint64(pos)) - // do not increment match count, etc! - goto __4 -__65: - X__shlim(tls, f, int64(0)) -__67: - if !(__isspace(tls, func() int32 { - if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { - return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) - } - return X__shgetc(tls, f) - }()) != 0) { - goto __68 - } - goto __67 -__68: - ; - if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { - (*FILE)(unsafe.Pointer(f)).rpos-- - } else { - } - pos = pos + ((*FILE)(unsafe.Pointer(f)).shcnt + (int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1) -__61: - ; - - X__shlim(tls, f, int64(width)) - if !(func() int32 { - if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { - return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) - } - return X__shgetc(tls, f) - }() < 0) { - goto __69 - } - goto input_fail -__69: - ; - if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { - (*FILE)(unsafe.Pointer(f)).rpos-- - } else { - } - - switch t { - case 's': - goto __71 - case 'c': - goto __72 - case '[': - goto __73 - case 'p': - goto __74 - case 'X': - goto __75 - case 'x': - goto __76 - case 'o': - goto __77 - case 'd': - goto __78 - case 'u': - goto __79 - case 'i': - goto __80 - case 'a': - goto __81 - case 'A': - goto __82 - case 'e': - goto __83 - case 'E': - goto __84 - case 'f': - goto __85 - case 'F': - goto __86 - case 'g': - goto __87 - case 'G': - goto __88 - } - goto __70 -__71: -__72: -__73: - if !(t == 'c' || t == 's') { - goto __89 - } - Xmemset(tls, bp, -1, uint64(unsafe.Sizeof([257]uint8{}))) - *(*uint8)(unsafe.Pointer(bp)) = uint8(0) - if !(t == 's') { - goto __91 - } - *(*uint8)(unsafe.Pointer(bp + 10)) = uint8(0) - *(*uint8)(unsafe.Pointer(bp + 11)) = uint8(0) - *(*uint8)(unsafe.Pointer(bp + 12)) = uint8(0) - *(*uint8)(unsafe.Pointer(bp + 13)) = uint8(0) - *(*uint8)(unsafe.Pointer(bp + 14)) = uint8(0) - *(*uint8)(unsafe.Pointer(bp + 33)) = uint8(0) -__91: - ; - goto __90 -__89: - if !(int32(*(*uint8)(unsafe.Pointer(PreIncUintptr(&p, 1)))) == '^') { - goto __92 - } - p++ - invert = 1 - goto __93 -__92: - invert = 0 -__93: - ; - Xmemset(tls, bp, invert, uint64(unsafe.Sizeof([257]uint8{}))) - *(*uint8)(unsafe.Pointer(bp)) = uint8(0) - if !(int32(*(*uint8)(unsafe.Pointer(p))) == '-') { - goto __94 - } - p++ - *(*uint8)(unsafe.Pointer(bp + 46)) = uint8(1 - invert) - goto __95 -__94: - if !(int32(*(*uint8)(unsafe.Pointer(p))) == ']') { - goto __96 - } - p++ - *(*uint8)(unsafe.Pointer(bp + 94)) = uint8(1 - invert) -__96: - ; -__95: - ; -__97: - if !(int32(*(*uint8)(unsafe.Pointer(p))) != ']') { - goto __99 - } - if !!(int32(*(*uint8)(unsafe.Pointer(p))) != 0) { - goto __100 - } - goto fmt_fail -__100: - ; - if !(int32(*(*uint8)(unsafe.Pointer(p))) == '-' && *(*uint8)(unsafe.Pointer(p + 1)) != 0 && int32(*(*uint8)(unsafe.Pointer(p + 1))) != ']') { - goto __101 - } - c = int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&p, 1) + UintptrFromInt32(-1)))) -__102: - if !(c < int32(*(*uint8)(unsafe.Pointer(p)))) { - goto __104 - } - *(*uint8)(unsafe.Pointer(bp + uintptr(1+c))) = uint8(1 - invert) - goto __103 -__103: - c++ - goto __102 - goto __104 -__104: - ; -__101: - ; - *(*uint8)(unsafe.Pointer(bp + uintptr(1+int32(*(*uint8)(unsafe.Pointer(p)))))) = uint8(1 - invert) - goto __98 -__98: - p++ - goto __97 - goto __99 -__99: - ; -__90: - ; - wcs = uintptr(0) - s = uintptr(0) - i = uint64(0) - if t == 'c' { - k = uint64(uint32(width) + 1) - } else { - k = uint64(31) - } - if !(size == 1) { - goto __105 - } - if !(alloc != 0) { - goto __107 - } - wcs = Xmalloc(tls, k*size_t(unsafe.Sizeof(wchar_t(0)))) - if !!(wcs != 0) { - goto __109 - } - goto alloc_fail -__109: - ; - goto __108 -__107: - wcs = dest -__108: - ; - *(*mbstate_t)(unsafe.Pointer(bp + 268 /* st */)) = mbstate_t{} -__110: - if !(*(*uint8)(unsafe.Pointer(bp + uintptr(AssignInt32(&c, func() int32 { - if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { - return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) - } - return X__shgetc(tls, f) - }())+1))) != 0) { - goto __111 - } - switch Xmbrtowc(tls, bp+260, func() uintptr { *(*int8)(unsafe.Pointer(bp + 264)) = int8(c); return bp + 264 }(), uint64(1), bp+268 /* &st */) { - case Uint64FromInt32(-1): - goto __113 - case Uint64FromInt32(-2): - goto __114 - } - goto __112 -__113: - goto input_fail -__114: - goto __110 -__112: - ; - if !(wcs != 0) { - goto __115 - } - *(*wchar_t)(unsafe.Pointer(wcs + uintptr(PostIncUint64(&i, 1))*4)) = *(*wchar_t)(unsafe.Pointer(bp + 260 /* wc */)) -__115: - ; - if !(alloc != 0 && i == k) { - goto __116 - } - k = k + (k + uint64(1)) - tmp = Xrealloc(tls, wcs, k*size_t(unsafe.Sizeof(wchar_t(0)))) - if !!(tmp != 0) { - goto __117 - } - goto alloc_fail -__117: - ; - wcs = tmp -__116: - ; - goto __110 -__111: - ; - if !!(Xmbsinit(tls, bp+268) != 0) { - goto __118 - } - goto input_fail -__118: - ; - goto __106 -__105: - if !(alloc != 0) { - goto __119 - } - s = Xmalloc(tls, k) - if !!(s != 0) { - goto __121 - } - goto alloc_fail -__121: - ; -__122: - if !(*(*uint8)(unsafe.Pointer(bp + uintptr(AssignInt32(&c, func() int32 { - if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { - return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) - } - return X__shgetc(tls, f) - }())+1))) != 0) { - goto __123 - } - *(*int8)(unsafe.Pointer(s + uintptr(PostIncUint64(&i, 1)))) = int8(c) - if !(i == k) { - goto __124 - } - k = k + (k + uint64(1)) - tmp1 = Xrealloc(tls, s, k) - if !!(tmp1 != 0) { - goto __125 - } - goto alloc_fail -__125: - ; - s = tmp1 -__124: - ; - goto __122 -__123: - ; - goto __120 -__119: - if !(AssignUintptr(&s, dest) != 0) { - goto __126 - } -__128: - if !(*(*uint8)(unsafe.Pointer(bp + uintptr(AssignInt32(&c, func() int32 { - if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { - return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) - } - return X__shgetc(tls, f) - }())+1))) != 0) { - goto __129 - } - *(*int8)(unsafe.Pointer(s + uintptr(PostIncUint64(&i, 1)))) = int8(c) - goto __128 -__129: - ; - goto __127 -__126: -__130: - if !(*(*uint8)(unsafe.Pointer(bp + uintptr(AssignInt32(&c, func() int32 { - if (*FILE)(unsafe.Pointer(f)).rpos != (*FILE)(unsafe.Pointer(f)).shend { - return int32(*(*uint8)(unsafe.Pointer(PostIncUintptr(&(*FILE)(unsafe.Pointer(f)).rpos, 1)))) - } - return X__shgetc(tls, f) - }())+1))) != 0) { - goto __131 - } - goto __130 -__131: - ; -__127: - ; -__120: - ; -__106: - ; - if (*FILE)(unsafe.Pointer(f)).shlim >= int64(0) { - (*FILE)(unsafe.Pointer(f)).rpos-- - } else { - } - if !!((*FILE)(unsafe.Pointer(f)).shcnt+(int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1 != 0) { - goto __132 - } - goto match_fail -__132: - ; - if !(t == 'c' && (*FILE)(unsafe.Pointer(f)).shcnt+(int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1 != off_t(width)) { - goto __133 - } - goto match_fail -__133: - ; - if !(alloc != 0) { - goto __134 - } - if !(size == 1) { - goto __135 - } - *(*uintptr)(unsafe.Pointer(dest)) = wcs - goto __136 -__135: - *(*uintptr)(unsafe.Pointer(dest)) = s -__136: - ; -__134: - ; - if !(t != 'c') { - goto __137 - } - if !(wcs != 0) { - goto __138 - } - *(*wchar_t)(unsafe.Pointer(wcs + uintptr(i)*4)) = 0 -__138: - ; - if !(s != 0) { - goto __139 - } - *(*int8)(unsafe.Pointer(s + uintptr(i))) = int8(0) -__139: - ; -__137: - ; - goto __70 -__74: -__75: -__76: - base = 16 - goto int_common -__77: - base = 8 - goto int_common -__78: -__79: - base = 10 - goto int_common -__80: - base = 0 -int_common: - x = X__intscan(tls, f, uint32(base), 0, 2*uint64(0x7fffffffffffffff)+uint64(1)) - if !!((*FILE)(unsafe.Pointer(f)).shcnt+(int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1 != 0) { - goto __140 - } - goto match_fail -__140: - ; - if !(t == 'p' && dest != 0) { - goto __141 - } - *(*uintptr)(unsafe.Pointer(dest)) = uintptr(uintptr_t(x)) - goto __142 -__141: - store_int(tls, dest, size, x) -__142: - ; - goto __70 -__81: -__82: -__83: -__84: -__85: -__86: -__87: -__88: - y = X__floatscan(tls, f, size, 0) - if !!((*FILE)(unsafe.Pointer(f)).shcnt+(int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1 != 0) { - goto __143 - } - goto match_fail -__143: - ; - if !(dest != 0) { - goto __144 - } - switch size { - case 0: - goto __146 - case 1: - goto __147 - case 2: - goto __148 - } - goto __145 -__146: - *(*float32)(unsafe.Pointer(dest)) = float32(y) - goto __145 -__147: - *(*float64)(unsafe.Pointer(dest)) = y - goto __145 -__148: - *(*float64)(unsafe.Pointer(dest)) = y - goto __145 -__145: - ; -__144: - ; - goto __70 -__70: - ; - - pos = pos + ((*FILE)(unsafe.Pointer(f)).shcnt + (int64((*FILE)(unsafe.Pointer(f)).rpos)-int64((*FILE)(unsafe.Pointer(f)).buf))/1) - if !(dest != 0) { - goto __149 - } - matches++ -__149: - ; - goto __4 -__4: - p++ - goto __3 - goto __5 -__5: - ; - if !(0 != 0) { - goto __150 - } -fmt_fail: -alloc_fail: -input_fail: - if !!(matches != 0) { - goto __151 - } - matches-- -__151: - ; -match_fail: - if !(alloc != 0) { - goto __152 - } - Xfree(tls, s) - Xfree(tls, wcs) -__152: - ; -__150: - ; -__153: - if !(__need_unlock != 0) { - goto __156 - } - X__unlockfile(tls, f) -__156: - ; - goto __154 -__154: - if 0 != 0 { - goto __153 - } - goto __155 -__155: - ; - return matches -} - -func string_read(tls *TLS, f uintptr, buf uintptr, len size_t) size_t { /* vsscanf.c:4:15: */ - var src uintptr = (*FILE)(unsafe.Pointer(f)).cookie - var k size_t = len + uint64(256) - var end uintptr = Xmemchr(tls, src, 0, k) - if end != 0 { - k = size_t((int64(end) - int64(src)) / 1) - } - if k < len { - len = k - } - Xmemcpy(tls, buf, src, len) - (*FILE)(unsafe.Pointer(f)).rpos = src + uintptr(len) - (*FILE)(unsafe.Pointer(f)).rend = src + uintptr(k) - (*FILE)(unsafe.Pointer(f)).cookie = src + uintptr(k) - return len -} - -func Xvsscanf(tls *TLS, s uintptr, fmt uintptr, ap va_list) int32 { /* vsscanf.c:18:5: */ - if __ccgo_strace { - trc("tls=%v s=%v fmt=%v ap=%v, (%v:)", tls, s, fmt, ap, origin(2)) - } - bp := tls.Alloc(232) - defer tls.Free(232) - - *(*FILE)(unsafe.Pointer(bp /* f */)) = FILE{read: *(*uintptr)(unsafe.Pointer(&struct { - f func(*TLS, uintptr, uintptr, size_t) size_t - }{string_read})), buf: s, lock: -1, cookie: s} - return Xvfscanf(tls, bp, fmt, ap) -} - -func Xbsearch(tls *TLS, key uintptr, base uintptr, nel size_t, width size_t, cmp uintptr) uintptr { /* bsearch.c:3:6: */ - if __ccgo_strace { - trc("tls=%v key=%v base=%v nel=%v width=%v cmp=%v, (%v:)", tls, key, base, nel, width, cmp, origin(2)) - } - var try uintptr - var sign int32 - for nel > uint64(0) { - try = base + uintptr(width*(nel/uint64(2))) - sign = (*struct { - f func(*TLS, uintptr, uintptr) int32 - })(unsafe.Pointer(&struct{ uintptr }{cmp})).f(tls, key, try) - if sign < 0 { - nel = nel / uint64(2) - } else if sign > 0 { - base = try + uintptr(width) - nel = nel - (nel/uint64(2) + uint64(1)) - } else { - return try - } - } - return uintptr(0) -} - -func strtox(tls *TLS, s uintptr, p uintptr, prec int32) float64 { /* strtod.c:6:20: */ - bp := tls.Alloc(232) - defer tls.Free(232) - - // var f FILE at bp, 232 - - (*FILE)(unsafe.Pointer(bp)).buf = AssignPtrUintptr(bp+8, s) - (*FILE)(unsafe.Pointer(bp)).rend = UintptrFromInt32(-1) - X__shlim(tls, bp, int64(0)) - var y float64 = X__floatscan(tls, bp, prec, 1) - var cnt off_t = (*FILE)(unsafe.Pointer(bp)).shcnt + (int64((*FILE)(unsafe.Pointer(bp)).rpos)-int64((*FILE)(unsafe.Pointer(bp)).buf))/1 - if p != 0 { - *(*uintptr)(unsafe.Pointer(p)) = func() uintptr { - if cnt != 0 { - return s + uintptr(cnt) - } - return s - }() - } - return y -} - -func Xstrtof(tls *TLS, s uintptr, p uintptr) float32 { /* strtod.c:17:7: */ - if __ccgo_strace { - trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2)) - } - return float32(strtox(tls, s, p, 0)) -} - -func Xstrtod(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:22:8: */ - if __ccgo_strace { - trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2)) - } - return strtox(tls, s, p, 1) -} - -func Xstrtold(tls *TLS, s uintptr, p uintptr) float64 { /* strtod.c:27:13: */ - if __ccgo_strace { - trc("tls=%v s=%v p=%v, (%v:)", tls, s, p, origin(2)) - } - return strtox(tls, s, p, 2) -} - -func strtox1(tls *TLS, s uintptr, p uintptr, base int32, lim uint64) uint64 { /* strtol.c:8:27: */ - bp := tls.Alloc(232) - defer tls.Free(232) - - // var f FILE at bp, 232 - - (*FILE)(unsafe.Pointer(bp)).buf = AssignPtrUintptr(bp+8, s) - (*FILE)(unsafe.Pointer(bp)).rend = UintptrFromInt32(-1) - X__shlim(tls, bp, int64(0)) - var y uint64 = X__intscan(tls, bp, uint32(base), 1, lim) - if p != 0 { - var cnt size_t = size_t((*FILE)(unsafe.Pointer(bp)).shcnt + (int64((*FILE)(unsafe.Pointer(bp)).rpos)-int64((*FILE)(unsafe.Pointer(bp)).buf))/1) - *(*uintptr)(unsafe.Pointer(p)) = s + uintptr(cnt) - } - return y -} - -func Xstrtoull(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:21:20: */ - if __ccgo_strace { - trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2)) - } - return strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1)) -} - -func Xstrtoll(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:26:11: */ - if __ccgo_strace { - trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2)) - } - return int64(strtox1(tls, s, p, base, Uint64FromInt64(-0x7fffffffffffffff-int64(1)))) -} - -func Xstrtoul(tls *TLS, s uintptr, p uintptr, base int32) uint64 { /* strtol.c:31:15: */ - if __ccgo_strace { - trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2)) - } - return uint64(strtox1(tls, s, p, base, 2*uint64(0x7fffffffffffffff)+uint64(1))) -} - -func Xstrtol(tls *TLS, s uintptr, p uintptr, base int32) int64 { /* strtol.c:36:6: */ - if __ccgo_strace { - trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2)) - } - return int64(strtox1(tls, s, p, base, 0+Uint64FromInt64(Int64(-Int64(0x7fffffffffffffff))-Int64FromInt32(1)))) -} - -func Xstrtoimax(tls *TLS, s uintptr, p uintptr, base int32) intmax_t { /* strtol.c:41:10: */ - if __ccgo_strace { - trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2)) - } - return intmax_t(Xstrtoll(tls, s, p, base)) -} - -func Xstrtoumax(tls *TLS, s uintptr, p uintptr, base int32) uintmax_t { /* strtol.c:46:11: */ - if __ccgo_strace { - trc("tls=%v s=%v p=%v base=%v, (%v:)", tls, s, p, base, origin(2)) - } - return uintmax_t(Xstrtoull(tls, s, p, base)) -} - -func Xstrdup(tls *TLS, s uintptr) uintptr { /* strdup.c:4:6: */ - if __ccgo_strace { - trc("tls=%v s=%v, (%v:)", tls, s, origin(2)) - } - var l size_t = Xstrlen(tls, s) - var d uintptr = Xmalloc(tls, l+uint64(1)) - if !(d != 0) { - return uintptr(0) - } - return Xmemcpy(tls, d, s, l+uint64(1)) -} - -func Xstrlcat(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcat.c:4:8: */ - if __ccgo_strace { - trc("tls=%v d=%v s=%v n=%v, (%v:)", tls, d, s, n, origin(2)) - } - var l size_t = Xstrnlen(tls, d, n) - if l == n { - return l + Xstrlen(tls, s) - } - return l + Xstrlcpy(tls, d+uintptr(l), s, n-l) -} - -// Support signed or unsigned plain-char - -// Implementation choices... - -// Arbitrary numbers... - -// POSIX/SUS requirements follow. These numbers come directly -// from SUS and have nothing to do with the host system. - -func Xstrlcpy(tls *TLS, d uintptr, s uintptr, n size_t) size_t { /* strlcpy.c:11:8: */ - if __ccgo_strace { - trc("tls=%v d=%v s=%v n=%v, (%v:)", tls, d, s, n, origin(2)) - } - var d0 uintptr - var wd uintptr - var ws uintptr - d0 = d - - if !!(int32(PostDecUint64(&n, 1)) != 0) { - goto __1 - } - goto finish -__1: - ; - if !(uintptr_t(s)&(uint64(unsafe.Sizeof(size_t(0)))-uint64(1)) == uintptr_t(d)&(uint64(unsafe.Sizeof(size_t(0)))-uint64(1))) { - goto __2 - } -__3: - if !(uintptr_t(s)&(uint64(unsafe.Sizeof(size_t(0)))-uint64(1)) != 0 && n != 0 && AssignPtrInt8(d, *(*int8)(unsafe.Pointer(s))) != 0) { - goto __5 - } - goto __4 -__4: - n-- - s++ - d++ - goto __3 - goto __5 -__5: - ; - if !(n != 0 && *(*int8)(unsafe.Pointer(s)) != 0) { - goto __6 - } - wd = d - ws = s -__7: - if !(n >= size_t(unsafe.Sizeof(size_t(0))) && !((*(*uint64)(unsafe.Pointer(ws))-Uint64(Uint64FromInt32(-1))/uint64(255)) & ^*(*uint64)(unsafe.Pointer(ws)) & (Uint64(Uint64FromInt32(-1))/uint64(255)*uint64(255/2+1)) != 0)) { - goto __9 - } - *(*size_t)(unsafe.Pointer(wd)) = *(*uint64)(unsafe.Pointer(ws)) - goto __8 -__8: - n = n - size_t(unsafe.Sizeof(size_t(0))) - ws += 8 - wd += 8 - goto __7 - goto __9 -__9: - ; - d = wd - s = ws -__6: - ; -__2: - ; -__10: - if !(n != 0 && AssignPtrInt8(d, *(*int8)(unsafe.Pointer(s))) != 0) { - goto __12 - } - goto __11 -__11: - n-- - s++ - d++ - goto __10 - goto __12 -__12: - ; - *(*int8)(unsafe.Pointer(d)) = int8(0) -finish: - return size_t((int64(d)-int64(d0))/1) + Xstrlen(tls, s) -} - -func Xstrncasecmp(tls *TLS, _l uintptr, _r uintptr, n size_t) int32 { /* strncasecmp.c:4:5: */ - if __ccgo_strace { - trc("tls=%v _l=%v _r=%v n=%v, (%v:)", tls, _l, _r, n, origin(2)) - } - var l uintptr = _l - var r uintptr = _r - if !(int32(PostDecUint64(&n, 1)) != 0) { - return 0 - } -__1: - if !(*(*uint8)(unsafe.Pointer(l)) != 0 && *(*uint8)(unsafe.Pointer(r)) != 0 && n != 0 && (int32(*(*uint8)(unsafe.Pointer(l))) == int32(*(*uint8)(unsafe.Pointer(r))) || Xtolower(tls, int32(*(*uint8)(unsafe.Pointer(l)))) == Xtolower(tls, int32(*(*uint8)(unsafe.Pointer(r)))))) { - goto __3 - } - goto __2 -__2: - l++ - r++ - n-- - goto __1 - goto __3 -__3: - ; - return Xtolower(tls, int32(*(*uint8)(unsafe.Pointer(l)))) - Xtolower(tls, int32(*(*uint8)(unsafe.Pointer(r)))) -} - -func X__strncasecmp_l(tls *TLS, l uintptr, r uintptr, n size_t, loc locale_t) int32 { /* strncasecmp.c:12:5: */ - if __ccgo_strace { - trc("tls=%v l=%v r=%v n=%v loc=%v, (%v:)", tls, l, r, n, loc, origin(2)) - } - return Xstrncasecmp(tls, l, r, n) -} - -func Xstrncat(tls *TLS, d uintptr, s uintptr, n size_t) uintptr { /* strncat.c:3:6: */ - if __ccgo_strace { - trc("tls=%v d=%v s=%v n=%v, (%v:)", tls, d, s, n, origin(2)) - } - var a uintptr = d - d += uintptr(Xstrlen(tls, d)) - for n != 0 && *(*int8)(unsafe.Pointer(s)) != 0 { - n-- - *(*int8)(unsafe.Pointer(PostIncUintptr(&d, 1))) = *(*int8)(unsafe.Pointer(PostIncUintptr(&s, 1))) - } - *(*int8)(unsafe.Pointer(PostIncUintptr(&d, 1))) = int8(0) - return a -} - -func Xstrnlen(tls *TLS, s uintptr, n size_t) size_t { /* strnlen.c:3:8: */ - if __ccgo_strace { - trc("tls=%v s=%v n=%v, (%v:)", tls, s, n, origin(2)) - } - var p uintptr = Xmemchr(tls, s, 0, n) - if p != 0 { - return uint64((int64(p) - int64(s)) / 1) - } - return n -} - -func Xstrspn(tls *TLS, s uintptr, c uintptr) size_t { /* strspn.c:6:8: */ - if __ccgo_strace { - trc("tls=%v s=%v c=%v, (%v:)", tls, s, c, origin(2)) - } - bp := tls.Alloc(32) - defer tls.Free(32) - - var a uintptr = s - *(*[4]size_t)(unsafe.Pointer(bp /* byteset */)) = [4]size_t{0: uint64(0)} - - if !(int32(*(*int8)(unsafe.Pointer(c))) != 0) { - return uint64(0) - } - if !(int32(*(*int8)(unsafe.Pointer(c + 1))) != 0) { - for ; int32(*(*int8)(unsafe.Pointer(s))) == int32(*(*int8)(unsafe.Pointer(c))); s++ { - } - return size_t((int64(s) - int64(a)) / 1) - } - - for ; *(*int8)(unsafe.Pointer(c)) != 0 && AssignOrPtrUint64(bp+uintptr(size_t(*(*uint8)(unsafe.Pointer(c)))/(uint64(8)*uint64(unsafe.Sizeof(size_t(0)))))*8, size_t(uint64(1))<<(size_t(*(*uint8)(unsafe.Pointer(c)))%(uint64(8)*uint64(unsafe.Sizeof(size_t(0)))))) != 0; c++ { - } - for ; *(*int8)(unsafe.Pointer(s)) != 0 && *(*size_t)(unsafe.Pointer(bp + uintptr(size_t(*(*uint8)(unsafe.Pointer(s)))/(uint64(8)*uint64(unsafe.Sizeof(size_t(0)))))*8))&(size_t(uint64(1))<<(size_t(*(*uint8)(unsafe.Pointer(s)))%(uint64(8)*uint64(unsafe.Sizeof(size_t(0)))))) != 0; s++ { - } - return size_t((int64(s) - int64(a)) / 1) -} - -func Xstrtok(tls *TLS, s uintptr, sep uintptr) uintptr { /* strtok.c:3:6: */ - if __ccgo_strace { - trc("tls=%v s=%v sep=%v, (%v:)", tls, s, sep, origin(2)) - } - if !(s != 0) && !(int32(AssignUintptr(&s, _sp)) != 0) { - return uintptr(0) - } - s += uintptr(Xstrspn(tls, s, sep)) - if !(int32(*(*int8)(unsafe.Pointer(s))) != 0) { - return AssignPtrUintptr(uintptr(unsafe.Pointer(&_sp)), uintptr(0)) - } - _sp = s + uintptr(Xstrcspn(tls, s, sep)) - if *(*int8)(unsafe.Pointer(_sp)) != 0 { - *(*int8)(unsafe.Pointer(PostIncUintptr(&_sp, 1))) = int8(0) - } else { - _sp = uintptr(0) - } - return s -} - -var _sp uintptr /* strtok.c:5:14: */ - -func X__ccgo_pthreadAttrGetDetachState(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:3:5: */ - if __ccgo_strace { - trc("tls=%v a=%v, (%v:)", tls, a, origin(2)) - } - return *(*int32)(unsafe.Pointer(a + 6*4)) -} - -func Xpthread_attr_getdetachstate(tls *TLS, a uintptr, state uintptr) int32 { /* pthread_attr_get.c:7:5: */ - if __ccgo_strace { - trc("tls=%v a=%v state=%v, (%v:)", tls, a, state, origin(2)) - } - *(*int32)(unsafe.Pointer(state)) = *(*int32)(unsafe.Pointer(a + 6*4)) - return 0 -} - -// -// int pthread_attr_getguardsize(const pthread_attr_t *restrict a, size_t *restrict size) -// { -// *size = a->_a_guardsize; -// return 0; -// } -// -// int pthread_attr_getinheritsched(const pthread_attr_t *restrict a, int *restrict inherit) -// { -// *inherit = a->_a_sched; -// return 0; -// } -// -// int pthread_attr_getschedparam(const pthread_attr_t *restrict a, struct sched_param *restrict param) -// { -// param->sched_priority = a->_a_prio; -// return 0; -// } -// -// int pthread_attr_getschedpolicy(const pthread_attr_t *restrict a, int *restrict policy) -// { -// *policy = a->_a_policy; -// return 0; -// } -// -// int pthread_attr_getscope(const pthread_attr_t *restrict a, int *restrict scope) -// { -// *scope = PTHREAD_SCOPE_SYSTEM; -// return 0; -// } -// -// int pthread_attr_getstack(const pthread_attr_t *restrict a, void **restrict addr, size_t *restrict size) -// { -// if (!a->_a_stackaddr) -// return EINVAL; -// *size = a->_a_stacksize; -// *addr = (void *)(a->_a_stackaddr - *size); -// return 0; -// } -// -// int pthread_attr_getstacksize(const pthread_attr_t *restrict a, size_t *restrict size) -// { -// *size = a->_a_stacksize; -// return 0; -// } -// -// int pthread_barrierattr_getpshared(const pthread_barrierattr_t *restrict a, int *restrict pshared) -// { -// *pshared = !!a->__attr; -// return 0; -// } -// -// int pthread_condattr_getclock(const pthread_condattr_t *restrict a, clockid_t *restrict clk) -// { -// *clk = a->__attr & 0x7fffffff; -// return 0; -// } -// -// int pthread_condattr_getpshared(const pthread_condattr_t *restrict a, int *restrict pshared) -// { -// *pshared = a->__attr>>31; -// return 0; -// } -// -// int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *restrict a, int *restrict protocol) -// { -// *protocol = PTHREAD_PRIO_NONE; -// return 0; -// } -// int pthread_mutexattr_getpshared(const pthread_mutexattr_t *restrict a, int *restrict pshared) -// { -// *pshared = a->__attr / 128U % 2; -// return 0; -// } -// -// int pthread_mutexattr_getrobust(const pthread_mutexattr_t *restrict a, int *restrict robust) -// { -// *robust = a->__attr / 4U % 2; -// return 0; -// } - -func X__ccgo_pthreadMutexattrGettype(tls *TLS, a uintptr) int32 { /* pthread_attr_get.c:93:5: */ - if __ccgo_strace { - trc("tls=%v a=%v, (%v:)", tls, a, origin(2)) - } - return int32((*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr & uint32(3)) -} - -// int pthread_mutexattr_gettype(const pthread_mutexattr_t *restrict a, int *restrict type) -// { -// *type = a->__attr & 3; -// return 0; -// } -// -// int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *restrict a, int *restrict pshared) -// { -// *pshared = a->__attr[0]; -// return 0; -// } - -func Xpthread_attr_setdetachstate(tls *TLS, a uintptr, state int32) int32 { /* pthread_attr_setdetachstate.c:3:5: */ - if __ccgo_strace { - trc("tls=%v a=%v state=%v, (%v:)", tls, a, state, origin(2)) - } - if uint32(state) > 1 { - return 22 - } - *(*int32)(unsafe.Pointer(a + 6*4)) = state - return 0 -} - -func X__ccgo_getMutexType(tls *TLS, m uintptr) int32 { /* pthread_mutex_lock.c:3:5: */ - if __ccgo_strace { - trc("tls=%v m=%v, (%v:)", tls, m, origin(2)) - } - return *(*int32)(unsafe.Pointer(m)) & 15 -} - -// int __pthread_mutex_lock(pthread_mutex_t *m) -// { -// if ((m->_m_type&15) == PTHREAD_MUTEX_NORMAL -// && !a_cas(&m->_m_lock, 0, EBUSY)) -// return 0; -// -// return __pthread_mutex_timedlock(m, 0); -// } -// -// weak_alias(__pthread_mutex_lock, pthread_mutex_lock); - -func Xpthread_mutexattr_destroy(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_destroy.c:3:5: */ - if __ccgo_strace { - trc("tls=%v a=%v, (%v:)", tls, a, origin(2)) - } - return 0 -} - -func Xpthread_mutexattr_init(tls *TLS, a uintptr) int32 { /* pthread_mutexattr_init.c:3:5: */ - if __ccgo_strace { - trc("tls=%v a=%v, (%v:)", tls, a, origin(2)) - } - *(*pthread_mutexattr_t)(unsafe.Pointer(a)) = pthread_mutexattr_t{} - return 0 -} - -func Xpthread_mutexattr_settype(tls *TLS, a uintptr, type1 int32) int32 { /* pthread_mutexattr_settype.c:3:5: */ - if __ccgo_strace { - trc("tls=%v a=%v type1=%v, (%v:)", tls, a, type1, origin(2)) - } - if uint32(type1) > uint32(2) { - return 22 - } - (*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr = (*pthread_mutexattr_t)(unsafe.Pointer(a)).__attr&Uint32FromInt32(CplInt32(3)) | uint32(type1) - return 0 -} - -func init() { - *(*uintptr)(unsafe.Pointer(uintptr(unsafe.Pointer(&ptable)) + 0)) = uintptr(unsafe.Pointer(&table)) + uintptr(128)*2 // __ctype_b_loc.c:36:45: -} - -var ts1 = "infinity\x00nan\x00\x00\x00\x01\x02\x04\a\x03\x06\x05\x00.\x00%d.%d.%d.%d.in-addr.arpa\x00ip6.arpa\x000123456789abcdef\x00/etc/hosts\x00rb\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00%d.%d.%d.%d\x00%x:%x:%x:%x:%x:%x:%x:%x\x00%x:%x:%x:%x:%x:%x:%d.%d.%d.%d\x00:0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\x00\x00 \x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 \x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfc\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" -var ts = (*reflect.StringHeader)(unsafe.Pointer(&ts1)).Data diff --git a/vendor/modernc.org/libc/pthread_musl.go b/vendor/modernc.org/libc/pthread_musl.go index 01fa300f6..c051945af 100644 --- a/vendor/modernc.org/libc/pthread_musl.go +++ b/vendor/modernc.org/libc/pthread_musl.go @@ -22,14 +22,26 @@ type pthreadCleanupItem struct { routine, arg uintptr } -// C version is 40 bytes (64b) and 24 bytes (32b). -type pthreadMutex struct { // 64b 32b - sync.Mutex // 0 8 0 8 - count int32 // 8 4 8 4 - mType uint32 // 12 4 12 4 - outer sync.Mutex // 16 8 16 8 - owner int32 // 24 4 24 4 - // 28 28 +// C original, unpatched version +// +// include/alltypes.h.in:86:TYPEDEF struct { +// union { +// int __i[sizeof(long)==8?10:6]; +// volatile int __vi[sizeof(long)==8?10:6]; +// volatile void *volatile __p[sizeof(long)==8?5:6]; +// } __u; +// } pthread_mutex_t; + +//TODO(jnml) can remove __ccgo_room patches now. + +// We overlay the C version with our version below. It must not be larger than +// the C version. +type pthreadMutex struct { // gc 64b 32b | tinygo 64b 32b + sync.Mutex // 0 8 0 4 | 0 16 0 8 + count int32 // 8 4 4 4 | 16 4 8 4 + typ uint32 // 12 4 8 4 | 20 4 12 4 + owner int32 // 16 4 12 4 | 24 4 16 4 + // 20 16 | 28 20 } type pthreadConds struct { @@ -39,7 +51,6 @@ type pthreadConds struct { var ( // Ensure there's enough space for unsafe type conversions. - _ [unsafe.Sizeof(sync.Mutex{}) - __CCGO_SIZEOF_GO_MUTEX]byte _ [unsafe.Sizeof(Tpthread_mutex_t{}) - unsafe.Sizeof(pthreadMutex{})]byte _ [unsafe.Sizeof(Tpthread_attr_t{}) - unsafe.Sizeof(pthreadAttr{})]byte @@ -255,103 +266,75 @@ func Xpthread_self(tls *TLS) uintptr { func Xpthread_mutex_init(tls *TLS, m, a uintptr) int32 { *(*Tpthread_mutex_t)(unsafe.Pointer(m)) = Tpthread_mutex_t{} if a != 0 { - (*pthreadMutex)(unsafe.Pointer(m)).mType = (*Tpthread_mutexattr_t)(unsafe.Pointer(a)).F__attr + (*pthreadMutex)(unsafe.Pointer(m)).typ = (*Tpthread_mutexattr_t)(unsafe.Pointer(a)).F__attr } return 0 } -func Xpthread_mutex_destroy(tls *TLS, mutex uintptr) int32 { +func Xpthread_mutex_destroy(tls *TLS, m uintptr) int32 { + *(*Tpthread_mutex_t)(unsafe.Pointer(m)) = Tpthread_mutex_t{} return 0 } func Xpthread_mutex_lock(tls *TLS, m uintptr) int32 { - (*pthreadMutex)(unsafe.Pointer(m)).outer.Lock() - owner := (*pthreadMutex)(unsafe.Pointer(m)).owner - typ := (*pthreadMutex)(unsafe.Pointer(m)).mType - switch typ { + switch typ := (*pthreadMutex)(unsafe.Pointer(m)).typ; typ { case PTHREAD_MUTEX_NORMAL: - (*pthreadMutex)(unsafe.Pointer(m)).owner = tls.ID - (*pthreadMutex)(unsafe.Pointer(m)).outer.Unlock() (*pthreadMutex)(unsafe.Pointer(m)).Lock() + return 0 case PTHREAD_MUTEX_RECURSIVE: - switch owner { - case 0: + if atomic.CompareAndSwapInt32(&((*pthreadMutex)(unsafe.Pointer(m)).owner), 0, tls.ID) { (*pthreadMutex)(unsafe.Pointer(m)).count = 1 - (*pthreadMutex)(unsafe.Pointer(m)).owner = tls.ID - (*pthreadMutex)(unsafe.Pointer(m)).outer.Unlock() (*pthreadMutex)(unsafe.Pointer(m)).Lock() return 0 - case tls.ID: - (*pthreadMutex)(unsafe.Pointer(m)).count++ - (*pthreadMutex)(unsafe.Pointer(m)).outer.Unlock() - return 0 - default: - wait: - (*pthreadMutex)(unsafe.Pointer(m)).outer.Unlock() - (*pthreadMutex)(unsafe.Pointer(m)).Lock() - (*pthreadMutex)(unsafe.Pointer(m)).outer.Lock() - if (*pthreadMutex)(unsafe.Pointer(m)).owner != 0 { - goto wait - } - - (*pthreadMutex)(unsafe.Pointer(m)).count = 1 - (*pthreadMutex)(unsafe.Pointer(m)).owner = tls.ID - (*pthreadMutex)(unsafe.Pointer(m)).outer.Unlock() - return 0 + } + + if atomic.LoadInt32(&((*pthreadMutex)(unsafe.Pointer(m)).owner)) == tls.ID { + (*pthreadMutex)(unsafe.Pointer(m)).count++ + return 0 + } + + for { + (*pthreadMutex)(unsafe.Pointer(m)).Lock() + if atomic.CompareAndSwapInt32(&((*pthreadMutex)(unsafe.Pointer(m)).owner), 0, tls.ID) { + (*pthreadMutex)(unsafe.Pointer(m)).count = 1 + return 0 + } + + (*pthreadMutex)(unsafe.Pointer(m)).Unlock() } default: - panic(todo("typ=%v", typ)) + panic(todo("", typ)) } - return 0 } func Xpthread_mutex_trylock(tls *TLS, m uintptr) int32 { - (*pthreadMutex)(unsafe.Pointer(m)).outer.Lock() - owner := (*pthreadMutex)(unsafe.Pointer(m)).owner - typ := (*pthreadMutex)(unsafe.Pointer(m)).mType - switch typ { + switch typ := (*pthreadMutex)(unsafe.Pointer(m)).typ; typ { case PTHREAD_MUTEX_NORMAL: - if owner != 0 { - (*pthreadMutex)(unsafe.Pointer(m)).outer.Unlock() - return EBUSY + if (*pthreadMutex)(unsafe.Pointer(m)).TryLock() { + return 0 } - (*pthreadMutex)(unsafe.Pointer(m)).owner = tls.ID - (*pthreadMutex)(unsafe.Pointer(m)).outer.Unlock() - (*pthreadMutex)(unsafe.Pointer(m)).Lock() - return 0 + return EBUSY default: panic(todo("typ=%v", typ)) } } func Xpthread_mutex_unlock(tls *TLS, m uintptr) int32 { - (*pthreadMutex)(unsafe.Pointer(m)).outer.Lock() - count := (*pthreadMutex)(unsafe.Pointer(m)).count - owner := (*pthreadMutex)(unsafe.Pointer(m)).owner - typ := (*pthreadMutex)(unsafe.Pointer(m)).mType - switch typ { + switch typ := (*pthreadMutex)(unsafe.Pointer(m)).typ; typ { case PTHREAD_MUTEX_NORMAL: - (*pthreadMutex)(unsafe.Pointer(m)).outer.Unlock() (*pthreadMutex)(unsafe.Pointer(m)).Unlock() return 0 case PTHREAD_MUTEX_RECURSIVE: - switch owner { - case tls.ID: - switch count { - case 1: - (*pthreadMutex)(unsafe.Pointer(m)).owner = 0 - (*pthreadMutex)(unsafe.Pointer(m)).outer.Unlock() - (*pthreadMutex)(unsafe.Pointer(m)).Unlock() - return 0 - default: - (*pthreadMutex)(unsafe.Pointer(m)).count-- - (*pthreadMutex)(unsafe.Pointer(m)).outer.Unlock() - return 0 - } - default: - panic(todo("", owner, tls.ID)) + if atomic.LoadInt32(&((*pthreadMutex)(unsafe.Pointer(m)).owner)) != tls.ID { + return EPERM } + + if atomic.AddInt32(&((*pthreadMutex)(unsafe.Pointer(m)).count), -1) == 0 { + atomic.StoreInt32(&((*pthreadMutex)(unsafe.Pointer(m)).owner), 0) + (*pthreadMutex)(unsafe.Pointer(m)).Unlock() + } + return 0 default: panic(todo("", typ)) } @@ -404,9 +387,8 @@ func Xpthread_cond_timedwait(tls *TLS, c, m, ts uintptr) (r int32) { } }() - switch typ := (*pthreadMutex)(unsafe.Pointer(m)).mType; typ { + switch typ := (*pthreadMutex)(unsafe.Pointer(m)).typ; typ { case PTHREAD_MUTEX_NORMAL: - (*pthreadMutex)(unsafe.Pointer(m)).owner = 0 (*pthreadMutex)(unsafe.Pointer(m)).Unlock() select { case <-ch: @@ -414,7 +396,6 @@ func Xpthread_cond_timedwait(tls *TLS, c, m, ts uintptr) (r int32) { case <-to: r = ETIMEDOUT } - (*pthreadMutex)(unsafe.Pointer(m)).owner = tls.ID (*pthreadMutex)(unsafe.Pointer(m)).Lock() return r default: diff --git a/vendor/modernc.org/memory/LICENSE-LOGO b/vendor/modernc.org/memory/LICENSE-LOGO new file mode 100644 index 000000000..ec496d173 --- /dev/null +++ b/vendor/modernc.org/memory/LICENSE-LOGO @@ -0,0 +1 @@ +https://commons.wikimedia.org/wiki/File:Memory_infra_logo.png diff --git a/vendor/modernc.org/memory/Makefile b/vendor/modernc.org/memory/Makefile index f844f1314..40a91322c 100644 --- a/vendor/modernc.org/memory/Makefile +++ b/vendor/modernc.org/memory/Makefile @@ -37,30 +37,59 @@ editor: build_all_targets: GOOS=darwin GOARCH=amd64 go build + GOOS=darwin GOARCH=amd64 staticcheck GOOS=darwin GOARCH=arm64 go build + GOOS=darwin GOARCH=arm64 staticcheck GOOS=freebsd GOARCH=386 go build + GOOS=freebsd GOARCH=386 staticcheck GOOS=freebsd GOARCH=amd64 go build + GOOS=freebsd GOARCH=amd64 staticcheck GOOS=freebsd GOARCH=arm go build + GOOS=freebsd GOARCH=arm staticcheck GOOS=freebsd GOARCH=arm64 go build + GOOS=freebsd GOARCH=arm64 staticcheck GOOS=illumos GOARCH=amd64 go build + GOOS=illumos GOARCH=amd64 staticcheck GOOS=linux GOARCH=386 go build + GOOS=linux GOARCH=386 staticcheck GOOS=linux GOARCH=amd64 go build + GOOS=linux GOARCH=amd64 staticcheck GOOS=linux GOARCH=arm go build + GOOS=linux GOARCH=arm staticcheck GOOS=linux GOARCH=arm64 go build + GOOS=linux GOARCH=arm64 staticcheck GOOS=linux GOARCH=loong64 go build + GOOS=linux GOARCH=loong64 staticcheck GOOS=linux GOARCH=mips go build + GOOS=linux GOARCH=mips staticcheck GOOS=linux GOARCH=mips64le go build + GOOS=linux GOARCH=mips64le staticcheck GOOS=linux GOARCH=mipsle go build + GOOS=linux GOARCH=mipsle staticcheck + GOOS=linux GOARCH=ppc64le go build + GOOS=linux GOARCH=ppc64le staticcheck GOOS=linux GOARCH=riscv64 go build + GOOS=linux GOARCH=riscv64 staticcheck GOOS=linux GOARCH=s390x go build + GOOS=linux GOARCH=s390x staticcheck GOOS=netbsd GOARCH=386 go build + GOOS=netbsd GOARCH=386 staticcheck GOOS=netbsd GOARCH=amd64 go build + GOOS=netbsd GOARCH=amd64 staticcheck GOOS=netbsd GOARCH=arm go build + GOOS=netbsd GOARCH=arm staticcheck GOOS=openbsd GOARCH=386 go build + GOOS=openbsd GOARCH=386 staticcheck GOOS=openbsd GOARCH=amd64 go build + GOOS=openbsd GOARCH=amd64 staticcheck GOOS=openbsd GOARCH=arm64 go build + GOOS=openbsd GOARCH=arm64 staticcheck GOOS=windows GOARCH=386 go build + GOOS=windows GOARCH=386 staticcheck GOOS=windows GOARCH=amd64 go build + GOOS=windows GOARCH=amd64 staticcheck + GOOS=windows GOARCH=arm64 go build + GOOS=windows GOARCH=arm64 staticcheck internalError: egrep -ho '"internal error.*"' *.go | sort | cat -n diff --git a/vendor/modernc.org/memory/README.md b/vendor/modernc.org/memory/README.md index 9354a3650..02c301256 100644 --- a/vendor/modernc.org/memory/README.md +++ b/vendor/modernc.org/memory/README.md @@ -1,4 +1,4 @@ -# memory +![logo-png](logo.png) Package memory implements a memory allocator. @@ -10,4 +10,4 @@ Installation $ go get modernc.org/memory -Documentation: [godoc.org/modernc.org/memory](http://godoc.org/modernc.org/memory) +[![Go Reference](https://pkg.go.dev/badge/modernc.org/memory.0.svg)](https://pkg.go.dev/modernc.org/memory) diff --git a/vendor/modernc.org/memory/logo.png b/vendor/modernc.org/memory/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..ba4eb2013e458967edff1047cca303008b9979e1 GIT binary patch literal 11369 zcmV-vESA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Z5JZ36!o^Ehg?k0ROVQ0!aDnHFR0O5|pqGc2Tzy`_ z@5Xco@!$*a=M#d)693bPIsu{Ch<;_Z}@Th13Jxsav}6o4=AZ%nv{C{K#E2h+wB87JPPFL1(wP{0n`m}&?+cW zwNeg4kB^|s%OO)IKt-hIp6yq_93vt@C7r6BUVOd_#C0g*GryXo&xnw1>#jA%xZ}jtDA#U0CM#r z%*18UQ?0zINL{cm-Mg4*+q|iTcK@XL0%3ZT}seh$uxV rN>PeZl%f=+C`BnsQHoNOu2A}42TSAQ7v(b;00000NkvXXu0mjfUOkc3 literal 0 HcmV?d00001 diff --git a/vendor/modernc.org/memory/memory.go b/vendor/modernc.org/memory/memory.go index c6d02df80..e25acda9b 100644 --- a/vendor/modernc.org/memory/memory.go +++ b/vendor/modernc.org/memory/memory.go @@ -57,7 +57,6 @@ import ( "fmt" "math/bits" "os" - "reflect" "unsafe" ) @@ -352,12 +351,7 @@ func (a *Allocator) Calloc(size int) (r []byte, err error) { return nil, err } - var b []byte - sh := (*reflect.SliceHeader)(unsafe.Pointer(&b)) - sh.Cap = usableSize(p) - sh.Data = p - sh.Len = size - return b, nil + return (*rawmem)(unsafe.Pointer(p))[:size:usableSize(p)], nil } // Close releases all OS resources used by a and sets it to its zero value. @@ -396,11 +390,7 @@ func (a *Allocator) Malloc(size int) (r []byte, err error) { return nil, err } - sh := (*reflect.SliceHeader)(unsafe.Pointer(&r)) - sh.Cap = usableSize(p) - sh.Data = p - sh.Len = size - return r, nil + return (*rawmem)(unsafe.Pointer(p))[:size:usableSize(p)], nil } // Realloc changes the size of the backing array of b to size bytes or returns @@ -422,11 +412,7 @@ func (a *Allocator) Realloc(b []byte, size int) (r []byte, err error) { return nil, err } - sh := (*reflect.SliceHeader)(unsafe.Pointer(&r)) - sh.Cap = usableSize(p) - sh.Data = p - sh.Len = size - return r, nil + return (*rawmem)(unsafe.Pointer(p))[:size:usableSize(p)], nil } // UsableSize reports the size of the memory block allocated at p, which must diff --git a/vendor/modernc.org/memory/mmap_darwin.go b/vendor/modernc.org/memory/mmap_darwin.go deleted file mode 100644 index d597cb45c..000000000 --- a/vendor/modernc.org/memory/mmap_darwin.go +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2017 The Memory Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build amd64 || arm64 -// +build amd64 arm64 - -package memory - -import ( - _ "unsafe" -) - -// Function syscall.mmap for darwin and openbsd calls internal/abi.FuncPCABI0, -// which is implemented as a compile intrinsic so the code cannot be reused. -// Using go:linkname directive to link mmapSyscall to syscall.mmap - -//go:linkname mmapSyscall syscall.mmap -func mmapSyscall(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) diff --git a/vendor/modernc.org/memory/mmap_freebsd_32.go b/vendor/modernc.org/memory/mmap_freebsd_32.go deleted file mode 100644 index 8b88f1b0e..000000000 --- a/vendor/modernc.org/memory/mmap_freebsd_32.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE-GO file. - -//go:build (freebsd && 386) || (freebsd && arm) -// +build freebsd,386 freebsd,arm - -package memory - -import ( - "syscall" -) - -// https://cs.opensource.google/go/go/+/refs/tags/go1.17.8:src/syscall/zsyscall_freebsd_386.go -func mmapSyscall(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := syscall.Syscall9(syscall.SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos), uintptr(pos>>32), 0, 0) - ret = uintptr(r0) - if e1 != 0 { - err = e1 - } - return -} diff --git a/vendor/modernc.org/memory/mmap_freebsd_64.go b/vendor/modernc.org/memory/mmap_freebsd_64.go deleted file mode 100644 index 9a988bca1..000000000 --- a/vendor/modernc.org/memory/mmap_freebsd_64.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE-GO file. - -//go:build (freebsd && amd64) || (freebsd && arm64) -// +build freebsd,amd64 freebsd,arm64 - -package memory - -import ( - "syscall" -) - -// https://cs.opensource.google/go/go/+/refs/tags/go1.17.8:src/syscall/zsyscall_freebsd_amd64.go;l=1337-1346 -func mmapSyscall(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := syscall.Syscall6(syscall.SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), uintptr(pos)) - ret = uintptr(r0) - if e1 != 0 { - err = e1 - } - return -} diff --git a/vendor/modernc.org/memory/mmap_illumos_amd64.go b/vendor/modernc.org/memory/mmap_illumos_amd64.go deleted file mode 100644 index 1006fe812..000000000 --- a/vendor/modernc.org/memory/mmap_illumos_amd64.go +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2011 Evan Shaw. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE-MMAP-GO file. - -// Modifications (c) 2022 The Memory Authors. - -package memory // import "modernc.org/memory" - -import ( - "os" - "syscall" - _ "unsafe" -) - -const ( - pageSizeLog = 20 - - // $ find /usr/include -name syscall.h - // /usr/include/sys/syscall.h - // $ grep -ni munmap /usr/include/sys/syscall.h - // 293:#define SYS_munmap 117 - // $ grep -ni mmap /usr/include/sys/syscall.h - // 291:#define SYS_mmap 115 - // 303:#define SYS_mmapobj 127 - // 442:#define SYS_mmap64 214 - // $ - // $ uname -a - // SunOS omnios64 5.11 omnios-r151044-d3b715b9d1 i86pc i386 i86pc - // $ - sys_MUNMAP = 117 - sys_MMAP = 214 -) - -var ( - osPageMask = osPageSize - 1 - osPageSize = os.Getpagesize() -) - -//go:linkname mmapSyscall syscall.mmap -func mmapSyscall(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) - -func unmap(addr uintptr, size int) error { - _, _, errno := syscall.Syscall(sys_MUNMAP, addr, uintptr(size), 0) - if errno != 0 { - return errno - } - - return nil -} - -// pageSize aligned. -func mmap(size int) (uintptr, int, error) { - size = roundup(size, osPageSize) - // The actual mmap syscall varies by architecture. mmapSyscall provides same - // functionality as the unexported funtion syscall.mmap and is declared in - // mmap_*_*.go and mmap_fallback.go. To add support for a new architecture, - // check function mmap in src/syscall/syscall_*_*.go or - // src/syscall/zsyscall_*_*.go in Go's source code. - p, err := mmapSyscall(0, uintptr(size+pageSize), syscall.PROT_READ|syscall.PROT_WRITE, syscall.MAP_PRIVATE|syscall.MAP_ANON, -1, 0) - if err != nil { - return 0, 0, err - } - - n := size + pageSize - if p&uintptr(osPageMask) != 0 { - panic("internal error") - } - - mod := int(p) & pageMask - if mod != 0 { - m := pageSize - mod - if err := unmap(p, m); err != nil { - return 0, 0, err - } - - n -= m - p += uintptr(m) - } - - if p&uintptr(pageMask) != 0 { - panic("internal error") - } - - if n-size != 0 { - if err := unmap(p+uintptr(size), n-size); err != nil { - return 0, 0, err - } - } - - return p, size, nil -} diff --git a/vendor/modernc.org/memory/mmap_linux_32.go b/vendor/modernc.org/memory/mmap_linux_32.go deleted file mode 100644 index 207ad417d..000000000 --- a/vendor/modernc.org/memory/mmap_linux_32.go +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE-GO file. - -//go:build linux && (386 || arm || mips || mipsle) -// +build linux -// +build 386 arm mips mipsle - -package memory - -import ( - "syscall" -) - -// Function syscall.mmap and syscall.mmap2 are same for linux/386, linux/arm, -// linux/mips and linux/mipsle - -// https://cs.opensource.google/go/go/+/refs/tags/go1.17.8:src/syscall/syscall_linux_386.go;l=99-105 -func mmapSyscall(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) { - page := uintptr(offset / 4096) - if offset != int64(page)*4096 { - return 0, syscall.EINVAL - } - return mmap2Syscall(addr, length, prot, flags, fd, page) -} - -// https://cs.opensource.google/go/go/+/refs/tags/go1.17.8:src/syscall/zsyscall_linux_386.go;l=1361-1370 -func mmap2Syscall(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error) { - r0, _, e1 := syscall.Syscall6(syscall.SYS_MMAP2, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(pageOffset)) - xaddr = uintptr(r0) - if e1 != 0 { - err = e1 - } - return -} diff --git a/vendor/modernc.org/memory/mmap_linux_64.go b/vendor/modernc.org/memory/mmap_linux_64.go deleted file mode 100644 index 6b7e93dc1..000000000 --- a/vendor/modernc.org/memory/mmap_linux_64.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE-GO file. - -//go:build linux && (amd64 || arm64 || mips64 || mips64le || riscv64 || ppc64le || loong64) -// +build linux -// +build amd64 arm64 mips64 mips64le riscv64 ppc64le loong64 - -package memory - -import ( - "syscall" -) - -// Function syscall.mmap is same for linux/amd64, linux/arm64, linux/mips64, -// linux/mips64le and linux/riscv64. - -// https://cs.opensource.google/go/go/+/refs/tags/go1.17.8:src/syscall/zsyscall_linux_amd64.go;l=1575-1584 -func mmapSyscall(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) { - r0, _, e1 := syscall.Syscall6(syscall.SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset)) - xaddr = uintptr(r0) - if e1 != 0 { - err = e1 - } - return -} diff --git a/vendor/modernc.org/memory/mmap_linux_s390x.go b/vendor/modernc.org/memory/mmap_linux_s390x.go deleted file mode 100644 index bf7260e52..000000000 --- a/vendor/modernc.org/memory/mmap_linux_s390x.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE-GO file. - -package memory - -import ( - "syscall" - "unsafe" -) - -// https://cs.opensource.google/go/go/+/refs/tags/go1.17.8:src/syscall/syscall_linux_s390x.go;l=105-115 -// Linux on s390x uses the old mmap interface, which requires arguments to be passed in a struct. -// mmap2 also requires arguments to be passed in a struct; it is currently not exposed in . -func mmapSyscall(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) { - mmap_args := [6]uintptr{addr, length, uintptr(prot), uintptr(flags), uintptr(fd), uintptr(offset)} - r0, _, e1 := syscall.Syscall(syscall.SYS_MMAP, uintptr(unsafe.Pointer(&mmap_args[0])), 0, 0) - xaddr = uintptr(r0) - if e1 != 0 { - err = e1 - } - return -} diff --git a/vendor/modernc.org/memory/mmap_netbsd_32.go b/vendor/modernc.org/memory/mmap_netbsd_32.go deleted file mode 100644 index 2c17038ae..000000000 --- a/vendor/modernc.org/memory/mmap_netbsd_32.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE-GO file. - -//go:build (netbsd && 386) || (netbsd && arm) -// +build netbsd,386 netbsd,arm - -package memory - -import ( - "syscall" -) - -// https://cs.opensource.google/go/go/+/refs/tags/go1.17.8:src/syscall/zsyscall_freebsd_386.go -func mmapSyscall(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := syscall.Syscall9(syscall.SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), 0, uintptr(pos), uintptr(pos>>32), 0) - ret = uintptr(r0) - if e1 != 0 { - err = e1 - } - return -} diff --git a/vendor/modernc.org/memory/mmap_netbsd_64.go b/vendor/modernc.org/memory/mmap_netbsd_64.go deleted file mode 100644 index 5c09a7bb0..000000000 --- a/vendor/modernc.org/memory/mmap_netbsd_64.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE-GO file. - -//go:build netbsd && amd64 -// +build netbsd,amd64 - -package memory - -import ( - "syscall" -) - -// https://cs.opensource.google/go/go/+/refs/tags/go1.17.8:src/syscall/zsyscall_netbsd_amd64.go;l=1190 -func mmapSyscall(addr uintptr, length uintptr, prot int, flag int, fd int, pos int64) (ret uintptr, err error) { - r0, _, e1 := syscall.Syscall9(syscall.SYS_MMAP, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flag), uintptr(fd), 0, uintptr(pos), 0, 0) - ret = uintptr(r0) - if e1 != 0 { - err = e1 - } - return -} diff --git a/vendor/modernc.org/memory/mmap_openbsd.go b/vendor/modernc.org/memory/mmap_openbsd.go deleted file mode 100644 index 24cc0a424..000000000 --- a/vendor/modernc.org/memory/mmap_openbsd.go +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2011 Evan Shaw. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE-MMAP-GO file. - -// Modifications (c) 2024 The Memory Authors. -// Copyright 2024 The Memory Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build openbsd && (386 || amd64 || arm64) - -package memory - -import ( - "fmt" - "os" - "sync" - "unsafe" - - "golang.org/x/sys/unix" -) - -// track what can be unmapped -var allocmap map[uintptr][]byte -var m sync.Mutex - -const pageSizeLog = 20 - -var ( - osPageMask = osPageSize - 1 - osPageSize = os.Getpagesize() -) - -func init() { - allocmap = make(map[uintptr][]byte) -} - -func unmap(addr uintptr, size int) error { - if trace { - fmt.Fprintf(os.Stderr, "unmap %#x\n", addr) - } - - a, ok := allocmap[addr] - if !ok { - if trace { - fmt.Fprintf(os.Stderr, "unmap %#x: not found\n", addr) - } - // panic("unmap called on unknown mapping") - return nil - } - - if err := unix.Munmap(a); err != nil { - if trace { - fmt.Fprintf(os.Stderr, "unmap: %s\n", err.Error()) - } - // panic(err.Error()) - return err - } - - m.Lock() - delete(allocmap, addr) - m.Unlock() - - return nil -} - -func mmap(size int) (uintptr, int, error) { - roundsize := roundup(size, osPageSize) + pageSize - - b, err := unix.Mmap(-1, 0, roundsize, unix.PROT_READ|unix.PROT_WRITE, unix.MAP_PRIVATE|unix.MAP_ANON) - if err != nil { - return 0, 0, err - } - - p := uintptr(unsafe.Pointer(&b[0])) - - if trace { - fmt.Fprintf(os.Stderr, "mmap actual @%#x size: %#x\n", p, roundsize) - } - - // waste all the space until the next page - r := (p + uintptr(pageSize)) &^ uintptr(pageMask) - nsize := (roundsize) - int((r - p)) - if nsize < size { - panic("didn't allocate enough to meet initial request!") - } - - if trace { - fmt.Fprintf(os.Stderr, "mmap page-rounded @%#x size: %#x\n", r, nsize) - } - - m.Lock() - allocmap[r] = b - m.Unlock() - - return r, nsize, nil -} diff --git a/vendor/modernc.org/memory/mmap_unix.go b/vendor/modernc.org/memory/mmap_unix.go index de57b8823..ef6c9a539 100644 --- a/vendor/modernc.org/memory/mmap_unix.go +++ b/vendor/modernc.org/memory/mmap_unix.go @@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE-MMAP-GO file. -//go:build darwin || dragonfly || freebsd || linux || (solaris && !illumos) || netbsd -// +build darwin dragonfly freebsd linux solaris,!illumos netbsd +//go:build unix // Modifications (c) 2017 The Memory Authors. package memory // import "modernc.org/memory" import ( + "golang.org/x/sys/unix" "os" - "syscall" + "unsafe" ) const pageSizeLog = 20 @@ -22,28 +22,18 @@ var ( ) func unmap(addr uintptr, size int) error { - _, _, errno := syscall.Syscall(syscall.SYS_MUNMAP, addr, uintptr(size), 0) - if errno != 0 { - return errno - } - - return nil + return unix.MunmapPtr(unsafe.Pointer(addr), uintptr(size)) } // pageSize aligned. func mmap(size int) (uintptr, int, error) { size = roundup(size, osPageSize) - - // The actual mmap syscall varies by architecture. mmapSyscall provides same - // functionality as the unexported funtion syscall.mmap and is declared in - // mmap_*_*.go and mmap_fallback.go. To add support for a new architecture, - // check function mmap in src/syscall/syscall_*_*.go or - // src/syscall/zsyscall_*_*.go in Go's source code. - p, err := mmapSyscall(0, uintptr(size+pageSize), syscall.PROT_READ|syscall.PROT_WRITE, syscall.MAP_PRIVATE|syscall.MAP_ANON, -1, 0) + up, err := unix.MmapPtr(-1, 0, nil, uintptr(size+pageSize), unix.PROT_READ|unix.PROT_WRITE, unix.MAP_PRIVATE|unix.MAP_ANON) if err != nil { return 0, 0, err } + p := uintptr(up) n := size + pageSize if p&uintptr(osPageMask) != 0 { panic("internal error") diff --git a/vendor/modernc.org/memory/mmap_windows.go b/vendor/modernc.org/memory/mmap_windows.go index f085a22ce..f88e51606 100644 --- a/vendor/modernc.org/memory/mmap_windows.go +++ b/vendor/modernc.org/memory/mmap_windows.go @@ -5,8 +5,8 @@ package memory // import "modernc.org/memory" import ( - "os" syscall "golang.org/x/sys/windows" + "os" ) const ( diff --git a/vendor/modernc.org/sqlite/Makefile b/vendor/modernc.org/sqlite/Makefile index f1d70c7a6..a72da1c9e 100644 --- a/vendor/modernc.org/sqlite/Makefile +++ b/vendor/modernc.org/sqlite/Makefile @@ -56,13 +56,13 @@ clean: go clean edit: - @if [ -f "Session.vim" ]; then gvim -S & else gvim -p Makefile go.mod builder.json all_test.go vendor_libsqlite3.go & fi + @if [ -f "Session.vim" ]; then gvim -S & else gvim -p Makefile go.mod builder.json all_test.go & fi editor: gofmt -l -s -w . go test -c -o /dev/null go build -v -o /dev/null ./... - go build -o /dev/null vendor_libsqlite3.go + cd vendor_libsqlite3 && go build -o /dev/null main.go test: go test -v -timeout 24h diff --git a/vendor/modernc.org/sqlite/lib/mutex.go b/vendor/modernc.org/sqlite/lib/mutex.go index 0780f5f94..305b24610 100644 --- a/vendor/modernc.org/sqlite/lib/mutex.go +++ b/vendor/modernc.org/sqlite/lib/mutex.go @@ -59,170 +59,40 @@ var ( }{mutexNotheld})), } - MutexCounters = libc.NewPerfCounter([]string{ - "enter-fast", - "enter-recursive", - "enter-recursive-loop", - "try-fast", - "try-recursive", - }) - MutexEnterCallers = libc.NewStackCapture(4) + mutexApp10 mutex + mutexApp20 mutex + mutexApp30 mutex + mutexLRU0 mutex + mutexMaster0 mutex + mutexMem0 mutex + mutexOpen0 mutex + mutexPMem0 mutex + mutexPRNG0 mutex + mutexVFS10 mutex + mutexVFS20 mutex + mutexVFS30 mutex - mutexes mutexPool - - mutexApp1 = mutexes.alloc(false) - mutexApp2 = mutexes.alloc(false) - mutexApp3 = mutexes.alloc(false) - mutexLRU = mutexes.alloc(false) - mutexMaster = mutexes.alloc(false) - mutexMem = mutexes.alloc(false) - mutexOpen = mutexes.alloc(false) - mutexPMem = mutexes.alloc(false) - mutexPRNG = mutexes.alloc(false) - mutexVFS1 = mutexes.alloc(false) - mutexVFS2 = mutexes.alloc(false) - mutexVFS3 = mutexes.alloc(false) + mutexApp1 = uintptr(unsafe.Pointer(&mutexApp10)) + mutexApp2 = uintptr(unsafe.Pointer(&mutexApp20)) + mutexApp3 = uintptr(unsafe.Pointer(&mutexApp30)) + mutexLRU = uintptr(unsafe.Pointer(&mutexLRU0)) + mutexMaster = uintptr(unsafe.Pointer(&mutexMaster0)) + mutexMem = uintptr(unsafe.Pointer(&mutexMem0)) + mutexOpen = uintptr(unsafe.Pointer(&mutexOpen0)) + mutexPMem = uintptr(unsafe.Pointer(&mutexPMem0)) + mutexPRNG = uintptr(unsafe.Pointer(&mutexPRNG0)) + mutexVFS1 = uintptr(unsafe.Pointer(&mutexVFS10)) + mutexVFS2 = uintptr(unsafe.Pointer(&mutexVFS20)) + mutexVFS3 = uintptr(unsafe.Pointer(&mutexVFS30)) ) -type mutexPool struct { - sync.Mutex - a []*[256]mutex - freeList []int -} - -func mutexFromPtr(p uintptr) *mutex { - if p == 0 { - return nil - } - - ix := p - 1 - - mutexes.Lock() - defer mutexes.Unlock() - - return &mutexes.a[ix>>8][ix&255] -} - -func (m *mutexPool) alloc(recursive bool) uintptr { - m.Lock() - defer m.Unlock() - - n := len(m.freeList) - if n == 0 { - outer := len(m.a) << 8 - m.a = append(m.a, &[256]mutex{}) - for i := 0; i < 256; i++ { - m.freeList = append(m.freeList, outer+i) - } - n = len(m.freeList) - } - ix := m.freeList[n-1] - outer := ix >> 8 - inner := ix & 255 - m.freeList = m.freeList[:n-1] - p := &m.a[outer][inner] - p.poolIndex = ix - p.recursive = recursive - return uintptr(ix) + 1 -} - -func (m *mutexPool) free(p uintptr) { - ptr := mutexFromPtr(p) - ix := ptr.poolIndex - *ptr = mutex{} - - m.Lock() - defer m.Unlock() - - m.freeList = append(m.freeList, ix) -} - type mutex struct { sync.Mutex - wait sync.Mutex - - poolIndex int - - cnt int32 - id int32 - + cnt int32 + id int32 // tls.ID recursive bool } -func (m *mutex) enter(id int32) { - // MutexEnterCallers.Record() - if !m.recursive { - // MutexCounters.Inc(0) - m.Lock() - m.id = id - return - } - - // MutexCounters.Inc(1) - for { - m.Lock() - switch m.id { - case 0: - m.cnt = 1 - m.id = id - m.wait.Lock() - m.Unlock() - return - case id: - m.cnt++ - m.Unlock() - return - } - - // MutexCounters.Inc(2) - m.Unlock() - m.wait.Lock() - //lint:ignore SA2001 TODO report staticcheck issue - m.wait.Unlock() - } -} - -func (m *mutex) try(id int32) int32 { - if !m.recursive { - // MutexCounters.Inc(3) - return SQLITE_BUSY - } - - // MutexCounters.Inc(4) - m.Lock() - switch m.id { - case 0: - m.cnt = 1 - m.id = id - m.wait.Lock() - m.Unlock() - return SQLITE_OK - case id: - m.cnt++ - m.Unlock() - return SQLITE_OK - } - - m.Unlock() - return SQLITE_BUSY -} - -func (m *mutex) leave(id int32) { - if !m.recursive { - m.id = 0 - m.Unlock() - return - } - - m.Lock() - m.cnt-- - if m.cnt == 0 { - m.id = 0 - m.wait.Unlock() - } - m.Unlock() -} - // int (*xMutexInit)(void); // // The xMutexInit method defined by this structure is invoked as part of system @@ -287,14 +157,15 @@ func mutexEnd(tls *libc.TLS) int32 { return SQLITE_OK } // SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc() returns a // different mutex on every call. For the static mutex types, the same mutex is // returned on every call that has the same type number. -func mutexAlloc(tls *libc.TLS, typ int32) uintptr { - defer func() { - }() +func mutexAlloc(tls *libc.TLS, typ int32) (r uintptr) { switch typ { case SQLITE_MUTEX_FAST: - return mutexes.alloc(false) + r = libc.Xcalloc(tls, 1, types.Size_t(unsafe.Sizeof(mutex{}))) + return r case SQLITE_MUTEX_RECURSIVE: - return mutexes.alloc(true) + r = libc.Xcalloc(tls, 1, types.Size_t(unsafe.Sizeof(mutex{}))) + (*mutex)(unsafe.Pointer(r)).recursive = true + return r case SQLITE_MUTEX_STATIC_MASTER: return mutexMaster case SQLITE_MUTEX_STATIC_MEM: @@ -325,7 +196,9 @@ func mutexAlloc(tls *libc.TLS, typ int32) uintptr { } // void (*xMutexFree)(sqlite3_mutex *); -func mutexFree(tls *libc.TLS, m uintptr) { mutexes.free(m) } +func mutexFree(tls *libc.TLS, m uintptr) { + libc.Xfree(tls, m) +} // The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt to enter // a mutex. If another thread is already within the mutex, @@ -346,7 +219,34 @@ func mutexEnter(tls *libc.TLS, m uintptr) { if m == 0 { return } - mutexFromPtr(m).enter(tls.ID) + + if !(*mutex)(unsafe.Pointer(m)).recursive { + (*mutex)(unsafe.Pointer(m)).Lock() + (*mutex)(unsafe.Pointer(m)).id = tls.ID + return + } + + id := tls.ID + if atomic.CompareAndSwapInt32(&(*mutex)(unsafe.Pointer(m)).id, 0, id) { + (*mutex)(unsafe.Pointer(m)).cnt = 1 + (*mutex)(unsafe.Pointer(m)).Lock() + return + } + + if atomic.LoadInt32(&(*mutex)(unsafe.Pointer(m)).id) == id { + (*mutex)(unsafe.Pointer(m)).cnt++ + return + } + + for { + (*mutex)(unsafe.Pointer(m)).Lock() + if atomic.CompareAndSwapInt32(&(*mutex)(unsafe.Pointer(m)).id, 0, id) { + (*mutex)(unsafe.Pointer(m)).cnt = 1 + return + } + + (*mutex)(unsafe.Pointer(m)).Unlock() + } } // int (*xMutexTry)(sqlite3_mutex *); @@ -355,7 +255,13 @@ func mutexTry(tls *libc.TLS, m uintptr) int32 { return SQLITE_OK } - return mutexFromPtr(m).try(tls.ID) + if !(*mutex)(unsafe.Pointer(m)).recursive { + if (*mutex)(unsafe.Pointer(m)).TryLock() { + return SQLITE_OK + } + } + + return SQLITE_BUSY } // void (*xMutexLeave)(sqlite3_mutex *); @@ -364,7 +270,16 @@ func mutexLeave(tls *libc.TLS, m uintptr) { return } - mutexFromPtr(m).leave(tls.ID) + if !(*mutex)(unsafe.Pointer(m)).recursive { + (*mutex)(unsafe.Pointer(m)).id = 0 + (*mutex)(unsafe.Pointer(m)).Unlock() + return + } + + if atomic.AddInt32(&(*mutex)(unsafe.Pointer(m)).cnt, -1) == 0 { + atomic.StoreInt32(&(*mutex)(unsafe.Pointer(m)).id, 0) + (*mutex)(unsafe.Pointer(m)).Unlock() + } } // The sqlite3_mutex_held() and sqlite3_mutex_notheld() routines are intended @@ -397,7 +312,7 @@ func mutexHeld(tls *libc.TLS, m uintptr) int32 { return 1 } - return libc.Bool32(atomic.LoadInt32(&mutexFromPtr(m).id) == tls.ID) + return libc.Bool32(atomic.LoadInt32(&(*mutex)(unsafe.Pointer(m)).id) == tls.ID) } // int (*xMutexNotheld)(sqlite3_mutex *); @@ -406,5 +321,5 @@ func mutexNotheld(tls *libc.TLS, m uintptr) int32 { return 1 } - return libc.Bool32(atomic.LoadInt32(&mutexFromPtr(m).id) != tls.ID) + return libc.Bool32(atomic.LoadInt32(&(*mutex)(unsafe.Pointer(m)).id) != tls.ID) } diff --git a/vendor/modernc.org/sqlite/lib/sqlite_freebsd_386.go b/vendor/modernc.org/sqlite/lib/sqlite_freebsd_386.go index 3fc6a8302..8d6fc9939 100644 --- a/vendor/modernc.org/sqlite/lib/sqlite_freebsd_386.go +++ b/vendor/modernc.org/sqlite/lib/sqlite_freebsd_386.go @@ -113738,8 +113738,8 @@ var mu mutex func init() { mu.recursive = true } func Xsqlite3_initialize(tls *libc.TLS) int32 { - mu.enter(tls.ID) - defer mu.leave(tls.ID) + mutexEnter(tls, uintptr(unsafe.Pointer(&mu))) + defer mutexLeave(tls, uintptr(unsafe.Pointer(&mu))) var pMainMtx uintptr var rc int32 diff --git a/vendor/modernc.org/sqlite/lib/sqlite_freebsd_arm.go b/vendor/modernc.org/sqlite/lib/sqlite_freebsd_arm.go index fd1930ace..ca50c9f3e 100644 --- a/vendor/modernc.org/sqlite/lib/sqlite_freebsd_arm.go +++ b/vendor/modernc.org/sqlite/lib/sqlite_freebsd_arm.go @@ -113799,8 +113799,8 @@ var mu mutex func init() { mu.recursive = true } func Xsqlite3_initialize(tls *libc.TLS) int32 { - mu.enter(tls.ID) - defer mu.leave(tls.ID) + mutexEnter(tls, uintptr(unsafe.Pointer(&mu))) + defer mutexLeave(tls, uintptr(unsafe.Pointer(&mu))) var pMainMtx uintptr var rc int32 diff --git a/vendor/modernc.org/sqlite/lib/sqlite_linux_arm64.go b/vendor/modernc.org/sqlite/lib/sqlite_linux_arm64.go index e3af6dee9..1188413aa 100644 --- a/vendor/modernc.org/sqlite/lib/sqlite_linux_arm64.go +++ b/vendor/modernc.org/sqlite/lib/sqlite_linux_arm64.go @@ -14386,10 +14386,10 @@ func _toLocaltime(tls *libc.TLS, p uintptr, pCtx uintptr) (r int32) { (*(*TDateTime)(unsafe.Pointer(bp + 64))).FY += iYearDiff (*(*TDateTime)(unsafe.Pointer(bp + 64))).FvalidJD = uint8(0) _computeJD(tls, bp+64) - *(*Ttime_t)(unsafe.Pointer(bp)) = int64((*(*TDateTime)(unsafe.Pointer(bp + 64))).FiJD/libc.Int64FromInt32(1000) - libc.Int64FromInt32(21086676)*libc.Int64FromInt32(10000)) + *(*Ttime_t)(unsafe.Pointer(bp)) = (*(*TDateTime)(unsafe.Pointer(bp + 64))).FiJD/libc.Int64FromInt32(1000) - libc.Int64FromInt32(21086676)*libc.Int64FromInt32(10000) } else { iYearDiff = 0 - *(*Ttime_t)(unsafe.Pointer(bp)) = int64((*TDateTime)(unsafe.Pointer(p)).FiJD/libc.Int64FromInt32(1000) - libc.Int64FromInt32(21086676)*libc.Int64FromInt32(10000)) + *(*Ttime_t)(unsafe.Pointer(bp)) = (*TDateTime)(unsafe.Pointer(p)).FiJD/libc.Int64FromInt32(1000) - libc.Int64FromInt32(21086676)*libc.Int64FromInt32(10000) } if _osLocaltime(tls, bp, bp+8) != 0 { Xsqlite3_result_error(tls, pCtx, __ccgo_ts+1212, -int32(1)) @@ -18748,7 +18748,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li if libc.Int32FromUint8(flag_long) == int32(2) { v = libc.VaInt64(&ap) } else { - v = int64(libc.VaInt64(&ap)) + v = libc.VaInt64(&ap) } } else { v = int64(libc.VaInt32(&ap)) @@ -18770,7 +18770,7 @@ func Xsqlite3_str_vappendf(tls *libc.TLS, pAccum uintptr, fmt uintptr, ap Tva_li if libc.Int32FromUint8(flag_long) == int32(2) { longvalue = libc.VaUint64(&ap) } else { - longvalue = uint64(libc.VaUint64(&ap)) + longvalue = libc.VaUint64(&ap) } } else { longvalue = uint64(libc.VaUint32(&ap)) @@ -27188,7 +27188,7 @@ func _unixOpenSharedMemory(tls *libc.TLS, pDbFd uintptr) (r int32) { goto shm_open_err } nShmFilename = int32(6) + libc.Int32FromUint64(libc.Xstrlen(tls, zBasePath)) - pShmNode = Xsqlite3_malloc64(tls, uint64(uint64(96)+libc.Uint64FromInt32(nShmFilename))) + pShmNode = Xsqlite3_malloc64(tls, uint64(96)+libc.Uint64FromInt32(nShmFilename)) if pShmNode == uintptr(0) { rc = int32(SQLITE_NOMEM) goto shm_open_err @@ -27363,7 +27363,7 @@ func _unixShmMap(tls *libc.TLS, fd uintptr, iRegion int32, szRegion int32, bExte } else { v2 = libc.Int32FromInt32(PROT_READ) | libc.Int32FromInt32(PROT_WRITE) } - pMem = (*(*func(*libc.TLS, uintptr, Tsize_t, int32, int32, int32, Toff_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(22)].FpCurrent})))(tls, uintptr(0), libc.Uint64FromInt32(nMap), v2, int32(MAP_SHARED), (*TunixShmNode)(unsafe.Pointer(pShmNode)).FhShm, int64(int64(szRegion)*libc.Int64FromUint16((*TunixShmNode)(unsafe.Pointer(pShmNode)).FnRegion))) + pMem = (*(*func(*libc.TLS, uintptr, Tsize_t, int32, int32, int32, Toff_t) uintptr)(unsafe.Pointer(&struct{ uintptr }{_aSyscall[int32(22)].FpCurrent})))(tls, uintptr(0), libc.Uint64FromInt32(nMap), v2, int32(MAP_SHARED), (*TunixShmNode)(unsafe.Pointer(pShmNode)).FhShm, int64(szRegion)*libc.Int64FromUint16((*TunixShmNode)(unsafe.Pointer(pShmNode)).FnRegion)) if pMem == uintptr(-libc.Int32FromInt32(1)) { rc = _unixLogErrorAtLine(tls, libc.Int32FromInt32(SQLITE_IOERR)|libc.Int32FromInt32(21)< 0 { endDistinctTest = _sqlite3VdbeMakeLabel(tls, pParse) /* Array of jump instruction addresses */ - aGotoChng = _sqlite3DbMallocRawNN(tls, db, uint64(uint64(4)*libc.Uint64FromInt32(nColTest))) + aGotoChng = _sqlite3DbMallocRawNN(tls, db, uint64(4)*libc.Uint64FromInt32(nColTest)) if aGotoChng == uintptr(0) { goto _13 } @@ -94226,7 +94226,7 @@ func _analysisLoader(tls *libc.TLS, pData uintptr, argc int32, argv uintptr, Not ** sqlite_stat1 entries for this index. In that case just clobber ** the old data with the new instead of allocating a new array. */ if (*TIndex)(unsafe.Pointer(pIndex)).FaiRowEst == uintptr(0) { - (*TIndex)(unsafe.Pointer(pIndex)).FaiRowEst = _sqlite3MallocZero(tls, uint64(uint64(8)*libc.Uint64FromInt32(nCol))) + (*TIndex)(unsafe.Pointer(pIndex)).FaiRowEst = _sqlite3MallocZero(tls, uint64(8)*libc.Uint64FromInt32(nCol)) if (*TIndex)(unsafe.Pointer(pIndex)).FaiRowEst == uintptr(0) { _sqlite3OomFault(tls, (*TanalysisInfo)(unsafe.Pointer(pInfo)).Fdb) } @@ -94429,8 +94429,8 @@ func _loadStatTbl(tls *libc.TLS, db uintptr, zSql1 uintptr, zSql2 uintptr, zDb u (*TIndex)(unsafe.Pointer(pIdx)).FnSampleCol = nIdxCol (*TIndex)(unsafe.Pointer(pIdx)).FmxSample = nSample nByte = libc.Int64FromUint64((libc.Uint64FromInt64(40)*libc.Uint64FromInt32(nSample) + libc.Uint64FromInt32(7)) & libc.Uint64FromInt32(^libc.Int32FromInt32(7))) - nByte = Ti64(uint64(nByte) + uint64(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(nIdxCol)*libc.Uint64FromInt32(3)*libc.Uint64FromInt32(nSample))) - nByte = Ti64(uint64(nByte) + uint64(libc.Uint64FromInt32(nIdxCol)*libc.Uint64FromInt64(8))) /* Space for Index.aAvgEq[] */ + nByte = Ti64(uint64(nByte) + libc.Uint64FromInt64(8)*libc.Uint64FromInt32(nIdxCol)*libc.Uint64FromInt32(3)*libc.Uint64FromInt32(nSample)) + nByte = Ti64(uint64(nByte) + libc.Uint64FromInt32(nIdxCol)*libc.Uint64FromInt64(8)) /* Space for Index.aAvgEq[] */ (*TIndex)(unsafe.Pointer(pIdx)).FaSample = _sqlite3DbMallocZero(tls, db, libc.Uint64FromInt64(nByte)) if (*TIndex)(unsafe.Pointer(pIdx)).FaSample == uintptr(0) { Xsqlite3_finalize(tls, *(*uintptr)(unsafe.Pointer(bp))) @@ -94830,13 +94830,13 @@ func _attachFunc(tls *libc.TLS, context uintptr, NotUsed int32, argv uintptr) { ** hash tables. */ if (*Tsqlite3)(unsafe.Pointer(db)).FaDb == db+696 { - aNew = _sqlite3DbMallocRawNN(tls, db, uint64(libc.Uint64FromInt64(32)*libc.Uint64FromInt32(3))) + aNew = _sqlite3DbMallocRawNN(tls, db, libc.Uint64FromInt64(32)*libc.Uint64FromInt32(3)) if aNew == uintptr(0) { return } libc.Xmemcpy(tls, aNew, (*Tsqlite3)(unsafe.Pointer(db)).FaDb, libc.Uint64FromInt64(32)*libc.Uint64FromInt32(2)) } else { - aNew = _sqlite3DbRealloc(tls, db, (*Tsqlite3)(unsafe.Pointer(db)).FaDb, uint64(uint64(32)*libc.Uint64FromInt32((*Tsqlite3)(unsafe.Pointer(db)).FnDb+libc.Int32FromInt32(1)))) + aNew = _sqlite3DbRealloc(tls, db, (*Tsqlite3)(unsafe.Pointer(db)).FaDb, uint64(32)*libc.Uint64FromInt32((*Tsqlite3)(unsafe.Pointer(db)).FnDb+libc.Int32FromInt32(1))) if aNew == uintptr(0) { return } @@ -100766,7 +100766,7 @@ func _sqlite3IdListAppend(tls *libc.TLS, pParse uintptr, pList uintptr, pToken u return uintptr(0) } } else { - pNew = _sqlite3DbRealloc(tls, db, pList, uint64(uint64(16)+libc.Uint64FromInt32((*TIdList)(unsafe.Pointer(pList)).FnId)*uint64(8))) + pNew = _sqlite3DbRealloc(tls, db, pList, uint64(16)+libc.Uint64FromInt32((*TIdList)(unsafe.Pointer(pList)).FnId)*uint64(8)) if pNew == uintptr(0) { _sqlite3IdListDelete(tls, db, pList) return uintptr(0) @@ -102222,7 +102222,7 @@ func _findCollSeqEntry(tls *libc.TLS, db uintptr, zName uintptr, create int32) ( pColl = _sqlite3HashFind(tls, db+648, zName) if uintptr(0) == pColl && create != 0 { nName = _sqlite3Strlen30(tls, zName) + int32(1) - pColl = _sqlite3DbMallocZero(tls, db, uint64(libc.Uint64FromInt32(3)*libc.Uint64FromInt64(40)+libc.Uint64FromInt32(nName))) + pColl = _sqlite3DbMallocZero(tls, db, libc.Uint64FromInt32(3)*libc.Uint64FromInt64(40)+libc.Uint64FromInt32(nName)) if pColl != 0 { pDel = uintptr(0) (*(*TCollSeq)(unsafe.Pointer(pColl))).FzName = pColl + 3*40 @@ -102572,7 +102572,7 @@ func _sqlite3FindFunction(tls *libc.TLS, db uintptr, zName uintptr, nArg int32, ** new entry to the hash table and return it. */ if v2 = createFlag != 0 && bestScore < int32(FUNC_PERFECT_MATCH); v2 { - v1 = _sqlite3DbMallocZero(tls, db, uint64(uint64(72)+libc.Uint64FromInt32(nName)+uint64(1))) + v1 = _sqlite3DbMallocZero(tls, db, uint64(72)+libc.Uint64FromInt32(nName)+uint64(1)) pBest = v1 } if v2 && v1 != uintptr(0) { @@ -105384,7 +105384,7 @@ func _trimFunc(tls *libc.TLS, context uintptr, argc int32, argv uintptr) { nChar++ } if nChar > 0 { - azChar = _contextMalloc(tls, context, libc.Int64FromUint64(libc.Uint64FromInt64(int64(nChar))*uint64(libc.Uint64FromInt64(8)+libc.Uint64FromInt64(4)))) + azChar = _contextMalloc(tls, context, libc.Int64FromUint64(libc.Uint64FromInt64(int64(nChar))*(libc.Uint64FromInt64(8)+libc.Uint64FromInt64(4)))) if azChar == uintptr(0) { return } @@ -106118,7 +106118,7 @@ func _groupConcatStep(tls *libc.TLS, context uintptr, argc int32, argv uintptr) pnsl = (*TGroupConcatCtx)(unsafe.Pointer(pGCC)).FpnSepLengths if pnsl == uintptr(0) { /* First separator length variation seen, start tracking them. */ - pnsl = Xsqlite3_malloc64(tls, uint64(libc.Uint64FromInt32((*TGroupConcatCtx)(unsafe.Pointer(pGCC)).FnAccum+libc.Int32FromInt32(1))*uint64(4))) + pnsl = Xsqlite3_malloc64(tls, libc.Uint64FromInt32((*TGroupConcatCtx)(unsafe.Pointer(pGCC)).FnAccum+libc.Int32FromInt32(1))*uint64(4)) if pnsl != uintptr(0) { i = 0 nA = (*TGroupConcatCtx)(unsafe.Pointer(pGCC)).FnAccum - int32(1) @@ -106129,7 +106129,7 @@ func _groupConcatStep(tls *libc.TLS, context uintptr, argc int32, argv uintptr) } } } else { - pnsl = Xsqlite3_realloc64(tls, pnsl, uint64(libc.Uint64FromInt32((*TGroupConcatCtx)(unsafe.Pointer(pGCC)).FnAccum)*uint64(4))) + pnsl = Xsqlite3_realloc64(tls, pnsl, libc.Uint64FromInt32((*TGroupConcatCtx)(unsafe.Pointer(pGCC)).FnAccum)*uint64(4)) } if pnsl != uintptr(0) { if (*TGroupConcatCtx)(unsafe.Pointer(pGCC)).FnAccum > 0 { @@ -107487,7 +107487,7 @@ func _sqlite3FkLocateIndex(tls *libc.TLS, pParse uintptr, pParent uintptr, pFKey } } else { if paiCol != 0 { - aiCol = _sqlite3DbMallocRawNN(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(libc.Uint64FromInt32(nCol)*uint64(4))) + aiCol = _sqlite3DbMallocRawNN(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, libc.Uint64FromInt32(nCol)*uint64(4)) if !(aiCol != 0) { return int32(1) } @@ -108775,7 +108775,7 @@ func _fkActionTrigger(tls *libc.TLS, pParse uintptr, pTab uintptr, pFKey uintptr /* Disable lookaside memory allocation */ (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.FbDisable++ (*Tsqlite3)(unsafe.Pointer(db)).Flookaside.Fsz = uint16(0) - pTrigger = _sqlite3DbMallocZero(tls, db, uint64(libc.Uint64FromInt64(72)+libc.Uint64FromInt64(96)+libc.Uint64FromInt32(nFrom)+uint64(1))) + pTrigger = _sqlite3DbMallocZero(tls, db, libc.Uint64FromInt64(72)+libc.Uint64FromInt64(96)+libc.Uint64FromInt32(nFrom)+uint64(1)) if pTrigger != 0 { v4 = pTrigger + 1*72 (*TTrigger)(unsafe.Pointer(pTrigger)).Fstep_list = v4 @@ -110053,7 +110053,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin */ bIdListInOrder = libc.BoolUint8((*TTable)(unsafe.Pointer(pTab)).FtabFlags&libc.Uint32FromInt32(libc.Int32FromInt32(TF_OOOHidden)|libc.Int32FromInt32(TF_HasStored)) == uint32(0)) if pColumn != 0 { - aTabColMap = _sqlite3DbMallocZero(tls, db, uint64(libc.Uint64FromInt16((*TTable)(unsafe.Pointer(pTab)).FnCol)*uint64(4))) + aTabColMap = _sqlite3DbMallocZero(tls, db, libc.Uint64FromInt16((*TTable)(unsafe.Pointer(pTab)).FnCol)*uint64(4)) if aTabColMap == uintptr(0) { goto insert_cleanup } @@ -110258,7 +110258,7 @@ func _sqlite3Insert(tls *libc.TLS, pParse uintptr, pTabList uintptr, pSelect uin /* If this is not a view, open the table and and all indices */ if !(isView != 0) { nIdx = _sqlite3OpenTableAndIndices(tls, pParse, pTab, int32(OP_OpenWrite), uint8(0), -int32(1), uintptr(0), bp, bp+4) - aRegIdx = _sqlite3DbMallocRawNN(tls, db, uint64(uint64(4)*libc.Uint64FromInt32(nIdx+libc.Int32FromInt32(2)))) + aRegIdx = _sqlite3DbMallocRawNN(tls, db, uint64(4)*libc.Uint64FromInt32(nIdx+libc.Int32FromInt32(2))) if aRegIdx == uintptr(0) { goto insert_cleanup } @@ -111147,7 +111147,7 @@ func _sqlite3GenerateConstraintChecks(tls *libc.TLS, pParse uintptr, pTab uintpt } (*(*TIndexIterator)(unsafe.Pointer(bp + 8))).FeType = int32(1) *(*int32)(unsafe.Pointer(bp + 8 + 8)) = nIdx - nByte = uint64((libc.Uint64FromInt64(16)+libc.Uint64FromInt32(1))*libc.Uint64FromInt32(nIdx) + libc.Uint64FromInt32(nIdx)) + nByte = (libc.Uint64FromInt64(16)+libc.Uint64FromInt32(1))*libc.Uint64FromInt32(nIdx) + libc.Uint64FromInt32(nIdx) *(*uintptr)(unsafe.Pointer(bp + 8 + 8 + 8)) = _sqlite3DbMallocZero(tls, db, nByte) if *(*uintptr)(unsafe.Pointer(bp + 8 + 8 + 8)) == uintptr(0) { return @@ -112385,7 +112385,7 @@ func Xsqlite3_exec(tls *libc.TLS, db uintptr, zSql uintptr, xCallback Tsqlite3_c if xCallback != 0 && (int32(SQLITE_ROW) == rc || int32(SQLITE_DONE) == rc && !(callbackIsInit != 0) && (*Tsqlite3)(unsafe.Pointer(db)).Fflags&uint64(SQLITE_NullCallback) != 0) { if !(callbackIsInit != 0) { nCol = Xsqlite3_column_count(tls, *(*uintptr)(unsafe.Pointer(bp + 8))) - azCols = _sqlite3DbMallocRaw(tls, db, uint64(libc.Uint64FromInt32(libc.Int32FromInt32(2)*nCol+libc.Int32FromInt32(1))*uint64(8))) + azCols = _sqlite3DbMallocRaw(tls, db, libc.Uint64FromInt32(libc.Int32FromInt32(2)*nCol+libc.Int32FromInt32(1))*uint64(8)) if azCols == uintptr(0) { goto exec_out } @@ -113148,7 +113148,7 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp pVfs = (*Tsqlite3)(unsafe.Pointer(db)).FpVfs *(*uintptr)(unsafe.Pointer(bp)) = uintptr(0) zAltEntry = uintptr(0) - nMsg = uint64(libc.Xstrlen(tls, zFile)) + nMsg = libc.Xstrlen(tls, zFile) if pzErrMsg != 0 { *(*uintptr)(unsafe.Pointer(pzErrMsg)) = uintptr(0) } @@ -113197,7 +113197,7 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp if zAltFile == uintptr(0) { return int32(SQLITE_NOMEM) } - if nMsg+uint64(libc.Xstrlen(tls, _azEndings[ii]))+uint64(1) <= uint64(FILENAME_MAX) { + if nMsg+libc.Xstrlen(tls, _azEndings[ii])+uint64(1) <= uint64(FILENAME_MAX) { handle = _sqlite3OsDlOpen(tls, pVfs, zAltFile) } Xsqlite3_free(tls, zAltFile) @@ -113266,7 +113266,7 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp } if xInit == uintptr(0) { if pzErrMsg != 0 { - nMsg += uint64(libc.Xstrlen(tls, zEntry) + uint64(300)) + nMsg += libc.Xstrlen(tls, zEntry) + uint64(300) v7 = Xsqlite3_malloc64(tls, nMsg) *(*uintptr)(unsafe.Pointer(bp)) = v7 *(*uintptr)(unsafe.Pointer(pzErrMsg)) = v7 @@ -113294,7 +113294,7 @@ func _sqlite3LoadExtension(tls *libc.TLS, db uintptr, zFile uintptr, zProc uintp return int32(SQLITE_ERROR) } /* Append the new shared library handle to the db->aExtension array. */ - aHandle = _sqlite3DbMallocZero(tls, db, uint64(uint64(8)*libc.Uint64FromInt32((*Tsqlite3)(unsafe.Pointer(db)).FnExtension+libc.Int32FromInt32(1)))) + aHandle = _sqlite3DbMallocZero(tls, db, uint64(8)*libc.Uint64FromInt32((*Tsqlite3)(unsafe.Pointer(db)).FnExtension+libc.Int32FromInt32(1))) if aHandle == uintptr(0) { return int32(SQLITE_NOMEM) } @@ -115889,7 +115889,7 @@ func _sqlite3Pragma(tls *libc.TLS, pParse uintptr, pId1 uintptr, pId2 uintptr, p if pObjTab != 0 { cnt++ } - aRoot = _sqlite3DbMallocRawNN(tls, db, uint64(uint64(4)*libc.Uint64FromInt32(cnt+libc.Int32FromInt32(1)))) + aRoot = _sqlite3DbMallocRawNN(tls, db, uint64(4)*libc.Uint64FromInt32(cnt+libc.Int32FromInt32(1))) if aRoot == uintptr(0) { break } @@ -120100,7 +120100,7 @@ func _sqlite3KeyInfoAlloc(tls *libc.TLS, db uintptr, N int32, X int32) (r uintpt var p uintptr _, _ = nExtra, p nExtra = libc.Int32FromUint64(libc.Uint64FromInt32(N+X)*(libc.Uint64FromInt64(8)+libc.Uint64FromInt32(1)) - uint64(8)) - p = _sqlite3DbMallocRawNN(tls, db, uint64(uint64(40)+libc.Uint64FromInt32(nExtra))) + p = _sqlite3DbMallocRawNN(tls, db, uint64(40)+libc.Uint64FromInt32(nExtra)) if p != 0 { (*TKeyInfo)(unsafe.Pointer(p)).FaSortFlags = p + 32 + uintptr(N+X)*8 (*TKeyInfo)(unsafe.Pointer(p)).FnKeyField = libc.Uint16FromInt32(N) @@ -120721,7 +120721,7 @@ func _sqlite3ColumnsFromExprList(tls *libc.TLS, pParse uintptr, pEList uintptr, _sqlite3HashInit(tls, bp+8) if pEList != 0 { nCol = (*TExprList)(unsafe.Pointer(pEList)).FnExpr - aCol = _sqlite3DbMallocZero(tls, db, uint64(uint64(16)*libc.Uint64FromInt32(nCol))) + aCol = _sqlite3DbMallocZero(tls, db, uint64(16)*libc.Uint64FromInt32(nCol)) if nCol > int32(32767) { nCol = int32(32767) } @@ -122093,7 +122093,7 @@ func _multiSelectOrderBy(tls *libc.TLS, pParse uintptr, p uintptr, pDest uintptr ** to the right and the left are evaluated, they use the correct ** collation. */ - aPermute = _sqlite3DbMallocRawNN(tls, db, uint64(uint64(4)*libc.Uint64FromInt32(nOrderBy+libc.Int32FromInt32(1)))) + aPermute = _sqlite3DbMallocRawNN(tls, db, uint64(4)*libc.Uint64FromInt32(nOrderBy+libc.Int32FromInt32(1))) if aPermute != 0 { *(*Tu32)(unsafe.Pointer(aPermute)) = libc.Uint32FromInt32(nOrderBy) i = int32(1) @@ -123464,7 +123464,7 @@ func _constInsert(tls *libc.TLS, pConst uintptr, pColumn uintptr, pValue uintptr (*TWhereConst)(unsafe.Pointer(pConst)).FbHasAffBlob = int32(1) } (*TWhereConst)(unsafe.Pointer(pConst)).FnConst++ - (*TWhereConst)(unsafe.Pointer(pConst)).FapExpr = _sqlite3DbReallocOrFree(tls, (*TParse)(unsafe.Pointer((*TWhereConst)(unsafe.Pointer(pConst)).FpParse)).Fdb, (*TWhereConst)(unsafe.Pointer(pConst)).FapExpr, uint64(libc.Uint64FromInt32((*TWhereConst)(unsafe.Pointer(pConst)).FnConst*int32(2))*uint64(8))) + (*TWhereConst)(unsafe.Pointer(pConst)).FapExpr = _sqlite3DbReallocOrFree(tls, (*TParse)(unsafe.Pointer((*TWhereConst)(unsafe.Pointer(pConst)).FpParse)).Fdb, (*TWhereConst)(unsafe.Pointer(pConst)).FapExpr, libc.Uint64FromInt32((*TWhereConst)(unsafe.Pointer(pConst)).FnConst*int32(2))*uint64(8)) if (*TWhereConst)(unsafe.Pointer(pConst)).FapExpr == uintptr(0) { (*TWhereConst)(unsafe.Pointer(pConst)).FnConst = 0 } else { @@ -129563,7 +129563,7 @@ func _sqlite3Update(tls *libc.TLS, pParse uintptr, pTabList uintptr, pChanges ui /* Allocate space for aXRef[], aRegIdx[], and aToOpen[]. ** Initialize aXRef[] and aToOpen[] to their default values. */ - aXRef = _sqlite3DbMallocRawNN(tls, db, uint64(uint64(4)*libc.Uint64FromInt32(int32((*TTable)(unsafe.Pointer(pTab)).FnCol)+nIdx+libc.Int32FromInt32(1))+libc.Uint64FromInt32(nIdx)+uint64(2))) + aXRef = _sqlite3DbMallocRawNN(tls, db, uint64(4)*libc.Uint64FromInt32(int32((*TTable)(unsafe.Pointer(pTab)).FnCol)+nIdx+libc.Int32FromInt32(1))+libc.Uint64FromInt32(nIdx)+uint64(2)) if aXRef == uintptr(0) { goto update_cleanup } @@ -131364,7 +131364,7 @@ func _sqlite3VtabCreateModule(tls *libc.TLS, db uintptr, zName uintptr, pModule pMod = uintptr(0) } else { nName = _sqlite3Strlen30(tls, zName) - pMod = _sqlite3Malloc(tls, uint64(uint64(48)+libc.Uint64FromInt32(nName)+uint64(1))) + pMod = _sqlite3Malloc(tls, uint64(48)+libc.Uint64FromInt32(nName)+uint64(1)) if pMod == uintptr(0) { _sqlite3OomFault(tls, db) return uintptr(0) @@ -132700,7 +132700,7 @@ func _sqlite3VtabOverloadFunction(tls *libc.TLS, db uintptr, pDef uintptr, nArg } /* Create a new ephemeral function definition for the overloaded ** function */ - pNew = _sqlite3DbMallocZero(tls, db, uint64(uint64(72)+libc.Uint64FromInt32(_sqlite3Strlen30(tls, (*TFuncDef)(unsafe.Pointer(pDef)).FzName))+uint64(1))) + pNew = _sqlite3DbMallocZero(tls, db, uint64(72)+libc.Uint64FromInt32(_sqlite3Strlen30(tls, (*TFuncDef)(unsafe.Pointer(pDef)).FzName))+uint64(1)) if pNew == uintptr(0) { return pDef } @@ -134401,7 +134401,7 @@ func _codeINTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr, pLevel uintptr, i db = (*TParse)(unsafe.Pointer(pParse)).Fdb pX = _removeUnindexableInClauseTerms(tls, pParse, iEq, pLoop, pX) if !((*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0) { - aiMap = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(uint64(4)*libc.Uint64FromInt32(nEq))) + aiMap = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(4)*libc.Uint64FromInt32(nEq)) eType = _sqlite3FindInIndex(tls, pParse, pX, uint32(IN_INDEX_LOOP), uintptr(0), aiMap, bp) (*TExpr)(unsafe.Pointer(pExpr)).FiTable = *(*int32)(unsafe.Pointer(bp)) } @@ -134413,7 +134413,7 @@ func _codeINTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr, pLevel uintptr, i } else { v3 = n } - aiMap = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(uint64(4)*libc.Uint64FromInt32(v3))) + aiMap = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(4)*libc.Uint64FromInt32(v3)) eType = _sqlite3FindInIndex(tls, pParse, pX, uint32(IN_INDEX_LOOP), uintptr(0), aiMap, bp) } pX = pExpr @@ -134451,10 +134451,10 @@ func _codeINTerm(tls *libc.TLS, pParse uintptr, pTerm uintptr, pLevel uintptr, i })(unsafe.Pointer(pLevel + 72))).FaInLoop = _sqlite3WhereRealloc(tls, (*TWhereClause)(unsafe.Pointer((*TWhereTerm)(unsafe.Pointer(pTerm)).FpWC)).FpWInfo, (*(*struct { FnIn int32 FaInLoop uintptr - })(unsafe.Pointer(pLevel + 72))).FaInLoop, uint64(uint64(20)*libc.Uint64FromInt32((*(*struct { + })(unsafe.Pointer(pLevel + 72))).FaInLoop, uint64(20)*libc.Uint64FromInt32((*(*struct { FnIn int32 FaInLoop uintptr - })(unsafe.Pointer(pLevel + 72))).FnIn))) + })(unsafe.Pointer(pLevel + 72))).FnIn)) pIn = (*(*struct { FnIn int32 FaInLoop uintptr @@ -134774,7 +134774,7 @@ func _codeDeferredSeek(tls *libc.TLS, pWInfo uintptr, pIdx uintptr, iCur int32, } if v2 && (*TParse)(unsafe.Pointer(v1)).FwriteMask == uint32(0) { pTab = (*TIndex)(unsafe.Pointer(pIdx)).FpTable - ai = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(uint64(4)*libc.Uint64FromInt32(int32((*TTable)(unsafe.Pointer(pTab)).FnCol)+libc.Int32FromInt32(1)))) + ai = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(4)*libc.Uint64FromInt32(int32((*TTable)(unsafe.Pointer(pTab)).FnCol)+libc.Int32FromInt32(1))) if ai != 0 { *(*Tu32)(unsafe.Pointer(ai)) = libc.Uint32FromInt16((*TTable)(unsafe.Pointer(pTab)).FnCol) i = 0 @@ -135800,7 +135800,7 @@ func _sqlite3WhereCodeOneLoopStart(tls *libc.TLS, pParse uintptr, v uintptr, pWI */ if libc.Int32FromUint8((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel) > int32(1) { /* Original list of tables */ nNotReady = libc.Int32FromUint8((*TWhereInfo)(unsafe.Pointer(pWInfo)).FnLevel) - iLevel - int32(1) - pOrTab = _sqlite3DbMallocRawNN(tls, db, uint64(uint64(88)+libc.Uint64FromInt32(nNotReady)*uint64(80))) + pOrTab = _sqlite3DbMallocRawNN(tls, db, uint64(88)+libc.Uint64FromInt32(nNotReady)*uint64(80)) if pOrTab == uintptr(0) { return notReady } @@ -136585,7 +136585,7 @@ func _whereClauseInsert(tls *libc.TLS, pWC uintptr, p uintptr, wtFlags Tu16) (r if (*TWhereClause)(unsafe.Pointer(pWC)).FnTerm >= (*TWhereClause)(unsafe.Pointer(pWC)).FnSlot { pOld = (*TWhereClause)(unsafe.Pointer(pWC)).Fa db = (*TParse)(unsafe.Pointer((*TWhereInfo)(unsafe.Pointer((*TWhereClause)(unsafe.Pointer(pWC)).FpWInfo)).FpParse)).Fdb - (*TWhereClause)(unsafe.Pointer(pWC)).Fa = _sqlite3WhereMalloc(tls, (*TWhereClause)(unsafe.Pointer(pWC)).FpWInfo, uint64(uint64(56)*libc.Uint64FromInt32((*TWhereClause)(unsafe.Pointer(pWC)).FnSlot)*uint64(2))) + (*TWhereClause)(unsafe.Pointer(pWC)).Fa = _sqlite3WhereMalloc(tls, (*TWhereClause)(unsafe.Pointer(pWC)).FpWInfo, uint64(56)*libc.Uint64FromInt32((*TWhereClause)(unsafe.Pointer(pWC)).FnSlot)*uint64(2)) if (*TWhereClause)(unsafe.Pointer(pWC)).Fa == uintptr(0) { if libc.Int32FromUint16(wtFlags)&int32(TERM_DYNAMIC) != 0 { _sqlite3ExprDelete(tls, db, p) @@ -140195,7 +140195,7 @@ func _allocateIndexInfo(tls *libc.TLS, pWInfo uintptr, pWC uintptr, mUnusable TB } /* Allocate the sqlite3_index_info structure */ - pIdxInfo = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(uint64(96)+(libc.Uint64FromInt64(12)+libc.Uint64FromInt64(8))*libc.Uint64FromInt32(nTerm)+uint64(8)*libc.Uint64FromInt32(nOrderBy)+uint64(40)+uint64(8)*libc.Uint64FromInt32(nTerm))) + pIdxInfo = _sqlite3DbMallocZero(tls, (*TParse)(unsafe.Pointer(pParse)).Fdb, uint64(96)+(libc.Uint64FromInt64(12)+libc.Uint64FromInt64(8))*libc.Uint64FromInt32(nTerm)+uint64(8)*libc.Uint64FromInt32(nOrderBy)+uint64(40)+uint64(8)*libc.Uint64FromInt32(nTerm)) if pIdxInfo == uintptr(0) { _sqlite3ErrorMsg(tls, pParse, __ccgo_ts+1637, 0) return uintptr(0) @@ -141195,7 +141195,7 @@ func _whereLoopResize(tls *libc.TLS, db uintptr, p uintptr, n int32) (r int32) { return SQLITE_OK } n = (n + int32(7)) & ^libc.Int32FromInt32(7) - paNew = _sqlite3DbMallocRawNN(tls, db, uint64(uint64(8)*libc.Uint64FromInt32(n))) + paNew = _sqlite3DbMallocRawNN(tls, db, uint64(8)*libc.Uint64FromInt32(n)) if paNew == uintptr(0) { return int32(SQLITE_NOMEM) } @@ -145883,7 +145883,7 @@ func _sqlite3WhereBegin(tls *libc.TLS, pParse uintptr, pTabList uintptr, pWhere if nTabList > int32(1) { nByteWInfo = libc.Int32FromUint64(libc.Uint64FromInt32(nByteWInfo) + libc.Uint64FromInt32(nTabList-libc.Int32FromInt32(1))*libc.Uint64FromInt64(104)) } - pWInfo = _sqlite3DbMallocRawNN(tls, db, uint64(libc.Uint64FromInt32(nByteWInfo)+uint64(104))) + pWInfo = _sqlite3DbMallocRawNN(tls, db, libc.Uint64FromInt32(nByteWInfo)+uint64(104)) if (*Tsqlite3)(unsafe.Pointer(db)).FmallocFailed != 0 { _sqlite3DbFree(tls, db, pWInfo) pWInfo = uintptr(0) @@ -156953,13 +156953,13 @@ func _yyGrowStack(tls *libc.TLS, p uintptr) (r int32) { newSize = oldSize*int32(2) + int32(100) idx = int32((int64((*TyyParser)(unsafe.Pointer(p)).Fyytos) - int64((*TyyParser)(unsafe.Pointer(p)).Fyystack)) / 24) if (*TyyParser)(unsafe.Pointer(p)).Fyystack == p+32 { - pNew = _parserStackRealloc(tls, uintptr(0), uint64(libc.Uint64FromInt32(newSize)*uint64(24))) + pNew = _parserStackRealloc(tls, uintptr(0), libc.Uint64FromInt32(newSize)*uint64(24)) if pNew == uintptr(0) { return int32(1) } libc.Xmemcpy(tls, pNew, (*TyyParser)(unsafe.Pointer(p)).Fyystack, libc.Uint64FromInt32(oldSize)*uint64(24)) } else { - pNew = _parserStackRealloc(tls, (*TyyParser)(unsafe.Pointer(p)).Fyystack, uint64(libc.Uint64FromInt32(newSize)*uint64(24))) + pNew = _parserStackRealloc(tls, (*TyyParser)(unsafe.Pointer(p)).Fyystack, libc.Uint64FromInt32(newSize)*uint64(24)) if pNew == uintptr(0) { return int32(1) } @@ -167673,7 +167673,7 @@ func Xsqlite3_create_filename(tls *libc.TLS, zDatabase uintptr, zJournal uintptr if !(i < nParam*int32(2)) { break } - nByte = Tsqlite3_int64(uint64(nByte) + uint64(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(azParam + uintptr(i)*8)))+libc.Uint64FromInt32(1))) + nByte = Tsqlite3_int64(uint64(nByte) + (libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(azParam + uintptr(i)*8))) + libc.Uint64FromInt32(1))) goto _1 _1: ; @@ -168366,7 +168366,7 @@ func _sqlite3ConnectionUnlocked(tls *libc.TLS, db uintptr) { _sqlite3BeginBenignMalloc(tls) if !(aDyn != 0) && nArg == libc.Int32FromUint64(libc.Uint64FromInt64(128)/libc.Uint64FromInt64(8)) || aDyn != 0 && nArg == libc.Int32FromUint64(libc.Uint64FromInt32(_sqlite3MallocSize(tls, aDyn))/libc.Uint64FromInt64(8)) { /* The aArg[] array needs to grow. */ - pNew = _sqlite3Malloc(tls, uint64(libc.Uint64FromInt32(nArg)*uint64(8)*uint64(2))) + pNew = _sqlite3Malloc(tls, libc.Uint64FromInt32(nArg)*uint64(8)*uint64(2)) if pNew != 0 { libc.Xmemcpy(tls, pNew, aArg, libc.Uint64FromInt32(nArg)*uint64(8)) Xsqlite3_free(tls, aDyn) @@ -176420,7 +176420,7 @@ func _writeInt64(tls *libc.TLS, p uintptr, _i Ti64) (r int32) { bp := tls.Alloc(16) defer tls.Free(16) *(*Ti64)(unsafe.Pointer(bp)) = _i - *(*Ti64)(unsafe.Pointer(bp)) = libc.Int64FromUint64(libc.X__builtin_bswap64(tls, uint64(libc.Uint64FromInt64(*(*Ti64)(unsafe.Pointer(bp)))))) + *(*Ti64)(unsafe.Pointer(bp)) = libc.Int64FromUint64(libc.X__builtin_bswap64(tls, libc.Uint64FromInt64(*(*Ti64)(unsafe.Pointer(bp))))) libc.Xmemcpy(tls, p, bp, uint64(8)) return int32(8) } @@ -176526,7 +176526,7 @@ func _nodeHashDelete(tls *libc.TLS, pRtree uintptr, pNode uintptr) { func _nodeNew(tls *libc.TLS, pRtree uintptr, pParent uintptr) (r uintptr) { var pNode uintptr _ = pNode - pNode = Xsqlite3_malloc64(tls, uint64(uint64(40)+libc.Uint64FromInt32((*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize))) + pNode = Xsqlite3_malloc64(tls, uint64(40)+libc.Uint64FromInt32((*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize)) if pNode != 0 { libc.Xmemset(tls, pNode, 0, uint64(40)+libc.Uint64FromInt32((*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize)) (*TRtreeNode)(unsafe.Pointer(pNode)).FzData = pNode + 1*40 @@ -176600,7 +176600,7 @@ func _nodeAcquire(tls *libc.TLS, pRtree uintptr, iNode Ti64, pParent uintptr, pp } } else { if (*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize == Xsqlite3_blob_bytes(tls, (*TRtree)(unsafe.Pointer(pRtree)).FpNodeBlob) { - pNode = Xsqlite3_malloc64(tls, uint64(uint64(40)+libc.Uint64FromInt32((*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize))) + pNode = Xsqlite3_malloc64(tls, uint64(40)+libc.Uint64FromInt32((*TRtree)(unsafe.Pointer(pRtree)).FiNodeSize)) if !(pNode != 0) { rc = int32(SQLITE_NOMEM) } else { @@ -177431,7 +177431,7 @@ func _rtreeEnqueue(tls *libc.TLS, pCur uintptr, rScore TRtreeDValue, iLevel Tu8) _, _, _, _, _, _, _ = i, j, nNew, pNew, pParent, v1, v2 if (*TRtreeCursor)(unsafe.Pointer(pCur)).FnPoint >= (*TRtreeCursor)(unsafe.Pointer(pCur)).FnPointAlloc { nNew = (*TRtreeCursor)(unsafe.Pointer(pCur)).FnPointAlloc*int32(2) + int32(8) - pNew = Xsqlite3_realloc64(tls, (*TRtreeCursor)(unsafe.Pointer(pCur)).FaPoint, uint64(libc.Uint64FromInt32(nNew)*uint64(24))) + pNew = Xsqlite3_realloc64(tls, (*TRtreeCursor)(unsafe.Pointer(pCur)).FaPoint, libc.Uint64FromInt32(nNew)*uint64(24)) if pNew == uintptr(0) { return uintptr(0) } @@ -177889,7 +177889,7 @@ func _rtreeFilter(tls *libc.TLS, pVtabCursor uintptr, idxNum int32, idxStr uintp */ rc = _nodeAcquire(tls, pRtree, int64(1), uintptr(0), bp) if rc == SQLITE_OK && argc > 0 { - (*TRtreeCursor)(unsafe.Pointer(pCsr)).FaConstraint = Xsqlite3_malloc64(tls, uint64(uint64(24)*libc.Uint64FromInt32(argc))) + (*TRtreeCursor)(unsafe.Pointer(pCsr)).FaConstraint = Xsqlite3_malloc64(tls, uint64(24)*libc.Uint64FromInt32(argc)) (*TRtreeCursor)(unsafe.Pointer(pCsr)).FnConstraint = argc if !((*TRtreeCursor)(unsafe.Pointer(pCsr)).FaConstraint != 0) { rc = int32(SQLITE_NOMEM) @@ -178788,7 +178788,7 @@ func _SplitNode(tls *libc.TLS, pRtree uintptr, pNode uintptr, pCell uintptr, iHe /* Allocate an array and populate it with a copy of pCell and ** all cells from node pLeft. Then zero the original node. */ - aCell = Xsqlite3_malloc64(tls, uint64((libc.Uint64FromInt64(48)+libc.Uint64FromInt64(4))*libc.Uint64FromInt32(nCell+libc.Int32FromInt32(1)))) + aCell = Xsqlite3_malloc64(tls, (libc.Uint64FromInt64(48)+libc.Uint64FromInt64(4))*libc.Uint64FromInt32(nCell+libc.Int32FromInt32(1))) if !(aCell != 0) { rc = int32(SQLITE_NOMEM) goto splitnode_out @@ -179977,7 +179977,7 @@ func _rtreeInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uintpt /* Allocate the sqlite3_vtab structure */ nDb = libc.Int32FromUint64(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 1*8)))) nName = libc.Int32FromUint64(libc.Xstrlen(tls, *(*uintptr)(unsafe.Pointer(argv + 2*8)))) - pRtree = Xsqlite3_malloc64(tls, uint64(uint64(968)+libc.Uint64FromInt32(nDb)+libc.Uint64FromInt32(nName*int32(2))+uint64(8))) + pRtree = Xsqlite3_malloc64(tls, uint64(968)+libc.Uint64FromInt32(nDb)+libc.Uint64FromInt32(nName*int32(2))+uint64(8)) if !(pRtree != 0) { return int32(SQLITE_NOMEM) } @@ -180990,7 +180990,7 @@ func _geopolyParseJson(tls *libc.TLS, z uintptr, pRc uintptr) (r uintptr) { (*(*TGeoParse)(unsafe.Pointer(bp))).Fz++ if (*(*TGeoParse)(unsafe.Pointer(bp))).FnVertex >= (*(*TGeoParse)(unsafe.Pointer(bp))).FnAlloc { (*(*TGeoParse)(unsafe.Pointer(bp))).FnAlloc = (*(*TGeoParse)(unsafe.Pointer(bp))).FnAlloc*int32(2) + int32(16) - aNew = Xsqlite3_realloc64(tls, (*(*TGeoParse)(unsafe.Pointer(bp))).Fa, uint64(libc.Uint64FromInt32((*(*TGeoParse)(unsafe.Pointer(bp))).FnAlloc)*uint64(4)*uint64(2))) + aNew = Xsqlite3_realloc64(tls, (*(*TGeoParse)(unsafe.Pointer(bp))).Fa, libc.Uint64FromInt32((*(*TGeoParse)(unsafe.Pointer(bp))).FnAlloc)*uint64(4)*uint64(2)) if aNew == uintptr(0) { rc = int32(SQLITE_NOMEM) (*(*TGeoParse)(unsafe.Pointer(bp))).FnErr++ @@ -181035,7 +181035,7 @@ func _geopolyParseJson(tls *libc.TLS, z uintptr, pRc uintptr) (r uintptr) { if v2 && libc.Int32FromUint8(_geopolySkipSpace(tls, bp)) == libc.Int32FromInt32(0) { *(*int32)(unsafe.Pointer(bp + 32)) = int32(1) (*(*TGeoParse)(unsafe.Pointer(bp))).FnVertex-- /* Remove the redundant vertex at the end */ - pOut = Xsqlite3_malloc64(tls, libc.Uint64FromInt64(40)+uint64(libc.Uint64FromInt64(4)*libc.Uint64FromInt32(2))*libc.Uint64FromInt64(int64((*(*TGeoParse)(unsafe.Pointer(bp))).FnVertex)-libc.Int64FromInt32(4))) + pOut = Xsqlite3_malloc64(tls, libc.Uint64FromInt64(40)+libc.Uint64FromInt64(4)*libc.Uint64FromInt32(2)*libc.Uint64FromInt64(int64((*(*TGeoParse)(unsafe.Pointer(bp))).FnVertex)-libc.Int64FromInt32(4))) *(*int32)(unsafe.Pointer(bp + 32)) = int32(1) if pOut == uintptr(0) { goto parse_json_err @@ -181097,7 +181097,7 @@ func _geopolyFuncParam(tls *libc.TLS, pCtx uintptr, pVal uintptr, pRc uintptr) ( } nVertex = libc.Int32FromUint8(*(*uint8)(unsafe.Pointer(a + 1)))< int32(1000) { n = int32(1000) } - p = Xsqlite3_malloc64(tls, uint64(uint64(40)+libc.Uint64FromInt32((n-int32(1))*int32(2))*uint64(4))) + p = Xsqlite3_malloc64(tls, uint64(40)+libc.Uint64FromInt32((n-int32(1))*int32(2))*uint64(4)) if p == uintptr(0) { Xsqlite3_result_error_nomem(tls, context) return @@ -181567,7 +181567,7 @@ func _geopolyBBox(tls *libc.TLS, context uintptr, pPoly uintptr, aCoord uintptr, goto geopolyBboxFill geopolyBboxFill: ; - pOut = Xsqlite3_realloc64(tls, p, uint64(libc.Uint64FromInt64(40)+libc.Uint64FromInt64(4)*libc.Uint64FromInt32(2)*libc.Uint64FromInt32(libc.Int32FromInt32(4)-libc.Int32FromInt32(4)))) + pOut = Xsqlite3_realloc64(tls, p, libc.Uint64FromInt64(40)+libc.Uint64FromInt64(4)*libc.Uint64FromInt32(2)*libc.Uint64FromInt32(libc.Int32FromInt32(4)-libc.Int32FromInt32(4))) if pOut == uintptr(0) { Xsqlite3_free(tls, p) if context != 0 { @@ -182376,7 +182376,7 @@ func _geopolyInit(tls *libc.TLS, db uintptr, pAux uintptr, argc int32, argv uint if !(pRtree != 0) { return int32(SQLITE_NOMEM) } - libc.Xmemset(tls, pRtree, 0, uint64(uint64(968)+libc.Uint64FromInt64(nDb)+libc.Uint64FromInt64(nName*int64(2))+uint64(8))) + libc.Xmemset(tls, pRtree, 0, uint64(968)+libc.Uint64FromInt64(nDb)+libc.Uint64FromInt64(nName*int64(2))+uint64(8)) (*TRtree)(unsafe.Pointer(pRtree)).FnBusy = uint32(1) (*TRtree)(unsafe.Pointer(pRtree)).Fbase.FpModule = uintptr(unsafe.Pointer(&_rtreeModule)) (*TRtree)(unsafe.Pointer(pRtree)).FzDb = pRtree + 1*968 @@ -186944,7 +186944,7 @@ func _rbuCaptureWalRead(tls *libc.TLS, pRbu uintptr, iOff Ti64, iAmt int32) (r i v1 = int32(64) } nNew = v1 * int32(2) - aNew = Xsqlite3_realloc64(tls, (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FaFrame, uint64(libc.Uint64FromInt32(nNew)*uint64(8))) + aNew = Xsqlite3_realloc64(tls, (*Tsqlite3rbu)(unsafe.Pointer(pRbu)).FaFrame, libc.Uint64FromInt32(nNew)*uint64(8)) if aNew == uintptr(0) { return int32(SQLITE_NOMEM) } @@ -189878,7 +189878,7 @@ func _statDecodePage(tls *libc.TLS, pBt uintptr, p uintptr) (r int32) { _sqlite3BtreeEnter(tls, pBt) nUsable = szPage - _sqlite3BtreeGetReserveNoMutex(tls, pBt) _sqlite3BtreeLeave(tls, pBt) - (*TStatPage)(unsafe.Pointer(p)).FaCell = Xsqlite3_malloc64(tls, uint64(libc.Uint64FromInt32((*TStatPage)(unsafe.Pointer(p)).FnCell+libc.Int32FromInt32(1))*uint64(32))) + (*TStatPage)(unsafe.Pointer(p)).FaCell = Xsqlite3_malloc64(tls, libc.Uint64FromInt32((*TStatPage)(unsafe.Pointer(p)).FnCell+libc.Int32FromInt32(1))*uint64(32)) if (*TStatPage)(unsafe.Pointer(p)).FaCell == uintptr(0) { return int32(SQLITE_NOMEM) } @@ -189925,7 +189925,7 @@ func _statDecodePage(tls *libc.TLS, pBt uintptr, p uintptr) (r int32) { } (*TStatCell)(unsafe.Pointer(pCell)).FnLastOvfl = libc.Int32FromUint32(*(*Tu32)(unsafe.Pointer(bp)) - libc.Uint32FromInt32(nLocal) - libc.Uint32FromInt32((nOvfl-int32(1))*(nUsable-int32(4)))) (*TStatCell)(unsafe.Pointer(pCell)).FnOvfl = nOvfl - (*TStatCell)(unsafe.Pointer(pCell)).FaOvfl = Xsqlite3_malloc64(tls, uint64(uint64(4)*libc.Uint64FromInt32(nOvfl))) + (*TStatCell)(unsafe.Pointer(pCell)).FaOvfl = Xsqlite3_malloc64(tls, uint64(4)*libc.Uint64FromInt32(nOvfl)) if (*TStatCell)(unsafe.Pointer(pCell)).FaOvfl == uintptr(0) { return int32(SQLITE_NOMEM) } @@ -191555,7 +191555,7 @@ func _sessionGrowHash(tls *libc.TLS, pSession uintptr, bPatchset int32, pTab uin } return SQLITE_OK } - libc.Xmemset(tls, apNew, 0, uint64(uint64(8)*libc.Uint64FromInt64(nNew))) + libc.Xmemset(tls, apNew, 0, uint64(8)*libc.Uint64FromInt64(nNew)) i = 0 for { if !(i < (*TSessionTable)(unsafe.Pointer(pTab)).FnChange) { @@ -191687,10 +191687,10 @@ func _sessionTableInfo(tls *libc.TLS, pSession uintptr, db uintptr, zDb uintptr, bRowid = 0 } nDbCol += bRowid - nByte = Tsqlite3_int64(uint64(nByte) + uint64(libc.Xstrlen(tls, __ccgo_ts+29902))) + nByte = Tsqlite3_int64(uint64(nByte) + libc.Xstrlen(tls, __ccgo_ts+29902)) rc = Xsqlite3_reset(tls, *(*uintptr)(unsafe.Pointer(bp))) if rc == SQLITE_OK { - nByte = Tsqlite3_int64(uint64(nByte) + uint64(libc.Uint64FromInt32(nDbCol)*(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(2)+libc.Uint64FromInt64(4)+libc.Uint64FromInt64(1)+libc.Uint64FromInt32(1)+libc.Uint64FromInt32(1)))) + nByte = Tsqlite3_int64(uint64(nByte) + libc.Uint64FromInt32(nDbCol)*(libc.Uint64FromInt64(8)*libc.Uint64FromInt32(2)+libc.Uint64FromInt64(4)+libc.Uint64FromInt64(1)+libc.Uint64FromInt32(1)+libc.Uint64FromInt32(1))) pAlloc = _sessionMalloc64(tls, pSession, nByte) if pAlloc == uintptr(0) { rc = int32(SQLITE_NOMEM) @@ -191819,7 +191819,7 @@ func _sessionInitTable(tls *libc.TLS, pSession uintptr, pTab uintptr, db uintptr } if pSession != 0 && (*Tsqlite3_session)(unsafe.Pointer(pSession)).FbEnableSize != 0 { p3 = pSession + 64 - *(*Ti64)(unsafe.Pointer(p3)) = Ti64(uint64(*(*Ti64)(unsafe.Pointer(p3))) + uint64(libc.Uint64FromInt32(libc.Int32FromInt32(1)+_sessionVarintLen(tls, (*TSessionTable)(unsafe.Pointer(pTab)).FnCol)+(*TSessionTable)(unsafe.Pointer(pTab)).FnCol)+libc.Xstrlen(tls, (*TSessionTable)(unsafe.Pointer(pTab)).FzName)+libc.Uint64FromInt32(1))) + *(*Ti64)(unsafe.Pointer(p3)) = Ti64(uint64(*(*Ti64)(unsafe.Pointer(p3))) + (libc.Uint64FromInt32(libc.Int32FromInt32(1)+_sessionVarintLen(tls, (*TSessionTable)(unsafe.Pointer(pTab)).FnCol)+(*TSessionTable)(unsafe.Pointer(pTab)).FnCol) + libc.Xstrlen(tls, (*TSessionTable)(unsafe.Pointer(pTab)).FzName) + libc.Uint64FromInt32(1))) } } } @@ -193078,7 +193078,7 @@ func Xsqlite3session_create(tls *libc.TLS, db uintptr, zDb uintptr, ppSession ui /* Zero the output value in case an error occurs. */ *(*uintptr)(unsafe.Pointer(ppSession)) = uintptr(0) /* Allocate and populate the new session object. */ - pNew = Xsqlite3_malloc64(tls, uint64(uint64(136)+libc.Uint64FromInt32(nDb)+uint64(1))) + pNew = Xsqlite3_malloc64(tls, uint64(136)+libc.Uint64FromInt32(nDb)+uint64(1)) if !(pNew != 0) { return int32(SQLITE_NOMEM) } @@ -195097,7 +195097,7 @@ func _sessionChangesetInvert(tls *libc.TLS, pInput uintptr, xOutput uintptr, pOu } case int32(SQLITE_UPDATE): if uintptr(0) == apVal { - apVal = Xsqlite3_malloc64(tls, uint64(uint64(8)*libc.Uint64FromInt32(*(*int32)(unsafe.Pointer(bp + 24)))*uint64(2))) + apVal = Xsqlite3_malloc64(tls, uint64(8)*libc.Uint64FromInt32(*(*int32)(unsafe.Pointer(bp + 24)))*uint64(2)) if uintptr(0) == apVal { *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_NOMEM) goto finished_invert @@ -196505,7 +196505,7 @@ func _sessionChangeMerge(tls *libc.TLS, pTab uintptr, bRebase int32, bPatchset i pNew = uintptr(0) rc = SQLITE_OK if !(pExist != 0) { - pNew = Xsqlite3_malloc64(tls, uint64(uint64(32)+libc.Uint64FromInt32(nRec))) + pNew = Xsqlite3_malloc64(tls, uint64(32)+libc.Uint64FromInt32(nRec)) if !(pNew != 0) { return int32(SQLITE_NOMEM) } @@ -196875,7 +196875,7 @@ func _sessionChangesetFindTable(tls *libc.TLS, pGrp uintptr, zTab uintptr, pIter } /* If one was not found above, create a new table now */ if !(pTab != 0) { - pTab = Xsqlite3_malloc64(tls, uint64(uint64(88)+libc.Uint64FromInt32(*(*int32)(unsafe.Pointer(bp + 8)))+libc.Uint64FromInt32(nTab)+uint64(1))) + pTab = Xsqlite3_malloc64(tls, uint64(88)+libc.Uint64FromInt32(*(*int32)(unsafe.Pointer(bp + 8)))+libc.Uint64FromInt32(nTab)+uint64(1)) if !(pTab != 0) { return int32(SQLITE_NOMEM) } @@ -199942,7 +199942,7 @@ func _fts5SentenceFinderAdd(tls *libc.TLS, p uintptr, iAdd int32) (r int32) { v1 = int32(64) } nNew = v1 - aNew = Xsqlite3_realloc64(tls, (*TFts5SFinder)(unsafe.Pointer(p)).FaFirst, uint64(libc.Uint64FromInt32(nNew)*uint64(4))) + aNew = Xsqlite3_realloc64(tls, (*TFts5SFinder)(unsafe.Pointer(p)).FaFirst, libc.Uint64FromInt32(nNew)*uint64(4)) if aNew == uintptr(0) { return int32(SQLITE_NOMEM) } @@ -201472,7 +201472,7 @@ func _fts5ConfigParseSpecial(tls *libc.TLS, pConfig uintptr, zCmd uintptr, zArg if Xsqlite3_strnicmp(tls, __ccgo_ts+35421, zCmd, nCmd) == 0 { p1 = zArg nArg = libc.Int64FromUint64(libc.Xstrlen(tls, zArg) + uint64(1)) - azArg = _sqlite3Fts5MallocZero(tls, bp, libc.Int64FromUint64(uint64(libc.Uint64FromInt64(8)+libc.Uint64FromInt32(2))*libc.Uint64FromInt64(nArg))) + azArg = _sqlite3Fts5MallocZero(tls, bp, libc.Int64FromUint64((libc.Uint64FromInt64(8)+libc.Uint64FromInt32(2))*libc.Uint64FromInt64(nArg))) if azArg != 0 { pSpace = azArg + uintptr(nArg)*8 if (*TFts5Config)(unsafe.Pointer(pConfig)).Ft.FazArg != 0 { @@ -204401,7 +204401,7 @@ func _fts5ParseTokenize(tls *libc.TLS, pContext uintptr, tflags int32, pToken ui v2 = 0 } nNew = SZALLOC + v2 - pNew = Xsqlite3_realloc64(tls, pPhrase, uint64(uint64(72)+uint64(40)*libc.Uint64FromInt32(nNew))) + pNew = Xsqlite3_realloc64(tls, pPhrase, uint64(72)+uint64(40)*libc.Uint64FromInt32(nNew)) if pNew == uintptr(0) { *(*int32)(unsafe.Pointer(bp)) = int32(SQLITE_NOMEM) } else { @@ -204725,7 +204725,7 @@ func _fts5ParseColset(tls *libc.TLS, pParse uintptr, p uintptr, iCol int32) (r u v1 = 0 } nCol = v1 /* New colset object to return */ - pNew = Xsqlite3_realloc64(tls, p, uint64(uint64(8)+uint64(4)*libc.Uint64FromInt32(nCol))) + pNew = Xsqlite3_realloc64(tls, p, uint64(8)+uint64(4)*libc.Uint64FromInt32(nCol)) if pNew == uintptr(0) { (*TFts5Parse)(unsafe.Pointer(pParse)).Frc = int32(SQLITE_NOMEM) } else { @@ -205309,7 +205309,7 @@ func _sqlite3Fts5ExprClearPoslists(tls *libc.TLS, pExpr uintptr, bLive int32) (r var i int32 var pBuf, pNode, pRet uintptr _, _, _, _ = i, pBuf, pNode, pRet - pRet = Xsqlite3_malloc64(tls, uint64(uint64(16)*libc.Uint64FromInt32((*TFts5Expr)(unsafe.Pointer(pExpr)).FnPhrase))) + pRet = Xsqlite3_malloc64(tls, uint64(16)*libc.Uint64FromInt32((*TFts5Expr)(unsafe.Pointer(pExpr)).FnPhrase)) if pRet != 0 { libc.Xmemset(tls, pRet, 0, uint64(16)*libc.Uint64FromInt32((*TFts5Expr)(unsafe.Pointer(pExpr)).FnPhrase)) i = 0 @@ -205903,7 +205903,7 @@ func _fts5HashResize(tls *libc.TLS, pHash uintptr) (r int32) { _, _, _, _, _, _ = apNew, apOld, i, iHash, nNew, p nNew = (*TFts5Hash)(unsafe.Pointer(pHash)).FnSlot * int32(2) apOld = (*TFts5Hash)(unsafe.Pointer(pHash)).FaSlot - apNew = Xsqlite3_malloc64(tls, uint64(libc.Uint64FromInt32(nNew)*uint64(8))) + apNew = Xsqlite3_malloc64(tls, libc.Uint64FromInt32(nNew)*uint64(8)) if !(apNew != 0) { return int32(SQLITE_NOMEM) } @@ -206215,7 +206215,7 @@ func _fts5HashEntrySort(tls *libc.TLS, pHash uintptr, pTerm uintptr, nTerm int32 _, _, _, _, _, _, _ = ap, i, iSlot, nMergeSlot, pEntry, pIter, pList nMergeSlot = int32(32) *(*uintptr)(unsafe.Pointer(ppSorted)) = uintptr(0) - ap = Xsqlite3_malloc64(tls, uint64(uint64(8)*libc.Uint64FromInt32(nMergeSlot))) + ap = Xsqlite3_malloc64(tls, uint64(8)*libc.Uint64FromInt32(nMergeSlot)) if !(ap != 0) { return int32(SQLITE_NOMEM) } @@ -208702,7 +208702,7 @@ func _fts5SegIterReverseInitPage(tls *libc.TLS, p uintptr, pIter uintptr) { /* If necessary, grow the pIter->aRowidOffset[] array. */ if iRowidOffset >= (*TFts5SegIter)(unsafe.Pointer(pIter)).FnRowidOffset { nNew = (*TFts5SegIter)(unsafe.Pointer(pIter)).FnRowidOffset + int32(8) - aNew = Xsqlite3_realloc64(tls, (*TFts5SegIter)(unsafe.Pointer(pIter)).FaRowidOffset, uint64(libc.Uint64FromInt32(nNew)*uint64(4))) + aNew = Xsqlite3_realloc64(tls, (*TFts5SegIter)(unsafe.Pointer(pIter)).FaRowidOffset, libc.Uint64FromInt32(nNew)*uint64(4)) if aNew == uintptr(0) { (*TFts5Index)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) break @@ -210954,7 +210954,7 @@ func _fts5WriteDlidxGrow(tls *libc.TLS, p uintptr, pWriter uintptr, nLvl int32) var nByte Tsize_t _, _ = aDlidx, nByte if (*TFts5Index)(unsafe.Pointer(p)).Frc == SQLITE_OK && nLvl >= (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FnDlidx { - aDlidx = Xsqlite3_realloc64(tls, (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FaDlidx, uint64(uint64(32)*libc.Uint64FromInt32(nLvl))) + aDlidx = Xsqlite3_realloc64(tls, (*TFts5SegWriter)(unsafe.Pointer(pWriter)).FaDlidx, uint64(32)*libc.Uint64FromInt32(nLvl)) if aDlidx == uintptr(0) { (*TFts5Index)(unsafe.Pointer(p)).Frc = int32(SQLITE_NOMEM) } else { @@ -212671,7 +212671,7 @@ func _fts5IndexOptimizeStruct(tls *libc.TLS, p uintptr, pStruct uintptr) (r uint ; i++ } - nByte = Tsqlite3_int64(uint64(nByte) + uint64(libc.Uint64FromInt32((*TFts5Structure)(unsafe.Pointer(pStruct)).FnLevel+libc.Int32FromInt32(1))*libc.Uint64FromInt64(16))) + nByte = Tsqlite3_int64(uint64(nByte) + libc.Uint64FromInt32((*TFts5Structure)(unsafe.Pointer(pStruct)).FnLevel+libc.Int32FromInt32(1))*libc.Uint64FromInt64(16)) pNew = _sqlite3Fts5MallocZero(tls, p+60, nByte) if pNew != 0 { nByte = libc.Int64FromUint64(libc.Uint64FromInt32(nSeg) * uint64(56)) @@ -218237,7 +218237,7 @@ func _fts5CacheInstArray(tls *libc.TLS, pCsr uintptr) (r int32) { v3 = int32(32) } nNewSize = v3 - aInst = Xsqlite3_realloc64(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FaInst, uint64(libc.Uint64FromInt32(nNewSize)*uint64(4)*uint64(3))) + aInst = Xsqlite3_realloc64(tls, (*TFts5Cursor)(unsafe.Pointer(pCsr)).FaInst, libc.Uint64FromInt32(nNewSize)*uint64(4)*uint64(3)) if aInst != 0 { (*TFts5Cursor)(unsafe.Pointer(pCsr)).FaInst = aInst (*TFts5Cursor)(unsafe.Pointer(pCsr)).FnInstAlloc = nNewSize @@ -221078,7 +221078,7 @@ func _sqlite3Fts5StorageIntegrity(tls *libc.TLS, p uintptr, iArg int32) (r int32 rc = SQLITE_OK libc.Xmemset(tls, bp, 0, uint64(40)) (*(*TFts5IntegrityCtx)(unsafe.Pointer(bp))).FpConfig = (*TFts5Storage)(unsafe.Pointer(p)).FpConfig - aTotalSize = Xsqlite3_malloc64(tls, uint64(libc.Uint64FromInt32((*TFts5Config)(unsafe.Pointer(pConfig)).FnCol)*(libc.Uint64FromInt64(4)+libc.Uint64FromInt64(8)))) + aTotalSize = Xsqlite3_malloc64(tls, libc.Uint64FromInt32((*TFts5Config)(unsafe.Pointer(pConfig)).FnCol)*(libc.Uint64FromInt64(4)+libc.Uint64FromInt64(8))) if !(aTotalSize != 0) { return int32(SQLITE_NOMEM) } @@ -221704,7 +221704,7 @@ func _fts5UnicodeAddExceptions(tls *libc.TLS, p uintptr, z uintptr, bTokenChars rc = SQLITE_OK n = libc.Int32FromUint64(libc.Xstrlen(tls, z)) if n > 0 { - aNew = Xsqlite3_realloc64(tls, (*TUnicode61Tokenizer)(unsafe.Pointer(p)).FaiException, uint64(libc.Uint64FromInt32(n+(*TUnicode61Tokenizer)(unsafe.Pointer(p)).FnException)*uint64(4))) + aNew = Xsqlite3_realloc64(tls, (*TUnicode61Tokenizer)(unsafe.Pointer(p)).FaiException, libc.Uint64FromInt32(n+(*TUnicode61Tokenizer)(unsafe.Pointer(p)).FnException)*uint64(4)) if aNew != 0 { nNew = (*TUnicode61Tokenizer)(unsafe.Pointer(p)).FnException zCsr = z @@ -221843,7 +221843,7 @@ func _fts5UnicodeCreate(tls *libc.TLS, pUnused uintptr, azArg uintptr, nArg int3 libc.Xmemset(tls, p, 0, uint64(192)) (*TUnicode61Tokenizer)(unsafe.Pointer(p)).FeRemoveDiacritic = int32(FTS5_REMOVE_DIACRITICS_SIMPLE) (*TUnicode61Tokenizer)(unsafe.Pointer(p)).FnFold = int32(64) - (*TUnicode61Tokenizer)(unsafe.Pointer(p)).FaFold = Xsqlite3_malloc64(tls, uint64(libc.Uint64FromInt32((*TUnicode61Tokenizer)(unsafe.Pointer(p)).FnFold)*uint64(1))) + (*TUnicode61Tokenizer)(unsafe.Pointer(p)).FaFold = Xsqlite3_malloc64(tls, libc.Uint64FromInt32((*TUnicode61Tokenizer)(unsafe.Pointer(p)).FnFold)*uint64(1)) if (*TUnicode61Tokenizer)(unsafe.Pointer(p)).FaFold == uintptr(0) { rc = int32(SQLITE_NOMEM) } diff --git a/vendor/modernc.org/sqlite/lib/sqlite_openbsd_amd64.go b/vendor/modernc.org/sqlite/lib/sqlite_openbsd_amd64.go index 184d08ccb..bed28f24d 100644 --- a/vendor/modernc.org/sqlite/lib/sqlite_openbsd_amd64.go +++ b/vendor/modernc.org/sqlite/lib/sqlite_openbsd_amd64.go @@ -113181,8 +113181,8 @@ var mu mutex func init() { mu.recursive = true } func Xsqlite3_initialize(tls *libc.TLS) int32 { - mu.enter(tls.ID) - defer mu.leave(tls.ID) + mutexEnter(tls, uintptr(unsafe.Pointer(&mu))) + defer mutexLeave(tls, uintptr(unsafe.Pointer(&mu))) var pMainMtx uintptr var rc int32 diff --git a/vendor/modernc.org/sqlite/lib/sqlite_openbsd_arm64.go b/vendor/modernc.org/sqlite/lib/sqlite_openbsd_arm64.go index 349839cec..3764e7ac9 100644 --- a/vendor/modernc.org/sqlite/lib/sqlite_openbsd_arm64.go +++ b/vendor/modernc.org/sqlite/lib/sqlite_openbsd_arm64.go @@ -113186,8 +113186,8 @@ var mu mutex func init() { mu.recursive = true } func Xsqlite3_initialize(tls *libc.TLS) int32 { - mu.enter(tls.ID) - defer mu.leave(tls.ID) + mutexEnter(tls, uintptr(unsafe.Pointer(&mu))) + defer mutexLeave(tls, uintptr(unsafe.Pointer(&mu))) var pMainMtx uintptr var rc int32 diff --git a/vendor/modules.txt b/vendor/modules.txt index 5b20c6326..3acec9ac2 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1065,8 +1065,8 @@ golang.org/x/crypto/scrypt golang.org/x/crypto/sha3 golang.org/x/crypto/ssh golang.org/x/crypto/ssh/internal/bcrypt_pbkdf -# golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 -## explicit; go 1.20 +# golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 +## explicit; go 1.23.0 golang.org/x/exp/constraints # golang.org/x/image v0.24.0 ## explicit; go 1.18 @@ -1074,8 +1074,8 @@ golang.org/x/image/riff golang.org/x/image/vp8 golang.org/x/image/vp8l golang.org/x/image/webp -# golang.org/x/mod v0.23.0 -## explicit; go 1.22.0 +# golang.org/x/mod v0.24.0 +## explicit; go 1.23.0 golang.org/x/mod/internal/lazyregexp golang.org/x/mod/module golang.org/x/mod/semver @@ -1134,8 +1134,8 @@ golang.org/x/text/transform golang.org/x/text/unicode/bidi golang.org/x/text/unicode/norm golang.org/x/text/width -# golang.org/x/tools v0.30.0 -## explicit; go 1.22.0 +# golang.org/x/tools v0.31.0 +## explicit; go 1.23.0 golang.org/x/tools/go/ast/astutil golang.org/x/tools/go/gcexportdata golang.org/x/tools/go/packages @@ -1281,8 +1281,8 @@ gopkg.in/yaml.v2 # gopkg.in/yaml.v3 v3.0.1 ## explicit gopkg.in/yaml.v3 -# modernc.org/libc v1.61.13 -## explicit; go 1.21 +# modernc.org/libc v1.62.1 +## explicit; go 1.23.0 modernc.org/libc modernc.org/libc/errno modernc.org/libc/fcntl @@ -1312,10 +1312,10 @@ modernc.org/libc/wctype # modernc.org/mathutil v1.7.1 ## explicit; go 1.21 modernc.org/mathutil -# modernc.org/memory v1.8.2 -## explicit; go 1.21 +# modernc.org/memory v1.9.1 +## explicit; go 1.23.0 modernc.org/memory -# modernc.org/sqlite v0.0.0-00010101000000-000000000000 => gitlab.com/NyaaaWhatsUpDoc/sqlite v1.36.2-concurrency-workaround +# modernc.org/sqlite v0.0.0-00010101000000-000000000000 => gitlab.com/NyaaaWhatsUpDoc/sqlite v1.37.0-concurrency-workaround ## explicit; go 1.23.0 modernc.org/sqlite modernc.org/sqlite/lib @@ -1323,4 +1323,4 @@ modernc.org/sqlite/lib ## explicit; go 1.22.0 mvdan.cc/xurls/v2 # github.com/go-swagger/go-swagger => codeberg.org/superseriousbusiness/go-swagger v0.31.0-gts-go1.23-fix -# modernc.org/sqlite => gitlab.com/NyaaaWhatsUpDoc/sqlite v1.36.2-concurrency-workaround +# modernc.org/sqlite => gitlab.com/NyaaaWhatsUpDoc/sqlite v1.37.0-concurrency-workaround From b0873972ecb6d9977a36898d8281649d38c17df7 Mon Sep 17 00:00:00 2001 From: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Date: Tue, 1 Apr 2025 16:21:59 +0000 Subject: [PATCH 03/15] [chore] bump golang.org/x/net@v0.38.0, github.com/gin-contrib/cors@v1.7.4, github.com/spf13/viper@v1.20.1, github.com/tdewolff/minify/v2@v2.22.4 (#3959) --- go.mod | 8 +- go.sum | 16 +- .../github.com/gin-contrib/cors/.golangci.yml | 1 - vendor/github.com/gin-contrib/cors/config.go | 14 +- vendor/github.com/gin-contrib/cors/cors.go | 10 + vendor/github.com/spf13/viper/viper.go | 32 +- vendor/golang.org/x/net/html/atom/table.go | 1256 +++++++++-------- vendor/golang.org/x/net/html/parse.go | 4 +- vendor/golang.org/x/net/html/token.go | 18 +- vendor/golang.org/x/net/http2/frame.go | 11 + vendor/golang.org/x/net/http2/h2c/h2c.go | 14 +- vendor/golang.org/x/net/http2/server.go | 5 +- .../x/net/publicsuffix/data/children | Bin 2976 -> 3484 bytes .../golang.org/x/net/publicsuffix/data/nodes | Bin 46610 -> 50500 bytes .../golang.org/x/net/publicsuffix/data/text | 2 +- vendor/golang.org/x/net/publicsuffix/list.go | 2 +- vendor/golang.org/x/net/publicsuffix/table.go | 12 +- vendor/modules.txt | 10 +- 18 files changed, 734 insertions(+), 681 deletions(-) diff --git a/go.mod b/go.mod index 93799e7cc..c23748996 100644 --- a/go.mod +++ b/go.mod @@ -37,7 +37,7 @@ require ( github.com/SherClockHolmes/webpush-go v1.4.0 github.com/buckket/go-blurhash v1.1.0 github.com/coreos/go-oidc/v3 v3.12.0 - github.com/gin-contrib/cors v1.7.3 + github.com/gin-contrib/cors v1.7.4 github.com/gin-contrib/gzip v1.2.2 github.com/gin-contrib/sessions v1.0.2 github.com/gin-gonic/gin v1.10.0 @@ -59,9 +59,9 @@ require ( github.com/prometheus/client_golang v1.21.1 github.com/rivo/uniseg v0.4.7 github.com/spf13/cobra v1.9.1 - github.com/spf13/viper v1.20.0 + github.com/spf13/viper v1.20.1 github.com/stretchr/testify v1.10.0 - github.com/tdewolff/minify/v2 v2.22.3 + github.com/tdewolff/minify/v2 v2.22.4 github.com/technologize/otel-go-contrib v1.1.1 github.com/temoto/robotstxt v1.1.2 github.com/tetratelabs/wazero v1.9.0 @@ -84,7 +84,7 @@ require ( go.uber.org/automaxprocs v1.6.0 golang.org/x/crypto v0.36.0 golang.org/x/image v0.24.0 - golang.org/x/net v0.37.0 + golang.org/x/net v0.38.0 golang.org/x/oauth2 v0.27.0 golang.org/x/sys v0.31.0 golang.org/x/text v0.23.0 diff --git a/go.sum b/go.sum index 4f38aa932..88fb45e71 100644 --- a/go.sum +++ b/go.sum @@ -133,8 +133,8 @@ github.com/gabriel-vasile/mimetype v1.4.8 h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3G github.com/gabriel-vasile/mimetype v1.4.8/go.mod h1:ByKUIKGjh1ODkGM1asKUbQZOLGrPjydw3hYPU2YU9t8= github.com/gavv/httpexpect v2.0.0+incompatible h1:1X9kcRshkSKEjNJJxX9Y9mQ5BRfbxU5kORdjhlA1yX8= github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv1M62hOWzwo5OXotisrKc= -github.com/gin-contrib/cors v1.7.3 h1:hV+a5xp8hwJoTw7OY+a70FsL8JkVVFTXw9EcfrYUdns= -github.com/gin-contrib/cors v1.7.3/go.mod h1:M3bcKZhxzsvI+rlRSkkxHyljJt1ESd93COUvemZ79j4= +github.com/gin-contrib/cors v1.7.4 h1:/fC6/wk7rCRtqKqki8lLr2Xq+hnV49aXDLIuSek9g4k= +github.com/gin-contrib/cors v1.7.4/go.mod h1:vGc/APSgLMlQfEJV5NAzkrAHb0C8DetL3K6QZuvGii0= github.com/gin-contrib/gzip v1.2.2 h1:iUU/EYCM8ENfkjmZaVrxbjF/ZC267Iqv5S0MMCMEliI= github.com/gin-contrib/gzip v1.2.2/go.mod h1:C1a5cacjlDsS20cKnHlZRCPUu57D3qH6B2pV0rl+Y/s= github.com/gin-contrib/sessions v1.0.2 h1:UaIjUvTH1cMeOdj3in6dl+Xb6It8RiKRF9Z1anbUyCA= @@ -388,8 +388,8 @@ github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo= github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0= github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o= github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.20.0 h1:zrxIyR3RQIOsarIrgL8+sAvALXul9jeEPa06Y0Ph6vY= -github.com/spf13/viper v1.20.0/go.mod h1:P9Mdzt1zoHIG8m2eZQinpiBjo6kCmZSKBClNNqjJvu4= +github.com/spf13/viper v1.20.1 h1:ZMi+z/lvLyPSCoNtFCpqjy0S4kPbirhpTMwl8BkW9X4= +github.com/spf13/viper v1.20.1/go.mod h1:P9Mdzt1zoHIG8m2eZQinpiBjo6kCmZSKBClNNqjJvu4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= @@ -406,8 +406,8 @@ github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOf github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= -github.com/tdewolff/minify/v2 v2.22.3 h1:iWXbYdEwvyMXq+KoZlM7Aybp2ASq1VTibUIUxtiyfWo= -github.com/tdewolff/minify/v2 v2.22.3/go.mod h1:K/R8TT7aivpcU8QCNUU1UdR6etfnFPr7L11TO/X7shk= +github.com/tdewolff/minify/v2 v2.22.4 h1:0/8K2fheOuYr5B4e5oCE1hGBVX6DQHLP0EGzdsDlYeg= +github.com/tdewolff/minify/v2 v2.22.4/go.mod h1:K/R8TT7aivpcU8QCNUU1UdR6etfnFPr7L11TO/X7shk= github.com/tdewolff/parse/v2 v2.7.21 h1:OCuPFtGr4mXdnfKikQlUb0n654ROJANhBqCk+wioJ/A= github.com/tdewolff/parse/v2 v2.7.21/go.mod h1:I7TXO37t3aSG9SlPUBefAhgIF8nt7yYUwVGgETIoBcA= github.com/tdewolff/test v1.0.11 h1:FdLbwQVHxqG16SlkGveC0JVyrJN62COWTRyUFzfbtBE= @@ -554,8 +554,8 @@ golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= -golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c= -golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= +golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= +golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= golang.org/x/oauth2 v0.27.0 h1:da9Vo7/tDv5RH/7nZDz1eMGS/q1Vv1N/7FCrBhI9I3M= golang.org/x/oauth2 v0.27.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/vendor/github.com/gin-contrib/cors/.golangci.yml b/vendor/github.com/gin-contrib/cors/.golangci.yml index d59c99bd4..67edf0ac8 100644 --- a/vendor/github.com/gin-contrib/cors/.golangci.yml +++ b/vendor/github.com/gin-contrib/cors/.golangci.yml @@ -7,7 +7,6 @@ linters: - dogsled - dupl - errcheck - - exportloopref - exhaustive - gochecknoinits - goconst diff --git a/vendor/github.com/gin-contrib/cors/config.go b/vendor/github.com/gin-contrib/cors/config.go index 8a295e3db..a955c3171 100644 --- a/vendor/github.com/gin-contrib/cors/config.go +++ b/vendor/github.com/gin-contrib/cors/config.go @@ -2,6 +2,7 @@ package cors import ( "net/http" + "regexp" "strings" "github.com/gin-gonic/gin" @@ -122,21 +123,32 @@ func (cors *cors) isOriginValid(c *gin.Context, origin string) bool { return valid } +var originRegex = regexp.MustCompile(`^/(.+)/[gimuy]?$`) + func (cors *cors) validateOrigin(origin string) bool { if cors.allowAllOrigins { return true } + for _, value := range cors.allowOrigins { - if value == origin { + if !originRegex.MatchString(value) && value == origin { + return true + } + + if originRegex.MatchString(value) && + regexp.MustCompile(originRegex.FindStringSubmatch(value)[1]).MatchString(origin) { return true } } + if len(cors.wildcardOrigins) > 0 && cors.validateWildcardOrigin(origin) { return true } + if cors.allowOriginFunc != nil { return cors.allowOriginFunc(origin) } + return false } diff --git a/vendor/github.com/gin-contrib/cors/cors.go b/vendor/github.com/gin-contrib/cors/cors.go index 2261df759..cacb34a6c 100644 --- a/vendor/github.com/gin-contrib/cors/cors.go +++ b/vendor/github.com/gin-contrib/cors/cors.go @@ -3,6 +3,7 @@ package cors import ( "errors" "fmt" + "regexp" "strings" "time" @@ -103,8 +104,17 @@ func (c Config) getAllowedSchemas() []string { return allowedSchemas } +var regexpBasedOrigin = regexp.MustCompile(`^\/(.+)\/[gimuy]?$`) + func (c Config) validateAllowedSchemas(origin string) bool { allowedSchemas := c.getAllowedSchemas() + + if regexpBasedOrigin.MatchString(origin) { + // Normalize regexp-based origins + origin = regexpBasedOrigin.FindStringSubmatch(origin)[1] + origin = strings.Replace(origin, "?", "", 1) + } + for _, schema := range allowedSchemas { if strings.HasPrefix(origin, schema) { return true diff --git a/vendor/github.com/spf13/viper/viper.go b/vendor/github.com/spf13/viper/viper.go index f900e58b1..a58d757bd 100644 --- a/vendor/github.com/spf13/viper/viper.go +++ b/vendor/github.com/spf13/viper/viper.go @@ -1535,27 +1535,29 @@ func (v *Viper) MergeInConfig() error { func ReadConfig(in io.Reader) error { return v.ReadConfig(in) } func (v *Viper) ReadConfig(in io.Reader) error { - if v.configType == "" { - return errors.New("cannot decode configuration: config type is not set") + config := make(map[string]any) + + err := v.unmarshalReader(in, config) + if err != nil { + return err } - v.config = make(map[string]any) - return v.unmarshalReader(in, v.config) + v.config = config + + return nil } // MergeConfig merges a new configuration with an existing config. func MergeConfig(in io.Reader) error { return v.MergeConfig(in) } func (v *Viper) MergeConfig(in io.Reader) error { - if v.configType == "" { - return errors.New("cannot decode configuration: config type is not set") - } + config := make(map[string]any) - cfg := make(map[string]any) - if err := v.unmarshalReader(in, cfg); err != nil { + if err := v.unmarshalReader(in, config); err != nil { return err } - return v.MergeConfigMap(cfg) + + return v.MergeConfigMap(config) } // MergeConfigMap merges the configuration from the map given with an existing config. @@ -1662,15 +1664,21 @@ func (v *Viper) writeConfig(filename string, force bool) error { } func (v *Viper) unmarshalReader(in io.Reader, c map[string]any) error { + format := strings.ToLower(v.getConfigType()) + if format == "" { + return errors.New("cannot decode configuration: unable to determine config type") + } + buf := new(bytes.Buffer) buf.ReadFrom(in) - format := strings.ToLower(v.getConfigType()) - + // TODO: remove this once SupportedExts is deprecated/removed if !slices.Contains(SupportedExts, format) { return UnsupportedConfigError(format) } + // TODO: return [UnsupportedConfigError] if the registry does not contain the format + // TODO: consider deprecating this error type decoder, err := v.decoderRegistry.Decoder(format) if err != nil { return ConfigParseError{err} diff --git a/vendor/golang.org/x/net/html/atom/table.go b/vendor/golang.org/x/net/html/atom/table.go index 2a938864c..b460e6f72 100644 --- a/vendor/golang.org/x/net/html/atom/table.go +++ b/vendor/golang.org/x/net/html/atom/table.go @@ -11,23 +11,23 @@ const ( AcceptCharset Atom = 0x1a0e Accesskey Atom = 0x2c09 Acronym Atom = 0xaa07 - Action Atom = 0x27206 - Address Atom = 0x6f307 + Action Atom = 0x26506 + Address Atom = 0x6f107 Align Atom = 0xb105 - Allowfullscreen Atom = 0x2080f + Allowfullscreen Atom = 0x3280f Allowpaymentrequest Atom = 0xc113 Allowusermedia Atom = 0xdd0e Alt Atom = 0xf303 Annotation Atom = 0x1c90a AnnotationXml Atom = 0x1c90e - Applet Atom = 0x31906 - Area Atom = 0x35604 - Article Atom = 0x3fc07 + Applet Atom = 0x30806 + Area Atom = 0x35004 + Article Atom = 0x3f607 As Atom = 0x3c02 Aside Atom = 0x10705 Async Atom = 0xff05 Audio Atom = 0x11505 - Autocomplete Atom = 0x2780c + Autocomplete Atom = 0x26b0c Autofocus Atom = 0x12109 Autoplay Atom = 0x13c08 B Atom = 0x101 @@ -43,34 +43,34 @@ const ( Br Atom = 0x202 Button Atom = 0x19106 Canvas Atom = 0x10306 - Caption Atom = 0x23107 - Center Atom = 0x22006 - Challenge Atom = 0x29b09 + Caption Atom = 0x22407 + Center Atom = 0x21306 + Challenge Atom = 0x28e09 Charset Atom = 0x2107 - Checked Atom = 0x47907 + Checked Atom = 0x5b507 Cite Atom = 0x19c04 - Class Atom = 0x56405 - Code Atom = 0x5c504 + Class Atom = 0x55805 + Code Atom = 0x5ee04 Col Atom = 0x1ab03 Colgroup Atom = 0x1ab08 Color Atom = 0x1bf05 Cols Atom = 0x1c404 Colspan Atom = 0x1c407 Command Atom = 0x1d707 - Content Atom = 0x58b07 - Contenteditable Atom = 0x58b0f - Contextmenu Atom = 0x3800b + Content Atom = 0x57b07 + Contenteditable Atom = 0x57b0f + Contextmenu Atom = 0x37a0b Controls Atom = 0x1de08 - Coords Atom = 0x1ea06 - Crossorigin Atom = 0x1fb0b - Data Atom = 0x4a504 - Datalist Atom = 0x4a508 - Datetime Atom = 0x2b808 - Dd Atom = 0x2d702 + Coords Atom = 0x1f006 + Crossorigin Atom = 0x1fa0b + Data Atom = 0x49904 + Datalist Atom = 0x49908 + Datetime Atom = 0x2ab08 + Dd Atom = 0x2bf02 Default Atom = 0x10a07 - Defer Atom = 0x5c705 - Del Atom = 0x45203 - Desc Atom = 0x56104 + Defer Atom = 0x5f005 + Del Atom = 0x44c03 + Desc Atom = 0x55504 Details Atom = 0x7207 Dfn Atom = 0x8703 Dialog Atom = 0xbb06 @@ -78,106 +78,106 @@ const ( Dirname Atom = 0x9307 Disabled Atom = 0x16408 Div Atom = 0x16b03 - Dl Atom = 0x5e602 - Download Atom = 0x46308 + Dl Atom = 0x5d602 + Download Atom = 0x45d08 Draggable Atom = 0x17a09 - Dropzone Atom = 0x40508 - Dt Atom = 0x64b02 + Dropzone Atom = 0x3ff08 + Dt Atom = 0x64002 Em Atom = 0x6e02 Embed Atom = 0x6e05 - Enctype Atom = 0x28d07 - Face Atom = 0x21e04 - Fieldset Atom = 0x22608 - Figcaption Atom = 0x22e0a - Figure Atom = 0x24806 + Enctype Atom = 0x28007 + Face Atom = 0x21104 + Fieldset Atom = 0x21908 + Figcaption Atom = 0x2210a + Figure Atom = 0x23b06 Font Atom = 0x3f04 Footer Atom = 0xf606 - For Atom = 0x25403 - ForeignObject Atom = 0x2540d - Foreignobject Atom = 0x2610d - Form Atom = 0x26e04 - Formaction Atom = 0x26e0a - Formenctype Atom = 0x2890b - Formmethod Atom = 0x2a40a - Formnovalidate Atom = 0x2ae0e - Formtarget Atom = 0x2c00a + For Atom = 0x24703 + ForeignObject Atom = 0x2470d + Foreignobject Atom = 0x2540d + Form Atom = 0x26104 + Formaction Atom = 0x2610a + Formenctype Atom = 0x27c0b + Formmethod Atom = 0x2970a + Formnovalidate Atom = 0x2a10e + Formtarget Atom = 0x2b30a Frame Atom = 0x8b05 Frameset Atom = 0x8b08 H1 Atom = 0x15c02 - H2 Atom = 0x2de02 - H3 Atom = 0x30d02 - H4 Atom = 0x34502 - H5 Atom = 0x34f02 - H6 Atom = 0x64d02 - Head Atom = 0x33104 - Header Atom = 0x33106 - Headers Atom = 0x33107 + H2 Atom = 0x56102 + H3 Atom = 0x2cd02 + H4 Atom = 0x2fc02 + H5 Atom = 0x33f02 + H6 Atom = 0x34902 + Head Atom = 0x32004 + Header Atom = 0x32006 + Headers Atom = 0x32007 Height Atom = 0x5206 - Hgroup Atom = 0x2ca06 - Hidden Atom = 0x2d506 - High Atom = 0x2db04 + Hgroup Atom = 0x64206 + Hidden Atom = 0x2bd06 + High Atom = 0x2ca04 Hr Atom = 0x15702 - Href Atom = 0x2e004 - Hreflang Atom = 0x2e008 + Href Atom = 0x2cf04 + Hreflang Atom = 0x2cf08 Html Atom = 0x5604 - HttpEquiv Atom = 0x2e80a + HttpEquiv Atom = 0x2d70a I Atom = 0x601 - Icon Atom = 0x58a04 + Icon Atom = 0x57a04 Id Atom = 0x10902 - Iframe Atom = 0x2fc06 - Image Atom = 0x30205 - Img Atom = 0x30703 - Input Atom = 0x44b05 - Inputmode Atom = 0x44b09 - Ins Atom = 0x20403 - Integrity Atom = 0x23f09 + Iframe Atom = 0x2eb06 + Image Atom = 0x2f105 + Img Atom = 0x2f603 + Input Atom = 0x44505 + Inputmode Atom = 0x44509 + Ins Atom = 0x20303 + Integrity Atom = 0x23209 Is Atom = 0x16502 - Isindex Atom = 0x30f07 - Ismap Atom = 0x31605 - Itemid Atom = 0x38b06 + Isindex Atom = 0x2fe07 + Ismap Atom = 0x30505 + Itemid Atom = 0x38506 Itemprop Atom = 0x19d08 - Itemref Atom = 0x3cd07 - Itemscope Atom = 0x67109 - Itemtype Atom = 0x31f08 + Itemref Atom = 0x3c707 + Itemscope Atom = 0x66f09 + Itemtype Atom = 0x30e08 Kbd Atom = 0xb903 Keygen Atom = 0x3206 Keytype Atom = 0xd607 Kind Atom = 0x17704 Label Atom = 0x5905 - Lang Atom = 0x2e404 + Lang Atom = 0x2d304 Legend Atom = 0x18106 Li Atom = 0xb202 Link Atom = 0x17404 - List Atom = 0x4a904 - Listing Atom = 0x4a907 + List Atom = 0x49d04 + Listing Atom = 0x49d07 Loop Atom = 0x5d04 Low Atom = 0xc303 Main Atom = 0x1004 Malignmark Atom = 0xb00a - Manifest Atom = 0x6d708 - Map Atom = 0x31803 + Manifest Atom = 0x6d508 + Map Atom = 0x30703 Mark Atom = 0xb604 - Marquee Atom = 0x32707 - Math Atom = 0x32e04 - Max Atom = 0x33d03 - Maxlength Atom = 0x33d09 + Marquee Atom = 0x31607 + Math Atom = 0x31d04 + Max Atom = 0x33703 + Maxlength Atom = 0x33709 Media Atom = 0xe605 Mediagroup Atom = 0xe60a - Menu Atom = 0x38704 - Menuitem Atom = 0x38708 - Meta Atom = 0x4b804 + Menu Atom = 0x38104 + Menuitem Atom = 0x38108 + Meta Atom = 0x4ac04 Meter Atom = 0x9805 - Method Atom = 0x2a806 - Mglyph Atom = 0x30806 - Mi Atom = 0x34702 - Min Atom = 0x34703 - Minlength Atom = 0x34709 - Mn Atom = 0x2b102 + Method Atom = 0x29b06 + Mglyph Atom = 0x2f706 + Mi Atom = 0x34102 + Min Atom = 0x34103 + Minlength Atom = 0x34109 + Mn Atom = 0x2a402 Mo Atom = 0xa402 - Ms Atom = 0x67402 - Mtext Atom = 0x35105 - Multiple Atom = 0x35f08 - Muted Atom = 0x36705 + Ms Atom = 0x67202 + Mtext Atom = 0x34b05 + Multiple Atom = 0x35908 + Muted Atom = 0x36105 Name Atom = 0x9604 Nav Atom = 0x1303 Nobr Atom = 0x3704 @@ -185,101 +185,101 @@ const ( Noframes Atom = 0x8908 Nomodule Atom = 0xa208 Nonce Atom = 0x1a605 - Noscript Atom = 0x21608 - Novalidate Atom = 0x2b20a - Object Atom = 0x26806 + Noscript Atom = 0x2c208 + Novalidate Atom = 0x2a50a + Object Atom = 0x25b06 Ol Atom = 0x13702 Onabort Atom = 0x19507 - Onafterprint Atom = 0x2360c - Onautocomplete Atom = 0x2760e - Onautocompleteerror Atom = 0x27613 - Onauxclick Atom = 0x61f0a - Onbeforeprint Atom = 0x69e0d - Onbeforeunload Atom = 0x6e70e - Onblur Atom = 0x56d06 + Onafterprint Atom = 0x2290c + Onautocomplete Atom = 0x2690e + Onautocompleteerror Atom = 0x26913 + Onauxclick Atom = 0x6140a + Onbeforeprint Atom = 0x69c0d + Onbeforeunload Atom = 0x6e50e + Onblur Atom = 0x1ea06 Oncancel Atom = 0x11908 Oncanplay Atom = 0x14d09 Oncanplaythrough Atom = 0x14d10 - Onchange Atom = 0x41b08 - Onclick Atom = 0x2f507 - Onclose Atom = 0x36c07 - Oncontextmenu Atom = 0x37e0d - Oncopy Atom = 0x39106 - Oncuechange Atom = 0x3970b - Oncut Atom = 0x3a205 - Ondblclick Atom = 0x3a70a - Ondrag Atom = 0x3b106 - Ondragend Atom = 0x3b109 - Ondragenter Atom = 0x3ba0b - Ondragexit Atom = 0x3c50a - Ondragleave Atom = 0x3df0b - Ondragover Atom = 0x3ea0a - Ondragstart Atom = 0x3f40b - Ondrop Atom = 0x40306 - Ondurationchange Atom = 0x41310 - Onemptied Atom = 0x40a09 - Onended Atom = 0x42307 - Onerror Atom = 0x42a07 - Onfocus Atom = 0x43107 - Onhashchange Atom = 0x43d0c - Oninput Atom = 0x44907 - Oninvalid Atom = 0x45509 - Onkeydown Atom = 0x45e09 - Onkeypress Atom = 0x46b0a - Onkeyup Atom = 0x48007 - Onlanguagechange Atom = 0x48d10 - Onload Atom = 0x49d06 - Onloadeddata Atom = 0x49d0c - Onloadedmetadata Atom = 0x4b010 - Onloadend Atom = 0x4c609 - Onloadstart Atom = 0x4cf0b - Onmessage Atom = 0x4da09 - Onmessageerror Atom = 0x4da0e - Onmousedown Atom = 0x4e80b - Onmouseenter Atom = 0x4f30c - Onmouseleave Atom = 0x4ff0c - Onmousemove Atom = 0x50b0b - Onmouseout Atom = 0x5160a - Onmouseover Atom = 0x5230b - Onmouseup Atom = 0x52e09 - Onmousewheel Atom = 0x53c0c - Onoffline Atom = 0x54809 - Ononline Atom = 0x55108 - Onpagehide Atom = 0x5590a - Onpageshow Atom = 0x5730a - Onpaste Atom = 0x57f07 - Onpause Atom = 0x59a07 - Onplay Atom = 0x5a406 - Onplaying Atom = 0x5a409 - Onpopstate Atom = 0x5ad0a - Onprogress Atom = 0x5b70a - Onratechange Atom = 0x5cc0c - Onrejectionhandled Atom = 0x5d812 - Onreset Atom = 0x5ea07 - Onresize Atom = 0x5f108 - Onscroll Atom = 0x60008 - Onsecuritypolicyviolation Atom = 0x60819 - Onseeked Atom = 0x62908 - Onseeking Atom = 0x63109 - Onselect Atom = 0x63a08 - Onshow Atom = 0x64406 - Onsort Atom = 0x64f06 - Onstalled Atom = 0x65909 - Onstorage Atom = 0x66209 - Onsubmit Atom = 0x66b08 - Onsuspend Atom = 0x67b09 + Onchange Atom = 0x41508 + Onclick Atom = 0x2e407 + Onclose Atom = 0x36607 + Oncontextmenu Atom = 0x3780d + Oncopy Atom = 0x38b06 + Oncuechange Atom = 0x3910b + Oncut Atom = 0x39c05 + Ondblclick Atom = 0x3a10a + Ondrag Atom = 0x3ab06 + Ondragend Atom = 0x3ab09 + Ondragenter Atom = 0x3b40b + Ondragexit Atom = 0x3bf0a + Ondragleave Atom = 0x3d90b + Ondragover Atom = 0x3e40a + Ondragstart Atom = 0x3ee0b + Ondrop Atom = 0x3fd06 + Ondurationchange Atom = 0x40d10 + Onemptied Atom = 0x40409 + Onended Atom = 0x41d07 + Onerror Atom = 0x42407 + Onfocus Atom = 0x42b07 + Onhashchange Atom = 0x4370c + Oninput Atom = 0x44307 + Oninvalid Atom = 0x44f09 + Onkeydown Atom = 0x45809 + Onkeypress Atom = 0x4650a + Onkeyup Atom = 0x47407 + Onlanguagechange Atom = 0x48110 + Onload Atom = 0x49106 + Onloadeddata Atom = 0x4910c + Onloadedmetadata Atom = 0x4a410 + Onloadend Atom = 0x4ba09 + Onloadstart Atom = 0x4c30b + Onmessage Atom = 0x4ce09 + Onmessageerror Atom = 0x4ce0e + Onmousedown Atom = 0x4dc0b + Onmouseenter Atom = 0x4e70c + Onmouseleave Atom = 0x4f30c + Onmousemove Atom = 0x4ff0b + Onmouseout Atom = 0x50a0a + Onmouseover Atom = 0x5170b + Onmouseup Atom = 0x52209 + Onmousewheel Atom = 0x5300c + Onoffline Atom = 0x53c09 + Ononline Atom = 0x54508 + Onpagehide Atom = 0x54d0a + Onpageshow Atom = 0x5630a + Onpaste Atom = 0x56f07 + Onpause Atom = 0x58a07 + Onplay Atom = 0x59406 + Onplaying Atom = 0x59409 + Onpopstate Atom = 0x59d0a + Onprogress Atom = 0x5a70a + Onratechange Atom = 0x5bc0c + Onrejectionhandled Atom = 0x5c812 + Onreset Atom = 0x5da07 + Onresize Atom = 0x5e108 + Onscroll Atom = 0x5f508 + Onsecuritypolicyviolation Atom = 0x5fd19 + Onseeked Atom = 0x61e08 + Onseeking Atom = 0x62609 + Onselect Atom = 0x62f08 + Onshow Atom = 0x63906 + Onsort Atom = 0x64d06 + Onstalled Atom = 0x65709 + Onstorage Atom = 0x66009 + Onsubmit Atom = 0x66908 + Onsuspend Atom = 0x67909 Ontimeupdate Atom = 0x400c - Ontoggle Atom = 0x68408 - Onunhandledrejection Atom = 0x68c14 - Onunload Atom = 0x6ab08 - Onvolumechange Atom = 0x6b30e - Onwaiting Atom = 0x6c109 - Onwheel Atom = 0x6ca07 + Ontoggle Atom = 0x68208 + Onunhandledrejection Atom = 0x68a14 + Onunload Atom = 0x6a908 + Onvolumechange Atom = 0x6b10e + Onwaiting Atom = 0x6bf09 + Onwheel Atom = 0x6c807 Open Atom = 0x1a304 Optgroup Atom = 0x5f08 - Optimum Atom = 0x6d107 - Option Atom = 0x6e306 - Output Atom = 0x51d06 + Optimum Atom = 0x6cf07 + Option Atom = 0x6e106 + Output Atom = 0x51106 P Atom = 0xc01 Param Atom = 0xc05 Pattern Atom = 0x6607 @@ -288,466 +288,468 @@ const ( Placeholder Atom = 0x1310b Plaintext Atom = 0x1b209 Playsinline Atom = 0x1400b - Poster Atom = 0x2cf06 - Pre Atom = 0x47003 - Preload Atom = 0x48607 - Progress Atom = 0x5b908 - Prompt Atom = 0x53606 - Public Atom = 0x58606 + Poster Atom = 0x64706 + Pre Atom = 0x46a03 + Preload Atom = 0x47a07 + Progress Atom = 0x5a908 + Prompt Atom = 0x52a06 + Public Atom = 0x57606 Q Atom = 0xcf01 Radiogroup Atom = 0x30a Rb Atom = 0x3a02 - Readonly Atom = 0x35708 - Referrerpolicy Atom = 0x3d10e - Rel Atom = 0x48703 - Required Atom = 0x24c08 + Readonly Atom = 0x35108 + Referrerpolicy Atom = 0x3cb0e + Rel Atom = 0x47b03 + Required Atom = 0x23f08 Reversed Atom = 0x8008 Rows Atom = 0x9c04 Rowspan Atom = 0x9c07 - Rp Atom = 0x23c02 + Rp Atom = 0x22f02 Rt Atom = 0x19a02 Rtc Atom = 0x19a03 Ruby Atom = 0xfb04 S Atom = 0x2501 Samp Atom = 0x7804 Sandbox Atom = 0x12907 - Scope Atom = 0x67505 - Scoped Atom = 0x67506 - Script Atom = 0x21806 - Seamless Atom = 0x37108 - Section Atom = 0x56807 - Select Atom = 0x63c06 - Selected Atom = 0x63c08 - Shape Atom = 0x1e505 - Size Atom = 0x5f504 - Sizes Atom = 0x5f505 - Slot Atom = 0x1ef04 - Small Atom = 0x20605 - Sortable Atom = 0x65108 - Sorted Atom = 0x33706 - Source Atom = 0x37806 - Spacer Atom = 0x43706 + Scope Atom = 0x67305 + Scoped Atom = 0x67306 + Script Atom = 0x2c406 + Seamless Atom = 0x36b08 + Search Atom = 0x55c06 + Section Atom = 0x1e507 + Select Atom = 0x63106 + Selected Atom = 0x63108 + Shape Atom = 0x1f505 + Size Atom = 0x5e504 + Sizes Atom = 0x5e505 + Slot Atom = 0x20504 + Small Atom = 0x32605 + Sortable Atom = 0x64f08 + Sorted Atom = 0x37206 + Source Atom = 0x43106 + Spacer Atom = 0x46e06 Span Atom = 0x9f04 - Spellcheck Atom = 0x4740a - Src Atom = 0x5c003 - Srcdoc Atom = 0x5c006 - Srclang Atom = 0x5f907 - Srcset Atom = 0x6f906 - Start Atom = 0x3fa05 - Step Atom = 0x58304 + Spellcheck Atom = 0x5b00a + Src Atom = 0x5e903 + Srcdoc Atom = 0x5e906 + Srclang Atom = 0x6f707 + Srcset Atom = 0x6fe06 + Start Atom = 0x3f405 + Step Atom = 0x57304 Strike Atom = 0xd206 - Strong Atom = 0x6dd06 - Style Atom = 0x6ff05 - Sub Atom = 0x66d03 - Summary Atom = 0x70407 - Sup Atom = 0x70b03 - Svg Atom = 0x70e03 - System Atom = 0x71106 - Tabindex Atom = 0x4be08 - Table Atom = 0x59505 - Target Atom = 0x2c406 + Strong Atom = 0x6db06 + Style Atom = 0x70405 + Sub Atom = 0x66b03 + Summary Atom = 0x70907 + Sup Atom = 0x71003 + Svg Atom = 0x71303 + System Atom = 0x71606 + Tabindex Atom = 0x4b208 + Table Atom = 0x58505 + Target Atom = 0x2b706 Tbody Atom = 0x2705 Td Atom = 0x9202 - Template Atom = 0x71408 - Textarea Atom = 0x35208 + Template Atom = 0x71908 + Textarea Atom = 0x34c08 Tfoot Atom = 0xf505 Th Atom = 0x15602 - Thead Atom = 0x33005 + Thead Atom = 0x31f05 Time Atom = 0x4204 Title Atom = 0x11005 Tr Atom = 0xcc02 Track Atom = 0x1ba05 - Translate Atom = 0x1f209 + Translate Atom = 0x20809 Tt Atom = 0x6802 Type Atom = 0xd904 - Typemustmatch Atom = 0x2900d + Typemustmatch Atom = 0x2830d U Atom = 0xb01 Ul Atom = 0xa702 Updateviacache Atom = 0x460e - Usemap Atom = 0x59e06 + Usemap Atom = 0x58e06 Value Atom = 0x1505 Var Atom = 0x16d03 - Video Atom = 0x2f105 - Wbr Atom = 0x57c03 - Width Atom = 0x64905 - Workertype Atom = 0x71c0a - Wrap Atom = 0x72604 + Video Atom = 0x2e005 + Wbr Atom = 0x56c03 + Width Atom = 0x63e05 + Workertype Atom = 0x7210a + Wrap Atom = 0x72b04 Xmp Atom = 0x12f03 ) -const hash0 = 0x81cdf10e +const hash0 = 0x84f70e16 const maxAtomLen = 25 var table = [1 << 9]Atom{ - 0x1: 0xe60a, // mediagroup - 0x2: 0x2e404, // lang - 0x4: 0x2c09, // accesskey - 0x5: 0x8b08, // frameset - 0x7: 0x63a08, // onselect - 0x8: 0x71106, // system - 0xa: 0x64905, // width - 0xc: 0x2890b, // formenctype - 0xd: 0x13702, // ol - 0xe: 0x3970b, // oncuechange - 0x10: 0x14b03, // bdo - 0x11: 0x11505, // audio - 0x12: 0x17a09, // draggable - 0x14: 0x2f105, // video - 0x15: 0x2b102, // mn - 0x16: 0x38704, // menu - 0x17: 0x2cf06, // poster - 0x19: 0xf606, // footer - 0x1a: 0x2a806, // method - 0x1b: 0x2b808, // datetime - 0x1c: 0x19507, // onabort - 0x1d: 0x460e, // updateviacache - 0x1e: 0xff05, // async - 0x1f: 0x49d06, // onload - 0x21: 0x11908, // oncancel - 0x22: 0x62908, // onseeked - 0x23: 0x30205, // image - 0x24: 0x5d812, // onrejectionhandled - 0x26: 0x17404, // link - 0x27: 0x51d06, // output - 0x28: 0x33104, // head - 0x29: 0x4ff0c, // onmouseleave - 0x2a: 0x57f07, // onpaste - 0x2b: 0x5a409, // onplaying - 0x2c: 0x1c407, // colspan - 0x2f: 0x1bf05, // color - 0x30: 0x5f504, // size - 0x31: 0x2e80a, // http-equiv - 0x33: 0x601, // i - 0x34: 0x5590a, // onpagehide - 0x35: 0x68c14, // onunhandledrejection - 0x37: 0x42a07, // onerror - 0x3a: 0x3b08, // basefont - 0x3f: 0x1303, // nav - 0x40: 0x17704, // kind - 0x41: 0x35708, // readonly - 0x42: 0x30806, // mglyph - 0x44: 0xb202, // li - 0x46: 0x2d506, // hidden - 0x47: 0x70e03, // svg - 0x48: 0x58304, // step - 0x49: 0x23f09, // integrity - 0x4a: 0x58606, // public - 0x4c: 0x1ab03, // col - 0x4d: 0x1870a, // blockquote - 0x4e: 0x34f02, // h5 - 0x50: 0x5b908, // progress - 0x51: 0x5f505, // sizes - 0x52: 0x34502, // h4 - 0x56: 0x33005, // thead - 0x57: 0xd607, // keytype - 0x58: 0x5b70a, // onprogress - 0x59: 0x44b09, // inputmode - 0x5a: 0x3b109, // ondragend - 0x5d: 0x3a205, // oncut - 0x5e: 0x43706, // spacer - 0x5f: 0x1ab08, // colgroup - 0x62: 0x16502, // is - 0x65: 0x3c02, // as - 0x66: 0x54809, // onoffline - 0x67: 0x33706, // sorted - 0x69: 0x48d10, // onlanguagechange - 0x6c: 0x43d0c, // onhashchange - 0x6d: 0x9604, // name - 0x6e: 0xf505, // tfoot - 0x6f: 0x56104, // desc - 0x70: 0x33d03, // max - 0x72: 0x1ea06, // coords - 0x73: 0x30d02, // h3 - 0x74: 0x6e70e, // onbeforeunload - 0x75: 0x9c04, // rows - 0x76: 0x63c06, // select - 0x77: 0x9805, // meter - 0x78: 0x38b06, // itemid - 0x79: 0x53c0c, // onmousewheel - 0x7a: 0x5c006, // srcdoc - 0x7d: 0x1ba05, // track - 0x7f: 0x31f08, // itemtype - 0x82: 0xa402, // mo - 0x83: 0x41b08, // onchange - 0x84: 0x33107, // headers - 0x85: 0x5cc0c, // onratechange - 0x86: 0x60819, // onsecuritypolicyviolation - 0x88: 0x4a508, // datalist - 0x89: 0x4e80b, // onmousedown - 0x8a: 0x1ef04, // slot - 0x8b: 0x4b010, // onloadedmetadata - 0x8c: 0x1a06, // accept - 0x8d: 0x26806, // object - 0x91: 0x6b30e, // onvolumechange - 0x92: 0x2107, // charset - 0x93: 0x27613, // onautocompleteerror - 0x94: 0xc113, // allowpaymentrequest - 0x95: 0x2804, // body - 0x96: 0x10a07, // default - 0x97: 0x63c08, // selected - 0x98: 0x21e04, // face - 0x99: 0x1e505, // shape - 0x9b: 0x68408, // ontoggle - 0x9e: 0x64b02, // dt - 0x9f: 0xb604, // mark - 0xa1: 0xb01, // u - 0xa4: 0x6ab08, // onunload - 0xa5: 0x5d04, // loop - 0xa6: 0x16408, // disabled - 0xaa: 0x42307, // onended - 0xab: 0xb00a, // malignmark - 0xad: 0x67b09, // onsuspend - 0xae: 0x35105, // mtext - 0xaf: 0x64f06, // onsort - 0xb0: 0x19d08, // itemprop - 0xb3: 0x67109, // itemscope - 0xb4: 0x17305, // blink - 0xb6: 0x3b106, // ondrag - 0xb7: 0xa702, // ul - 0xb8: 0x26e04, // form - 0xb9: 0x12907, // sandbox - 0xba: 0x8b05, // frame - 0xbb: 0x1505, // value - 0xbc: 0x66209, // onstorage - 0xbf: 0xaa07, // acronym - 0xc0: 0x19a02, // rt - 0xc2: 0x202, // br - 0xc3: 0x22608, // fieldset - 0xc4: 0x2900d, // typemustmatch - 0xc5: 0xa208, // nomodule - 0xc6: 0x6c07, // noembed - 0xc7: 0x69e0d, // onbeforeprint - 0xc8: 0x19106, // button - 0xc9: 0x2f507, // onclick - 0xca: 0x70407, // summary - 0xcd: 0xfb04, // ruby - 0xce: 0x56405, // class - 0xcf: 0x3f40b, // ondragstart - 0xd0: 0x23107, // caption - 0xd4: 0xdd0e, // allowusermedia - 0xd5: 0x4cf0b, // onloadstart - 0xd9: 0x16b03, // div - 0xda: 0x4a904, // list - 0xdb: 0x32e04, // math - 0xdc: 0x44b05, // input - 0xdf: 0x3ea0a, // ondragover - 0xe0: 0x2de02, // h2 - 0xe2: 0x1b209, // plaintext - 0xe4: 0x4f30c, // onmouseenter - 0xe7: 0x47907, // checked - 0xe8: 0x47003, // pre - 0xea: 0x35f08, // multiple - 0xeb: 0xba03, // bdi - 0xec: 0x33d09, // maxlength - 0xed: 0xcf01, // q - 0xee: 0x61f0a, // onauxclick - 0xf0: 0x57c03, // wbr - 0xf2: 0x3b04, // base - 0xf3: 0x6e306, // option - 0xf5: 0x41310, // ondurationchange - 0xf7: 0x8908, // noframes - 0xf9: 0x40508, // dropzone - 0xfb: 0x67505, // scope - 0xfc: 0x8008, // reversed - 0xfd: 0x3ba0b, // ondragenter - 0xfe: 0x3fa05, // start - 0xff: 0x12f03, // xmp - 0x100: 0x5f907, // srclang - 0x101: 0x30703, // img - 0x104: 0x101, // b - 0x105: 0x25403, // for - 0x106: 0x10705, // aside - 0x107: 0x44907, // oninput - 0x108: 0x35604, // area - 0x109: 0x2a40a, // formmethod - 0x10a: 0x72604, // wrap - 0x10c: 0x23c02, // rp - 0x10d: 0x46b0a, // onkeypress - 0x10e: 0x6802, // tt - 0x110: 0x34702, // mi - 0x111: 0x36705, // muted - 0x112: 0xf303, // alt - 0x113: 0x5c504, // code - 0x114: 0x6e02, // em - 0x115: 0x3c50a, // ondragexit - 0x117: 0x9f04, // span - 0x119: 0x6d708, // manifest - 0x11a: 0x38708, // menuitem - 0x11b: 0x58b07, // content - 0x11d: 0x6c109, // onwaiting - 0x11f: 0x4c609, // onloadend - 0x121: 0x37e0d, // oncontextmenu - 0x123: 0x56d06, // onblur - 0x124: 0x3fc07, // article - 0x125: 0x9303, // dir - 0x126: 0xef04, // ping - 0x127: 0x24c08, // required - 0x128: 0x45509, // oninvalid - 0x129: 0xb105, // align - 0x12b: 0x58a04, // icon - 0x12c: 0x64d02, // h6 - 0x12d: 0x1c404, // cols - 0x12e: 0x22e0a, // figcaption - 0x12f: 0x45e09, // onkeydown - 0x130: 0x66b08, // onsubmit - 0x131: 0x14d09, // oncanplay - 0x132: 0x70b03, // sup - 0x133: 0xc01, // p - 0x135: 0x40a09, // onemptied - 0x136: 0x39106, // oncopy - 0x137: 0x19c04, // cite - 0x138: 0x3a70a, // ondblclick - 0x13a: 0x50b0b, // onmousemove - 0x13c: 0x66d03, // sub - 0x13d: 0x48703, // rel - 0x13e: 0x5f08, // optgroup - 0x142: 0x9c07, // rowspan - 0x143: 0x37806, // source - 0x144: 0x21608, // noscript - 0x145: 0x1a304, // open - 0x146: 0x20403, // ins - 0x147: 0x2540d, // foreignObject - 0x148: 0x5ad0a, // onpopstate - 0x14a: 0x28d07, // enctype - 0x14b: 0x2760e, // onautocomplete - 0x14c: 0x35208, // textarea - 0x14e: 0x2780c, // autocomplete - 0x14f: 0x15702, // hr - 0x150: 0x1de08, // controls - 0x151: 0x10902, // id - 0x153: 0x2360c, // onafterprint - 0x155: 0x2610d, // foreignobject - 0x156: 0x32707, // marquee - 0x157: 0x59a07, // onpause - 0x158: 0x5e602, // dl - 0x159: 0x5206, // height - 0x15a: 0x34703, // min - 0x15b: 0x9307, // dirname - 0x15c: 0x1f209, // translate - 0x15d: 0x5604, // html - 0x15e: 0x34709, // minlength - 0x15f: 0x48607, // preload - 0x160: 0x71408, // template - 0x161: 0x3df0b, // ondragleave - 0x162: 0x3a02, // rb - 0x164: 0x5c003, // src - 0x165: 0x6dd06, // strong - 0x167: 0x7804, // samp - 0x168: 0x6f307, // address - 0x169: 0x55108, // ononline - 0x16b: 0x1310b, // placeholder - 0x16c: 0x2c406, // target - 0x16d: 0x20605, // small - 0x16e: 0x6ca07, // onwheel - 0x16f: 0x1c90a, // annotation - 0x170: 0x4740a, // spellcheck - 0x171: 0x7207, // details - 0x172: 0x10306, // canvas - 0x173: 0x12109, // autofocus - 0x174: 0xc05, // param - 0x176: 0x46308, // download - 0x177: 0x45203, // del - 0x178: 0x36c07, // onclose - 0x179: 0xb903, // kbd - 0x17a: 0x31906, // applet - 0x17b: 0x2e004, // href - 0x17c: 0x5f108, // onresize - 0x17e: 0x49d0c, // onloadeddata - 0x180: 0xcc02, // tr - 0x181: 0x2c00a, // formtarget - 0x182: 0x11005, // title - 0x183: 0x6ff05, // style - 0x184: 0xd206, // strike - 0x185: 0x59e06, // usemap - 0x186: 0x2fc06, // iframe - 0x187: 0x1004, // main - 0x189: 0x7b07, // picture - 0x18c: 0x31605, // ismap - 0x18e: 0x4a504, // data - 0x18f: 0x5905, // label - 0x191: 0x3d10e, // referrerpolicy - 0x192: 0x15602, // th - 0x194: 0x53606, // prompt - 0x195: 0x56807, // section - 0x197: 0x6d107, // optimum - 0x198: 0x2db04, // high - 0x199: 0x15c02, // h1 - 0x19a: 0x65909, // onstalled - 0x19b: 0x16d03, // var - 0x19c: 0x4204, // time - 0x19e: 0x67402, // ms - 0x19f: 0x33106, // header - 0x1a0: 0x4da09, // onmessage - 0x1a1: 0x1a605, // nonce - 0x1a2: 0x26e0a, // formaction - 0x1a3: 0x22006, // center - 0x1a4: 0x3704, // nobr - 0x1a5: 0x59505, // table - 0x1a6: 0x4a907, // listing - 0x1a7: 0x18106, // legend - 0x1a9: 0x29b09, // challenge - 0x1aa: 0x24806, // figure - 0x1ab: 0xe605, // media - 0x1ae: 0xd904, // type - 0x1af: 0x3f04, // font - 0x1b0: 0x4da0e, // onmessageerror - 0x1b1: 0x37108, // seamless - 0x1b2: 0x8703, // dfn - 0x1b3: 0x5c705, // defer - 0x1b4: 0xc303, // low - 0x1b5: 0x19a03, // rtc - 0x1b6: 0x5230b, // onmouseover - 0x1b7: 0x2b20a, // novalidate - 0x1b8: 0x71c0a, // workertype - 0x1ba: 0x3cd07, // itemref - 0x1bd: 0x1, // a - 0x1be: 0x31803, // map - 0x1bf: 0x400c, // ontimeupdate - 0x1c0: 0x15e07, // bgsound - 0x1c1: 0x3206, // keygen - 0x1c2: 0x2705, // tbody - 0x1c5: 0x64406, // onshow - 0x1c7: 0x2501, // s - 0x1c8: 0x6607, // pattern - 0x1cc: 0x14d10, // oncanplaythrough - 0x1ce: 0x2d702, // dd - 0x1cf: 0x6f906, // srcset - 0x1d0: 0x17003, // big - 0x1d2: 0x65108, // sortable - 0x1d3: 0x48007, // onkeyup - 0x1d5: 0x5a406, // onplay - 0x1d7: 0x4b804, // meta - 0x1d8: 0x40306, // ondrop - 0x1da: 0x60008, // onscroll - 0x1db: 0x1fb0b, // crossorigin - 0x1dc: 0x5730a, // onpageshow - 0x1dd: 0x4, // abbr - 0x1de: 0x9202, // td - 0x1df: 0x58b0f, // contenteditable - 0x1e0: 0x27206, // action - 0x1e1: 0x1400b, // playsinline - 0x1e2: 0x43107, // onfocus - 0x1e3: 0x2e008, // hreflang - 0x1e5: 0x5160a, // onmouseout - 0x1e6: 0x5ea07, // onreset - 0x1e7: 0x13c08, // autoplay - 0x1e8: 0x63109, // onseeking - 0x1ea: 0x67506, // scoped - 0x1ec: 0x30a, // radiogroup - 0x1ee: 0x3800b, // contextmenu - 0x1ef: 0x52e09, // onmouseup - 0x1f1: 0x2ca06, // hgroup - 0x1f2: 0x2080f, // allowfullscreen - 0x1f3: 0x4be08, // tabindex - 0x1f6: 0x30f07, // isindex - 0x1f7: 0x1a0e, // accept-charset - 0x1f8: 0x2ae0e, // formnovalidate - 0x1fb: 0x1c90e, // annotation-xml - 0x1fc: 0x6e05, // embed - 0x1fd: 0x21806, // script - 0x1fe: 0xbb06, // dialog - 0x1ff: 0x1d707, // command + 0x1: 0x3ff08, // dropzone + 0x2: 0x3b08, // basefont + 0x3: 0x23209, // integrity + 0x4: 0x43106, // source + 0x5: 0x2c09, // accesskey + 0x6: 0x1a06, // accept + 0x7: 0x6c807, // onwheel + 0xb: 0x47407, // onkeyup + 0xc: 0x32007, // headers + 0xd: 0x67306, // scoped + 0xe: 0x67909, // onsuspend + 0xf: 0x8908, // noframes + 0x10: 0x1fa0b, // crossorigin + 0x11: 0x2e407, // onclick + 0x12: 0x3f405, // start + 0x13: 0x37a0b, // contextmenu + 0x14: 0x5e903, // src + 0x15: 0x1c404, // cols + 0x16: 0xbb06, // dialog + 0x17: 0x47a07, // preload + 0x18: 0x3c707, // itemref + 0x1b: 0x2f105, // image + 0x1d: 0x4ba09, // onloadend + 0x1e: 0x45d08, // download + 0x1f: 0x46a03, // pre + 0x23: 0x2970a, // formmethod + 0x24: 0x71303, // svg + 0x25: 0xcf01, // q + 0x26: 0x64002, // dt + 0x27: 0x1de08, // controls + 0x2a: 0x2804, // body + 0x2b: 0xd206, // strike + 0x2c: 0x3910b, // oncuechange + 0x2d: 0x4c30b, // onloadstart + 0x2e: 0x2fe07, // isindex + 0x2f: 0xb202, // li + 0x30: 0x1400b, // playsinline + 0x31: 0x34102, // mi + 0x32: 0x30806, // applet + 0x33: 0x4ce09, // onmessage + 0x35: 0x13702, // ol + 0x36: 0x1a304, // open + 0x39: 0x14d09, // oncanplay + 0x3a: 0x6bf09, // onwaiting + 0x3b: 0x11908, // oncancel + 0x3c: 0x6a908, // onunload + 0x3e: 0x53c09, // onoffline + 0x3f: 0x1a0e, // accept-charset + 0x40: 0x32004, // head + 0x42: 0x3ab09, // ondragend + 0x43: 0x1310b, // placeholder + 0x44: 0x2b30a, // formtarget + 0x45: 0x2540d, // foreignobject + 0x47: 0x400c, // ontimeupdate + 0x48: 0xdd0e, // allowusermedia + 0x4a: 0x69c0d, // onbeforeprint + 0x4b: 0x5604, // html + 0x4c: 0x9f04, // span + 0x4d: 0x64206, // hgroup + 0x4e: 0x16408, // disabled + 0x4f: 0x4204, // time + 0x51: 0x42b07, // onfocus + 0x53: 0xb00a, // malignmark + 0x55: 0x4650a, // onkeypress + 0x56: 0x55805, // class + 0x57: 0x1ab08, // colgroup + 0x58: 0x33709, // maxlength + 0x59: 0x5a908, // progress + 0x5b: 0x70405, // style + 0x5c: 0x2a10e, // formnovalidate + 0x5e: 0x38b06, // oncopy + 0x60: 0x26104, // form + 0x61: 0xf606, // footer + 0x64: 0x30a, // radiogroup + 0x66: 0xfb04, // ruby + 0x67: 0x4ff0b, // onmousemove + 0x68: 0x19d08, // itemprop + 0x69: 0x2d70a, // http-equiv + 0x6a: 0x15602, // th + 0x6c: 0x6e02, // em + 0x6d: 0x38108, // menuitem + 0x6e: 0x63106, // select + 0x6f: 0x48110, // onlanguagechange + 0x70: 0x31f05, // thead + 0x71: 0x15c02, // h1 + 0x72: 0x5e906, // srcdoc + 0x75: 0x9604, // name + 0x76: 0x19106, // button + 0x77: 0x55504, // desc + 0x78: 0x17704, // kind + 0x79: 0x1bf05, // color + 0x7c: 0x58e06, // usemap + 0x7d: 0x30e08, // itemtype + 0x7f: 0x6d508, // manifest + 0x81: 0x5300c, // onmousewheel + 0x82: 0x4dc0b, // onmousedown + 0x84: 0xc05, // param + 0x85: 0x2e005, // video + 0x86: 0x4910c, // onloadeddata + 0x87: 0x6f107, // address + 0x8c: 0xef04, // ping + 0x8d: 0x24703, // for + 0x8f: 0x62f08, // onselect + 0x90: 0x30703, // map + 0x92: 0xc01, // p + 0x93: 0x8008, // reversed + 0x94: 0x54d0a, // onpagehide + 0x95: 0x3206, // keygen + 0x96: 0x34109, // minlength + 0x97: 0x3e40a, // ondragover + 0x98: 0x42407, // onerror + 0x9a: 0x2107, // charset + 0x9b: 0x29b06, // method + 0x9c: 0x101, // b + 0x9d: 0x68208, // ontoggle + 0x9e: 0x2bd06, // hidden + 0xa0: 0x3f607, // article + 0xa2: 0x63906, // onshow + 0xa3: 0x64d06, // onsort + 0xa5: 0x57b0f, // contenteditable + 0xa6: 0x66908, // onsubmit + 0xa8: 0x44f09, // oninvalid + 0xaa: 0x202, // br + 0xab: 0x10902, // id + 0xac: 0x5d04, // loop + 0xad: 0x5630a, // onpageshow + 0xb0: 0x2cf04, // href + 0xb2: 0x2210a, // figcaption + 0xb3: 0x2690e, // onautocomplete + 0xb4: 0x49106, // onload + 0xb6: 0x9c04, // rows + 0xb7: 0x1a605, // nonce + 0xb8: 0x68a14, // onunhandledrejection + 0xbb: 0x21306, // center + 0xbc: 0x59406, // onplay + 0xbd: 0x33f02, // h5 + 0xbe: 0x49d07, // listing + 0xbf: 0x57606, // public + 0xc2: 0x23b06, // figure + 0xc3: 0x57a04, // icon + 0xc4: 0x1ab03, // col + 0xc5: 0x47b03, // rel + 0xc6: 0xe605, // media + 0xc7: 0x12109, // autofocus + 0xc8: 0x19a02, // rt + 0xca: 0x2d304, // lang + 0xcc: 0x49908, // datalist + 0xce: 0x2eb06, // iframe + 0xcf: 0x36105, // muted + 0xd0: 0x6140a, // onauxclick + 0xd2: 0x3c02, // as + 0xd6: 0x3fd06, // ondrop + 0xd7: 0x1c90a, // annotation + 0xd8: 0x21908, // fieldset + 0xdb: 0x2cf08, // hreflang + 0xdc: 0x4e70c, // onmouseenter + 0xdd: 0x2a402, // mn + 0xde: 0xe60a, // mediagroup + 0xdf: 0x9805, // meter + 0xe0: 0x56c03, // wbr + 0xe2: 0x63e05, // width + 0xe3: 0x2290c, // onafterprint + 0xe4: 0x30505, // ismap + 0xe5: 0x1505, // value + 0xe7: 0x1303, // nav + 0xe8: 0x54508, // ononline + 0xe9: 0xb604, // mark + 0xea: 0xc303, // low + 0xeb: 0x3ee0b, // ondragstart + 0xef: 0x12f03, // xmp + 0xf0: 0x22407, // caption + 0xf1: 0xd904, // type + 0xf2: 0x70907, // summary + 0xf3: 0x6802, // tt + 0xf4: 0x20809, // translate + 0xf5: 0x1870a, // blockquote + 0xf8: 0x15702, // hr + 0xfa: 0x2705, // tbody + 0xfc: 0x7b07, // picture + 0xfd: 0x5206, // height + 0xfe: 0x19c04, // cite + 0xff: 0x2501, // s + 0x101: 0xff05, // async + 0x102: 0x56f07, // onpaste + 0x103: 0x19507, // onabort + 0x104: 0x2b706, // target + 0x105: 0x14b03, // bdo + 0x106: 0x1f006, // coords + 0x107: 0x5e108, // onresize + 0x108: 0x71908, // template + 0x10a: 0x3a02, // rb + 0x10b: 0x2a50a, // novalidate + 0x10c: 0x460e, // updateviacache + 0x10d: 0x71003, // sup + 0x10e: 0x6c07, // noembed + 0x10f: 0x16b03, // div + 0x110: 0x6f707, // srclang + 0x111: 0x17a09, // draggable + 0x112: 0x67305, // scope + 0x113: 0x5905, // label + 0x114: 0x22f02, // rp + 0x115: 0x23f08, // required + 0x116: 0x3780d, // oncontextmenu + 0x117: 0x5e504, // size + 0x118: 0x5b00a, // spellcheck + 0x119: 0x3f04, // font + 0x11a: 0x9c07, // rowspan + 0x11b: 0x10a07, // default + 0x11d: 0x44307, // oninput + 0x11e: 0x38506, // itemid + 0x11f: 0x5ee04, // code + 0x120: 0xaa07, // acronym + 0x121: 0x3b04, // base + 0x125: 0x2470d, // foreignObject + 0x126: 0x2ca04, // high + 0x127: 0x3cb0e, // referrerpolicy + 0x128: 0x33703, // max + 0x129: 0x59d0a, // onpopstate + 0x12a: 0x2fc02, // h4 + 0x12b: 0x4ac04, // meta + 0x12c: 0x17305, // blink + 0x12e: 0x5f508, // onscroll + 0x12f: 0x59409, // onplaying + 0x130: 0xc113, // allowpaymentrequest + 0x131: 0x19a03, // rtc + 0x132: 0x72b04, // wrap + 0x134: 0x8b08, // frameset + 0x135: 0x32605, // small + 0x137: 0x32006, // header + 0x138: 0x40409, // onemptied + 0x139: 0x34902, // h6 + 0x13a: 0x35908, // multiple + 0x13c: 0x52a06, // prompt + 0x13f: 0x28e09, // challenge + 0x141: 0x4370c, // onhashchange + 0x142: 0x57b07, // content + 0x143: 0x1c90e, // annotation-xml + 0x144: 0x36607, // onclose + 0x145: 0x14d10, // oncanplaythrough + 0x148: 0x5170b, // onmouseover + 0x149: 0x64f08, // sortable + 0x14a: 0xa402, // mo + 0x14b: 0x2cd02, // h3 + 0x14c: 0x2c406, // script + 0x14d: 0x41d07, // onended + 0x14f: 0x64706, // poster + 0x150: 0x7210a, // workertype + 0x153: 0x1f505, // shape + 0x154: 0x4, // abbr + 0x155: 0x1, // a + 0x156: 0x2bf02, // dd + 0x157: 0x71606, // system + 0x158: 0x4ce0e, // onmessageerror + 0x159: 0x36b08, // seamless + 0x15a: 0x2610a, // formaction + 0x15b: 0x6e106, // option + 0x15c: 0x31d04, // math + 0x15d: 0x62609, // onseeking + 0x15e: 0x39c05, // oncut + 0x15f: 0x44c03, // del + 0x160: 0x11005, // title + 0x161: 0x11505, // audio + 0x162: 0x63108, // selected + 0x165: 0x3b40b, // ondragenter + 0x166: 0x46e06, // spacer + 0x167: 0x4a410, // onloadedmetadata + 0x168: 0x44505, // input + 0x16a: 0x58505, // table + 0x16b: 0x41508, // onchange + 0x16e: 0x5f005, // defer + 0x171: 0x50a0a, // onmouseout + 0x172: 0x20504, // slot + 0x175: 0x3704, // nobr + 0x177: 0x1d707, // command + 0x17a: 0x7207, // details + 0x17b: 0x38104, // menu + 0x17c: 0xb903, // kbd + 0x17d: 0x57304, // step + 0x17e: 0x20303, // ins + 0x17f: 0x13c08, // autoplay + 0x182: 0x34103, // min + 0x183: 0x17404, // link + 0x185: 0x40d10, // ondurationchange + 0x186: 0x9202, // td + 0x187: 0x8b05, // frame + 0x18a: 0x2ab08, // datetime + 0x18b: 0x44509, // inputmode + 0x18c: 0x35108, // readonly + 0x18d: 0x21104, // face + 0x18f: 0x5e505, // sizes + 0x191: 0x4b208, // tabindex + 0x192: 0x6db06, // strong + 0x193: 0xba03, // bdi + 0x194: 0x6fe06, // srcset + 0x196: 0x67202, // ms + 0x197: 0x5b507, // checked + 0x198: 0xb105, // align + 0x199: 0x1e507, // section + 0x19b: 0x6e05, // embed + 0x19d: 0x15e07, // bgsound + 0x1a2: 0x49d04, // list + 0x1a3: 0x61e08, // onseeked + 0x1a4: 0x66009, // onstorage + 0x1a5: 0x2f603, // img + 0x1a6: 0xf505, // tfoot + 0x1a9: 0x26913, // onautocompleteerror + 0x1aa: 0x5fd19, // onsecuritypolicyviolation + 0x1ad: 0x9303, // dir + 0x1ae: 0x9307, // dirname + 0x1b0: 0x5a70a, // onprogress + 0x1b2: 0x65709, // onstalled + 0x1b5: 0x66f09, // itemscope + 0x1b6: 0x49904, // data + 0x1b7: 0x3d90b, // ondragleave + 0x1b8: 0x56102, // h2 + 0x1b9: 0x2f706, // mglyph + 0x1ba: 0x16502, // is + 0x1bb: 0x6e50e, // onbeforeunload + 0x1bc: 0x2830d, // typemustmatch + 0x1bd: 0x3ab06, // ondrag + 0x1be: 0x5da07, // onreset + 0x1c0: 0x51106, // output + 0x1c1: 0x12907, // sandbox + 0x1c2: 0x1b209, // plaintext + 0x1c4: 0x34c08, // textarea + 0x1c7: 0xd607, // keytype + 0x1c8: 0x34b05, // mtext + 0x1c9: 0x6b10e, // onvolumechange + 0x1ca: 0x1ea06, // onblur + 0x1cb: 0x58a07, // onpause + 0x1cd: 0x5bc0c, // onratechange + 0x1ce: 0x10705, // aside + 0x1cf: 0x6cf07, // optimum + 0x1d1: 0x45809, // onkeydown + 0x1d2: 0x1c407, // colspan + 0x1d3: 0x1004, // main + 0x1d4: 0x66b03, // sub + 0x1d5: 0x25b06, // object + 0x1d6: 0x55c06, // search + 0x1d7: 0x37206, // sorted + 0x1d8: 0x17003, // big + 0x1d9: 0xb01, // u + 0x1db: 0x26b0c, // autocomplete + 0x1dc: 0xcc02, // tr + 0x1dd: 0xf303, // alt + 0x1df: 0x7804, // samp + 0x1e0: 0x5c812, // onrejectionhandled + 0x1e1: 0x4f30c, // onmouseleave + 0x1e2: 0x28007, // enctype + 0x1e3: 0xa208, // nomodule + 0x1e5: 0x3280f, // allowfullscreen + 0x1e6: 0x5f08, // optgroup + 0x1e8: 0x27c0b, // formenctype + 0x1e9: 0x18106, // legend + 0x1ea: 0x10306, // canvas + 0x1eb: 0x6607, // pattern + 0x1ec: 0x2c208, // noscript + 0x1ed: 0x601, // i + 0x1ee: 0x5d602, // dl + 0x1ef: 0xa702, // ul + 0x1f2: 0x52209, // onmouseup + 0x1f4: 0x1ba05, // track + 0x1f7: 0x3a10a, // ondblclick + 0x1f8: 0x3bf0a, // ondragexit + 0x1fa: 0x8703, // dfn + 0x1fc: 0x26506, // action + 0x1fd: 0x35004, // area + 0x1fe: 0x31607, // marquee + 0x1ff: 0x16d03, // var } const atomText = "abbradiogrouparamainavalueaccept-charsetbodyaccesskeygenobrb" + @@ -758,26 +760,26 @@ const atomText = "abbradiogrouparamainavalueaccept-charsetbodyaccesskeygenobrb" "dboxmplaceholderautoplaysinlinebdoncanplaythrough1bgsoundisa" + "bledivarbigblinkindraggablegendblockquotebuttonabortcitempro" + "penoncecolgrouplaintextrackcolorcolspannotation-xmlcommandco" + - "ntrolshapecoordslotranslatecrossoriginsmallowfullscreenoscri" + - "ptfacenterfieldsetfigcaptionafterprintegrityfigurequiredfore" + - "ignObjectforeignobjectformactionautocompleteerrorformenctype" + - "mustmatchallengeformmethodformnovalidatetimeformtargethgroup" + - "osterhiddenhigh2hreflanghttp-equivideonclickiframeimageimgly" + - "ph3isindexismappletitemtypemarqueematheadersortedmaxlength4m" + - "inlength5mtextareadonlymultiplemutedoncloseamlessourceoncont" + - "extmenuitemidoncopyoncuechangeoncutondblclickondragendondrag" + - "enterondragexitemreferrerpolicyondragleaveondragoverondragst" + - "articleondropzonemptiedondurationchangeonendedonerroronfocus" + - "paceronhashchangeoninputmodeloninvalidonkeydownloadonkeypres" + - "spellcheckedonkeyupreloadonlanguagechangeonloadeddatalisting" + - "onloadedmetadatabindexonloadendonloadstartonmessageerroronmo" + - "usedownonmouseenteronmouseleaveonmousemoveonmouseoutputonmou" + - "seoveronmouseupromptonmousewheelonofflineononlineonpagehides" + - "classectionbluronpageshowbronpastepublicontenteditableonpaus" + - "emaponplayingonpopstateonprogressrcdocodeferonratechangeonre" + - "jectionhandledonresetonresizesrclangonscrollonsecuritypolicy" + - "violationauxclickonseekedonseekingonselectedonshowidth6onsor" + - "tableonstalledonstorageonsubmitemscopedonsuspendontoggleonun" + - "handledrejectionbeforeprintonunloadonvolumechangeonwaitingon" + - "wheeloptimumanifestrongoptionbeforeunloaddressrcsetstylesumm" + - "arysupsvgsystemplateworkertypewrap" + "ntrolsectionblurcoordshapecrossoriginslotranslatefacenterfie" + + "ldsetfigcaptionafterprintegrityfigurequiredforeignObjectfore" + + "ignobjectformactionautocompleteerrorformenctypemustmatchalle" + + "ngeformmethodformnovalidatetimeformtargethiddenoscripthigh3h" + + "reflanghttp-equivideonclickiframeimageimglyph4isindexismappl" + + "etitemtypemarqueematheadersmallowfullscreenmaxlength5minleng" + + "th6mtextareadonlymultiplemutedoncloseamlessortedoncontextmen" + + "uitemidoncopyoncuechangeoncutondblclickondragendondragentero" + + "ndragexitemreferrerpolicyondragleaveondragoverondragstarticl" + + "eondropzonemptiedondurationchangeonendedonerroronfocusourceo" + + "nhashchangeoninputmodeloninvalidonkeydownloadonkeypresspacer" + + "onkeyupreloadonlanguagechangeonloadeddatalistingonloadedmeta" + + "databindexonloadendonloadstartonmessageerroronmousedownonmou" + + "seenteronmouseleaveonmousemoveonmouseoutputonmouseoveronmous" + + "eupromptonmousewheelonofflineononlineonpagehidesclassearch2o" + + "npageshowbronpastepublicontenteditableonpausemaponplayingonp" + + "opstateonprogresspellcheckedonratechangeonrejectionhandledon" + + "resetonresizesrcdocodeferonscrollonsecuritypolicyviolationau" + + "xclickonseekedonseekingonselectedonshowidthgrouposteronsorta" + + "bleonstalledonstorageonsubmitemscopedonsuspendontoggleonunha" + + "ndledrejectionbeforeprintonunloadonvolumechangeonwaitingonwh" + + "eeloptimumanifestrongoptionbeforeunloaddressrclangsrcsetstyl" + + "esummarysupsvgsystemplateworkertypewrap" diff --git a/vendor/golang.org/x/net/html/parse.go b/vendor/golang.org/x/net/html/parse.go index 643c674e3..518ee4c94 100644 --- a/vendor/golang.org/x/net/html/parse.go +++ b/vendor/golang.org/x/net/html/parse.go @@ -924,7 +924,7 @@ func inBodyIM(p *parser) bool { p.addElement() p.im = inFramesetIM return true - case a.Address, a.Article, a.Aside, a.Blockquote, a.Center, a.Details, a.Dialog, a.Dir, a.Div, a.Dl, a.Fieldset, a.Figcaption, a.Figure, a.Footer, a.Header, a.Hgroup, a.Main, a.Menu, a.Nav, a.Ol, a.P, a.Section, a.Summary, a.Ul: + case a.Address, a.Article, a.Aside, a.Blockquote, a.Center, a.Details, a.Dialog, a.Dir, a.Div, a.Dl, a.Fieldset, a.Figcaption, a.Figure, a.Footer, a.Header, a.Hgroup, a.Main, a.Menu, a.Nav, a.Ol, a.P, a.Search, a.Section, a.Summary, a.Ul: p.popUntil(buttonScope, a.P) p.addElement() case a.H1, a.H2, a.H3, a.H4, a.H5, a.H6: @@ -1136,7 +1136,7 @@ func inBodyIM(p *parser) bool { return false } return true - case a.Address, a.Article, a.Aside, a.Blockquote, a.Button, a.Center, a.Details, a.Dialog, a.Dir, a.Div, a.Dl, a.Fieldset, a.Figcaption, a.Figure, a.Footer, a.Header, a.Hgroup, a.Listing, a.Main, a.Menu, a.Nav, a.Ol, a.Pre, a.Section, a.Summary, a.Ul: + case a.Address, a.Article, a.Aside, a.Blockquote, a.Button, a.Center, a.Details, a.Dialog, a.Dir, a.Div, a.Dl, a.Fieldset, a.Figcaption, a.Figure, a.Footer, a.Header, a.Hgroup, a.Listing, a.Main, a.Menu, a.Nav, a.Ol, a.Pre, a.Search, a.Section, a.Summary, a.Ul: p.popUntil(defaultScope, p.tok.DataAtom) case a.Form: if p.oe.contains(a.Template) { diff --git a/vendor/golang.org/x/net/html/token.go b/vendor/golang.org/x/net/html/token.go index 3c57880d6..6598c1f7b 100644 --- a/vendor/golang.org/x/net/html/token.go +++ b/vendor/golang.org/x/net/html/token.go @@ -839,8 +839,22 @@ func (z *Tokenizer) readStartTag() TokenType { if raw { z.rawTag = strings.ToLower(string(z.buf[z.data.start:z.data.end])) } - // Look for a self-closing token like "
". - if z.err == nil && z.buf[z.raw.end-2] == '/' { + // Look for a self-closing token (e.g.
). + // + // Originally, we did this by just checking that the last character of the + // tag (ignoring the closing bracket) was a solidus (/) character, but this + // is not always accurate. + // + // We need to be careful that we don't misinterpret a non-self-closing tag + // as self-closing, as can happen if the tag contains unquoted attribute + // values (i.e.

). + // + // To avoid this, we check that the last non-bracket character of the tag + // (z.raw.end-2) isn't the same character as the last non-quote character of + // the last attribute of the tag (z.pendingAttr[1].end-1), if the tag has + // attributes. + nAttrs := len(z.attr) + if z.err == nil && z.buf[z.raw.end-2] == '/' && (nAttrs == 0 || z.raw.end-2 != z.attr[nAttrs-1][1].end-1) { return SelfClosingTagToken } return StartTagToken diff --git a/vendor/golang.org/x/net/http2/frame.go b/vendor/golang.org/x/net/http2/frame.go index 81faec7e7..97bd8b06f 100644 --- a/vendor/golang.org/x/net/http2/frame.go +++ b/vendor/golang.org/x/net/http2/frame.go @@ -225,6 +225,11 @@ var fhBytes = sync.Pool{ }, } +func invalidHTTP1LookingFrameHeader() FrameHeader { + fh, _ := readFrameHeader(make([]byte, frameHeaderLen), strings.NewReader("HTTP/1.1 ")) + return fh +} + // ReadFrameHeader reads 9 bytes from r and returns a FrameHeader. // Most users should use Framer.ReadFrame instead. func ReadFrameHeader(r io.Reader) (FrameHeader, error) { @@ -503,10 +508,16 @@ func (fr *Framer) ReadFrame() (Frame, error) { return nil, err } if fh.Length > fr.maxReadSize { + if fh == invalidHTTP1LookingFrameHeader() { + return nil, fmt.Errorf("http2: failed reading the frame payload: %w, note that the frame header looked like an HTTP/1.1 header", err) + } return nil, ErrFrameTooLarge } payload := fr.getReadBuf(fh.Length) if _, err := io.ReadFull(fr.r, payload); err != nil { + if fh == invalidHTTP1LookingFrameHeader() { + return nil, fmt.Errorf("http2: failed reading the frame payload: %w, note that the frame header looked like an HTTP/1.1 header", err) + } return nil, err } f, err := typeFrameParser(fh.Type)(fr.frameCache, fh, fr.countError, payload) diff --git a/vendor/golang.org/x/net/http2/h2c/h2c.go b/vendor/golang.org/x/net/http2/h2c/h2c.go index 2d6bf861b..19e94791d 100644 --- a/vendor/golang.org/x/net/http2/h2c/h2c.go +++ b/vendor/golang.org/x/net/http2/h2c/h2c.go @@ -132,11 +132,8 @@ func (s h2cHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { // of the body, and reforward the client preface on the net.Conn this function // creates. func initH2CWithPriorKnowledge(w http.ResponseWriter) (net.Conn, error) { - hijacker, ok := w.(http.Hijacker) - if !ok { - return nil, errors.New("h2c: connection does not support Hijack") - } - conn, rw, err := hijacker.Hijack() + rc := http.NewResponseController(w) + conn, rw, err := rc.Hijack() if err != nil { return nil, err } @@ -163,10 +160,6 @@ func h2cUpgrade(w http.ResponseWriter, r *http.Request) (_ net.Conn, settings [] if err != nil { return nil, nil, err } - hijacker, ok := w.(http.Hijacker) - if !ok { - return nil, nil, errors.New("h2c: connection does not support Hijack") - } body, err := io.ReadAll(r.Body) if err != nil { @@ -174,7 +167,8 @@ func h2cUpgrade(w http.ResponseWriter, r *http.Request) (_ net.Conn, settings [] } r.Body = io.NopCloser(bytes.NewBuffer(body)) - conn, rw, err := hijacker.Hijack() + rc := http.NewResponseController(w) + conn, rw, err := rc.Hijack() if err != nil { return nil, nil, err } diff --git a/vendor/golang.org/x/net/http2/server.go b/vendor/golang.org/x/net/http2/server.go index b640deb0e..51fca38f6 100644 --- a/vendor/golang.org/x/net/http2/server.go +++ b/vendor/golang.org/x/net/http2/server.go @@ -1068,7 +1068,10 @@ func (sc *serverConn) serve(conf http2Config) { func (sc *serverConn) handlePingTimer(lastFrameReadTime time.Time) { if sc.pingSent { - sc.vlogf("timeout waiting for PING response") + sc.logf("timeout waiting for PING response") + if f := sc.countErrorFunc; f != nil { + f("conn_close_lost_ping") + } sc.conn.Close() return } diff --git a/vendor/golang.org/x/net/publicsuffix/data/children b/vendor/golang.org/x/net/publicsuffix/data/children index 08261bffd196fd6942b4cebb5ff06e0ffe53808d..986a246a6c05ca5b49c1d9f3f7fc84cb6628b64e 100644 GIT binary patch literal 3484 zcmV~$2S8JI9suCHk@x<8g#Z>x5h%R(3rVOG5qoywsKjUppdunfb~vqq0~NP*FqDKK zA}F9B5ch0xwA5`vGzlO$5U?zR=$&=6=&9&^pFkiG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r?YLO|Ew-9=Vry3} zE>(YrfATZppVWtNS=V8FOnr(?RbOIL3yf@Pw@JA~p3g2x+^<|xP{1zfE>tcpC}Nj( z7qiRcR^_t95_Va^0p)UeDZ4!J5WBqKuyRGgPwa~BayCtVlub)K#-o8Em=xiaw-yRzUkyR!QXyGnjmxhnA-yQ<*4@-z7bKNm;X$^%=Qw-R|14YKe~zu_xy+vEsbwqu z8`#Q4jcjFM6IZWFHqf*vB`T+2;W*?8_pj^5u<3?CYXG zKoam2BpM0O8VaO=GQgVtz-oMfHOql@`U7VU01wS@@N#|-+AnZC_y$f0_0=SUuQ>($ z%&DP%&gCH2tbl;Pbr2Nz6%fsK;LSUMcjiK{<~s;Be-8?C9)xL3p<(7a2ykm&jXG(qb@=h_0vLEk}Y z&~8{}F+iHDG&DWv1f(ZbLb~f0SetYT)><5})>RLm2Q@%OQX_0|xnPs!Hf(Y|g)OdU zu#X@xXyc)fB!Rg%Bh;eZ7HTQp5o+npgyP2k#4B!b;9XlH=NPl zg0ti_^bh?wFOSc5B@yp?}MsoM-r>o?%iZG~R<4si2&=;O2D7QY*A=?rjRXN3FKGI-!F zmr1NAWONBFqx;^Hp=3^mN<3vupO*~x4VFRjJ2F{ckc>-K$~^mq$@&G4mh~^0AnV`v a@p}W4r^yDE#L9e<7sz~*lVpA+DgOrzLVp1O diff --git a/vendor/golang.org/x/net/publicsuffix/data/nodes b/vendor/golang.org/x/net/publicsuffix/data/nodes index 1dae6ede8f292889cb4252aa473312fea1bac46a..38b8999600c8cb35fbceee1b938b5de72da1345f 100644 GIT binary patch literal 50500 zcmc${b(kDg+V}sd>YnbI9-qm?1$TF+-N#*l;Igntmf*>_#0d}}xVyVerpG4eQ)o?sNP7EhybS0q(M9a3^$>=!dEkf)Jmd z08dsgR6o!L@q3c7xpRB4ZMdfms?JG)f~{R@Qo-}N54;sE;I^6Ix!DHM#w6^X@*b!= zJAr*wc`ww*`$%#>ZG!Ln1XN$xPg3_5Jy3Dm0F-YX#Npn-3*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Q6A-jv$$T-bO+3j-e(b~ba zHxxMahIWriM5O%iRZiTHj*GUOx&_Xs(uz`i~wHJEjOangaahn)1_V1CypXy~_>_IepRDT$S|)>=}0Y zhOU|B^oJ8ePXDr&A!kZpzaeMJ;MgJOr?zJwg^G0Pd9$3K4z^Eojtw*qImZr84>`vL zH(`L*J_R`fp#_|M*XEItIO4cNnS+>mY!bAKHI;_4UMO zJEZ?&gfq8Jrw@|70c)f8Jc7)|;C*4K9*Ld*`lSE;cmKz4*p9#L|KjETfABkYeB92- zUVhqZdBn&*z=Cg1#@8PsgsS<6#6<^ z&!#hxtyTyo+|xdYV@LC|Y_swokfw?` z3qzpgN`PrpWLgkAX*mk+OaT3e1O!YdX#oTsW4}OJU`2@(fr-^R^(m=+d6^XIg?V-Y z`Nri?s!l*h^S5YgLP)fpR;%pUt+NhByF<3+@gA9#i7ZdF-41{H22Q6nV;$IiR=6i$&b`(!K_COQ`Ve+0+5WynNGn+xrSI~76 z#7Ho7c)1ihXQ9+~;3BE>-_lZd=X$B Date: Wed, 2 Apr 2025 12:39:38 +0200 Subject: [PATCH 04/15] [bugfix] Fix update users query in migration (#3963) --- .../migrations/20250310144102_application_management.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/db/bundb/migrations/20250310144102_application_management.go b/internal/db/bundb/migrations/20250310144102_application_management.go index 46ff9926b..e20cd2921 100644 --- a/internal/db/bundb/migrations/20250310144102_application_management.go +++ b/internal/db/bundb/migrations/20250310144102_application_management.go @@ -81,12 +81,13 @@ func init() { return err } - // Set instance app - // ID on all users. + // Set instance app ID on + // users where it's null. if _, err := tx. NewUpdate(). Table("users"). Set("? = ?", bun.Ident("created_by_application_id"), instanceAppID). + Where("? IS NULL", bun.Ident("created_by_application_id")). Exec(ctx); err != nil { return err } From 6473886c8e4c713a6f5686e289985a0ebf3e9a82 Mon Sep 17 00:00:00 2001 From: Kelson Vibber Date: Thu, 3 Apr 2025 00:43:21 -0700 Subject: [PATCH 05/15] [bugfix] Fix Atkinson Hyperlegible font embedding on Ecks Pee theme. (#3964) Most browsers just take the second src line and they're fine, but Tor has trouble displaying the woff version on Linux. With two separate lines it doesn't fall back correctly. --- web/assets/themes/ecks-pee.css | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/web/assets/themes/ecks-pee.css b/web/assets/themes/ecks-pee.css index f474f800c..a85e5da0b 100644 --- a/web/assets/themes/ecks-pee.css +++ b/web/assets/themes/ecks-pee.css @@ -93,29 +93,29 @@ font-family: "Atkinson Hyperlegible"; font-weight: normal; font-style: normal; - src: url(/assets/fonts/Atkinson-Hyperlegible-Regular-102a.woff2) format('woff2'); - src: url(/assets/fonts/Atkinson-Hyperlegible-Regular-102.woff) format('woff'); + src: url(/assets/fonts/Atkinson-Hyperlegible-Regular-102a.woff2) format('woff2'), + url(/assets/fonts/Atkinson-Hyperlegible-Regular-102.woff) format('woff'); } @font-face { font-family: "Atkinson Hyperlegible"; font-weight: bold; font-style: normal; - src: url(/assets/fonts/Atkinson-Hyperlegible-Bold-102a.woff2) format('woff2'); - src: url(/assets/fonts/Atkinson-Hyperlegible-Bold-102.woff) format('woff'); + src: url(/assets/fonts/Atkinson-Hyperlegible-Bold-102a.woff2) format('woff2'), + url(/assets/fonts/Atkinson-Hyperlegible-Bold-102.woff) format('woff'); } @font-face { font-family: "Atkinson Hyperlegible"; font-weight: normal; font-style: italic; - src: url(/assets/fonts/Atkinson-Hyperlegible-Italic-102a.woff2) format('woff2'); - src: url(/assets/fonts/Atkinson-Hyperlegible-Italic-102.woff) format('woff'); + src: url(/assets/fonts/Atkinson-Hyperlegible-Italic-102a.woff2) format('woff2'), + url(/assets/fonts/Atkinson-Hyperlegible-Italic-102.woff) format('woff'); } @font-face { font-family: "Atkinson Hyperlegible"; font-weight: bold; font-style: italic; - src: url(/assets/fonts/Atkinson-Hyperlegible-BoldItalic-102a.woff2) format('woff2'); - src: url(/assets/fonts/Atkinson-Hyperlegible-BoldItalic-102.woff) format('woff'); + src: url(/assets/fonts/Atkinson-Hyperlegible-BoldItalic-102a.woff2) format('woff2'), + url(/assets/fonts/Atkinson-Hyperlegible-BoldItalic-102.woff) format('woff'); } /* Main page background */ From db4b85715966ee590c6cdff5cc52e592b66e3d17 Mon Sep 17 00:00:00 2001 From: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Date: Fri, 4 Apr 2025 15:34:38 +0000 Subject: [PATCH 06/15] [chore] bump ncruces/go-sqlite3 to v0.25.0 (#3966) --- go.mod | 2 +- go.sum | 4 +- .../github.com/ncruces/go-sqlite3/README.md | 22 +- vendor/github.com/ncruces/go-sqlite3/blob.go | 9 +- .../github.com/ncruces/go-sqlite3/config.go | 16 +- vendor/github.com/ncruces/go-sqlite3/conn.go | 79 +++----- vendor/github.com/ncruces/go-sqlite3/const.go | 7 +- .../github.com/ncruces/go-sqlite3/context.go | 10 +- .../ncruces/go-sqlite3/driver/driver.go | 188 +++++++++++------- .../ncruces/go-sqlite3/driver/time.go | 11 +- vendor/github.com/ncruces/go-sqlite3/error.go | 18 +- vendor/github.com/ncruces/go-sqlite3/func.go | 159 +++++++++++---- .../ncruces/go-sqlite3/internal/util/error.go | 4 +- .../ncruces/go-sqlite3/internal/util/mem.go | 5 +- .../github.com/ncruces/go-sqlite3/sqlite.go | 38 ++-- vendor/github.com/ncruces/go-sqlite3/stmt.go | 140 ++++++++++--- vendor/github.com/ncruces/go-sqlite3/txn.go | 24 +-- .../ncruces/go-sqlite3/util/osutil/open.go | 16 -- .../go-sqlite3/util/osutil/open_windows.go | 115 ----------- .../ncruces/go-sqlite3/util/osutil/osfs.go | 33 --- .../ncruces/go-sqlite3/util/osutil/osutil.go | 2 - .../go-sqlite3/util/sql3util/sql3util.go | 2 +- vendor/github.com/ncruces/go-sqlite3/value.go | 8 +- .../ncruces/go-sqlite3/vfs/README.md | 35 +++- .../github.com/ncruces/go-sqlite3/vfs/cksm.go | 24 ++- .../github.com/ncruces/go-sqlite3/vfs/file.go | 28 ++- .../ncruces/go-sqlite3/vfs/os_bsd.go | 27 ++- .../ncruces/go-sqlite3/vfs/os_darwin.go | 22 +- .../ncruces/go-sqlite3/vfs/os_linux.go | 46 ++++- .../ncruces/go-sqlite3/vfs/os_std.go | 2 +- .../ncruces/go-sqlite3/vfs/os_unix.go | 13 +- .../ncruces/go-sqlite3/vfs/os_windows.go | 35 +--- .../ncruces/go-sqlite3/vfs/shm_bsd.go | 15 +- .../ncruces/go-sqlite3/vfs/shm_windows.go | 23 +-- vendor/github.com/ncruces/go-sqlite3/vtab.go | 29 ++- vendor/modules.txt | 3 +- 36 files changed, 636 insertions(+), 578 deletions(-) delete mode 100644 vendor/github.com/ncruces/go-sqlite3/util/osutil/open.go delete mode 100644 vendor/github.com/ncruces/go-sqlite3/util/osutil/open_windows.go delete mode 100644 vendor/github.com/ncruces/go-sqlite3/util/osutil/osfs.go delete mode 100644 vendor/github.com/ncruces/go-sqlite3/util/osutil/osutil.go diff --git a/go.mod b/go.mod index c23748996..479002530 100644 --- a/go.mod +++ b/go.mod @@ -54,7 +54,7 @@ require ( github.com/miekg/dns v1.1.64 github.com/minio/minio-go/v7 v7.0.85 github.com/mitchellh/mapstructure v1.5.0 - github.com/ncruces/go-sqlite3 v0.24.0 + github.com/ncruces/go-sqlite3 v0.25.0 github.com/oklog/ulid v1.3.1 github.com/prometheus/client_golang v1.21.1 github.com/rivo/uniseg v0.4.7 diff --git a/go.sum b/go.sum index 88fb45e71..f886b0e89 100644 --- a/go.sum +++ b/go.sum @@ -322,8 +322,8 @@ github.com/moul/http2curl v1.0.0 h1:dRMWoAtb+ePxMlLkrCbAqh4TlPHXvoGUSQ323/9Zahs= github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/ncruces/go-sqlite3 v0.24.0 h1:Z4jfmzu2NCd4SmyFwLT2OmF3EnTZbqwATvdiuNHNhLA= -github.com/ncruces/go-sqlite3 v0.24.0/go.mod h1:/Vs8ACZHjJ1SA6E9RZUn3EyB1OP3nDQ4z/ar+0fplTQ= +github.com/ncruces/go-sqlite3 v0.25.0 h1:trugKUs98Zwy9KwRr/EUxZHL92LYt7UqcKqAfpGpK+I= +github.com/ncruces/go-sqlite3 v0.25.0/go.mod h1:n6Z7036yFilJx04yV0mi5JWaF66rUmXn1It9Ux8dx68= github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4= github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= github.com/ncruces/julianday v1.0.0 h1:fH0OKwa7NWvniGQtxdJRxAgkBMolni2BjDHaWTxqt7M= diff --git a/vendor/github.com/ncruces/go-sqlite3/README.md b/vendor/github.com/ncruces/go-sqlite3/README.md index cac6ee6b8..94fd9950b 100644 --- a/vendor/github.com/ncruces/go-sqlite3/README.md +++ b/vendor/github.com/ncruces/go-sqlite3/README.md @@ -65,17 +65,20 @@ db.QueryRow(`SELECT sqlite_version()`).Scan(&version) This module replaces the SQLite [OS Interface](https://sqlite.org/vfs.html) (aka VFS) with a [pure Go](vfs/) implementation, which has advantages and disadvantages. - Read more about the Go VFS design [here](vfs/README.md). +Because each database connection executes within a Wasm sandboxed environment, +memory usage will be higher than alternatives. + ### Testing This project aims for [high test coverage](https://github.com/ncruces/go-sqlite3/wiki/Test-coverage-report). It also benefits greatly from [SQLite's](https://sqlite.org/testing.html) and -[wazero's](https://tetrate.io/blog/introducing-wazero-from-tetrate/#:~:text=Rock%2Dsolid%20test%20approach) thorough testing. +[wazero's](https://tetrate.io/blog/introducing-wazero-from-tetrate/#:~:text=Rock%2Dsolid%20test%20approach) +thorough testing. Every commit is [tested](https://github.com/ncruces/go-sqlite3/wiki/Support-matrix) on -Linux (amd64/arm64/386/riscv64/ppc64le/s390x), macOS (amd64/arm64), +Linux (amd64/arm64/386/riscv64/ppc64le/s390x), macOS (arm64/amd64), Windows (amd64), FreeBSD (amd64/arm64), OpenBSD (amd64), NetBSD (amd64/arm64), DragonFly BSD (amd64), illumos (amd64), and Solaris (amd64). @@ -84,12 +87,21 @@ The Go VFS is tested by running SQLite's ### Performance -Perfomance of the [`database/sql`](https://pkg.go.dev/database/sql) driver is +Performance of the [`database/sql`](https://pkg.go.dev/database/sql) driver is [competitive](https://github.com/cvilsmeier/go-sqlite-bench) with alternatives. -The Wasm and VFS layers are also tested by running SQLite's +The Wasm and VFS layers are also benchmarked by running SQLite's [speedtest1](https://github.com/sqlite/sqlite/blob/master/test/speedtest1.c). +### Concurrency + +This module behaves similarly to SQLite in [multi-thread](https://sqlite.org/threadsafe.html) mode: +it is goroutine-safe, provided that no single database connection, or object derived from it, +is used concurrently by multiple goroutines. + +The [`database/sql`](https://pkg.go.dev/database/sql) API is safe to use concurrently, +according to its documentation. + ### FAQ, issues, new features For questions, please see [Discussions](https://github.com/ncruces/go-sqlite3/discussions/categories/q-a). diff --git a/vendor/github.com/ncruces/go-sqlite3/blob.go b/vendor/github.com/ncruces/go-sqlite3/blob.go index 2fac72045..ea7caf9d8 100644 --- a/vendor/github.com/ncruces/go-sqlite3/blob.go +++ b/vendor/github.com/ncruces/go-sqlite3/blob.go @@ -31,6 +31,10 @@ var _ io.ReadWriteSeeker = &Blob{} // // https://sqlite.org/c3ref/blob_open.html func (c *Conn) OpenBlob(db, table, column string, row int64, write bool) (*Blob, error) { + if c.interrupt.Err() != nil { + return nil, INTERRUPT + } + defer c.arena.mark()() blobPtr := c.arena.new(ptrlen) dbPtr := c.arena.string(db) @@ -42,7 +46,6 @@ func (c *Conn) OpenBlob(db, table, column string, row int64, write bool) (*Blob, flags = 1 } - c.checkInterrupt(c.handle) rc := res_t(c.call("sqlite3_blob_open", stk_t(c.handle), stk_t(dbPtr), stk_t(tablePtr), stk_t(columnPtr), stk_t(row), stk_t(flags), stk_t(blobPtr))) @@ -253,7 +256,9 @@ func (b *Blob) Seek(offset int64, whence int) (int64, error) { // // https://sqlite.org/c3ref/blob_reopen.html func (b *Blob) Reopen(row int64) error { - b.c.checkInterrupt(b.c.handle) + if b.c.interrupt.Err() != nil { + return INTERRUPT + } err := b.c.error(res_t(b.c.call("sqlite3_blob_reopen", stk_t(b.handle), stk_t(row)))) b.bytes = int64(int32(b.c.call("sqlite3_blob_bytes", stk_t(b.handle)))) b.offset = 0 diff --git a/vendor/github.com/ncruces/go-sqlite3/config.go b/vendor/github.com/ncruces/go-sqlite3/config.go index 17166b9c5..3921fe98a 100644 --- a/vendor/github.com/ncruces/go-sqlite3/config.go +++ b/vendor/github.com/ncruces/go-sqlite3/config.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "strconv" + "sync/atomic" "github.com/tetratelabs/wazero/api" @@ -48,6 +49,15 @@ func (c *Conn) Config(op DBConfig, arg ...bool) (bool, error) { return util.ReadBool(c.mod, argsPtr), c.error(rc) } +var defaultLogger atomic.Pointer[func(code ExtendedErrorCode, msg string)] + +// ConfigLog sets up the default error logging callback for new connections. +// +// https://sqlite.org/errlog.html +func ConfigLog(cb func(code ExtendedErrorCode, msg string)) { + defaultLogger.Store(&cb) +} + // ConfigLog sets up the error logging callback for the connection. // // https://sqlite.org/errlog.html @@ -265,6 +275,10 @@ func traceCallback(ctx context.Context, mod api.Module, evt TraceEvent, pDB, pAr // // https://sqlite.org/c3ref/wal_checkpoint_v2.html func (c *Conn) WALCheckpoint(schema string, mode CheckpointMode) (nLog, nCkpt int, err error) { + if c.interrupt.Err() != nil { + return 0, 0, INTERRUPT + } + defer c.arena.mark()() nLogPtr := c.arena.new(ptrlen) nCkptPtr := c.arena.new(ptrlen) @@ -378,6 +392,6 @@ func (c *Conn) EnableChecksums(schema string) error { } // Checkpoint the WAL. - _, _, err = c.WALCheckpoint(schema, CHECKPOINT_RESTART) + _, _, err = c.WALCheckpoint(schema, CHECKPOINT_FULL) return err } diff --git a/vendor/github.com/ncruces/go-sqlite3/conn.go b/vendor/github.com/ncruces/go-sqlite3/conn.go index 9f9251e9f..7e88d8c85 100644 --- a/vendor/github.com/ncruces/go-sqlite3/conn.go +++ b/vendor/github.com/ncruces/go-sqlite3/conn.go @@ -25,7 +25,6 @@ type Conn struct { *sqlite interrupt context.Context - pending *Stmt stmts []*Stmt busy func(context.Context, int) bool log func(xErrorCode, string) @@ -41,6 +40,7 @@ type Conn struct { busylst time.Time arena arena handle ptr_t + gosched uint8 } // Open calls [OpenFlags] with [OPEN_READWRITE], [OPEN_CREATE] and [OPEN_URI]. @@ -49,7 +49,7 @@ func Open(filename string) (*Conn, error) { } // OpenContext is like [Open] but includes a context, -// which is used to interrupt the process of opening the connectiton. +// which is used to interrupt the process of opening the connection. func OpenContext(ctx context.Context, filename string) (*Conn, error) { return newConn(ctx, filename, OPEN_READWRITE|OPEN_CREATE|OPEN_URI) } @@ -92,6 +92,9 @@ func newConn(ctx context.Context, filename string, flags OpenFlag) (ret *Conn, _ }() c.ctx = context.WithValue(c.ctx, connKey{}, c) + if logger := defaultLogger.Load(); logger != nil { + c.ConfigLog(*logger) + } c.arena = c.newArena() c.handle, err = c.openDB(filename, flags) if err == nil { @@ -117,7 +120,7 @@ func (c *Conn) openDB(filename string, flags OpenFlag) (ptr_t, error) { return 0, err } - c.call("sqlite3_progress_handler_go", stk_t(handle), 100) + c.call("sqlite3_progress_handler_go", stk_t(handle), 1000) if flags|OPEN_URI != 0 && strings.HasPrefix(filename, "file:") { var pragmas strings.Builder if _, after, ok := strings.Cut(filename, "?"); ok { @@ -129,7 +132,6 @@ func (c *Conn) openDB(filename string, flags OpenFlag) (ptr_t, error) { } } if pragmas.Len() != 0 { - c.checkInterrupt(handle) pragmaPtr := c.arena.string(pragmas.String()) rc := res_t(c.call("sqlite3_exec", stk_t(handle), stk_t(pragmaPtr), 0, 0, 0)) if err := c.sqlite.error(rc, handle, pragmas.String()); err != nil { @@ -163,9 +165,6 @@ func (c *Conn) Close() error { return nil } - c.pending.Close() - c.pending = nil - rc := res_t(c.call("sqlite3_close", stk_t(c.handle))) if err := c.error(rc); err != nil { return err @@ -180,11 +179,16 @@ func (c *Conn) Close() error { // // https://sqlite.org/c3ref/exec.html func (c *Conn) Exec(sql string) error { - defer c.arena.mark()() - sqlPtr := c.arena.string(sql) + if c.interrupt.Err() != nil { + return INTERRUPT + } + return c.exec(sql) +} - c.checkInterrupt(c.handle) - rc := res_t(c.call("sqlite3_exec", stk_t(c.handle), stk_t(sqlPtr), 0, 0, 0)) +func (c *Conn) exec(sql string) error { + defer c.arena.mark()() + textPtr := c.arena.string(sql) + rc := res_t(c.call("sqlite3_exec", stk_t(c.handle), stk_t(textPtr), 0, 0, 0)) return c.error(rc, sql) } @@ -203,20 +207,22 @@ func (c *Conn) PrepareFlags(sql string, flags PrepareFlag) (stmt *Stmt, tail str if len(sql) > _MAX_SQL_LENGTH { return nil, "", TOOBIG } + if c.interrupt.Err() != nil { + return nil, "", INTERRUPT + } defer c.arena.mark()() stmtPtr := c.arena.new(ptrlen) tailPtr := c.arena.new(ptrlen) - sqlPtr := c.arena.string(sql) + textPtr := c.arena.string(sql) - c.checkInterrupt(c.handle) rc := res_t(c.call("sqlite3_prepare_v3", stk_t(c.handle), - stk_t(sqlPtr), stk_t(len(sql)+1), stk_t(flags), + stk_t(textPtr), stk_t(len(sql)+1), stk_t(flags), stk_t(stmtPtr), stk_t(tailPtr))) - stmt = &Stmt{c: c} + stmt = &Stmt{c: c, sql: sql} stmt.handle = util.Read32[ptr_t](c.mod, stmtPtr) - if sql := sql[util.Read32[ptr_t](c.mod, tailPtr)-sqlPtr:]; sql != "" { + if sql := sql[util.Read32[ptr_t](c.mod, tailPtr)-textPtr:]; sql != "" { tail = sql } @@ -337,43 +343,17 @@ func (c *Conn) GetInterrupt() context.Context { // // https://sqlite.org/c3ref/interrupt.html func (c *Conn) SetInterrupt(ctx context.Context) (old context.Context) { + if ctx == nil { + panic("nil Context") + } old = c.interrupt c.interrupt = ctx - - if ctx == old || ctx.Done() == old.Done() { - return old - } - - // A busy SQL statement prevents SQLite from ignoring an interrupt - // that comes before any other statements are started. - if c.pending == nil { - defer c.arena.mark()() - stmtPtr := c.arena.new(ptrlen) - loopPtr := c.arena.string(`WITH RECURSIVE c(x) AS (VALUES(0) UNION ALL SELECT x FROM c) SELECT x FROM c`) - c.call("sqlite3_prepare_v3", stk_t(c.handle), stk_t(loopPtr), math.MaxUint64, - stk_t(PREPARE_PERSISTENT), stk_t(stmtPtr), 0) - c.pending = &Stmt{c: c} - c.pending.handle = util.Read32[ptr_t](c.mod, stmtPtr) - } - - if old.Done() != nil && ctx.Err() == nil { - c.pending.Reset() - } - if ctx.Done() != nil { - c.pending.Step() - } return old } -func (c *Conn) checkInterrupt(handle ptr_t) { - if c.interrupt.Err() != nil { - c.call("sqlite3_interrupt", stk_t(handle)) - } -} - func progressCallback(ctx context.Context, mod api.Module, _ ptr_t) (interrupt int32) { if c, ok := ctx.Value(connKey{}).(*Conn); ok { - if c.interrupt.Done() != nil { + if c.gosched++; c.gosched%16 == 0 { runtime.Gosched() } if c.interrupt.Err() != nil { @@ -429,11 +409,8 @@ func (c *Conn) BusyHandler(cb func(ctx context.Context, count int) (retry bool)) func busyCallback(ctx context.Context, mod api.Module, pDB ptr_t, count int32) (retry int32) { if c, ok := ctx.Value(connKey{}).(*Conn); ok && c.handle == pDB && c.busy != nil { - interrupt := c.interrupt - if interrupt == nil { - interrupt = context.Background() - } - if interrupt.Err() == nil && c.busy(interrupt, int(count)) { + if interrupt := c.interrupt; interrupt.Err() == nil && + c.busy(interrupt, int(count)) { retry = 1 } } diff --git a/vendor/github.com/ncruces/go-sqlite3/const.go b/vendor/github.com/ncruces/go-sqlite3/const.go index 82d80515e..522f68bfb 100644 --- a/vendor/github.com/ncruces/go-sqlite3/const.go +++ b/vendor/github.com/ncruces/go-sqlite3/const.go @@ -11,10 +11,9 @@ const ( _ROW = 100 /* sqlite3_step() has another row ready */ _DONE = 101 /* sqlite3_step() has finished executing */ - _MAX_NAME = 1e6 // Self-imposed limit for most NUL terminated strings. - _MAX_LENGTH = 1e9 - _MAX_SQL_LENGTH = 1e9 - _MAX_FUNCTION_ARG = 100 + _MAX_NAME = 1e6 // Self-imposed limit for most NUL terminated strings. + _MAX_LENGTH = 1e9 + _MAX_SQL_LENGTH = 1e9 ptrlen = util.PtrLen intlen = util.IntLen diff --git a/vendor/github.com/ncruces/go-sqlite3/context.go b/vendor/github.com/ncruces/go-sqlite3/context.go index 637ddc282..abee4ec1e 100644 --- a/vendor/github.com/ncruces/go-sqlite3/context.go +++ b/vendor/github.com/ncruces/go-sqlite3/context.go @@ -89,20 +89,26 @@ func (ctx Context) ResultText(value string) { } // ResultRawText sets the text result of the function to a []byte. -// Returning a nil slice is the same as calling [Context.ResultNull]. // // https://sqlite.org/c3ref/result_blob.html func (ctx Context) ResultRawText(value []byte) { + if len(value) == 0 { + ctx.ResultText("") + return + } ptr := ctx.c.newBytes(value) ctx.c.call("sqlite3_result_text_go", stk_t(ctx.handle), stk_t(ptr), stk_t(len(value))) } // ResultBlob sets the result of the function to a []byte. -// Returning a nil slice is the same as calling [Context.ResultNull]. // // https://sqlite.org/c3ref/result_blob.html func (ctx Context) ResultBlob(value []byte) { + if len(value) == 0 { + ctx.ResultZeroBlob(0) + return + } ptr := ctx.c.newBytes(value) ctx.c.call("sqlite3_result_blob_go", stk_t(ctx.handle), stk_t(ptr), stk_t(len(value))) diff --git a/vendor/github.com/ncruces/go-sqlite3/driver/driver.go b/vendor/github.com/ncruces/go-sqlite3/driver/driver.go index 21799aeb2..9250cf39d 100644 --- a/vendor/github.com/ncruces/go-sqlite3/driver/driver.go +++ b/vendor/github.com/ncruces/go-sqlite3/driver/driver.go @@ -20,22 +20,45 @@ // - a [serializable] transaction is always "immediate"; // - a [read-only] transaction is always "deferred". // +// # Datatypes In SQLite +// +// SQLite is dynamically typed. +// Columns can mostly hold any value regardless of their declared type. +// SQLite supports most [driver.Value] types out of the box, +// but bool and [time.Time] require special care. +// +// Booleans can be stored on any column type and scanned back to a *bool. +// However, if scanned to a *any, booleans may either become an +// int64, string or bool, depending on the declared type of the column. +// If you use BOOLEAN for your column type, +// 1 and 0 will always scan as true and false. +// // # Working with time // +// Time values can similarly be stored on any column type. // The time encoding/decoding format can be specified using "_timefmt": // // sql.Open("sqlite3", "file:demo.db?_timefmt=sqlite") // -// Possible values are: "auto" (the default), "sqlite", "rfc3339"; +// Special values are: "auto" (the default), "sqlite", "rfc3339"; // - "auto" encodes as RFC 3339 and decodes any [format] supported by SQLite; // - "sqlite" encodes as SQLite and decodes any [format] supported by SQLite; // - "rfc3339" encodes and decodes RFC 3339 only. // -// If you encode as RFC 3339 (the default), -// consider using the TIME [collating sequence] to produce a time-ordered sequence. +// You can also set "_timefmt" to an arbitrary [sqlite3.TimeFormat] or [time.Layout]. // -// To scan values in other formats, [sqlite3.TimeFormat.Scanner] may be helpful. -// To bind values in other formats, [sqlite3.TimeFormat.Encode] them before binding. +// If you encode as RFC 3339 (the default), +// consider using the TIME [collating sequence] to produce time-ordered sequences. +// +// If you encode as RFC 3339 (the default), +// time values will scan back to a *time.Time unless your column type is TEXT. +// Otherwise, if scanned to a *any, time values may either become an +// int64, float64 or string, depending on the time format and declared type of the column. +// If you use DATE, TIME, DATETIME, or TIMESTAMP for your column type, +// "_timefmt" will be used to decode values. +// +// To scan values in custom formats, [sqlite3.TimeFormat.Scanner] may be helpful. +// To bind values in custom formats, [sqlite3.TimeFormat.Encode] them before binding. // // When using a custom time struct, you'll have to implement // [database/sql/driver.Valuer] and [database/sql.Scanner]. @@ -48,7 +71,7 @@ // The Scan method needs to take into account that the value it receives can be of differing types. // It can already be a [time.Time], if the driver decoded the value according to "_timefmt" rules. // Or it can be a: string, int64, float64, []byte, or nil, -// depending on the column type and what whoever wrote the value. +// depending on the column type and whoever wrote the value. // [sqlite3.TimeFormat.Decode] may help. // // # Setting PRAGMAs @@ -358,13 +381,10 @@ func (c *conn) Commit() error { } func (c *conn) Rollback() error { - err := c.Conn.Exec(`ROLLBACK` + c.txReset) - if errors.Is(err, sqlite3.INTERRUPT) { - old := c.Conn.SetInterrupt(context.Background()) - defer c.Conn.SetInterrupt(old) - err = c.Conn.Exec(`ROLLBACK` + c.txReset) - } - return err + // ROLLBACK even if interrupted. + old := c.Conn.SetInterrupt(context.Background()) + defer c.Conn.SetInterrupt(old) + return c.Conn.Exec(`ROLLBACK` + c.txReset) } func (c *conn) Prepare(query string) (driver.Stmt, error) { @@ -598,6 +618,28 @@ const ( _TIME ) +func scanFromDecl(decl string) scantype { + // These types are only used before we have rows, + // and otherwise as type hints. + // The first few ensure STRICT tables are strictly typed. + // The other two are type hints for booleans and time. + switch decl { + case "INT", "INTEGER": + return _INT + case "REAL": + return _REAL + case "TEXT": + return _TEXT + case "BLOB": + return _BLOB + case "BOOLEAN": + return _BOOL + case "DATE", "TIME", "DATETIME", "TIMESTAMP": + return _TIME + } + return _ANY +} + var ( // Ensure these interfaces are implemented: _ driver.RowsColumnTypeDatabaseTypeName = &rows{} @@ -622,6 +664,18 @@ func (r *rows) Columns() []string { return r.names } +func (r *rows) scanType(index int) scantype { + if r.scans == nil { + count := r.Stmt.ColumnCount() + scans := make([]scantype, count) + for i := range scans { + scans[i] = scanFromDecl(strings.ToUpper(r.Stmt.ColumnDeclType(i))) + } + r.scans = scans + } + return r.scans[index] +} + func (r *rows) loadColumnMetadata() { if r.nulls == nil { count := r.Stmt.ColumnCount() @@ -635,24 +689,7 @@ func (r *rows) loadColumnMetadata() { r.Stmt.ColumnTableName(i), col) types[i] = strings.ToUpper(types[i]) - // These types are only used before we have rows, - // and otherwise as type hints. - // The first few ensure STRICT tables are strictly typed. - // The other two are type hints for booleans and time. - switch types[i] { - case "INT", "INTEGER": - scans[i] = _INT - case "REAL": - scans[i] = _REAL - case "TEXT": - scans[i] = _TEXT - case "BLOB": - scans[i] = _BLOB - case "BOOLEAN": - scans[i] = _BOOL - case "DATE", "TIME", "DATETIME", "TIMESTAMP": - scans[i] = _TIME - } + scans[i] = scanFromDecl(types[i]) } } r.nulls = nulls @@ -661,27 +698,15 @@ func (r *rows) loadColumnMetadata() { } } -func (r *rows) declType(index int) string { - if r.types == nil { - count := r.Stmt.ColumnCount() - types := make([]string, count) - for i := range types { - types[i] = strings.ToUpper(r.Stmt.ColumnDeclType(i)) - } - r.types = types - } - return r.types[index] -} - func (r *rows) ColumnTypeDatabaseTypeName(index int) string { r.loadColumnMetadata() - decltype := r.types[index] - if len := len(decltype); len > 0 && decltype[len-1] == ')' { - if i := strings.LastIndexByte(decltype, '('); i >= 0 { - decltype = decltype[:i] + decl := r.types[index] + if len := len(decl); len > 0 && decl[len-1] == ')' { + if i := strings.LastIndexByte(decl, '('); i >= 0 { + decl = decl[:i] } } - return strings.TrimSpace(decltype) + return strings.TrimSpace(decl) } func (r *rows) ColumnTypeNullable(index int) (nullable, ok bool) { @@ -748,36 +773,49 @@ func (r *rows) Next(dest []driver.Value) error { } data := unsafe.Slice((*any)(unsafe.SliceData(dest)), len(dest)) - err := r.Stmt.Columns(data...) + if err := r.Stmt.ColumnsRaw(data...); err != nil { + return err + } for i := range dest { - if t, ok := r.decodeTime(i, dest[i]); ok { - dest[i] = t - } - } - return err -} - -func (r *rows) decodeTime(i int, v any) (_ time.Time, ok bool) { - switch v := v.(type) { - case int64, float64: - // could be a time value - case string: - if r.tmWrite != "" && r.tmWrite != time.RFC3339 && r.tmWrite != time.RFC3339Nano { + scan := r.scanType(i) + switch v := dest[i].(type) { + case int64: + if scan == _BOOL { + switch v { + case 1: + dest[i] = true + case 0: + dest[i] = false + } + continue + } + case []byte: + if len(v) == cap(v) { // a BLOB + continue + } + if scan != _TEXT { + switch r.tmWrite { + case "", time.RFC3339, time.RFC3339Nano: + t, ok := maybeTime(v) + if ok { + dest[i] = t + continue + } + } + } + dest[i] = string(v) + case float64: break + default: + continue } - t, ok := maybeTime(v) - if ok { - return t, true + if scan == _TIME { + t, err := r.tmRead.Decode(dest[i]) + if err == nil { + dest[i] = t + continue + } } - default: - return } - switch r.declType(i) { - case "DATE", "TIME", "DATETIME", "TIMESTAMP": - // could be a time value - default: - return - } - t, err := r.tmRead.Decode(v) - return t, err == nil + return nil } diff --git a/vendor/github.com/ncruces/go-sqlite3/driver/time.go b/vendor/github.com/ncruces/go-sqlite3/driver/time.go index b3ebdd263..4d48bd8dc 100644 --- a/vendor/github.com/ncruces/go-sqlite3/driver/time.go +++ b/vendor/github.com/ncruces/go-sqlite3/driver/time.go @@ -1,12 +1,15 @@ package driver -import "time" +import ( + "bytes" + "time" +) // Convert a string in [time.RFC3339Nano] format into a [time.Time] // if it roundtrips back to the same string. // This way times can be persisted to, and recovered from, the database, // but if a string is needed, [database/sql] will recover the same string. -func maybeTime(text string) (_ time.Time, _ bool) { +func maybeTime(text []byte) (_ time.Time, _ bool) { // Weed out (some) values that can't possibly be // [time.RFC3339Nano] timestamps. if len(text) < len("2006-01-02T15:04:05Z") { @@ -21,8 +24,8 @@ func maybeTime(text string) (_ time.Time, _ bool) { // Slow path. var buf [len(time.RFC3339Nano)]byte - date, err := time.Parse(time.RFC3339Nano, text) - if err == nil && text == string(date.AppendFormat(buf[:0], time.RFC3339Nano)) { + date, err := time.Parse(time.RFC3339Nano, string(text)) + if err == nil && bytes.Equal(text, date.AppendFormat(buf[:0], time.RFC3339Nano)) { return date, true } return diff --git a/vendor/github.com/ncruces/go-sqlite3/error.go b/vendor/github.com/ncruces/go-sqlite3/error.go index 6d4bd63f8..59982eafd 100644 --- a/vendor/github.com/ncruces/go-sqlite3/error.go +++ b/vendor/github.com/ncruces/go-sqlite3/error.go @@ -2,7 +2,6 @@ package sqlite3 import ( "errors" - "strconv" "strings" "github.com/ncruces/go-sqlite3/internal/util" @@ -12,7 +11,6 @@ import ( // // https://sqlite.org/c3ref/errcode.html type Error struct { - str string msg string sql string code res_t @@ -29,19 +27,13 @@ func (e *Error) Code() ErrorCode { // // https://sqlite.org/rescode.html func (e *Error) ExtendedCode() ExtendedErrorCode { - return ExtendedErrorCode(e.code) + return xErrorCode(e.code) } // Error implements the error interface. func (e *Error) Error() string { var b strings.Builder - b.WriteString("sqlite3: ") - - if e.str != "" { - b.WriteString(e.str) - } else { - b.WriteString(strconv.Itoa(int(e.code))) - } + b.WriteString(util.ErrorCodeString(uint32(e.code))) if e.msg != "" { b.WriteString(": ") @@ -103,12 +95,12 @@ func (e ErrorCode) Error() string { // Temporary returns true for [BUSY] errors. func (e ErrorCode) Temporary() bool { - return e == BUSY + return e == BUSY || e == INTERRUPT } // ExtendedCode returns the extended error code for this error. func (e ErrorCode) ExtendedCode() ExtendedErrorCode { - return ExtendedErrorCode(e) + return xErrorCode(e) } // Error implements the error interface. @@ -133,7 +125,7 @@ func (e ExtendedErrorCode) As(err any) bool { // Temporary returns true for [BUSY] errors. func (e ExtendedErrorCode) Temporary() bool { - return ErrorCode(e) == BUSY + return ErrorCode(e) == BUSY || ErrorCode(e) == INTERRUPT } // Timeout returns true for [BUSY_TIMEOUT] errors. diff --git a/vendor/github.com/ncruces/go-sqlite3/func.go b/vendor/github.com/ncruces/go-sqlite3/func.go index f907fa940..16b43056d 100644 --- a/vendor/github.com/ncruces/go-sqlite3/func.go +++ b/vendor/github.com/ncruces/go-sqlite3/func.go @@ -3,7 +3,9 @@ package sqlite3 import ( "context" "io" + "iter" "sync" + "sync/atomic" "github.com/tetratelabs/wazero/api" @@ -45,7 +47,7 @@ func (c Conn) AnyCollationNeeded() error { // CreateCollation defines a new collating sequence. // // https://sqlite.org/c3ref/create_collation.html -func (c *Conn) CreateCollation(name string, fn func(a, b []byte) int) error { +func (c *Conn) CreateCollation(name string, fn CollatingFunction) error { var funcPtr ptr_t defer c.arena.mark()() namePtr := c.arena.string(name) @@ -57,6 +59,10 @@ func (c *Conn) CreateCollation(name string, fn func(a, b []byte) int) error { return c.error(rc) } +// Collating function is the type of a collation callback. +// Implementations must not retain a or b. +type CollatingFunction func(a, b []byte) int + // CreateFunction defines a new scalar SQL function. // // https://sqlite.org/c3ref/create_function.html @@ -77,34 +83,67 @@ func (c *Conn) CreateFunction(name string, nArg int, flag FunctionFlag, fn Scala // Implementations must not retain arg. type ScalarFunction func(ctx Context, arg ...Value) -// CreateWindowFunction defines a new aggregate or aggregate window SQL function. -// If fn returns a [WindowFunction], then an aggregate window function is created. -// If fn returns an [io.Closer], it will be called to free resources. +// CreateAggregateFunction defines a new aggregate SQL function. // // https://sqlite.org/c3ref/create_function.html -func (c *Conn) CreateWindowFunction(name string, nArg int, flag FunctionFlag, fn func() AggregateFunction) error { +func (c *Conn) CreateAggregateFunction(name string, nArg int, flag FunctionFlag, fn AggregateSeqFunction) error { var funcPtr ptr_t defer c.arena.mark()() namePtr := c.arena.string(name) - call := "sqlite3_create_aggregate_function_go" if fn != nil { - agg := fn() - if c, ok := agg.(io.Closer); ok { - if err := c.Close(); err != nil { - return err + funcPtr = util.AddHandle(c.ctx, AggregateConstructor(func() AggregateFunction { + var a aggregateFunc + coro := func(yieldCoro func(struct{}) bool) { + seq := func(yieldSeq func([]Value) bool) { + for yieldSeq(a.arg) { + if !yieldCoro(struct{}{}) { + break + } + } + } + fn(&a.ctx, seq) } - } - if _, ok := agg.(WindowFunction); ok { - call = "sqlite3_create_window_function_go" - } - funcPtr = util.AddHandle(c.ctx, fn) + a.next, a.stop = iter.Pull(coro) + return &a + })) } - rc := res_t(c.call(call, + rc := res_t(c.call("sqlite3_create_aggregate_function_go", stk_t(c.handle), stk_t(namePtr), stk_t(nArg), stk_t(flag), stk_t(funcPtr))) return c.error(rc) } +// AggregateSeqFunction is the type of an aggregate SQL function. +// Implementations must not retain the slices yielded by seq. +type AggregateSeqFunction func(ctx *Context, seq iter.Seq[[]Value]) + +// CreateWindowFunction defines a new aggregate or aggregate window SQL function. +// If fn returns a [WindowFunction], an aggregate window function is created. +// If fn returns an [io.Closer], it will be called to free resources. +// +// https://sqlite.org/c3ref/create_function.html +func (c *Conn) CreateWindowFunction(name string, nArg int, flag FunctionFlag, fn AggregateConstructor) error { + var funcPtr ptr_t + defer c.arena.mark()() + namePtr := c.arena.string(name) + if fn != nil { + funcPtr = util.AddHandle(c.ctx, AggregateConstructor(func() AggregateFunction { + agg := fn() + if win, ok := agg.(WindowFunction); ok { + return win + } + return windowFunc{agg, name} + })) + } + rc := res_t(c.call("sqlite3_create_window_function_go", + stk_t(c.handle), stk_t(namePtr), stk_t(nArg), + stk_t(flag), stk_t(funcPtr))) + return c.error(rc) +} + +// AggregateConstructor is a an [AggregateFunction] constructor. +type AggregateConstructor func() AggregateFunction + // AggregateFunction is the interface an aggregate function should implement. // // https://sqlite.org/appfunc.html @@ -153,26 +192,24 @@ func collationCallback(ctx context.Context, mod api.Module, pArg, pDB ptr_t, eTe } func compareCallback(ctx context.Context, mod api.Module, pApp ptr_t, nKey1 int32, pKey1 ptr_t, nKey2 int32, pKey2 ptr_t) uint32 { - fn := util.GetHandle(ctx, pApp).(func(a, b []byte) int) + fn := util.GetHandle(ctx, pApp).(CollatingFunction) return uint32(fn(util.View(mod, pKey1, int64(nKey1)), util.View(mod, pKey2, int64(nKey2)))) } func funcCallback(ctx context.Context, mod api.Module, pCtx, pApp ptr_t, nArg int32, pArg ptr_t) { - args := getFuncArgs() - defer putFuncArgs(args) db := ctx.Value(connKey{}).(*Conn) + args := callbackArgs(db, nArg, pArg) + defer returnArgs(args) fn := util.GetHandle(db.ctx, pApp).(ScalarFunction) - callbackArgs(db, args[:nArg], pArg) - fn(Context{db, pCtx}, args[:nArg]...) + fn(Context{db, pCtx}, *args...) } func stepCallback(ctx context.Context, mod api.Module, pCtx, pAgg, pApp ptr_t, nArg int32, pArg ptr_t) { - args := getFuncArgs() - defer putFuncArgs(args) db := ctx.Value(connKey{}).(*Conn) - callbackArgs(db, args[:nArg], pArg) + args := callbackArgs(db, nArg, pArg) + defer returnArgs(args) fn, _ := callbackAggregate(db, pAgg, pApp) - fn.Step(Context{db, pCtx}, args[:nArg]...) + fn.Step(Context{db, pCtx}, *args...) } func valueCallback(ctx context.Context, mod api.Module, pCtx, pAgg, pApp ptr_t, final int32) { @@ -196,12 +233,11 @@ func valueCallback(ctx context.Context, mod api.Module, pCtx, pAgg, pApp ptr_t, } func inverseCallback(ctx context.Context, mod api.Module, pCtx, pAgg ptr_t, nArg int32, pArg ptr_t) { - args := getFuncArgs() - defer putFuncArgs(args) db := ctx.Value(connKey{}).(*Conn) - callbackArgs(db, args[:nArg], pArg) + args := callbackArgs(db, nArg, pArg) + defer returnArgs(args) fn := util.GetHandle(db.ctx, pAgg).(WindowFunction) - fn.Inverse(Context{db, pCtx}, args[:nArg]...) + fn.Inverse(Context{db, pCtx}, *args...) } func callbackAggregate(db *Conn, pAgg, pApp ptr_t) (AggregateFunction, ptr_t) { @@ -211,7 +247,7 @@ func callbackAggregate(db *Conn, pAgg, pApp ptr_t) (AggregateFunction, ptr_t) { } // We need to create the aggregate. - fn := util.GetHandle(db.ctx, pApp).(func() AggregateFunction)() + fn := util.GetHandle(db.ctx, pApp).(AggregateConstructor)() if pAgg != 0 { handle := util.AddHandle(db.ctx, fn) util.Write32(db.mod, pAgg, handle) @@ -220,25 +256,64 @@ func callbackAggregate(db *Conn, pAgg, pApp ptr_t) (AggregateFunction, ptr_t) { return fn, 0 } -func callbackArgs(db *Conn, arg []Value, pArg ptr_t) { - for i := range arg { - arg[i] = Value{ +var ( + valueArgsPool sync.Pool + valueArgsLen atomic.Int32 +) + +func callbackArgs(db *Conn, nArg int32, pArg ptr_t) *[]Value { + arg, ok := valueArgsPool.Get().(*[]Value) + if !ok || cap(*arg) < int(nArg) { + max := valueArgsLen.Or(nArg) | nArg + lst := make([]Value, max) + arg = &lst + } + lst := (*arg)[:nArg] + for i := range lst { + lst[i] = Value{ c: db, handle: util.Read32[ptr_t](db.mod, pArg+ptr_t(i)*ptrlen), } } + *arg = lst + return arg } -var funcArgsPool sync.Pool - -func putFuncArgs(p *[_MAX_FUNCTION_ARG]Value) { - funcArgsPool.Put(p) +func returnArgs(p *[]Value) { + valueArgsPool.Put(p) } -func getFuncArgs() *[_MAX_FUNCTION_ARG]Value { - if p := funcArgsPool.Get(); p == nil { - return new([_MAX_FUNCTION_ARG]Value) - } else { - return p.(*[_MAX_FUNCTION_ARG]Value) +type aggregateFunc struct { + next func() (struct{}, bool) + stop func() + ctx Context + arg []Value +} + +func (a *aggregateFunc) Step(ctx Context, arg ...Value) { + a.ctx = ctx + a.arg = append(a.arg[:0], arg...) + if _, more := a.next(); !more { + a.stop() } } + +func (a *aggregateFunc) Value(ctx Context) { + a.ctx = ctx + a.stop() +} + +func (a *aggregateFunc) Close() error { + a.stop() + return nil +} + +type windowFunc struct { + AggregateFunction + name string +} + +func (w windowFunc) Inverse(ctx Context, arg ...Value) { + // Implementing inverse allows certain queries that don't really need it to succeed. + ctx.ResultError(util.ErrorString(w.name + ": may not be used as a window function")) +} diff --git a/vendor/github.com/ncruces/go-sqlite3/internal/util/error.go b/vendor/github.com/ncruces/go-sqlite3/internal/util/error.go index 2aecac96e..76769ed2e 100644 --- a/vendor/github.com/ncruces/go-sqlite3/internal/util/error.go +++ b/vendor/github.com/ncruces/go-sqlite3/internal/util/error.go @@ -75,7 +75,7 @@ func ErrorCodeString(rc uint32) string { return "sqlite3: unable to open database file" case PROTOCOL: return "sqlite3: locking protocol" - case FORMAT: + case EMPTY: break case SCHEMA: return "sqlite3: database schema has changed" @@ -91,7 +91,7 @@ func ErrorCodeString(rc uint32) string { break case AUTH: return "sqlite3: authorization denied" - case EMPTY: + case FORMAT: break case RANGE: return "sqlite3: column index out of range" diff --git a/vendor/github.com/ncruces/go-sqlite3/internal/util/mem.go b/vendor/github.com/ncruces/go-sqlite3/internal/util/mem.go index d2fea08b4..90c0e9e54 100644 --- a/vendor/github.com/ncruces/go-sqlite3/internal/util/mem.go +++ b/vendor/github.com/ncruces/go-sqlite3/internal/util/mem.go @@ -135,11 +135,10 @@ func ReadString(mod api.Module, ptr Ptr_t, maxlen int64) string { panic(RangeErr) } } - if i := bytes.IndexByte(buf, 0); i < 0 { - panic(NoNulErr) - } else { + if i := bytes.IndexByte(buf, 0); i >= 0 { return string(buf[:i]) } + panic(NoNulErr) } func WriteBytes(mod api.Module, ptr Ptr_t, b []byte) { diff --git a/vendor/github.com/ncruces/go-sqlite3/sqlite.go b/vendor/github.com/ncruces/go-sqlite3/sqlite.go index 9e2d1d381..c05a86fde 100644 --- a/vendor/github.com/ncruces/go-sqlite3/sqlite.go +++ b/vendor/github.com/ncruces/go-sqlite3/sqlite.go @@ -120,33 +120,33 @@ func (sqlt *sqlite) error(rc res_t, handle ptr_t, sql ...string) error { return nil } - err := Error{code: rc} - - if err.Code() == NOMEM || err.ExtendedCode() == IOERR_NOMEM { + if ErrorCode(rc) == NOMEM || xErrorCode(rc) == IOERR_NOMEM { panic(util.OOMErr) } - if ptr := ptr_t(sqlt.call("sqlite3_errstr", stk_t(rc))); ptr != 0 { - err.str = util.ReadString(sqlt.mod, ptr, _MAX_NAME) - } - if handle != 0 { + var msg, query string if ptr := ptr_t(sqlt.call("sqlite3_errmsg", stk_t(handle))); ptr != 0 { - err.msg = util.ReadString(sqlt.mod, ptr, _MAX_LENGTH) + msg = util.ReadString(sqlt.mod, ptr, _MAX_LENGTH) + switch { + case msg == "not an error": + msg = "" + case msg == util.ErrorCodeString(uint32(rc))[len("sqlite3: "):]: + msg = "" + } } if len(sql) != 0 { if i := int32(sqlt.call("sqlite3_error_offset", stk_t(handle))); i != -1 { - err.sql = sql[0][i:] + query = sql[0][i:] } } - } - switch err.msg { - case err.str, "not an error": - err.msg = "" + if msg != "" || query != "" { + return &Error{code: rc, msg: msg, sql: query} + } } - return &err + return xErrorCode(rc) } func (sqlt *sqlite) getfn(name string) api.Function { @@ -212,14 +212,10 @@ func (sqlt *sqlite) realloc(ptr ptr_t, size int64) ptr_t { } func (sqlt *sqlite) newBytes(b []byte) ptr_t { - if (*[0]byte)(b) == nil { + if len(b) == 0 { return 0 } - size := len(b) - if size == 0 { - size = 1 - } - ptr := sqlt.new(int64(size)) + ptr := sqlt.new(int64(len(b))) util.WriteBytes(sqlt.mod, ptr, b) return ptr } @@ -288,7 +284,7 @@ func (a *arena) new(size int64) ptr_t { } func (a *arena) bytes(b []byte) ptr_t { - if (*[0]byte)(b) == nil { + if len(b) == 0 { return 0 } ptr := a.new(int64(len(b))) diff --git a/vendor/github.com/ncruces/go-sqlite3/stmt.go b/vendor/github.com/ncruces/go-sqlite3/stmt.go index 4e17d1039..1ea726ea1 100644 --- a/vendor/github.com/ncruces/go-sqlite3/stmt.go +++ b/vendor/github.com/ncruces/go-sqlite3/stmt.go @@ -106,7 +106,14 @@ func (s *Stmt) Busy() bool { // // https://sqlite.org/c3ref/step.html func (s *Stmt) Step() bool { - s.c.checkInterrupt(s.c.handle) + if s.c.interrupt.Err() != nil { + s.err = INTERRUPT + return false + } + return s.step() +} + +func (s *Stmt) step() bool { rc := res_t(s.c.call("sqlite3_step", stk_t(s.handle))) switch rc { case _ROW: @@ -131,7 +138,11 @@ func (s *Stmt) Err() error { // Exec is a convenience function that repeatedly calls [Stmt.Step] until it returns false, // then calls [Stmt.Reset] to reset the statement and get any error that occurred. func (s *Stmt) Exec() error { - for s.Step() { + if s.c.interrupt.Err() != nil { + return INTERRUPT + } + // TODO: implement this in C. + for s.step() { } return s.Reset() } @@ -254,13 +265,15 @@ func (s *Stmt) BindText(param int, value string) error { // BindRawText binds a []byte to the prepared statement as text. // The leftmost SQL parameter has an index of 1. -// Binding a nil slice is the same as calling [Stmt.BindNull]. // // https://sqlite.org/c3ref/bind_blob.html func (s *Stmt) BindRawText(param int, value []byte) error { if len(value) > _MAX_LENGTH { return TOOBIG } + if len(value) == 0 { + return s.BindText(param, "") + } ptr := s.c.newBytes(value) rc := res_t(s.c.call("sqlite3_bind_text_go", stk_t(s.handle), stk_t(param), @@ -270,13 +283,15 @@ func (s *Stmt) BindRawText(param int, value []byte) error { // BindBlob binds a []byte to the prepared statement. // The leftmost SQL parameter has an index of 1. -// Binding a nil slice is the same as calling [Stmt.BindNull]. // // https://sqlite.org/c3ref/bind_blob.html func (s *Stmt) BindBlob(param int, value []byte) error { if len(value) > _MAX_LENGTH { return TOOBIG } + if len(value) == 0 { + return s.BindZeroBlob(param, 0) + } ptr := s.c.newBytes(value) rc := res_t(s.c.call("sqlite3_bind_blob_go", stk_t(s.handle), stk_t(param), @@ -560,7 +575,7 @@ func (s *Stmt) ColumnBlob(col int, buf []byte) []byte { func (s *Stmt) ColumnRawText(col int) []byte { ptr := ptr_t(s.c.call("sqlite3_column_text", stk_t(s.handle), stk_t(col))) - return s.columnRawBytes(col, ptr) + return s.columnRawBytes(col, ptr, 1) } // ColumnRawBlob returns the value of the result column as a []byte. @@ -572,10 +587,10 @@ func (s *Stmt) ColumnRawText(col int) []byte { func (s *Stmt) ColumnRawBlob(col int) []byte { ptr := ptr_t(s.c.call("sqlite3_column_blob", stk_t(s.handle), stk_t(col))) - return s.columnRawBytes(col, ptr) + return s.columnRawBytes(col, ptr, 0) } -func (s *Stmt) columnRawBytes(col int, ptr ptr_t) []byte { +func (s *Stmt) columnRawBytes(col int, ptr ptr_t, nul int32) []byte { if ptr == 0 { rc := res_t(s.c.call("sqlite3_errcode", stk_t(s.c.handle))) if rc != _ROW && rc != _DONE { @@ -586,7 +601,7 @@ func (s *Stmt) columnRawBytes(col int, ptr ptr_t) []byte { n := int32(s.c.call("sqlite3_column_bytes", stk_t(s.handle), stk_t(col))) - return util.View(s.c.mod, ptr, int64(n)) + return util.View(s.c.mod, ptr, int64(n+nul))[:n] } // ColumnJSON parses the JSON-encoded value of the result column @@ -633,22 +648,12 @@ func (s *Stmt) ColumnValue(col int) Value { // [INTEGER] columns will be retrieved as int64 values, // [FLOAT] as float64, [NULL] as nil, // [TEXT] as string, and [BLOB] as []byte. -// Any []byte are owned by SQLite and may be invalidated by -// subsequent calls to [Stmt] methods. func (s *Stmt) Columns(dest ...any) error { - defer s.c.arena.mark()() - count := int64(len(dest)) - typePtr := s.c.arena.new(count) - dataPtr := s.c.arena.new(count * 8) - - rc := res_t(s.c.call("sqlite3_columns_go", - stk_t(s.handle), stk_t(count), stk_t(typePtr), stk_t(dataPtr))) - if err := s.c.error(rc); err != nil { + types, ptr, err := s.columns(int64(len(dest))) + if err != nil { return err } - types := util.View(s.c.mod, typePtr, count) - // Avoid bounds checks on types below. if len(types) != len(dest) { panic(util.AssertErr()) @@ -657,26 +662,95 @@ func (s *Stmt) Columns(dest ...any) error { for i := range dest { switch types[i] { case byte(INTEGER): - dest[i] = util.Read64[int64](s.c.mod, dataPtr) + dest[i] = util.Read64[int64](s.c.mod, ptr) case byte(FLOAT): - dest[i] = util.ReadFloat64(s.c.mod, dataPtr) + dest[i] = util.ReadFloat64(s.c.mod, ptr) case byte(NULL): dest[i] = nil - default: - ptr := util.Read32[ptr_t](s.c.mod, dataPtr+0) - if ptr == 0 { - dest[i] = []byte{} - continue - } - len := util.Read32[int32](s.c.mod, dataPtr+4) - buf := util.View(s.c.mod, ptr, int64(len)) - if types[i] == byte(TEXT) { + case byte(TEXT): + len := util.Read32[int32](s.c.mod, ptr+4) + if len != 0 { + ptr := util.Read32[ptr_t](s.c.mod, ptr) + buf := util.View(s.c.mod, ptr, int64(len)) dest[i] = string(buf) } else { - dest[i] = buf + dest[i] = "" + } + case byte(BLOB): + len := util.Read32[int32](s.c.mod, ptr+4) + if len != 0 { + ptr := util.Read32[ptr_t](s.c.mod, ptr) + buf := util.View(s.c.mod, ptr, int64(len)) + tmp, _ := dest[i].([]byte) + dest[i] = append(tmp[:0], buf...) + } else { + dest[i], _ = dest[i].([]byte) } } - dataPtr += 8 + ptr += 8 } return nil } + +// ColumnsRaw populates result columns into the provided slice. +// The slice must have [Stmt.ColumnCount] length. +// +// [INTEGER] columns will be retrieved as int64 values, +// [FLOAT] as float64, [NULL] as nil, +// [TEXT] and [BLOB] as []byte. +// Any []byte are owned by SQLite and may be invalidated by +// subsequent calls to [Stmt] methods. +func (s *Stmt) ColumnsRaw(dest ...any) error { + types, ptr, err := s.columns(int64(len(dest))) + if err != nil { + return err + } + + // Avoid bounds checks on types below. + if len(types) != len(dest) { + panic(util.AssertErr()) + } + + for i := range dest { + switch types[i] { + case byte(INTEGER): + dest[i] = util.Read64[int64](s.c.mod, ptr) + case byte(FLOAT): + dest[i] = util.ReadFloat64(s.c.mod, ptr) + case byte(NULL): + dest[i] = nil + default: + len := util.Read32[int32](s.c.mod, ptr+4) + if len == 0 && types[i] == byte(BLOB) { + dest[i] = []byte{} + } else { + cap := len + if types[i] == byte(TEXT) { + cap++ + } + ptr := util.Read32[ptr_t](s.c.mod, ptr) + buf := util.View(s.c.mod, ptr, int64(cap))[:len] + dest[i] = buf + } + } + ptr += 8 + } + return nil +} + +func (s *Stmt) columns(count int64) ([]byte, ptr_t, error) { + defer s.c.arena.mark()() + typePtr := s.c.arena.new(count) + dataPtr := s.c.arena.new(count * 8) + + rc := res_t(s.c.call("sqlite3_columns_go", + stk_t(s.handle), stk_t(count), stk_t(typePtr), stk_t(dataPtr))) + if rc == res_t(MISUSE) { + return nil, 0, MISUSE + } + if err := s.c.error(rc); err != nil { + return nil, 0, err + } + + return util.View(s.c.mod, typePtr, count), dataPtr, nil +} diff --git a/vendor/github.com/ncruces/go-sqlite3/txn.go b/vendor/github.com/ncruces/go-sqlite3/txn.go index b24789f87..931b89958 100644 --- a/vendor/github.com/ncruces/go-sqlite3/txn.go +++ b/vendor/github.com/ncruces/go-sqlite3/txn.go @@ -2,7 +2,6 @@ package sqlite3 import ( "context" - "errors" "math/rand" "runtime" "strconv" @@ -21,11 +20,13 @@ type Txn struct { } // Begin starts a deferred transaction. +// It panics if a transaction is in-progress. +// For nested transactions, use [Conn.Savepoint]. // // https://sqlite.org/lang_transaction.html func (c *Conn) Begin() Txn { // BEGIN even if interrupted. - err := c.txnExecInterrupted(`BEGIN DEFERRED`) + err := c.exec(`BEGIN DEFERRED`) if err != nil { panic(err) } @@ -120,7 +121,8 @@ func (tx Txn) Commit() error { // // https://sqlite.org/lang_transaction.html func (tx Txn) Rollback() error { - return tx.c.txnExecInterrupted(`ROLLBACK`) + // ROLLBACK even if interrupted. + return tx.c.exec(`ROLLBACK`) } // Savepoint is a marker within a transaction @@ -143,7 +145,7 @@ func (c *Conn) Savepoint() Savepoint { // Names can be reused, but this makes catching bugs more likely. name = QuoteIdentifier(name + "_" + strconv.Itoa(int(rand.Int31()))) - err := c.txnExecInterrupted(`SAVEPOINT ` + name) + err := c.exec(`SAVEPOINT ` + name) if err != nil { panic(err) } @@ -199,7 +201,7 @@ func (s Savepoint) Release(errp *error) { return } // ROLLBACK and RELEASE even if interrupted. - err := s.c.txnExecInterrupted(`ROLLBACK TO ` + s.name + `; RELEASE ` + s.name) + err := s.c.exec(`ROLLBACK TO ` + s.name + `; RELEASE ` + s.name) if err != nil { panic(err) } @@ -212,17 +214,7 @@ func (s Savepoint) Release(errp *error) { // https://sqlite.org/lang_transaction.html func (s Savepoint) Rollback() error { // ROLLBACK even if interrupted. - return s.c.txnExecInterrupted(`ROLLBACK TO ` + s.name) -} - -func (c *Conn) txnExecInterrupted(sql string) error { - err := c.Exec(sql) - if errors.Is(err, INTERRUPT) { - old := c.SetInterrupt(context.Background()) - defer c.SetInterrupt(old) - err = c.Exec(sql) - } - return err + return s.c.exec(`ROLLBACK TO ` + s.name) } // TxnState determines the transaction state of a database. diff --git a/vendor/github.com/ncruces/go-sqlite3/util/osutil/open.go b/vendor/github.com/ncruces/go-sqlite3/util/osutil/open.go deleted file mode 100644 index 0242ad032..000000000 --- a/vendor/github.com/ncruces/go-sqlite3/util/osutil/open.go +++ /dev/null @@ -1,16 +0,0 @@ -//go:build !windows - -package osutil - -import ( - "io/fs" - "os" -) - -// OpenFile behaves the same as [os.OpenFile], -// except on Windows it sets [syscall.FILE_SHARE_DELETE]. -// -// See: https://go.dev/issue/32088#issuecomment-502850674 -func OpenFile(name string, flag int, perm fs.FileMode) (*os.File, error) { - return os.OpenFile(name, flag, perm) -} diff --git a/vendor/github.com/ncruces/go-sqlite3/util/osutil/open_windows.go b/vendor/github.com/ncruces/go-sqlite3/util/osutil/open_windows.go deleted file mode 100644 index febaf846e..000000000 --- a/vendor/github.com/ncruces/go-sqlite3/util/osutil/open_windows.go +++ /dev/null @@ -1,115 +0,0 @@ -package osutil - -import ( - "io/fs" - "os" - . "syscall" - "unsafe" -) - -// OpenFile behaves the same as [os.OpenFile], -// except on Windows it sets [syscall.FILE_SHARE_DELETE]. -// -// See: https://go.dev/issue/32088#issuecomment-502850674 -func OpenFile(name string, flag int, perm fs.FileMode) (*os.File, error) { - if name == "" { - return nil, &os.PathError{Op: "open", Path: name, Err: ENOENT} - } - r, e := syscallOpen(name, flag|O_CLOEXEC, uint32(perm.Perm())) - if e != nil { - return nil, &os.PathError{Op: "open", Path: name, Err: e} - } - return os.NewFile(uintptr(r), name), nil -} - -// syscallOpen is a copy of [syscall.Open] -// that uses [syscall.FILE_SHARE_DELETE]. -// -// https://go.dev/src/syscall/syscall_windows.go -func syscallOpen(path string, mode int, perm uint32) (fd Handle, err error) { - if len(path) == 0 { - return InvalidHandle, ERROR_FILE_NOT_FOUND - } - pathp, err := UTF16PtrFromString(path) - if err != nil { - return InvalidHandle, err - } - var access uint32 - switch mode & (O_RDONLY | O_WRONLY | O_RDWR) { - case O_RDONLY: - access = GENERIC_READ - case O_WRONLY: - access = GENERIC_WRITE - case O_RDWR: - access = GENERIC_READ | GENERIC_WRITE - } - if mode&O_CREAT != 0 { - access |= GENERIC_WRITE - } - if mode&O_APPEND != 0 { - access &^= GENERIC_WRITE - access |= FILE_APPEND_DATA - } - sharemode := uint32(FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE) - var sa *SecurityAttributes - if mode&O_CLOEXEC == 0 { - sa = makeInheritSa() - } - var createmode uint32 - switch { - case mode&(O_CREAT|O_EXCL) == (O_CREAT | O_EXCL): - createmode = CREATE_NEW - case mode&(O_CREAT|O_TRUNC) == (O_CREAT | O_TRUNC): - createmode = CREATE_ALWAYS - case mode&O_CREAT == O_CREAT: - createmode = OPEN_ALWAYS - case mode&O_TRUNC == O_TRUNC: - createmode = TRUNCATE_EXISTING - default: - createmode = OPEN_EXISTING - } - var attrs uint32 = FILE_ATTRIBUTE_NORMAL - if perm&S_IWRITE == 0 { - attrs = FILE_ATTRIBUTE_READONLY - if createmode == CREATE_ALWAYS { - const _ERROR_BAD_NETPATH = Errno(53) - // We have been asked to create a read-only file. - // If the file already exists, the semantics of - // the Unix open system call is to preserve the - // existing permissions. If we pass CREATE_ALWAYS - // and FILE_ATTRIBUTE_READONLY to CreateFile, - // and the file already exists, CreateFile will - // change the file permissions. - // Avoid that to preserve the Unix semantics. - h, e := CreateFile(pathp, access, sharemode, sa, TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL, 0) - switch e { - case ERROR_FILE_NOT_FOUND, _ERROR_BAD_NETPATH, ERROR_PATH_NOT_FOUND: - // File does not exist. These are the same - // errors as Errno.Is checks for ErrNotExist. - // Carry on to create the file. - default: - // Success or some different error. - return h, e - } - } - } - if createmode == OPEN_EXISTING && access == GENERIC_READ { - // Necessary for opening directory handles. - attrs |= FILE_FLAG_BACKUP_SEMANTICS - } - if mode&O_SYNC != 0 { - const _FILE_FLAG_WRITE_THROUGH = 0x80000000 - attrs |= _FILE_FLAG_WRITE_THROUGH - } - if mode&O_NONBLOCK != 0 { - attrs |= FILE_FLAG_OVERLAPPED - } - return CreateFile(pathp, access, sharemode, sa, createmode, attrs, 0) -} - -func makeInheritSa() *SecurityAttributes { - var sa SecurityAttributes - sa.Length = uint32(unsafe.Sizeof(sa)) - sa.InheritHandle = 1 - return &sa -} diff --git a/vendor/github.com/ncruces/go-sqlite3/util/osutil/osfs.go b/vendor/github.com/ncruces/go-sqlite3/util/osutil/osfs.go deleted file mode 100644 index 2e1195934..000000000 --- a/vendor/github.com/ncruces/go-sqlite3/util/osutil/osfs.go +++ /dev/null @@ -1,33 +0,0 @@ -package osutil - -import ( - "io/fs" - "os" -) - -// FS implements [fs.FS], [fs.StatFS], and [fs.ReadFileFS] -// using package [os]. -// -// This filesystem does not respect [fs.ValidPath] rules, -// and fails [testing/fstest.TestFS]! -// -// Still, it can be a useful tool to unify implementations -// that can access either the [os] filesystem or an [fs.FS]. -// It's OK to use this to open files, but you should avoid -// opening directories, resolving paths, or walking the file system. -type FS struct{} - -// Open implements [fs.FS]. -func (FS) Open(name string) (fs.File, error) { - return OpenFile(name, os.O_RDONLY, 0) -} - -// ReadFileFS implements [fs.StatFS]. -func (FS) Stat(name string) (fs.FileInfo, error) { - return os.Stat(name) -} - -// ReadFile implements [fs.ReadFileFS]. -func (FS) ReadFile(name string) ([]byte, error) { - return os.ReadFile(name) -} diff --git a/vendor/github.com/ncruces/go-sqlite3/util/osutil/osutil.go b/vendor/github.com/ncruces/go-sqlite3/util/osutil/osutil.go deleted file mode 100644 index 83444e906..000000000 --- a/vendor/github.com/ncruces/go-sqlite3/util/osutil/osutil.go +++ /dev/null @@ -1,2 +0,0 @@ -// Package osutil implements operating system utilities. -package osutil diff --git a/vendor/github.com/ncruces/go-sqlite3/util/sql3util/sql3util.go b/vendor/github.com/ncruces/go-sqlite3/util/sql3util/sql3util.go index 6be61927d..f2e33c0b2 100644 --- a/vendor/github.com/ncruces/go-sqlite3/util/sql3util/sql3util.go +++ b/vendor/github.com/ncruces/go-sqlite3/util/sql3util/sql3util.go @@ -5,5 +5,5 @@ package sql3util // // https://sqlite.org/fileformat.html#pages func ValidPageSize(s int) bool { - return 512 <= s && s <= 65536 && s&(s-1) == 0 + return s&(s-1) == 0 && 512 <= s && s <= 65536 } diff --git a/vendor/github.com/ncruces/go-sqlite3/value.go b/vendor/github.com/ncruces/go-sqlite3/value.go index a2399fba0..6753027b5 100644 --- a/vendor/github.com/ncruces/go-sqlite3/value.go +++ b/vendor/github.com/ncruces/go-sqlite3/value.go @@ -139,7 +139,7 @@ func (v Value) Blob(buf []byte) []byte { // https://sqlite.org/c3ref/value_blob.html func (v Value) RawText() []byte { ptr := ptr_t(v.c.call("sqlite3_value_text", v.protected())) - return v.rawBytes(ptr) + return v.rawBytes(ptr, 1) } // RawBlob returns the value as a []byte. @@ -149,16 +149,16 @@ func (v Value) RawText() []byte { // https://sqlite.org/c3ref/value_blob.html func (v Value) RawBlob() []byte { ptr := ptr_t(v.c.call("sqlite3_value_blob", v.protected())) - return v.rawBytes(ptr) + return v.rawBytes(ptr, 0) } -func (v Value) rawBytes(ptr ptr_t) []byte { +func (v Value) rawBytes(ptr ptr_t, nul int32) []byte { if ptr == 0 { return nil } n := int32(v.c.call("sqlite3_value_bytes", v.protected())) - return util.View(v.c.mod, ptr, int64(n)) + return util.View(v.c.mod, ptr, int64(n+nul))[:n] } // Pointer gets the pointer associated with this value, diff --git a/vendor/github.com/ncruces/go-sqlite3/vfs/README.md b/vendor/github.com/ncruces/go-sqlite3/vfs/README.md index 4e987ce3f..17c24ec65 100644 --- a/vendor/github.com/ncruces/go-sqlite3/vfs/README.md +++ b/vendor/github.com/ncruces/go-sqlite3/vfs/README.md @@ -6,22 +6,30 @@ It replaces the default SQLite VFS with a **pure Go** implementation, and exposes [interfaces](https://pkg.go.dev/github.com/ncruces/go-sqlite3/vfs#VFS) that should allow you to implement your own [custom VFSes](#custom-vfses). -Since it is a from scratch reimplementation, -there are naturally some ways it deviates from the original. +See the [support matrix](https://github.com/ncruces/go-sqlite3/wiki/Support-matrix) +for the list of supported OS and CPU architectures. -The main differences are [file locking](#file-locking) and [WAL mode](#write-ahead-logging) support. +Since this is a from scratch reimplementation, +there are naturally some ways it deviates from the original. +It's also not as battle tested as the original. + +The main differences to be aware of are +[file locking](#file-locking) and +[WAL mode](#write-ahead-logging) support. ### File Locking -POSIX advisory locks, which SQLite uses on Unix, are -[broken by design](https://github.com/sqlite/sqlite/blob/b74eb0/src/os_unix.c#L1073-L1161). +POSIX advisory locks, +which SQLite uses on [Unix](https://github.com/sqlite/sqlite/blob/5d60f4/src/os_unix.c#L13-L14), +are [broken by design](https://github.com/sqlite/sqlite/blob/5d60f4/src/os_unix.c#L1074-L1162). Instead, on Linux and macOS, this package uses [OFD locks](https://www.gnu.org/software/libc/manual/html_node/Open-File-Description-Locks.html) to synchronize access to database files. This package can also use [BSD locks](https://man.freebsd.org/cgi/man.cgi?query=flock&sektion=2), -albeit with reduced concurrency (`BEGIN IMMEDIATE` behaves like `BEGIN EXCLUSIVE`). +albeit with reduced concurrency (`BEGIN IMMEDIATE` behaves like `BEGIN EXCLUSIVE`, +[docs](https://sqlite.org/lang_transaction.html#immediate)). BSD locks are the default on BSD and illumos, but you can opt into them with the `sqlite3_flock` build tag. @@ -44,11 +52,11 @@ to check if your build supports file locking. ### Write-Ahead Logging -On Unix, this package may use `mmap` to implement +On Unix, this package uses `mmap` to implement [shared-memory for the WAL-index](https://sqlite.org/wal.html#implementation_of_shared_memory_for_the_wal_index), like SQLite. -On Windows, this package may use `MapViewOfFile`, like SQLite. +On Windows, this package uses `MapViewOfFile`, like SQLite. You can also opt into a cross-platform, in-process, memory sharing implementation with the `sqlite3_dotlk` build tag. @@ -63,6 +71,11 @@ you must disable connection pooling by calling You can use [`vfs.SupportsSharedMemory`](https://pkg.go.dev/github.com/ncruces/go-sqlite3/vfs#SupportsSharedMemory) to check if your build supports shared memory. +### Blocking Locks + +On Windows and macOS, this package implements +[Wal-mode blocking locks](https://sqlite.org/src/doc/tip/doc/wal-lock.md). + ### Batch-Atomic Write On Linux, this package may support @@ -94,8 +107,10 @@ The VFS can be customized with a few build tags: > [`unix-flock` VFS](https://sqlite.org/compile.html#enable_locking_style); > `sqlite3_dotlk` builds are compatible with the > [`unix-dotfile` VFS](https://sqlite.org/compile.html#enable_locking_style). -> If incompatible file locking is used, accessing databases concurrently with -> _other_ SQLite libraries will eventually corrupt data. + +> [!CAUTION] +> Concurrently accessing databases using incompatible VFSes +> will eventually corrupt data. ### Custom VFSes diff --git a/vendor/github.com/ncruces/go-sqlite3/vfs/cksm.go b/vendor/github.com/ncruces/go-sqlite3/vfs/cksm.go index 041defec3..0ff7b6f18 100644 --- a/vendor/github.com/ncruces/go-sqlite3/vfs/cksm.go +++ b/vendor/github.com/ncruces/go-sqlite3/vfs/cksm.go @@ -49,9 +49,7 @@ func (c cksmFile) ReadAt(p []byte, off int64) (n int, err error) { n, err = c.File.ReadAt(p, off) p = p[:n] - // SQLite is reading the header of a database file. - if c.isDB && off == 0 && len(p) >= 100 && - bytes.HasPrefix(p, []byte("SQLite format 3\000")) { + if isHeader(c.isDB, p, off) { c.init((*[100]byte)(p)) } @@ -67,9 +65,7 @@ func (c cksmFile) ReadAt(p []byte, off int64) (n int, err error) { } func (c cksmFile) WriteAt(p []byte, off int64) (n int, err error) { - // SQLite is writing the first page of a database file. - if c.isDB && off == 0 && len(p) >= 100 && - bytes.HasPrefix(p, []byte("SQLite format 3\000")) { + if isHeader(c.isDB, p, off) { c.init((*[100]byte)(p)) } @@ -116,9 +112,11 @@ func (c cksmFile) fileControl(ctx context.Context, mod api.Module, op _FcntlOpco c.inCkpt = true case _FCNTL_CKPT_DONE: c.inCkpt = false - } - if rc := vfsFileControlImpl(ctx, mod, c, op, pArg); rc != _NOTFOUND { - return rc + case _FCNTL_PRAGMA: + rc := vfsFileControlImpl(ctx, mod, c, op, pArg) + if rc != _NOTFOUND { + return rc + } } return vfsFileControlImpl(ctx, mod, c.File, op, pArg) } @@ -135,6 +133,14 @@ func (f *cksmFlags) init(header *[100]byte) { } } +func isHeader(isDB bool, p []byte, off int64) bool { + check := sql3util.ValidPageSize(len(p)) + if isDB { + check = off == 0 && len(p) >= 100 + } + return check && bytes.HasPrefix(p, []byte("SQLite format 3\000")) +} + func cksmCompute(a []byte) (cksm [8]byte) { var s1, s2 uint32 for len(a) >= 8 { diff --git a/vendor/github.com/ncruces/go-sqlite3/vfs/file.go b/vendor/github.com/ncruces/go-sqlite3/vfs/file.go index 0a3c9d622..65409823c 100644 --- a/vendor/github.com/ncruces/go-sqlite3/vfs/file.go +++ b/vendor/github.com/ncruces/go-sqlite3/vfs/file.go @@ -6,9 +6,8 @@ import ( "io/fs" "os" "path/filepath" + "runtime" "syscall" - - "github.com/ncruces/go-sqlite3/util/osutil" ) type vfsOS struct{} @@ -40,7 +39,7 @@ func (vfsOS) Delete(path string, syncDir bool) error { if err != nil { return err } - if canSyncDirs && syncDir { + if isUnix && syncDir { f, err := os.Open(filepath.Dir(path)) if err != nil { return _OK @@ -96,7 +95,7 @@ func (vfsOS) OpenFilename(name *Filename, flags OpenFlag) (File, OpenFlag, error if name == nil { f, err = os.CreateTemp(os.Getenv("SQLITE_TMPDIR"), "*.db") } else { - f, err = osutil.OpenFile(name.String(), oflags, 0666) + f, err = os.OpenFile(name.String(), oflags, 0666) } if err != nil { if name == nil { @@ -118,15 +117,17 @@ func (vfsOS) OpenFilename(name *Filename, flags OpenFlag) (File, OpenFlag, error return nil, flags, _IOERR_FSTAT } } - if flags&OPEN_DELETEONCLOSE != 0 { + if isUnix && flags&OPEN_DELETEONCLOSE != 0 { os.Remove(f.Name()) } file := vfsFile{ File: f, psow: true, + atomic: osBatchAtomic(f), readOnly: flags&OPEN_READONLY != 0, - syncDir: canSyncDirs && isCreate && isJournl, + syncDir: isUnix && isCreate && isJournl, + delete: !isUnix && flags&OPEN_DELETEONCLOSE != 0, shm: NewSharedMemory(name.String()+"-shm", flags), } return &file, flags, nil @@ -139,6 +140,8 @@ type vfsFile struct { readOnly bool keepWAL bool syncDir bool + atomic bool + delete bool psow bool } @@ -152,6 +155,9 @@ var ( ) func (f *vfsFile) Close() error { + if f.delete { + defer os.Remove(f.Name()) + } if f.shm != nil { f.shm.Close() } @@ -175,7 +181,7 @@ func (f *vfsFile) Sync(flags SyncFlag) error { if err != nil { return err } - if canSyncDirs && f.syncDir { + if isUnix && f.syncDir { f.syncDir = false d, err := os.Open(filepath.Dir(f.File.Name())) if err != nil { @@ -200,12 +206,15 @@ func (f *vfsFile) SectorSize() int { func (f *vfsFile) DeviceCharacteristics() DeviceCharacteristic { ret := IOCAP_SUBPAGE_READ - if osBatchAtomic(f.File) { + if f.atomic { ret |= IOCAP_BATCH_ATOMIC } if f.psow { ret |= IOCAP_POWERSAFE_OVERWRITE } + if runtime.GOOS == "windows" { + ret |= IOCAP_UNDELETABLE_WHEN_OPEN + } return ret } @@ -214,6 +223,9 @@ func (f *vfsFile) SizeHint(size int64) error { } func (f *vfsFile) HasMoved() (bool, error) { + if runtime.GOOS == "windows" { + return false, nil + } fi, err := f.Stat() if err != nil { return false, err diff --git a/vendor/github.com/ncruces/go-sqlite3/vfs/os_bsd.go b/vendor/github.com/ncruces/go-sqlite3/vfs/os_bsd.go index 4f6fadef4..4542f8e7c 100644 --- a/vendor/github.com/ncruces/go-sqlite3/vfs/os_bsd.go +++ b/vendor/github.com/ncruces/go-sqlite3/vfs/os_bsd.go @@ -50,11 +50,15 @@ func osDowngradeLock(file *os.File, _ LockLevel) _ErrorCode { } func osReleaseLock(file *os.File, _ LockLevel) _ErrorCode { - err := unix.Flock(int(file.Fd()), unix.LOCK_UN) - if err != nil { - return _IOERR_UNLOCK + for { + err := unix.Flock(int(file.Fd()), unix.LOCK_UN) + if err == nil { + return _OK + } + if err != unix.EINTR { + return _IOERR_UNLOCK + } } - return _OK } func osCheckReservedLock(file *os.File) (bool, _ErrorCode) { @@ -89,13 +93,18 @@ func osLock(file *os.File, typ int16, start, len int64, def _ErrorCode) _ErrorCo } func osUnlock(file *os.File, start, len int64) _ErrorCode { - err := unix.FcntlFlock(file.Fd(), unix.F_SETLK, &unix.Flock_t{ + lock := unix.Flock_t{ Type: unix.F_UNLCK, Start: start, Len: len, - }) - if err != nil { - return _IOERR_UNLOCK } - return _OK + for { + err := unix.FcntlFlock(file.Fd(), unix.F_SETLK, &lock) + if err == nil { + return _OK + } + if err != unix.EINTR { + return _IOERR_UNLOCK + } + } } diff --git a/vendor/github.com/ncruces/go-sqlite3/vfs/os_darwin.go b/vendor/github.com/ncruces/go-sqlite3/vfs/os_darwin.go index 07de7c3d8..ee08e9a7b 100644 --- a/vendor/github.com/ncruces/go-sqlite3/vfs/os_darwin.go +++ b/vendor/github.com/ncruces/go-sqlite3/vfs/os_darwin.go @@ -27,7 +27,12 @@ func osSync(file *os.File, fullsync, _ /*dataonly*/ bool) error { if fullsync { return file.Sync() } - return unix.Fsync(int(file.Fd())) + for { + err := unix.Fsync(int(file.Fd())) + if err != unix.EINTR { + return err + } + } } func osAllocate(file *os.File, size int64) error { @@ -85,13 +90,18 @@ func osLock(file *os.File, typ int16, start, len int64, timeout time.Duration, d } func osUnlock(file *os.File, start, len int64) _ErrorCode { - err := unix.FcntlFlock(file.Fd(), _F_OFD_SETLK, &unix.Flock_t{ + lock := unix.Flock_t{ Type: unix.F_UNLCK, Start: start, Len: len, - }) - if err != nil { - return _IOERR_UNLOCK } - return _OK + for { + err := unix.FcntlFlock(file.Fd(), _F_OFD_SETLK, &lock) + if err == nil { + return _OK + } + if err != unix.EINTR { + return _IOERR_UNLOCK + } + } } diff --git a/vendor/github.com/ncruces/go-sqlite3/vfs/os_linux.go b/vendor/github.com/ncruces/go-sqlite3/vfs/os_linux.go index 6199c7b00..d112c5a99 100644 --- a/vendor/github.com/ncruces/go-sqlite3/vfs/os_linux.go +++ b/vendor/github.com/ncruces/go-sqlite3/vfs/os_linux.go @@ -3,6 +3,7 @@ package vfs import ( + "io" "os" "time" @@ -11,14 +12,36 @@ import ( func osSync(file *os.File, _ /*fullsync*/, _ /*dataonly*/ bool) error { // SQLite trusts Linux's fdatasync for all fsync's. - return unix.Fdatasync(int(file.Fd())) + for { + err := unix.Fdatasync(int(file.Fd())) + if err != unix.EINTR { + return err + } + } } func osAllocate(file *os.File, size int64) error { if size == 0 { return nil } - return unix.Fallocate(int(file.Fd()), 0, 0, size) + for { + err := unix.Fallocate(int(file.Fd()), 0, 0, size) + if err == unix.EOPNOTSUPP { + break + } + if err != unix.EINTR { + return err + } + } + off, err := file.Seek(0, io.SeekEnd) + if err != nil { + return err + } + if size <= off { + return nil + } + return file.Truncate(size) + } func osReadLock(file *os.File, start, len int64, timeout time.Duration) _ErrorCode { @@ -37,22 +60,27 @@ func osLock(file *os.File, typ int16, start, len int64, timeout time.Duration, d } var err error switch { - case timeout < 0: - err = unix.FcntlFlock(file.Fd(), unix.F_OFD_SETLKW, &lock) default: err = unix.FcntlFlock(file.Fd(), unix.F_OFD_SETLK, &lock) + case timeout < 0: + err = unix.FcntlFlock(file.Fd(), unix.F_OFD_SETLKW, &lock) } return osLockErrorCode(err, def) } func osUnlock(file *os.File, start, len int64) _ErrorCode { - err := unix.FcntlFlock(file.Fd(), unix.F_OFD_SETLK, &unix.Flock_t{ + lock := unix.Flock_t{ Type: unix.F_UNLCK, Start: start, Len: len, - }) - if err != nil { - return _IOERR_UNLOCK } - return _OK + for { + err := unix.FcntlFlock(file.Fd(), unix.F_OFD_SETLK, &lock) + if err == nil { + return _OK + } + if err != unix.EINTR { + return _IOERR_UNLOCK + } + } } diff --git a/vendor/github.com/ncruces/go-sqlite3/vfs/os_std.go b/vendor/github.com/ncruces/go-sqlite3/vfs/os_std.go index 0d0ca24c9..a48c71e9f 100644 --- a/vendor/github.com/ncruces/go-sqlite3/vfs/os_std.go +++ b/vendor/github.com/ncruces/go-sqlite3/vfs/os_std.go @@ -8,8 +8,8 @@ import ( ) const ( + isUnix = false _O_NOFOLLOW = 0 - canSyncDirs = false ) func osAccess(path string, flags AccessFlag) error { diff --git a/vendor/github.com/ncruces/go-sqlite3/vfs/os_unix.go b/vendor/github.com/ncruces/go-sqlite3/vfs/os_unix.go index 9f42b5f6c..ec312ccd3 100644 --- a/vendor/github.com/ncruces/go-sqlite3/vfs/os_unix.go +++ b/vendor/github.com/ncruces/go-sqlite3/vfs/os_unix.go @@ -10,8 +10,8 @@ import ( ) const ( + isUnix = true _O_NOFOLLOW = unix.O_NOFOLLOW - canSyncDirs = true ) func osAccess(path string, flags AccessFlag) error { @@ -65,10 +65,15 @@ func osTestLock(file *os.File, start, len int64) (int16, _ErrorCode) { Start: start, Len: len, } - if unix.FcntlFlock(file.Fd(), unix.F_GETLK, &lock) != nil { - return 0, _IOERR_CHECKRESERVEDLOCK + for { + err := unix.FcntlFlock(file.Fd(), unix.F_GETLK, &lock) + if err == nil { + return lock.Type, _OK + } + if err != unix.EINTR { + return 0, _IOERR_CHECKRESERVEDLOCK + } } - return lock.Type, _OK } func osLockErrorCode(err error, def _ErrorCode) _ErrorCode { diff --git a/vendor/github.com/ncruces/go-sqlite3/vfs/os_windows.go b/vendor/github.com/ncruces/go-sqlite3/vfs/os_windows.go index ecce3cfa2..0a6693de5 100644 --- a/vendor/github.com/ncruces/go-sqlite3/vfs/os_windows.go +++ b/vendor/github.com/ncruces/go-sqlite3/vfs/os_windows.go @@ -135,12 +135,10 @@ func osWriteLock(file *os.File, start, len uint32, timeout time.Duration) _Error func osLock(file *os.File, flags, start, len uint32, timeout time.Duration, def _ErrorCode) _ErrorCode { var err error switch { - case timeout == 0: + default: err = osLockEx(file, flags|windows.LOCKFILE_FAIL_IMMEDIATELY, start, len) case timeout < 0: err = osLockEx(file, flags, start, len) - default: - err = osLockExTimeout(file, flags, start, len, timeout) } return osLockErrorCode(err, def) } @@ -162,37 +160,6 @@ func osLockEx(file *os.File, flags, start, len uint32) error { 0, len, 0, &windows.Overlapped{Offset: start}) } -func osLockExTimeout(file *os.File, flags, start, len uint32, timeout time.Duration) error { - event, err := windows.CreateEvent(nil, 1, 0, nil) - if err != nil { - return err - } - defer windows.CloseHandle(event) - - fd := windows.Handle(file.Fd()) - overlapped := &windows.Overlapped{ - Offset: start, - HEvent: event, - } - - err = windows.LockFileEx(fd, flags, 0, len, 0, overlapped) - if err != windows.ERROR_IO_PENDING { - return err - } - - ms := (timeout + time.Millisecond - 1) / time.Millisecond - rc, err := windows.WaitForSingleObject(event, uint32(ms)) - if rc == windows.WAIT_OBJECT_0 { - return nil - } - defer windows.CancelIoEx(fd, overlapped) - - if err != nil { - return err - } - return windows.Errno(rc) -} - func osLockErrorCode(err error, def _ErrorCode) _ErrorCode { if err == nil { return _OK diff --git a/vendor/github.com/ncruces/go-sqlite3/vfs/shm_bsd.go b/vendor/github.com/ncruces/go-sqlite3/vfs/shm_bsd.go index 11e7bb2fd..be1495d99 100644 --- a/vendor/github.com/ncruces/go-sqlite3/vfs/shm_bsd.go +++ b/vendor/github.com/ncruces/go-sqlite3/vfs/shm_bsd.go @@ -68,16 +68,11 @@ func (s *vfsShm) Close() error { panic(util.AssertErr()) } -func (s *vfsShm) shmOpen() _ErrorCode { +func (s *vfsShm) shmOpen() (rc _ErrorCode) { if s.vfsShmParent != nil { return _OK } - var f *os.File - // Close file on error. - // Keep this here to avoid confusing checklocks. - defer func() { f.Close() }() - vfsShmListMtx.Lock() defer vfsShmListMtx.Unlock() @@ -98,11 +93,16 @@ func (s *vfsShm) shmOpen() _ErrorCode { } // Always open file read-write, as it will be shared. - f, err = os.OpenFile(s.path, + f, err := os.OpenFile(s.path, os.O_RDWR|os.O_CREATE|_O_NOFOLLOW, 0666) if err != nil { return _CANTOPEN } + defer func() { + if rc != _OK { + f.Close() + } + }() // Dead man's switch. if lock, rc := osTestLock(f, _SHM_DMS, 1); rc != _OK { @@ -131,7 +131,6 @@ func (s *vfsShm) shmOpen() _ErrorCode { File: f, info: fi, } - f = nil // Don't close the file. for i, g := range vfsShmList { if g == nil { vfsShmList[i] = s.vfsShmParent diff --git a/vendor/github.com/ncruces/go-sqlite3/vfs/shm_windows.go b/vendor/github.com/ncruces/go-sqlite3/vfs/shm_windows.go index ed2e93f8e..7cc5b2a23 100644 --- a/vendor/github.com/ncruces/go-sqlite3/vfs/shm_windows.go +++ b/vendor/github.com/ncruces/go-sqlite3/vfs/shm_windows.go @@ -7,14 +7,11 @@ import ( "io" "os" "sync" - "syscall" - "time" "github.com/tetratelabs/wazero/api" "golang.org/x/sys/windows" "github.com/ncruces/go-sqlite3/internal/util" - "github.com/ncruces/go-sqlite3/util/osutil" ) type vfsShm struct { @@ -33,8 +30,6 @@ type vfsShm struct { sync.Mutex } -var _ blockingSharedMemory = &vfsShm{} - func (s *vfsShm) Close() error { // Unmap regions. for _, r := range s.regions { @@ -48,8 +43,7 @@ func (s *vfsShm) Close() error { func (s *vfsShm) shmOpen() _ErrorCode { if s.File == nil { - f, err := osutil.OpenFile(s.path, - os.O_RDWR|os.O_CREATE|syscall.O_NONBLOCK, 0666) + f, err := os.OpenFile(s.path, os.O_RDWR|os.O_CREATE, 0666) if err != nil { return _CANTOPEN } @@ -67,7 +61,7 @@ func (s *vfsShm) shmOpen() _ErrorCode { return _IOERR_SHMOPEN } } - rc := osReadLock(s.File, _SHM_DMS, 1, time.Millisecond) + rc := osReadLock(s.File, _SHM_DMS, 1, 0) s.fileLock = rc == _OK return rc } @@ -135,11 +129,6 @@ func (s *vfsShm) shmMap(ctx context.Context, mod api.Module, id, size int32, ext } func (s *vfsShm) shmLock(offset, n int32, flags _ShmFlag) (rc _ErrorCode) { - var timeout time.Duration - if s.blocking { - timeout = time.Millisecond - } - switch { case flags&_SHM_LOCK != 0: defer s.shmAcquire(&rc) @@ -151,9 +140,9 @@ func (s *vfsShm) shmLock(offset, n int32, flags _ShmFlag) (rc _ErrorCode) { case flags&_SHM_UNLOCK != 0: return osUnlock(s.File, _SHM_BASE+uint32(offset), uint32(n)) case flags&_SHM_SHARED != 0: - return osReadLock(s.File, _SHM_BASE+uint32(offset), uint32(n), timeout) + return osReadLock(s.File, _SHM_BASE+uint32(offset), uint32(n), 0) case flags&_SHM_EXCLUSIVE != 0: - return osWriteLock(s.File, _SHM_BASE+uint32(offset), uint32(n), timeout) + return osWriteLock(s.File, _SHM_BASE+uint32(offset), uint32(n), 0) default: panic(util.AssertErr()) } @@ -184,7 +173,3 @@ func (s *vfsShm) shmUnmap(delete bool) { os.Remove(s.path) } } - -func (s *vfsShm) shmEnableBlocking(block bool) { - s.blocking = block -} diff --git a/vendor/github.com/ncruces/go-sqlite3/vtab.go b/vendor/github.com/ncruces/go-sqlite3/vtab.go index 884aaaa0c..16ff2806b 100644 --- a/vendor/github.com/ncruces/go-sqlite3/vtab.go +++ b/vendor/github.com/ncruces/go-sqlite3/vtab.go @@ -79,9 +79,12 @@ func implements[T any](typ reflect.Type) bool { // // https://sqlite.org/c3ref/declare_vtab.html func (c *Conn) DeclareVTab(sql string) error { + if c.interrupt.Err() != nil { + return INTERRUPT + } defer c.arena.mark()() - sqlPtr := c.arena.string(sql) - rc := res_t(c.call("sqlite3_declare_vtab", stk_t(c.handle), stk_t(sqlPtr))) + textPtr := c.arena.string(sql) + rc := res_t(c.call("sqlite3_declare_vtab", stk_t(c.handle), stk_t(textPtr))) return c.error(rc) } @@ -162,6 +165,7 @@ type VTabDestroyer interface { } // A VTabUpdater allows a virtual table to be updated. +// Implementations must not retain arg. type VTabUpdater interface { VTab // https://sqlite.org/vtab.html#xupdate @@ -241,6 +245,7 @@ type VTabSavepointer interface { // to loop through the virtual table. // A VTabCursor may optionally implement // [io.Closer] to free resources. +// Implementations of Filter must not retain arg. // // https://sqlite.org/c3ref/vtab_cursor.html type VTabCursor interface { @@ -489,12 +494,12 @@ func vtabBestIndexCallback(ctx context.Context, mod api.Module, pVTab, pIdxInfo } func vtabUpdateCallback(ctx context.Context, mod api.Module, pVTab ptr_t, nArg int32, pArg, pRowID ptr_t) res_t { - vtab := vtabGetHandle(ctx, mod, pVTab).(VTabUpdater) - db := ctx.Value(connKey{}).(*Conn) - args := make([]Value, nArg) - callbackArgs(db, args, pArg) - rowID, err := vtab.Update(args...) + args := callbackArgs(db, nArg, pArg) + defer returnArgs(args) + + vtab := vtabGetHandle(ctx, mod, pVTab).(VTabUpdater) + rowID, err := vtab.Update(*args...) if err == nil { util.Write64(mod, pRowID, rowID) } @@ -593,15 +598,17 @@ func cursorCloseCallback(ctx context.Context, mod api.Module, pCur ptr_t) res_t } func cursorFilterCallback(ctx context.Context, mod api.Module, pCur ptr_t, idxNum int32, idxStr ptr_t, nArg int32, pArg ptr_t) res_t { - cursor := vtabGetHandle(ctx, mod, pCur).(VTabCursor) db := ctx.Value(connKey{}).(*Conn) - args := make([]Value, nArg) - callbackArgs(db, args, pArg) + args := callbackArgs(db, nArg, pArg) + defer returnArgs(args) + var idxName string if idxStr != 0 { idxName = util.ReadString(mod, idxStr, _MAX_LENGTH) } - err := cursor.Filter(int(idxNum), idxName, args...) + + cursor := vtabGetHandle(ctx, mod, pCur).(VTabCursor) + err := cursor.Filter(int(idxNum), idxName, *args...) return vtabError(ctx, mod, pCur, _CURSOR_ERROR, err) } diff --git a/vendor/modules.txt b/vendor/modules.txt index a6317e4d9..5e421a2da 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -691,7 +691,7 @@ github.com/modern-go/reflect2 # github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 ## explicit github.com/munnerz/goautoneg -# github.com/ncruces/go-sqlite3 v0.24.0 +# github.com/ncruces/go-sqlite3 v0.25.0 ## explicit; go 1.23.0 github.com/ncruces/go-sqlite3 github.com/ncruces/go-sqlite3/driver @@ -699,7 +699,6 @@ github.com/ncruces/go-sqlite3/embed github.com/ncruces/go-sqlite3/internal/alloc github.com/ncruces/go-sqlite3/internal/dotlk github.com/ncruces/go-sqlite3/internal/util -github.com/ncruces/go-sqlite3/util/osutil github.com/ncruces/go-sqlite3/util/sql3util github.com/ncruces/go-sqlite3/vfs github.com/ncruces/go-sqlite3/vfs/memdb From b1844323314dd1f0832f1fcdb765a7f67ca01dbc Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Fri, 4 Apr 2025 18:29:22 +0200 Subject: [PATCH 07/15] [feature] Allow editing domain blocks/allows, fix comment import (#3967) * start implementing editing of existing domain permissions * [feature] Allow editing domain blocks/allows, fix comment import * [bugfix] Use "comment" via /api/v1/instance * fix the stuff --- docs/admin/domain_permission_subscriptions.md | 21 ++ docs/api/swagger.yaml | 116 +++++++- internal/api/client/admin/admin.go | 2 + .../api/client/admin/domainallowupdate.go | 91 +++++++ .../api/client/admin/domainblockupdate.go | 91 +++++++ internal/api/client/admin/domainpermission.go | 89 +++++- .../admin/domainpermissiondraftcreate.go | 7 +- .../domainpermissionsubscriptiontest_test.go | 28 +- .../client/instance/instancepeersget_test.go | 10 +- internal/api/model/domain.go | 17 +- internal/db/bundb/domain.go | 4 +- internal/db/bundb/domain_test.go | 14 +- .../domainpermissionsubscription_test.go | 2 +- internal/db/domain.go | 8 +- internal/gtsmodel/domainallow.go | 2 +- internal/gtsmodel/domainblock.go | 2 +- internal/processing/admin/domainallow.go | 50 +++- internal/processing/admin/domainblock.go | 50 +++- internal/processing/admin/domainpermission.go | 179 +++++++++--- internal/processing/instance.go | 6 +- internal/subscriptions/domainperms.go | 39 +-- internal/subscriptions/subscriptions_test.go | 4 +- internal/typeutils/internaltofrontend.go | 6 +- testrig/transportcontroller.go | 2 +- .../query/admin/domain-permissions/import.ts | 38 +-- .../query/admin/domain-permissions/update.ts | 43 +++ .../settings/lib/types/domain-permission.ts | 8 +- web/source/settings/style.css | 41 ++- .../moderation/domain-permissions/detail.tsx | 255 +++++++++++------- .../domain-permissions/import-export.tsx | 2 +- .../moderation/domain-permissions/process.tsx | 103 ++++--- .../settings/views/moderation/router.tsx | 4 +- 32 files changed, 1021 insertions(+), 313 deletions(-) create mode 100644 internal/api/client/admin/domainallowupdate.go create mode 100644 internal/api/client/admin/domainblockupdate.go diff --git a/docs/admin/domain_permission_subscriptions.md b/docs/admin/domain_permission_subscriptions.md index 77ec831e1..78518e187 100644 --- a/docs/admin/domain_permission_subscriptions.md +++ b/docs/admin/domain_permission_subscriptions.md @@ -113,6 +113,27 @@ nothanks.com,suspend,false,false,,false JSON lists use content type `application/json`. +```json +[ + { + "domain": "bumfaces.net", + "suspended_at": "2020-05-13T13:29:12.000Z", + "comment": "big jerks" + }, + { + "domain": "peepee.poopoo", + "suspended_at": "2020-05-13T13:29:12.000Z", + "comment": "harassment" + }, + { + "domain": "nothanks.com", + "suspended_at": "2020-05-13T13:29:12.000Z" + } +] +``` + +As an alternative to `"comment"`, `"public_comment"` will also work: + ```json [ { diff --git a/docs/api/swagger.yaml b/docs/api/swagger.yaml index e1c1c14e9..778b1c843 100644 --- a/docs/api/swagger.yaml +++ b/docs/api/swagger.yaml @@ -1099,13 +1099,22 @@ definitions: domain: description: Domain represents a remote domain properties: + comment: + description: |- + If the domain is blocked, what's the publicly-stated reason for the block. + Alternative to `public_comment` to be used when serializing/deserializing via /api/v1/instance. + example: they smell + type: string + x-go-name: Comment domain: description: The hostname of the domain. example: example.org type: string x-go-name: Domain public_comment: - description: If the domain is blocked, what's the publicly-stated reason for the block. + description: |- + If the domain is blocked, what's the publicly-stated reason for the block. + Alternative to `comment` to be used when serializing/deserializing NOT via /api/v1/instance. example: they smell type: string x-go-name: PublicComment @@ -1124,6 +1133,13 @@ definitions: x-go-package: github.com/superseriousbusiness/gotosocial/internal/api/model domainPermission: properties: + comment: + description: |- + If the domain is blocked, what's the publicly-stated reason for the block. + Alternative to `public_comment` to be used when serializing/deserializing via /api/v1/instance. + example: they smell + type: string + x-go-name: Comment created_at: description: Time at which the permission entry was created (ISO 8601 Datetime). example: "2021-07-30T09:20:25+00:00" @@ -1162,7 +1178,9 @@ definitions: type: string x-go-name: PrivateComment public_comment: - description: If the domain is blocked, what's the publicly-stated reason for the block. + description: |- + If the domain is blocked, what's the publicly-stated reason for the block. + Alternative to `comment` to be used when serializing/deserializing NOT via /api/v1/instance. example: they smell type: string x-go-name: PublicComment @@ -5823,6 +5841,53 @@ paths: summary: View domain allow with the given ID. tags: - admin + put: + consumes: + - multipart/form-data + operationId: domainAllowUpdate + parameters: + - description: The id of the domain allow. + in: path + name: id + required: true + type: string + - description: Obfuscate the name of the domain when serving it publicly. Eg., `example.org` becomes something like `ex***e.org`. + in: formData + name: obfuscate + type: boolean + - description: Public comment about this domain allow. This will be displayed alongside the domain allow if you choose to share allows. + in: formData + name: public_comment + type: string + - description: Private comment about this domain allow. Will only be shown to other admins, so this is a useful way of internally keeping track of why a certain domain ended up allowed. + in: formData + name: private_comment + type: string + produces: + - application/json + responses: + "200": + description: The updated domain allow. + schema: + $ref: '#/definitions/domainPermission' + "400": + description: bad request + "401": + description: unauthorized + "403": + description: forbidden + "404": + description: not found + "406": + description: not acceptable + "500": + description: internal server error + security: + - OAuth2 Bearer: + - admin:write:domain_allows + summary: Update a single domain allow. + tags: + - admin /api/v1/admin/domain_blocks: get: operationId: domainBlocksGet @@ -5990,6 +6055,53 @@ paths: summary: View domain block with the given ID. tags: - admin + put: + consumes: + - multipart/form-data + operationId: domainBlockUpdate + parameters: + - description: The id of the domain block. + in: path + name: id + required: true + type: string + - description: Obfuscate the name of the domain when serving it publicly. Eg., `example.org` becomes something like `ex***e.org`. + in: formData + name: obfuscate + type: boolean + - description: Public comment about this domain block. This will be displayed alongside the domain block if you choose to share blocks. + in: formData + name: public_comment + type: string + - description: Private comment about this domain block. Will only be shown to other admins, so this is a useful way of internally keeping track of why a certain domain ended up blocked. + in: formData + name: private_comment + type: string + produces: + - application/json + responses: + "200": + description: The updated domain block. + schema: + $ref: '#/definitions/domainPermission' + "400": + description: bad request + "401": + description: unauthorized + "403": + description: forbidden + "404": + description: not found + "406": + description: not acceptable + "500": + description: internal server error + security: + - OAuth2 Bearer: + - admin:write:domain_blocks + summary: Update a single domain block. + tags: + - admin /api/v1/admin/domain_keys_expire: post: consumes: diff --git a/internal/api/client/admin/admin.go b/internal/api/client/admin/admin.go index a5a16f35f..01a5796ae 100644 --- a/internal/api/client/admin/admin.go +++ b/internal/api/client/admin/admin.go @@ -102,12 +102,14 @@ func (m *Module) Route(attachHandler func(method string, path string, f ...gin.H attachHandler(http.MethodPost, DomainBlocksPath, m.DomainBlocksPOSTHandler) attachHandler(http.MethodGet, DomainBlocksPath, m.DomainBlocksGETHandler) attachHandler(http.MethodGet, DomainBlocksPathWithID, m.DomainBlockGETHandler) + attachHandler(http.MethodPut, DomainBlocksPathWithID, m.DomainBlockUpdatePUTHandler) attachHandler(http.MethodDelete, DomainBlocksPathWithID, m.DomainBlockDELETEHandler) // domain allow stuff attachHandler(http.MethodPost, DomainAllowsPath, m.DomainAllowsPOSTHandler) attachHandler(http.MethodGet, DomainAllowsPath, m.DomainAllowsGETHandler) attachHandler(http.MethodGet, DomainAllowsPathWithID, m.DomainAllowGETHandler) + attachHandler(http.MethodPut, DomainAllowsPathWithID, m.DomainAllowUpdatePUTHandler) attachHandler(http.MethodDelete, DomainAllowsPathWithID, m.DomainAllowDELETEHandler) // domain permission draft stuff diff --git a/internal/api/client/admin/domainallowupdate.go b/internal/api/client/admin/domainallowupdate.go new file mode 100644 index 000000000..02edfdfef --- /dev/null +++ b/internal/api/client/admin/domainallowupdate.go @@ -0,0 +1,91 @@ +// GoToSocial +// Copyright (C) GoToSocial Authors admin@gotosocial.org +// SPDX-License-Identifier: AGPL-3.0-or-later +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +package admin + +import ( + "github.com/gin-gonic/gin" + "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" +) + +// DomainAllowUpdatePUTHandler swagger:operation PUT /api/v1/admin/domain_allows/{id} domainAllowUpdate +// +// Update a single domain allow. +// +// --- +// tags: +// - admin +// +// consumes: +// - multipart/form-data +// +// produces: +// - application/json +// +// parameters: +// - +// name: id +// type: string +// description: The id of the domain allow. +// in: path +// required: true +// - +// name: obfuscate +// in: formData +// description: >- +// Obfuscate the name of the domain when serving it publicly. +// Eg., `example.org` becomes something like `ex***e.org`. +// type: boolean +// - +// name: public_comment +// in: formData +// description: >- +// Public comment about this domain allow. +// This will be displayed alongside the domain allow if you choose to share allows. +// type: string +// - +// name: private_comment +// in: formData +// description: >- +// Private comment about this domain allow. Will only be shown to other admins, so this +// is a useful way of internally keeping track of why a certain domain ended up allowed. +// type: string +// +// security: +// - OAuth2 Bearer: +// - admin:write:domain_allows +// +// responses: +// '200': +// description: The updated domain allow. +// schema: +// "$ref": "#/definitions/domainPermission" +// '400': +// description: bad request +// '401': +// description: unauthorized +// '403': +// description: forbidden +// '404': +// description: not found +// '406': +// description: not acceptable +// '500': +// description: internal server error +func (m *Module) DomainAllowUpdatePUTHandler(c *gin.Context) { + m.updateDomainPermission(c, gtsmodel.DomainPermissionAllow) +} diff --git a/internal/api/client/admin/domainblockupdate.go b/internal/api/client/admin/domainblockupdate.go new file mode 100644 index 000000000..0fbe72aa8 --- /dev/null +++ b/internal/api/client/admin/domainblockupdate.go @@ -0,0 +1,91 @@ +// GoToSocial +// Copyright (C) GoToSocial Authors admin@gotosocial.org +// SPDX-License-Identifier: AGPL-3.0-or-later +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +package admin + +import ( + "github.com/gin-gonic/gin" + "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" +) + +// DomainBlockUpdatePUTHandler swagger:operation PUT /api/v1/admin/domain_blocks/{id} domainBlockUpdate +// +// Update a single domain block. +// +// --- +// tags: +// - admin +// +// consumes: +// - multipart/form-data +// +// produces: +// - application/json +// +// parameters: +// - +// name: id +// type: string +// description: The id of the domain block. +// in: path +// required: true +// - +// name: obfuscate +// in: formData +// description: >- +// Obfuscate the name of the domain when serving it publicly. +// Eg., `example.org` becomes something like `ex***e.org`. +// type: boolean +// - +// name: public_comment +// in: formData +// description: >- +// Public comment about this domain block. +// This will be displayed alongside the domain block if you choose to share blocks. +// type: string +// - +// name: private_comment +// in: formData +// description: >- +// Private comment about this domain block. Will only be shown to other admins, so this +// is a useful way of internally keeping track of why a certain domain ended up blocked. +// type: string +// +// security: +// - OAuth2 Bearer: +// - admin:write:domain_blocks +// +// responses: +// '200': +// description: The updated domain block. +// schema: +// "$ref": "#/definitions/domainPermission" +// '400': +// description: bad request +// '401': +// description: unauthorized +// '403': +// description: forbidden +// '404': +// description: not found +// '406': +// description: not acceptable +// '500': +// description: internal server error +func (m *Module) DomainBlockUpdatePUTHandler(c *gin.Context) { + m.updateDomainPermission(c, gtsmodel.DomainPermissionBlock) +} diff --git a/internal/api/client/admin/domainpermission.go b/internal/api/client/admin/domainpermission.go index c64c90eb2..91b95334b 100644 --- a/internal/api/client/admin/domainpermission.go +++ b/internal/api/client/admin/domainpermission.go @@ -29,6 +29,7 @@ import ( apiutil "github.com/superseriousbusiness/gotosocial/internal/api/util" "github.com/superseriousbusiness/gotosocial/internal/gtserror" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" + "github.com/superseriousbusiness/gotosocial/internal/util" ) type singleDomainPermCreate func( @@ -112,7 +113,7 @@ func (m *Module) createDomainPermissions( if importing && form.Domains.Size == 0 { err = errors.New("import was specified but list of domains is empty") } else if !importing && form.Domain == "" { - err = errors.New("empty domain provided") + err = errors.New("no domain provided") } if err != nil { @@ -122,14 +123,14 @@ func (m *Module) createDomainPermissions( if !importing { // Single domain permission creation. - domainBlock, _, errWithCode := single( + perm, _, errWithCode := single( c.Request.Context(), permType, authed.Account, form.Domain, - form.Obfuscate, - form.PublicComment, - form.PrivateComment, + util.PtrOrZero(form.Obfuscate), + util.PtrOrZero(form.PublicComment), + util.PtrOrZero(form.PrivateComment), "", // No sub ID for single perm creation. ) @@ -138,7 +139,7 @@ func (m *Module) createDomainPermissions( return } - apiutil.JSON(c, http.StatusOK, domainBlock) + apiutil.JSON(c, http.StatusOK, perm) return } @@ -177,6 +178,82 @@ func (m *Module) createDomainPermissions( apiutil.JSON(c, http.StatusOK, domainPerms) } +func (m *Module) updateDomainPermission( + c *gin.Context, + permType gtsmodel.DomainPermissionType, +) { + // Scope differs based on permType. + var requireScope apiutil.Scope + if permType == gtsmodel.DomainPermissionBlock { + requireScope = apiutil.ScopeAdminWriteDomainBlocks + } else { + requireScope = apiutil.ScopeAdminWriteDomainAllows + } + + authed, errWithCode := apiutil.TokenAuth(c, + true, true, true, true, + requireScope, + ) + if errWithCode != nil { + apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1) + return + } + + if !*authed.User.Admin { + err := fmt.Errorf("user %s not an admin", authed.User.ID) + apiutil.ErrorHandler(c, gtserror.NewErrorForbidden(err, err.Error()), m.processor.InstanceGetV1) + return + } + + if authed.Account.IsMoving() { + apiutil.ForbiddenAfterMove(c) + return + } + + if _, err := apiutil.NegotiateAccept(c, apiutil.JSONAcceptHeaders...); err != nil { + apiutil.ErrorHandler(c, gtserror.NewErrorNotAcceptable(err, err.Error()), m.processor.InstanceGetV1) + return + } + + permID, errWithCode := apiutil.ParseID(c.Param(apiutil.IDKey)) + if errWithCode != nil { + apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1) + return + } + + // Parse + validate form. + form := new(apimodel.DomainPermissionRequest) + if err := c.ShouldBind(form); err != nil { + apiutil.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGetV1) + return + } + + if form.Obfuscate == nil && + form.PrivateComment == nil && + form.PublicComment == nil { + const errText = "empty form submitted" + errWithCode := gtserror.NewErrorBadRequest(errors.New(errText), errText) + apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1) + return + } + + perm, errWithCode := m.processor.Admin().DomainPermissionUpdate( + c.Request.Context(), + permType, + permID, + form.Obfuscate, + form.PublicComment, + form.PrivateComment, + nil, // Can't update perm sub ID this way yet. + ) + if errWithCode != nil { + apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1) + return + } + + apiutil.JSON(c, http.StatusOK, perm) +} + // deleteDomainPermission deletes a single domain permission (block or allow). func (m *Module) deleteDomainPermission( c *gin.Context, diff --git a/internal/api/client/admin/domainpermissiondraftcreate.go b/internal/api/client/admin/domainpermissiondraftcreate.go index b8d3085e9..e7fcd2c40 100644 --- a/internal/api/client/admin/domainpermissiondraftcreate.go +++ b/internal/api/client/admin/domainpermissiondraftcreate.go @@ -26,6 +26,7 @@ import ( apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model" apiutil "github.com/superseriousbusiness/gotosocial/internal/api/util" "github.com/superseriousbusiness/gotosocial/internal/gtserror" + "github.com/superseriousbusiness/gotosocial/internal/util" ) // DomainPermissionDraftsPOSTHandler swagger:operation POST /api/v1/admin/domain_permission_drafts domainPermissionDraftCreate @@ -148,9 +149,9 @@ func (m *Module) DomainPermissionDraftsPOSTHandler(c *gin.Context) { authed.Account, form.Domain, permType, - form.Obfuscate, - form.PublicComment, - form.PrivateComment, + util.PtrOrZero(form.Obfuscate), + util.PtrOrZero(form.PublicComment), + util.PtrOrZero(form.PrivateComment), ) if errWithCode != nil { apiutil.ErrorHandler(c, errWithCode, m.processor.InstanceGetV1) diff --git a/internal/api/client/admin/domainpermissionsubscriptiontest_test.go b/internal/api/client/admin/domainpermissionsubscriptiontest_test.go index c03b950a9..4ac366520 100644 --- a/internal/api/client/admin/domainpermissionsubscriptiontest_test.go +++ b/internal/api/client/admin/domainpermissionsubscriptiontest_test.go @@ -97,14 +97,21 @@ func (suite *DomainPermissionSubscriptionTestTestSuite) TestDomainPermissionSubs suite.Equal(`[ { "domain": "bumfaces.net", - "public_comment": "big jerks" + "public_comment": "big jerks", + "obfuscate": false, + "private_comment": "" }, { "domain": "peepee.poopoo", - "public_comment": "harassment" + "public_comment": "harassment", + "obfuscate": false, + "private_comment": "" }, { - "domain": "nothanks.com" + "domain": "nothanks.com", + "public_comment": "", + "obfuscate": false, + "private_comment": "" } ]`, dst.String()) @@ -177,13 +184,22 @@ func (suite *DomainPermissionSubscriptionTestTestSuite) TestDomainPermissionSubs // Ensure expected. suite.Equal(`[ { - "domain": "bumfaces.net" + "domain": "bumfaces.net", + "public_comment": "", + "obfuscate": false, + "private_comment": "" }, { - "domain": "peepee.poopoo" + "domain": "peepee.poopoo", + "public_comment": "", + "obfuscate": false, + "private_comment": "" }, { - "domain": "nothanks.com" + "domain": "nothanks.com", + "public_comment": "", + "obfuscate": false, + "private_comment": "" } ]`, dst.String()) diff --git a/internal/api/client/instance/instancepeersget_test.go b/internal/api/client/instance/instancepeersget_test.go index a2c81cc4e..2421205f7 100644 --- a/internal/api/client/instance/instancepeersget_test.go +++ b/internal/api/client/instance/instancepeersget_test.go @@ -136,7 +136,7 @@ func (suite *InstancePeersGetTestSuite) TestInstancePeersGetOnlySuspended() { { "domain": "replyguys.com", "suspended_at": "2020-05-13T13:29:12.000Z", - "public_comment": "reply-guying to tech posts" + "comment": "reply-guying to tech posts" } ]`, dst.String()) } @@ -186,7 +186,7 @@ func (suite *InstancePeersGetTestSuite) TestInstancePeersGetOnlySuspendedAuthori { "domain": "replyguys.com", "suspended_at": "2020-05-13T13:29:12.000Z", - "public_comment": "reply-guying to tech posts" + "comment": "reply-guying to tech posts" } ]`, dst.String()) } @@ -219,7 +219,7 @@ func (suite *InstancePeersGetTestSuite) TestInstancePeersGetAll() { { "domain": "replyguys.com", "suspended_at": "2020-05-13T13:29:12.000Z", - "public_comment": "reply-guying to tech posts" + "comment": "reply-guying to tech posts" } ]`, dst.String()) } @@ -263,12 +263,12 @@ func (suite *InstancePeersGetTestSuite) TestInstancePeersGetAllWithObfuscated() { "domain": "o*g.*u**.t**.*or*t.*r**ev**", "suspended_at": "2021-06-09T10:34:55.000Z", - "public_comment": "just absolutely the worst, wowza" + "comment": "just absolutely the worst, wowza" }, { "domain": "replyguys.com", "suspended_at": "2020-05-13T13:29:12.000Z", - "public_comment": "reply-guying to tech posts" + "comment": "reply-guying to tech posts" } ]`, dst.String()) } diff --git a/internal/api/model/domain.go b/internal/api/model/domain.go index 94a190f63..8d94321d0 100644 --- a/internal/api/model/domain.go +++ b/internal/api/model/domain.go @@ -33,8 +33,13 @@ type Domain struct { // example: 2021-07-30T09:20:25+00:00 SilencedAt string `json:"silenced_at,omitempty"` // If the domain is blocked, what's the publicly-stated reason for the block. + // Alternative to `public_comment` to be used when serializing/deserializing via /api/v1/instance. // example: they smell - PublicComment string `form:"public_comment" json:"public_comment,omitempty"` + Comment *string `form:"comment" json:"comment,omitempty"` + // If the domain is blocked, what's the publicly-stated reason for the block. + // Alternative to `comment` to be used when serializing/deserializing NOT via /api/v1/instance. + // example: they smell + PublicComment *string `form:"public_comment" json:"public_comment,omitempty"` } // DomainPermission represents a permission applied to one domain (explicit block/allow). @@ -48,10 +53,10 @@ type DomainPermission struct { ID string `json:"id,omitempty"` // Obfuscate the domain name when serving this domain permission entry publicly. // example: false - Obfuscate bool `json:"obfuscate,omitempty"` + Obfuscate *bool `json:"obfuscate,omitempty"` // Private comment for this permission entry, visible to this instance's admins only. // example: they are poopoo - PrivateComment string `json:"private_comment,omitempty"` + PrivateComment *string `json:"private_comment,omitempty"` // If applicable, the ID of the subscription that caused this domain permission entry to be created. // example: 01FBW25TF5J67JW3HFHZCSD23K SubscriptionID string `json:"subscription_id,omitempty"` @@ -80,14 +85,14 @@ type DomainPermissionRequest struct { // Obfuscate the domain name when displaying this permission entry publicly. // Ie., instead of 'example.org' show something like 'e**mpl*.or*'. // example: false - Obfuscate bool `form:"obfuscate" json:"obfuscate"` + Obfuscate *bool `form:"obfuscate" json:"obfuscate"` // Private comment for other admins on why this permission entry was created. // example: don't like 'em!!!! - PrivateComment string `form:"private_comment" json:"private_comment"` + PrivateComment *string `form:"private_comment" json:"private_comment"` // Public comment on why this permission entry was created. // Will be visible to requesters at /api/v1/instance/peers if this endpoint is exposed. // example: foss dorks 😫 - PublicComment string `form:"public_comment" json:"public_comment"` + PublicComment *string `form:"public_comment" json:"public_comment"` // Permission type to create (only applies to domain permission drafts, not explicit blocks and allows). PermissionType string `form:"permission_type" json:"permission_type"` } diff --git a/internal/db/bundb/domain.go b/internal/db/bundb/domain.go index 925387bd9..23b9abc74 100644 --- a/internal/db/bundb/domain.go +++ b/internal/db/bundb/domain.go @@ -36,7 +36,7 @@ type domainDB struct { state *state.State } -func (d *domainDB) CreateDomainAllow(ctx context.Context, allow *gtsmodel.DomainAllow) (err error) { +func (d *domainDB) PutDomainAllow(ctx context.Context, allow *gtsmodel.DomainAllow) (err error) { // Normalize the domain as punycode, note the extra // validation step for domain name write operations. allow.Domain, err = util.PunifySafely(allow.Domain) @@ -162,7 +162,7 @@ func (d *domainDB) DeleteDomainAllow(ctx context.Context, domain string) error { return nil } -func (d *domainDB) CreateDomainBlock(ctx context.Context, block *gtsmodel.DomainBlock) error { +func (d *domainDB) PutDomainBlock(ctx context.Context, block *gtsmodel.DomainBlock) error { var err error // Normalize the domain as punycode, note the extra diff --git a/internal/db/bundb/domain_test.go b/internal/db/bundb/domain_test.go index 8164259e8..a56f469c4 100644 --- a/internal/db/bundb/domain_test.go +++ b/internal/db/bundb/domain_test.go @@ -46,7 +46,7 @@ func (suite *DomainTestSuite) TestIsDomainBlocked() { suite.NoError(err) suite.False(blocked) - err = suite.db.CreateDomainBlock(ctx, domainBlock) + err = suite.db.PutDomainBlock(ctx, domainBlock) suite.NoError(err) // domain block now exists @@ -75,7 +75,7 @@ func (suite *DomainTestSuite) TestIsDomainBlockedWithAllow() { suite.False(blocked) // Block this domain. - if err := suite.db.CreateDomainBlock(ctx, domainBlock); err != nil { + if err := suite.db.PutDomainBlock(ctx, domainBlock); err != nil { suite.FailNow(err.Error()) } @@ -96,7 +96,7 @@ func (suite *DomainTestSuite) TestIsDomainBlockedWithAllow() { CreatedByAccount: suite.testAccounts["admin_account"], } - if err := suite.db.CreateDomainAllow(ctx, domainAllow); err != nil { + if err := suite.db.PutDomainAllow(ctx, domainAllow); err != nil { suite.FailNow(err.Error()) } @@ -124,7 +124,7 @@ func (suite *DomainTestSuite) TestIsDomainBlockedWildcard() { suite.NoError(err) suite.False(blocked) - err = suite.db.CreateDomainBlock(ctx, domainBlock) + err = suite.db.PutDomainBlock(ctx, domainBlock) suite.NoError(err) // Start with the base block domain @@ -164,7 +164,7 @@ func (suite *DomainTestSuite) TestIsDomainBlockedNonASCII() { suite.NoError(err) suite.False(blocked) - err = suite.db.CreateDomainBlock(ctx, domainBlock) + err = suite.db.PutDomainBlock(ctx, domainBlock) suite.NoError(err) // domain block now exists @@ -200,7 +200,7 @@ func (suite *DomainTestSuite) TestIsDomainBlockedNonASCII2() { suite.NoError(err) suite.False(blocked) - err = suite.db.CreateDomainBlock(ctx, domainBlock) + err = suite.db.PutDomainBlock(ctx, domainBlock) suite.NoError(err) // domain block now exists @@ -232,7 +232,7 @@ func (suite *DomainTestSuite) TestIsOtherDomainBlockedWildcardAndExplicit() { } for _, block := range blocks { - if err := suite.db.CreateDomainBlock(ctx, block); err != nil { + if err := suite.db.PutDomainBlock(ctx, block); err != nil { suite.FailNow(err.Error()) } } diff --git a/internal/db/bundb/domainpermissionsubscription_test.go b/internal/db/bundb/domainpermissionsubscription_test.go index 732befbff..7a5cf8685 100644 --- a/internal/db/bundb/domainpermissionsubscription_test.go +++ b/internal/db/bundb/domainpermissionsubscription_test.go @@ -80,7 +80,7 @@ func (suite *DomainPermissionSubscriptionTestSuite) TestCount() { // Whack the perms in the db. for _, perm := range perms { - if err := suite.state.DB.CreateDomainBlock(ctx, perm); err != nil { + if err := suite.state.DB.PutDomainBlock(ctx, perm); err != nil { suite.FailNow(err.Error()) } } diff --git a/internal/db/domain.go b/internal/db/domain.go index 643538e7e..95a2f0755 100644 --- a/internal/db/domain.go +++ b/internal/db/domain.go @@ -31,8 +31,8 @@ type Domain interface { Block/allow storage + retrieval functions. */ - // CreateDomainAllow puts the given instance-level domain allow into the database. - CreateDomainAllow(ctx context.Context, allow *gtsmodel.DomainAllow) error + // PutDomainAllow puts the given instance-level domain allow into the database. + PutDomainAllow(ctx context.Context, allow *gtsmodel.DomainAllow) error // GetDomainAllow returns one instance-level domain allow with the given domain, if it exists. GetDomainAllow(ctx context.Context, domain string) (*gtsmodel.DomainAllow, error) @@ -49,8 +49,8 @@ type Domain interface { // DeleteDomainAllow deletes an instance-level domain allow with the given domain, if it exists. DeleteDomainAllow(ctx context.Context, domain string) error - // CreateDomainBlock puts the given instance-level domain block into the database. - CreateDomainBlock(ctx context.Context, block *gtsmodel.DomainBlock) error + // PutDomainBlock puts the given instance-level domain block into the database. + PutDomainBlock(ctx context.Context, block *gtsmodel.DomainBlock) error // GetDomainBlock returns one instance-level domain block with the given domain, if it exists. GetDomainBlock(ctx context.Context, domain string) (*gtsmodel.DomainBlock, error) diff --git a/internal/gtsmodel/domainallow.go b/internal/gtsmodel/domainallow.go index 3a7ca8774..f6aedbbba 100644 --- a/internal/gtsmodel/domainallow.go +++ b/internal/gtsmodel/domainallow.go @@ -26,7 +26,7 @@ type DomainAllow struct { UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated Domain string `bun:",nullzero,notnull"` // domain to allow. Eg. 'whatever.com' CreatedByAccountID string `bun:"type:CHAR(26),nullzero,notnull"` // Account ID of the creator of this allow - CreatedByAccount *Account `bun:"rel:belongs-to"` // Account corresponding to createdByAccountID + CreatedByAccount *Account `bun:"-"` // Account corresponding to createdByAccountID PrivateComment string `bun:""` // Private comment on this allow, viewable to admins PublicComment string `bun:""` // Public comment on this allow, viewable (optionally) by everyone Obfuscate *bool `bun:",nullzero,notnull,default:false"` // whether the domain name should appear obfuscated when displaying it publicly diff --git a/internal/gtsmodel/domainblock.go b/internal/gtsmodel/domainblock.go index 4a0e1c5b7..fb0921c25 100644 --- a/internal/gtsmodel/domainblock.go +++ b/internal/gtsmodel/domainblock.go @@ -26,7 +26,7 @@ type DomainBlock struct { UpdatedAt time.Time `bun:"type:timestamptz,nullzero,notnull,default:current_timestamp"` // when was item last updated Domain string `bun:",nullzero,notnull"` // domain to block. Eg. 'whatever.com' CreatedByAccountID string `bun:"type:CHAR(26),nullzero,notnull"` // Account ID of the creator of this block - CreatedByAccount *Account `bun:"rel:belongs-to"` // Account corresponding to createdByAccountID + CreatedByAccount *Account `bun:"-"` // Account corresponding to createdByAccountID PrivateComment string `bun:""` // Private comment on this block, viewable to admins PublicComment string `bun:""` // Public comment on this block, viewable (optionally) by everyone Obfuscate *bool `bun:",nullzero,notnull,default:false"` // whether the domain name should appear obfuscated when displaying it publicly diff --git a/internal/processing/admin/domainallow.go b/internal/processing/admin/domainallow.go index 02101ccff..134351ad5 100644 --- a/internal/processing/admin/domainallow.go +++ b/internal/processing/admin/domainallow.go @@ -60,7 +60,7 @@ func (p *Processor) createDomainAllow( } // Insert the new allow into the database. - if err := p.state.DB.CreateDomainAllow(ctx, domainAllow); err != nil { + if err := p.state.DB.PutDomainAllow(ctx, domainAllow); err != nil { err = gtserror.Newf("db error putting domain allow %s: %w", domain, err) return nil, "", gtserror.NewErrorInternalError(err) } @@ -92,6 +92,54 @@ func (p *Processor) createDomainAllow( return apiDomainAllow, action.ID, nil } +func (p *Processor) updateDomainAllow( + ctx context.Context, + domainAllowID string, + obfuscate *bool, + publicComment *string, + privateComment *string, + subscriptionID *string, +) (*apimodel.DomainPermission, gtserror.WithCode) { + domainAllow, err := p.state.DB.GetDomainAllowByID(ctx, domainAllowID) + if err != nil { + if !errors.Is(err, db.ErrNoEntries) { + // Real error. + err = gtserror.Newf("db error getting domain allow: %w", err) + return nil, gtserror.NewErrorInternalError(err) + } + + // There are just no entries for this ID. + err = fmt.Errorf("no domain allow entry exists with ID %s", domainAllowID) + return nil, gtserror.NewErrorNotFound(err, err.Error()) + } + + var columns []string + if obfuscate != nil { + domainAllow.Obfuscate = obfuscate + columns = append(columns, "obfuscate") + } + if publicComment != nil { + domainAllow.PublicComment = *publicComment + columns = append(columns, "public_comment") + } + if privateComment != nil { + domainAllow.PrivateComment = *privateComment + columns = append(columns, "private_comment") + } + if subscriptionID != nil { + domainAllow.SubscriptionID = *subscriptionID + columns = append(columns, "subscription_id") + } + + // Update the domain allow. + if err := p.state.DB.UpdateDomainAllow(ctx, domainAllow, columns...); err != nil { + err = gtserror.Newf("db error updating domain allow: %w", err) + return nil, gtserror.NewErrorInternalError(err) + } + + return p.apiDomainPerm(ctx, domainAllow, false) +} + func (p *Processor) deleteDomainAllow( ctx context.Context, adminAcct *gtsmodel.Account, diff --git a/internal/processing/admin/domainblock.go b/internal/processing/admin/domainblock.go index 249df744c..3dd5a256f 100644 --- a/internal/processing/admin/domainblock.go +++ b/internal/processing/admin/domainblock.go @@ -60,7 +60,7 @@ func (p *Processor) createDomainBlock( } // Insert the new block into the database. - if err := p.state.DB.CreateDomainBlock(ctx, domainBlock); err != nil { + if err := p.state.DB.PutDomainBlock(ctx, domainBlock); err != nil { err = gtserror.Newf("db error putting domain block %s: %w", domain, err) return nil, "", gtserror.NewErrorInternalError(err) } @@ -93,6 +93,54 @@ func (p *Processor) createDomainBlock( return apiDomainBlock, action.ID, nil } +func (p *Processor) updateDomainBlock( + ctx context.Context, + domainBlockID string, + obfuscate *bool, + publicComment *string, + privateComment *string, + subscriptionID *string, +) (*apimodel.DomainPermission, gtserror.WithCode) { + domainBlock, err := p.state.DB.GetDomainBlockByID(ctx, domainBlockID) + if err != nil { + if !errors.Is(err, db.ErrNoEntries) { + // Real error. + err = gtserror.Newf("db error getting domain block: %w", err) + return nil, gtserror.NewErrorInternalError(err) + } + + // There are just no entries for this ID. + err = fmt.Errorf("no domain block entry exists with ID %s", domainBlockID) + return nil, gtserror.NewErrorNotFound(err, err.Error()) + } + + var columns []string + if obfuscate != nil { + domainBlock.Obfuscate = obfuscate + columns = append(columns, "obfuscate") + } + if publicComment != nil { + domainBlock.PublicComment = *publicComment + columns = append(columns, "public_comment") + } + if privateComment != nil { + domainBlock.PrivateComment = *privateComment + columns = append(columns, "private_comment") + } + if subscriptionID != nil { + domainBlock.SubscriptionID = *subscriptionID + columns = append(columns, "subscription_id") + } + + // Update the domain block. + if err := p.state.DB.UpdateDomainBlock(ctx, domainBlock, columns...); err != nil { + err = gtserror.Newf("db error updating domain block: %w", err) + return nil, gtserror.NewErrorInternalError(err) + } + + return p.apiDomainPerm(ctx, domainBlock, false) +} + func (p *Processor) deleteDomainBlock( ctx context.Context, adminAcct *gtsmodel.Account, diff --git a/internal/processing/admin/domainpermission.go b/internal/processing/admin/domainpermission.go index 55800f458..04ee2ab26 100644 --- a/internal/processing/admin/domainpermission.go +++ b/internal/processing/admin/domainpermission.go @@ -18,6 +18,7 @@ package admin import ( + "cmp" "context" "encoding/json" "errors" @@ -29,6 +30,7 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/gtserror" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" + "github.com/superseriousbusiness/gotosocial/internal/util" ) // DomainPermissionCreate creates an instance-level permission @@ -84,6 +86,50 @@ func (p *Processor) DomainPermissionCreate( } } +// DomainPermissionUpdate updates a domain permission +// of the given permissionType, with the given ID. +func (p *Processor) DomainPermissionUpdate( + ctx context.Context, + permissionType gtsmodel.DomainPermissionType, + permID string, + obfuscate *bool, + publicComment *string, + privateComment *string, + subscriptionID *string, +) (*apimodel.DomainPermission, gtserror.WithCode) { + switch permissionType { + + // Explicitly block a domain. + case gtsmodel.DomainPermissionBlock: + return p.updateDomainBlock( + ctx, + permID, + obfuscate, + publicComment, + privateComment, + subscriptionID, + ) + + // Explicitly allow a domain. + case gtsmodel.DomainPermissionAllow: + return p.updateDomainAllow( + ctx, + permID, + obfuscate, + publicComment, + privateComment, + subscriptionID, + ) + + // 🎵 Why don't we all strap bombs to our chests, + // and ride our bikes to the next G7 picnic? + // Seems easier with every clock-tick. 🎵 + default: + err := gtserror.Newf("unrecognized permission type %d", permissionType) + return nil, gtserror.NewErrorInternalError(err) + } +} + // DomainPermissionDelete removes one domain block with the given ID, // and processes side effects of removing the block asynchronously. // @@ -153,14 +199,14 @@ func (p *Processor) DomainPermissionsImport( } defer file.Close() - // Parse file as slice of domain blocks. - domainPerms := make([]*apimodel.DomainPermission, 0) - if err := json.NewDecoder(file).Decode(&domainPerms); err != nil { + // Parse file as slice of domain permissions. + apiDomainPerms := make([]*apimodel.DomainPermission, 0) + if err := json.NewDecoder(file).Decode(&apiDomainPerms); err != nil { err = gtserror.Newf("error parsing attachment as domain permissions: %w", err) return nil, gtserror.NewErrorBadRequest(err, err.Error()) } - count := len(domainPerms) + count := len(apiDomainPerms) if count == 0 { err = gtserror.New("error importing domain permissions: 0 entries provided") return nil, gtserror.NewErrorBadRequest(err, err.Error()) @@ -170,52 +216,97 @@ func (p *Processor) DomainPermissionsImport( // between successes and errors so that the caller can // try failed imports again if desired. multiStatusEntries := make([]apimodel.MultiStatusEntry, 0, count) - - for _, domainPerm := range domainPerms { - var ( - domain = domainPerm.Domain.Domain - obfuscate = domainPerm.Obfuscate - publicComment = domainPerm.PublicComment - privateComment = domainPerm.PrivateComment - subscriptionID = "" // No sub ID for imports. - errWithCode gtserror.WithCode + for _, apiDomainPerm := range apiDomainPerms { + multiStatusEntries = append( + multiStatusEntries, + p.importOrUpdateDomainPerm( + ctx, + permissionType, + account, + apiDomainPerm, + ), ) - - domainPerm, _, errWithCode = p.DomainPermissionCreate( - ctx, - permissionType, - account, - domain, - obfuscate, - publicComment, - privateComment, - subscriptionID, - ) - - var entry *apimodel.MultiStatusEntry - - if errWithCode != nil { - entry = &apimodel.MultiStatusEntry{ - // Use the failed domain entry as the resource value. - Resource: domain, - Message: errWithCode.Safe(), - Status: errWithCode.Code(), - } - } else { - entry = &apimodel.MultiStatusEntry{ - // Use successfully created API model domain block as the resource value. - Resource: domainPerm, - Message: http.StatusText(http.StatusOK), - Status: http.StatusOK, - } - } - - multiStatusEntries = append(multiStatusEntries, *entry) } return apimodel.NewMultiStatus(multiStatusEntries), nil } +func (p *Processor) importOrUpdateDomainPerm( + ctx context.Context, + permType gtsmodel.DomainPermissionType, + account *gtsmodel.Account, + apiDomainPerm *apimodel.DomainPermission, +) apimodel.MultiStatusEntry { + var ( + domain = apiDomainPerm.Domain.Domain + obfuscate = apiDomainPerm.Obfuscate + publicComment = cmp.Or(apiDomainPerm.PublicComment, apiDomainPerm.Comment) + privateComment = apiDomainPerm.PrivateComment + subscriptionID = "" // No sub ID for imports. + ) + + // Check if this domain + // perm already exists. + var ( + domainPerm gtsmodel.DomainPermission + err error + ) + if permType == gtsmodel.DomainPermissionBlock { + domainPerm, err = p.state.DB.GetDomainBlock(ctx, domain) + } else { + domainPerm, err = p.state.DB.GetDomainAllow(ctx, domain) + } + + if err != nil && !errors.Is(err, db.ErrNoEntries) { + // Real db error. + return apimodel.MultiStatusEntry{ + Resource: domain, + Message: "db error checking for existence of domain permission", + Status: http.StatusInternalServerError, + } + } + + var errWithCode gtserror.WithCode + if domainPerm != nil { + // Permission already exists, update it. + apiDomainPerm, errWithCode = p.DomainPermissionUpdate( + ctx, + permType, + domainPerm.GetID(), + obfuscate, + publicComment, + privateComment, + nil, + ) + } else { + // Permission didn't exist yet, create it. + apiDomainPerm, _, errWithCode = p.DomainPermissionCreate( + ctx, + permType, + account, + domain, + util.PtrOrZero(obfuscate), + util.PtrOrZero(publicComment), + util.PtrOrZero(privateComment), + subscriptionID, + ) + } + + if errWithCode != nil { + return apimodel.MultiStatusEntry{ + Resource: domain, + Message: errWithCode.Safe(), + Status: errWithCode.Code(), + } + } + + return apimodel.MultiStatusEntry{ + Resource: apiDomainPerm, + Message: http.StatusText(http.StatusOK), + Status: http.StatusOK, + } +} + // DomainPermissionsGet returns all existing domain // permissions of the requested type. If export is // true, the format will be suitable for writing out diff --git a/internal/processing/instance.go b/internal/processing/instance.go index 4cbbb742a..e723c751e 100644 --- a/internal/processing/instance.go +++ b/internal/processing/instance.go @@ -106,9 +106,9 @@ func (p *Processor) InstancePeersGet(ctx context.Context, includeSuspended bool, } domains = append(domains, &apimodel.Domain{ - Domain: d, - SuspendedAt: util.FormatISO8601(domainBlock.CreatedAt), - PublicComment: domainBlock.PublicComment, + Domain: d, + SuspendedAt: util.FormatISO8601(domainBlock.CreatedAt), + Comment: &domainBlock.PublicComment, }) } } diff --git a/internal/subscriptions/domainperms.go b/internal/subscriptions/domainperms.go index c9f569f94..8da9064f6 100644 --- a/internal/subscriptions/domainperms.go +++ b/internal/subscriptions/domainperms.go @@ -438,7 +438,7 @@ func (s *Subscriptions) processDomainPermission( Obfuscate: wantedPerm.GetObfuscate(), SubscriptionID: permSub.ID, } - insertF = func() error { return s.state.DB.CreateDomainBlock(ctx, domainBlock) } + insertF = func() error { return s.state.DB.PutDomainBlock(ctx, domainBlock) } action = >smodel.AdminAction{ ID: id.NewULID(), @@ -461,7 +461,7 @@ func (s *Subscriptions) processDomainPermission( Obfuscate: wantedPerm.GetObfuscate(), SubscriptionID: permSub.ID, } - insertF = func() error { return s.state.DB.CreateDomainAllow(ctx, domainAllow) } + insertF = func() error { return s.state.DB.PutDomainAllow(ctx, domainAllow) } action = >smodel.AdminAction{ ID: id.NewULID(), @@ -564,13 +564,13 @@ func permsFromCSV( for i, columnHeader := range columnHeaders { // Remove leading # if present. - normal := strings.TrimLeft(columnHeader, "#") + columnHeader = strings.TrimLeft(columnHeader, "#") // Find index of each column header we // care about, ensuring no duplicates. - switch normal { + switch { - case "domain": + case columnHeader == "domain": if domainI != nil { body.Close() err := gtserror.NewfAt(3, "duplicate domain column header in csv: %+v", columnHeaders) @@ -578,7 +578,7 @@ func permsFromCSV( } domainI = &i - case "severity": + case columnHeader == "severity": if severityI != nil { body.Close() err := gtserror.NewfAt(3, "duplicate severity column header in csv: %+v", columnHeaders) @@ -586,15 +586,15 @@ func permsFromCSV( } severityI = &i - case "public_comment": + case columnHeader == "public_comment" || columnHeader == "comment": if publicCommentI != nil { body.Close() - err := gtserror.NewfAt(3, "duplicate public_comment column header in csv: %+v", columnHeaders) + err := gtserror.NewfAt(3, "duplicate public_comment or comment column header in csv: %+v", columnHeaders) return nil, err } publicCommentI = &i - case "obfuscate": + case columnHeader == "obfuscate": if obfuscateI != nil { body.Close() err := gtserror.NewfAt(3, "duplicate obfuscate column header in csv: %+v", columnHeaders) @@ -674,15 +674,15 @@ func permsFromCSV( perm.SetPublicComment(record[*publicCommentI]) } + var obfuscate bool if obfuscateI != nil { - obfuscate, err := strconv.ParseBool(record[*obfuscateI]) + obfuscate, err = strconv.ParseBool(record[*obfuscateI]) if err != nil { l.Warnf("couldn't parse obfuscate field of record: %+v", record) continue } - - perm.SetObfuscate(&obfuscate) } + perm.SetObfuscate(&obfuscate) // We're done. perms = append(perms, perm) @@ -742,8 +742,9 @@ func permsFromJSON( } // Set remaining fields. - perm.SetPublicComment(apiPerm.PublicComment) - perm.SetObfuscate(&apiPerm.Obfuscate) + publicComment := cmp.Or(apiPerm.PublicComment, apiPerm.Comment) + perm.SetPublicComment(util.PtrOrZero(publicComment)) + perm.SetObfuscate(util.Ptr(util.PtrOrZero(apiPerm.Obfuscate))) // We're done. perms = append(perms, perm) @@ -792,9 +793,15 @@ func permsFromPlain( var perm gtsmodel.DomainPermission switch permType { case gtsmodel.DomainPermissionBlock: - perm = >smodel.DomainBlock{Domain: domain} + perm = >smodel.DomainBlock{ + Domain: domain, + Obfuscate: util.Ptr(false), + } case gtsmodel.DomainPermissionAllow: - perm = >smodel.DomainAllow{Domain: domain} + perm = >smodel.DomainAllow{ + Domain: domain, + Obfuscate: util.Ptr(false), + } } // We're done. diff --git a/internal/subscriptions/subscriptions_test.go b/internal/subscriptions/subscriptions_test.go index 133db4b7c..4441d8c15 100644 --- a/internal/subscriptions/subscriptions_test.go +++ b/internal/subscriptions/subscriptions_test.go @@ -775,7 +775,7 @@ func (suite *SubscriptionsTestSuite) TestAdoption() { existingBlock2, existingBlock3, } { - if err := testStructs.State.DB.CreateDomainBlock( + if err := testStructs.State.DB.PutDomainBlock( ctx, block, ); err != nil { suite.FailNow(err.Error()) @@ -876,7 +876,7 @@ func (suite *SubscriptionsTestSuite) TestDomainAllowsAndBlocks() { } // Store existing allow. - if err := testStructs.State.DB.CreateDomainAllow(ctx, existingAllow); err != nil { + if err := testStructs.State.DB.PutDomainAllow(ctx, existingAllow); err != nil { suite.FailNow(err.Error()) } diff --git a/internal/typeutils/internaltofrontend.go b/internal/typeutils/internaltofrontend.go index b0f5d12fa..62a1ebc1e 100644 --- a/internal/typeutils/internaltofrontend.go +++ b/internal/typeutils/internaltofrontend.go @@ -2182,7 +2182,7 @@ func (c *Converter) DomainPermToAPIDomainPerm( domainPerm := &apimodel.DomainPermission{ Domain: apimodel.Domain{ Domain: domain, - PublicComment: d.GetPublicComment(), + PublicComment: util.Ptr(d.GetPublicComment()), }, } @@ -2193,8 +2193,8 @@ func (c *Converter) DomainPermToAPIDomainPerm( } domainPerm.ID = d.GetID() - domainPerm.Obfuscate = util.PtrOrZero(d.GetObfuscate()) - domainPerm.PrivateComment = d.GetPrivateComment() + domainPerm.Obfuscate = d.GetObfuscate() + domainPerm.PrivateComment = util.Ptr(d.GetPrivateComment()) domainPerm.SubscriptionID = d.GetSubscriptionID() domainPerm.CreatedBy = d.GetCreatedByAccountID() if createdAt := d.GetCreatedAt(); !createdAt.IsZero() { diff --git a/testrig/transportcontroller.go b/testrig/transportcontroller.go index bbcb3901d..d66c71179 100644 --- a/testrig/transportcontroller.go +++ b/testrig/transportcontroller.go @@ -627,7 +627,7 @@ nothanks.com` { "domain": "bumfaces.net", "suspended_at": "2020-05-13T13:29:12.000Z", - "public_comment": "big jerks" + "comment": "big jerks" }, { "domain": "peepee.poopoo", diff --git a/web/source/settings/lib/query/admin/domain-permissions/import.ts b/web/source/settings/lib/query/admin/domain-permissions/import.ts index cbcf44964..a83448a1f 100644 --- a/web/source/settings/lib/query/admin/domain-permissions/import.ts +++ b/web/source/settings/lib/query/admin/domain-permissions/import.ts @@ -40,39 +40,19 @@ function importEntriesProcessor(formData: ImportDomainPermsParams): (_entry: Dom // Override each obfuscate entry if necessary. if (formData.obfuscate !== undefined) { - const obfuscateEntry = (entry: DomainPerm) => { + processingFuncs.push((entry: DomainPerm) => { entry.obfuscate = formData.obfuscate; - }; - processingFuncs.push(obfuscateEntry); + }); } - // Check whether we need to append or replace - // private_comment and public_comment. + // Check whether we need to replace + // private_comment and/or public_comment. ["private_comment","public_comment"].forEach((commentType) => { - let text = formData.commentType?.trim(); - if (!text) { - return; - } - - switch(formData[`${commentType}_behavior`]) { - case "append": - const appendComment = (entry: DomainPerm) => { - if (entry.commentType == undefined) { - entry.commentType = text; - } else { - entry.commentType = [entry.commentType, text].join("\n"); - } - }; - - processingFuncs.push(appendComment); - break; - case "replace": - const replaceComment = (entry: DomainPerm) => { - entry.commentType = text; - }; - - processingFuncs.push(replaceComment); - break; + if (formData[`replace_${commentType}`]) { + const text = formData[commentType]?.trim(); + processingFuncs.push((entry: DomainPerm) => { + entry[commentType] = text; + }); } }); diff --git a/web/source/settings/lib/query/admin/domain-permissions/update.ts b/web/source/settings/lib/query/admin/domain-permissions/update.ts index a6b4b2039..396c30d6e 100644 --- a/web/source/settings/lib/query/admin/domain-permissions/update.ts +++ b/web/source/settings/lib/query/admin/domain-permissions/update.ts @@ -22,6 +22,7 @@ import { gtsApi } from "../../gts-api"; import { replaceCacheOnMutation, removeFromCacheOnMutation, + updateCacheOnMutation, } from "../../query-modifiers"; import { listToKeyedObject } from "../../transforms"; import type { @@ -55,6 +56,36 @@ const extended = gtsApi.injectEndpoints({ ...replaceCacheOnMutation("domainAllows") }), + updateDomainBlock: build.mutation({ + query: ({ id, ...formData}) => ({ + method: "PUT", + url: `/api/v1/admin/domain_blocks/${id}`, + asForm: true, + body: formData, + discardEmpty: false + }), + ...updateCacheOnMutation("domainBlocks", { + key: (_draft, newData) => { + return newData.domain; + } + }) + }), + + updateDomainAllow: build.mutation({ + query: ({ id, ...formData}) => ({ + method: "PUT", + url: `/api/v1/admin/domain_allows/${id}`, + asForm: true, + body: formData, + discardEmpty: false + }), + ...updateCacheOnMutation("domainAllows", { + key: (_draft, newData) => { + return newData.domain; + } + }) + }), + removeDomainBlock: build.mutation({ query: (id) => ({ method: "DELETE", @@ -91,6 +122,16 @@ const useAddDomainBlockMutation = extended.useAddDomainBlockMutation; */ const useAddDomainAllowMutation = extended.useAddDomainAllowMutation; +/** + * Update a single domain permission (block) by PUTing to `/api/v1/admin/domain_blocks/{id}`. + */ +const useUpdateDomainBlockMutation = extended.useUpdateDomainBlockMutation; + +/** + * Update a single domain permission (allow) by PUTing to `/api/v1/admin/domain_allows/{id}`. + */ +const useUpdateDomainAllowMutation = extended.useUpdateDomainAllowMutation; + /** * Remove a single domain permission (block) by DELETEing to `/api/v1/admin/domain_blocks/{id}`. */ @@ -104,6 +145,8 @@ const useRemoveDomainAllowMutation = extended.useRemoveDomainAllowMutation; export { useAddDomainBlockMutation, useAddDomainAllowMutation, + useUpdateDomainBlockMutation, + useUpdateDomainAllowMutation, useRemoveDomainBlockMutation, useRemoveDomainAllowMutation }; diff --git a/web/source/settings/lib/types/domain-permission.ts b/web/source/settings/lib/types/domain-permission.ts index c4560d79b..27c4b56c9 100644 --- a/web/source/settings/lib/types/domain-permission.ts +++ b/web/source/settings/lib/types/domain-permission.ts @@ -46,8 +46,8 @@ export interface DomainPerm { valid?: boolean; checked?: boolean; commentType?: string; - private_comment_behavior?: "append" | "replace"; - public_comment_behavior?: "append" | "replace"; + replace_private_comment?: boolean; + replace_public_comment?: boolean; } /** @@ -65,8 +65,8 @@ const domainPermStripOnImport: Set = new Set([ "valid", "checked", "commentType", - "private_comment_behavior", - "public_comment_behavior", + "replace_private_comment", + "replace_public_comment", ]); /** diff --git a/web/source/settings/style.css b/web/source/settings/style.css index fc146cdd7..c05072043 100644 --- a/web/source/settings/style.css +++ b/web/source/settings/style.css @@ -618,6 +618,15 @@ span.form-info { } } +section > div.domain-block, +section > div.domain-allow { + height: 100%; + + > a { + margin-top: auto; + } +} + .domain-permissions-list { p { margin-top: 0; @@ -976,32 +985,26 @@ button.tab-button { .domain-perm-import-list { .checkbox-list-wrapper { - overflow-x: auto; display: grid; gap: 1rem; } .checkbox-list { + overflow-x: auto; .header { + align-items: center; input[type="checkbox"] { - align-self: start; height: 1.5rem; } } .entry { - gap: 0; - width: 100%; - grid-template-columns: auto minmax(25ch, 2fr) minmax(40ch, 1fr); - grid-template-rows: auto 1fr; - - input[type="checkbox"] { - margin-right: 1rem; - } + grid-template-columns: auto max(50%, 14rem) 1fr; + column-gap: 1rem; + align-items: center; .domain-input { - margin-right: 0.5rem; display: grid; grid-template-columns: 1fr $fa-fw; gap: 0.5rem; @@ -1020,13 +1023,21 @@ button.tab-button { } p { - align-self: center; margin: 0; - grid-column: 4; - grid-row: 1 / span 2; } } } + + .set-comment-checkbox { + display: flex; + flex-direction: column; + gap: 0.25rem; + + padding: 0.5rem 1rem 1rem 1rem; + width: 100%; + border: 0.1rem solid var(--gray1); + border-radius: 0.1rem; + } } .import-export { @@ -1406,6 +1417,7 @@ button.tab-button { } } +.domain-permission-details, .domain-permission-draft-details, .domain-permission-exclude-details, .domain-permission-subscription-details { @@ -1414,6 +1426,7 @@ button.tab-button { } } +.domain-permission-details, .domain-permission-drafts-view, .domain-permission-draft-details, .domain-permission-subscriptions-view, diff --git a/web/source/settings/views/moderation/domain-permissions/detail.tsx b/web/source/settings/views/moderation/domain-permissions/detail.tsx index 0105d9615..e8ef487e3 100644 --- a/web/source/settings/views/moderation/domain-permissions/detail.tsx +++ b/web/source/settings/views/moderation/domain-permissions/detail.tsx @@ -32,8 +32,18 @@ import Loading from "../../../components/loading"; import BackButton from "../../../components/back-button"; import MutationButton from "../../../components/form/mutation-button"; -import { useDomainAllowsQuery, useDomainBlocksQuery } from "../../../lib/query/admin/domain-permissions/get"; -import { useAddDomainAllowMutation, useAddDomainBlockMutation, useRemoveDomainAllowMutation, useRemoveDomainBlockMutation } from "../../../lib/query/admin/domain-permissions/update"; +import { + useDomainAllowsQuery, + useDomainBlocksQuery, +} from "../../../lib/query/admin/domain-permissions/get"; +import { + useAddDomainAllowMutation, + useAddDomainBlockMutation, + useRemoveDomainAllowMutation, + useRemoveDomainBlockMutation, + useUpdateDomainAllowMutation, + useUpdateDomainBlockMutation, +} from "../../../lib/query/admin/domain-permissions/update"; import { DomainPerm } from "../../../lib/types/domain-permission"; import { NoArg } from "../../../lib/types/query"; import { Error } from "../../../components/error"; @@ -41,8 +51,10 @@ import { useBaseUrl } from "../../../lib/navigation/util"; import { PermType } from "../../../lib/types/perm"; import { useCapitalize } from "../../../lib/util"; import { formDomainValidator } from "../../../lib/util/formvalidators"; +import UsernameLozenge from "../../../components/username-lozenge"; +import { FormSubmitEvent } from "../../../lib/form/types"; -export default function DomainPermDetail() { +export default function DomainPermView() { const baseUrl = useBaseUrl(); const search = useSearch(); @@ -101,33 +113,16 @@ export default function DomainPermDetail() { ? blocks[domain] : allows[domain]; - // Render different into content depending on - // if we have a perm already for this domain. - let infoContent: React.JSX.Element; - if (existingPerm === undefined) { - infoContent = ( - - No stored {permType} yet, you can add one below: - - ); - } else { - infoContent = ( -
- - Editing existing domain {permTypeRaw} isn't implemented yet, check here for progress -
- ); - } + const title = Domain {permType} for {domain}; return ( -
-

- - {" "} - Domain {permType} for {domain} -

- {infoContent} - +

{title}

+ { existingPerm + ? + : No stored {permType} yet, you can add one below: + } + { + if (perm.created_at) { + return new Date(perm.created_at).toDateString(); + } + return "unknown"; + }, [perm.created_at]); + + return ( +
+
+
Created
+
+
+
+
Created By
+
+ +
+
+
+
Domain
+
{perm.domain}
+
+
+
Permission type
+
+ + {permType} +
+
+
+
Subscription ID
+
{perm.subscription_id ?? "[none]"}
+
+
+ ); +} + +interface CreateOrUpdateDomainPermProps { defaultDomain: string; perm?: DomainPerm; permType: PermType; } -function DomainPermForm({ defaultDomain, perm, permType }: DomainPermFormProps) { +function CreateOrUpdateDomainPerm({ + defaultDomain, + perm, + permType +}: CreateOrUpdateDomainPermProps) { const isExistingPerm = perm !== undefined; - const disabledForm = isExistingPerm - ? { - disabled: true, - title: "Domain permissions currently cannot be edited." - } - : { - disabled: false, - title: "", - }; const form = { domain: useTextInput("domain", { @@ -161,8 +208,8 @@ function DomainPermForm({ defaultDomain, perm, permType }: DomainPermFormProps) validator: formDomainValidator, }), obfuscate: useBoolInput("obfuscate", { source: perm }), - commentPrivate: useTextInput("private_comment", { source: perm }), - commentPublic: useTextInput("public_comment", { source: perm }) + privateComment: useTextInput("private_comment", { source: perm }), + publicComment: useTextInput("public_comment", { source: perm }) }; // Check which perm type we're meant to be handling @@ -171,112 +218,132 @@ function DomainPermForm({ defaultDomain, perm, permType }: DomainPermFormProps) // react is like "weh" (mood), but we can decide // which ones to use conditionally. const [ addBlock, addBlockResult ] = useAddDomainBlockMutation(); + const [ updateBlock, updateBlockResult ] = useUpdateDomainBlockMutation({ fixedCacheKey: perm?.id }); const [ removeBlock, removeBlockResult] = useRemoveDomainBlockMutation({ fixedCacheKey: perm?.id }); const [ addAllow, addAllowResult ] = useAddDomainAllowMutation(); + const [ updateAllow, updateAllowResult ] = useUpdateDomainAllowMutation({ fixedCacheKey: perm?.id }); const [ removeAllow, removeAllowResult ] = useRemoveDomainAllowMutation({ fixedCacheKey: perm?.id }); const [ - addTrigger, - addResult, + createOrUpdateTrigger, + createOrUpdateResult, removeTrigger, removeResult, ] = useMemo(() => { - return permType == "block" - ? [ - addBlock, - addBlockResult, - removeBlock, - removeBlockResult, - ] - : [ - addAllow, - addAllowResult, - removeAllow, - removeAllowResult, - ]; - }, [permType, - addBlock, addBlockResult, removeBlock, removeBlockResult, - addAllow, addAllowResult, removeAllow, removeAllowResult, + switch (true) { + case (permType === "block" && !isExistingPerm): + return [ addBlock, addBlockResult, removeBlock, removeBlockResult ]; + case (permType === "block"): + return [ updateBlock, updateBlockResult, removeBlock, removeBlockResult ]; + case !isExistingPerm: + return [ addAllow, addAllowResult, removeAllow, removeAllowResult ]; + default: + return [ updateAllow, updateAllowResult, removeAllow, removeAllowResult ]; + } + }, [permType, isExistingPerm, + addBlock, addBlockResult, updateBlock, updateBlockResult, removeBlock, removeBlockResult, + addAllow, addAllowResult, updateAllow, updateAllowResult, removeAllow, removeAllowResult, ]); - // Use appropriate submission params for this permType. - const [submitForm, submitFormResult] = useFormSubmit(form, [addTrigger, addResult], { changedOnly: false }); + // Use appropriate submission params for this + // permType, and whether we're creating or updating. + const [submit, submitResult] = useFormSubmit( + form, + [ createOrUpdateTrigger, createOrUpdateResult ], + { + changedOnly: isExistingPerm, + // If we're updating an existing perm, + // insert the perm ID into the mutation + // data before submitting. Otherwise just + // return the mutationData unmodified. + customizeMutationArgs: (mutationData) => { + if (isExistingPerm) { + return { + id: perm?.id, + ...mutationData, + }; + } else { + return mutationData; + } + }, + }, + ); // Uppercase first letter of given permType. const permTypeUpper = useCapitalize(permType); const [location, setLocation] = useLocation(); - - function verifyUrlThenSubmit(e) { + function onSubmit(e: FormSubmitEvent) { // Adding a new domain permissions happens on a url like // "/settings/admin/domain-permissions/:permType/domain.com", // but if domain input changes, that doesn't match anymore // and causes issues later on so, before submitting the form, // silently change url, and THEN submit. - let correctUrl = `/${permType}s/${form.domain.value}`; - if (location != correctUrl) { - setLocation(correctUrl); + if (!isExistingPerm) { + let correctUrl = `/${permType}s/${form.domain.value}`; + if (location != correctUrl) { + setLocation(correctUrl); + } } - return submitForm(e); + return submit(e); } return ( -
- + + { !isExistingPerm && + + }