1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00
vcmi/launcher
Alexander Wilms 1b85abb508 Use auto instead of redundant type in initializations using new
grep -r --include \*.h --include \*.cpp "=" * | grep -v "auto\|int\|char\|bool\|float|\double\|for\|if\|googletest\|fuzzylite\|size_t\|using\|return\|{\|}\|= \"\|= tr(\|virtual\|void" | grep -Po ".*[^ ]+ [^ ]+ [^ ]*[ ]*=.*;" | grep -v "float\|nullptr" | grep "new" | grep -v "AI/FuzzyLite" | grep \( | grep "= new" > redundant_types.txt

import re

with open("redundant_types.txt") as f:
    for line in f:
        line = line.strip()
        path = line.split(":", 1)[0]
        original_code = line.split(":")[1].strip()
        if "new " in original_code:

            cpp_type = original_code.split(" ")[0]
            if original_code.count(cpp_type) == 2:
                print()
                print(path)
                print(original_code)
                new_code = "auto "+" ".join(original_code.split(" ")[1:])
                print(new_code)

                with open(path, "r") as f:
                    filedata = f.read()

                filedata = filedata.replace(original_code, new_code)

                with open(path, "w") as f:
                    f.write(filedata)
2024-01-16 21:40:53 +00:00
..
aboutProject Use the "nullptr" literal. 2023-10-27 18:18:59 +00:00
firstLaunch launcher/firstLaunch/firstlaunch_moc.cpp: "static" members should be accessed statically 2023-10-28 15:44:17 +00:00
icons Use 64px and 32px as icon sizes in launcher sidebar 2023-09-17 15:52:20 +00:00
ios Fix ios typo 2022-11-09 00:03:15 +04:00
lobby Use auto instead of redundant type in initializations using new 2024-01-16 21:40:53 +00:00
modManager Use auto instead of redundant type in initializations using new 2024-01-16 21:40:53 +00:00
settingsView Correctly initialize current value of allied AI in Launcher 2023-11-01 16:57:17 +02:00
translation Update Chinese translation for launcher 2024-01-13 13:17:03 +08:00
CMakeLists.txt #3151-windows-build-symlinks 2023-11-06 15:57:39 +01:00
eu.vcmi.VCMI.metainfo.xml Set 1.4.2 release date to 25th December 2023-12-24 19:29:33 +02:00
jsonutils.cpp Reorganization of boost filesystem usage 2023-07-28 19:12:04 +03:00
jsonutils.h fix building launcher 2022-09-24 15:55:22 +03:00
languages.cpp Update languages.cpp 2023-07-28 00:31:07 +00:00
languages.h - Implemented proposition to install translation mod when necessary 2023-03-14 16:02:16 +02:00
launcherdirs.cpp Code style: move or add licensing information on top of every file 2017-07-14 01:26:03 +03:00
launcherdirs.h Code style: move or add licensing information on top of every file 2017-07-14 01:26:03 +03:00
main.cpp convert line endings from CRLF (Windows) to LF (Linux/Unix) 2023-10-19 16:23:21 +02:00
main.h convert line endings from CRLF (Windows) to LF (Linux/Unix) 2023-10-19 16:23:21 +02:00
mainwindow_moc.cpp select first language 2023-12-17 23:48:21 +01:00
mainwindow_moc.h Initial version of "About Project" tab 2023-07-03 14:34:53 +03:00
mainwindow_moc.ui Use 64px and 32px as icon sizes in launcher sidebar 2023-09-17 15:52:20 +00:00
StdInc.cpp convert line endings from CRLF (Windows) to LF (Linux/Unix) 2023-10-19 16:23:21 +02:00
StdInc.h convert line endings from CRLF (Windows) to LF (Linux/Unix) 2023-10-19 16:23:21 +02:00
updatedialog_moc.cpp Use auto instead of redundant type in initializations using new 2024-01-16 21:40:53 +00:00
updatedialog_moc.h wrap all library code into namespace if VCMI_LIB_NAMESPACE is defined 2022-09-24 15:55:21 +03:00
updatedialog_moc.ui CModListView, firstlaunch and lobby strings reviewed 2023-03-31 19:24:06 +03:00
VCMI_launcher.cbp [c::b] project files tweak 2016-08-18 12:22:34 +03:00
VCMI_launcher.ico Update VCMI icon (#2672) 2023-09-05 23:57:19 +03:00
VCMI_launcher.rc don't use separate .rc files for MSVC and MinGW 2014-10-12 16:32:02 +03:00
VCMI_launcher.vcxproj Update VS files to 2019, partially fix test project 2019-06-09 17:28:55 +02:00
vcmilauncher.desktop Changes related to Debian packaging, based on josch patch 2014-03-20 18:17:40 +00:00