From 2d665dd840a00b8a4ed89beb71be8427799e5a61 Mon Sep 17 00:00:00 2001 From: mappu Date: Sun, 17 Nov 2024 16:10:24 +1300 Subject: [PATCH] genbindings/fmt: replace trivial sprintf with strconv --- cmd/genbindings/clang2il.go | 2 +- cmd/genbindings/transformoptional.go | 4 ++-- cmd/genbindings/util.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/genbindings/clang2il.go b/cmd/genbindings/clang2il.go index b76222d4..592be482 100644 --- a/cmd/genbindings/clang2il.go +++ b/cmd/genbindings/clang2il.go @@ -604,7 +604,7 @@ nextEnumEntry: if !foundValidInner { // Enum case without definition e.g. QCalendar::Gregorian // This means one more than the last value - cee.EntryValue = fmt.Sprintf("%d", lastImplicitValue+1) + cee.EntryValue = strconv.FormatInt(lastImplicitValue+1, 10) } afterParse: diff --git a/cmd/genbindings/transformoptional.go b/cmd/genbindings/transformoptional.go index 6dc318da..8771cf2a 100644 --- a/cmd/genbindings/transformoptional.go +++ b/cmd/genbindings/transformoptional.go @@ -1,7 +1,7 @@ package main import ( - "fmt" + "strconv" ) // astTransformOptional expands all methods with optional parameters into @@ -33,7 +33,7 @@ func astTransformOptional(parsed *CppParsedHeader) { // Add method copies for x := optionalStart; x < len(m.Parameters); x++ { dupMethod := m // shallow copy - dupMethod.Rename(m.MethodName + fmt.Sprintf("%d", x+1)) + dupMethod.Rename(m.MethodName + strconv.Itoa(x+1)) dupMethod.Parameters = m.Parameters[0 : x+1] dupMethod.HiddenParams = m.Parameters[x+1:] diff --git a/cmd/genbindings/util.go b/cmd/genbindings/util.go index 1c6a5989..db4e075b 100644 --- a/cmd/genbindings/util.go +++ b/cmd/genbindings/util.go @@ -1,8 +1,8 @@ package main import ( + "strconv" "encoding/json" - "fmt" "log" "strings" ) @@ -12,7 +12,7 @@ func maybeSuffix(counter int) string { return "" } - return fmt.Sprintf("%d", counter+1) + return strconv.Itoa(counter+1) } func titleCase(s string) string {