genbindings/fmt: replace trivial sprintf with strconv

This commit is contained in:
mappu 2024-11-17 16:10:24 +13:00
parent f6acae63bb
commit 2d665dd840
3 changed files with 5 additions and 5 deletions

View File

@ -604,7 +604,7 @@ nextEnumEntry:
if !foundValidInner { if !foundValidInner {
// Enum case without definition e.g. QCalendar::Gregorian // Enum case without definition e.g. QCalendar::Gregorian
// This means one more than the last value // This means one more than the last value
cee.EntryValue = fmt.Sprintf("%d", lastImplicitValue+1) cee.EntryValue = strconv.FormatInt(lastImplicitValue+1, 10)
} }
afterParse: afterParse:

View File

@ -1,7 +1,7 @@
package main package main
import ( import (
"fmt" "strconv"
) )
// astTransformOptional expands all methods with optional parameters into // astTransformOptional expands all methods with optional parameters into
@ -33,7 +33,7 @@ func astTransformOptional(parsed *CppParsedHeader) {
// Add method copies // Add method copies
for x := optionalStart; x < len(m.Parameters); x++ { for x := optionalStart; x < len(m.Parameters); x++ {
dupMethod := m // shallow copy 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.Parameters = m.Parameters[0 : x+1]
dupMethod.HiddenParams = m.Parameters[x+1:] dupMethod.HiddenParams = m.Parameters[x+1:]

View File

@ -1,8 +1,8 @@
package main package main
import ( import (
"strconv"
"encoding/json" "encoding/json"
"fmt"
"log" "log"
"strings" "strings"
) )
@ -12,7 +12,7 @@ func maybeSuffix(counter int) string {
return "" return ""
} }
return fmt.Sprintf("%d", counter+1) return strconv.Itoa(counter+1)
} }
func titleCase(s string) string { func titleCase(s string) string {