From 46dd39f2b4c62ed21eae4b0f84c39af94d033739 Mon Sep 17 00:00:00 2001 From: Brat-vseznamus Date: Wed, 24 Jul 2024 15:47:57 +0300 Subject: [PATCH] code format --- internal/tlcodegen/tlgen_cpp.go | 24 ++++++++++++------------ internal/tlcodegen/type_rw_struct_cpp.go | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/internal/tlcodegen/tlgen_cpp.go b/internal/tlcodegen/tlgen_cpp.go index bfe7d8f5..2b8f6914 100644 --- a/internal/tlcodegen/tlgen_cpp.go +++ b/internal/tlcodegen/tlgen_cpp.go @@ -279,11 +279,11 @@ func (gen *Gen2) generateCodeCPP(generateByteVersions []string) error { CC = g++ CFLAGS = -std=c++17 -O3 -Wno-noexcept-type -g -Wall -Wextra -Werror=return-type -Wno-unused-parameter `) - cppMake.WriteString(fmt.Sprintf("all: ")) - cppMake.WriteString(fmt.Sprintf("main.o ")) + cppMake.WriteString("all: ") + cppMake.WriteString("main.o ") cppMake.WriteString(fmt.Sprintf("%s\n", cppMakeO.String())) - cppMake.WriteString(fmt.Sprintf("\t$(CC) $(CFLAGS) -o all ")) - cppMake.WriteString(fmt.Sprintf("main.o ")) + cppMake.WriteString("\t$(CC) $(CFLAGS) -o all ") + cppMake.WriteString("main.o ") cppMake.WriteString(fmt.Sprintf("%s\n", cppMakeO.String())) cppMake.WriteString(` main.o: main.cpp @@ -496,7 +496,7 @@ func createMeta(gen *Gen2) error { meta.WriteString("#pragma once\n") meta.WriteString(fmt.Sprintf("#include \"%s\"\n", getCppDiff(filepathName, "a_tlgen_helpers_code.hpp"))) - meta.WriteString(fmt.Sprintf(` + meta.WriteString(` #include #include @@ -559,7 +559,7 @@ namespace meta { throw std::runtime_error("no such tl (\"" + name + "\") item in system"); } - void init_tl_items() {`)) + void init_tl_items() {`) for _, wr := range gen.generatedTypesList { if wr.tlTag == 0 || !wr.IsTopLevel() { @@ -579,11 +579,11 @@ namespace meta { } } - meta.WriteString(fmt.Sprintf(` + meta.WriteString(` } }; }; -`)) +`) if err := gen.addCodeFile(filepathName, gen.copyrightText+meta.String()); err != nil { return err } @@ -596,11 +596,11 @@ func createFactory(gen *Gen2, createdHpps map[string]bool) error { imports := DirectIncludesCPP{ns: map[*TypeRWWrapper]CppIncludeInfo{}} - factory.WriteString(fmt.Sprintf(` + factory.WriteString(` namespace tl2 { namespace factory { - void init_tl_create_objects() {`)) + void init_tl_create_objects() {`) for _, wr := range gen.generatedTypesList { if wr.tlTag == 0 || !wr.IsTopLevel() { @@ -668,11 +668,11 @@ namespace factory { } } - factory.WriteString(fmt.Sprintf(` + factory.WriteString(` } }; }; -`)) +`) suffix := factory.String() factory.Reset() diff --git a/internal/tlcodegen/type_rw_struct_cpp.go b/internal/tlcodegen/type_rw_struct_cpp.go index f450b3e4..f6e7a1d8 100644 --- a/internal/tlcodegen/type_rw_struct_cpp.go +++ b/internal/tlcodegen/type_rw_struct_cpp.go @@ -499,7 +499,7 @@ func (trw *TypeRWStruct) CPPReadFields(bytesVersion bool, hppDetInc *DirectInclu false) + "\n") if field.fieldMask != nil { // TODO - in case of recursive field, check for nil ptr - s.WriteString(fmt.Sprintf("\t} else {\n")) + s.WriteString("\t} else {\n") if field.recursive { s.WriteString(fmt.Sprintf("\t\tif (item.%s) {\n", field.cppName)) s.WriteString(fmt.Sprintf("\t\t%s\n", field.t.trw.CPPTypeResettingCode(bytesVersion, addAsterisk(field.recursive, fmt.Sprintf("item.%s", field.cppName))))) @@ -507,7 +507,7 @@ func (trw *TypeRWStruct) CPPReadFields(bytesVersion bool, hppDetInc *DirectInclu } else { s.WriteString(fmt.Sprintf("\t\t%s\n", field.t.trw.CPPTypeResettingCode(bytesVersion, addAsterisk(field.recursive, fmt.Sprintf("item.%s", field.cppName))))) } - s.WriteString(fmt.Sprintf("\t}\n")) + s.WriteString("\t}\n") } } return s.String()