Format the code via clang-format

This commit is contained in:
Maschell 2022-02-04 15:05:17 +01:00
parent 8cc667aa6f
commit b97c6bf3c9
14 changed files with 158 additions and 71 deletions

67
.clang-format Normal file
View File

@ -0,0 +1,67 @@
# Generated from CLion C/C++ Code Style settings
BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: Consecutive
AlignConsecutiveMacros: AcrossEmptyLinesAndComments
AlignOperands: Align
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Always
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Always
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterReturnType: None
AlwaysBreakTemplateDeclarations: Yes
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: true
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
ColumnLimit: 0
CompactNamespaces: false
ContinuationIndentWidth: 8
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 4
KeepEmptyLinesAtTheStartOfBlocks: true
MaxEmptyLinesToKeep: 2
NamespaceIndentation: All
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PointerAlignment: Right
ReflowComments: false
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
TabWidth: 4
UseTab: Never

View File

@ -6,8 +6,16 @@ on:
- main - main
jobs: jobs:
clang-format:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: clang-format
run: |
docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./src
build-binary: build-binary:
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
needs: clang-format
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: build binary - name: build binary

View File

@ -3,8 +3,16 @@ name: CI-PR
on: [pull_request] on: [pull_request]
jobs: jobs:
clang-format:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: clang-format
run: |
docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./src
build-binary: build-binary:
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
needs: clang-format
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: build binary - name: build binary

View File

@ -1,3 +1,5 @@
[![CI-Release](https://github.com/wiiu-env/sdcafiine_plugin/actions/workflows/ci.yml/badge.svg)](https://github.com/wiiu-env/sdcafiine_plugin/actions/workflows/ci.yml)
# SDCafiine Plugin # SDCafiine Plugin
## What is SDCafiine ## What is SDCafiine
@ -58,3 +60,7 @@ docker run -it --rm -v ${PWD}:/project sdcafiineplugin-builder make
# make clean # make clean
docker run -it --rm -v ${PWD}:/project sdcafiineplugin-builder make clean docker run -it --rm -v ${PWD}:/project sdcafiineplugin-builder make clean
``` ```
## Format the code via docker
`docker run --rm -v ${PWD}:/src wiiuenv/clang-format:13.0.0-2 -r ./src -i`

View File

@ -24,14 +24,14 @@
* DirList Class * DirList Class
* for WiiXplorer 2010 * for WiiXplorer 2010
***************************************************************************/ ***************************************************************************/
#include <algorithm>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <string> #include <string>
#include <strings.h> #include <strings.h>
#include <algorithm>
#include <sys/stat.h>
#include <sys/dirent.h> #include <sys/dirent.h>
#include <sys/stat.h>
#include <fs/DirList.h> #include <fs/DirList.h>
#include <utils/StringTools.h> #include <utils/StringTools.h>

View File

@ -27,8 +27,8 @@
#ifndef ___DIRLIST_H_ #ifndef ___DIRLIST_H_
#define ___DIRLIST_H_ #define ___DIRLIST_H_
#include <vector>
#include <string> #include <string>
#include <vector>
#include <wut_types.h> #include <wut_types.h>
typedef struct { typedef struct {
@ -60,7 +60,8 @@ public:
//!\param list index //!\param list index
const char *GetFilepath(int32_t index) const { const char *GetFilepath(int32_t index) const {
if (!valid(index)) return ""; if (!valid(index)) return "";
else return FileInfo[index].FilePath; else
return FileInfo[index].FilePath;
} }
//! Get the a filesize of the list //! Get the a filesize of the list
@ -94,6 +95,7 @@ public:
Dirs = 0x02, Dirs = 0x02,
CheckSubfolders = 0x08, CheckSubfolders = 0x08,
}; };
protected: protected:
// Internal parser // Internal parser
BOOL InternalLoadPath(std::string &path); BOOL InternalLoadPath(std::string &path);

View File

@ -1,7 +1,7 @@
#include <wups.h>
#include "utils/logger.h"
#include "modpackSelector.h" #include "modpackSelector.h"
#include "utils/logger.h"
#include <coreinit/title.h> #include <coreinit/title.h>
#include <wups.h>
WUPS_PLUGIN_NAME("SDCafiine"); WUPS_PLUGIN_NAME("SDCafiine");
WUPS_PLUGIN_DESCRIPTION("Wiiload Server"); WUPS_PLUGIN_DESCRIPTION("Wiiload Server");
@ -16,6 +16,6 @@ ON_APPLICATION_START() {
initLogging(); initLogging();
HandleMultiModPacks(OSGetTitleID()); HandleMultiModPacks(OSGetTitleID());
} }
ON_APPLICATION_ENDS(){ ON_APPLICATION_ENDS() {
deinitLogging(); deinitLogging();
} }

View File

@ -4,8 +4,8 @@
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#include <stdint.h>
#include <nsysnet/socket.h> #include <nsysnet/socket.h>
#include <stdint.h>
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -1,20 +1,20 @@
#include <string> #include "modpackSelector.h"
#include <map>
#include <cstring>
#include <cstdlib>
#include <cstdarg> #include <cstdarg>
#include <cstdio> #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <malloc.h> #include <malloc.h>
#include "modpackSelector.h" #include <map>
#include <string>
#include <coreinit/thread.h> #include <coreinit/thread.h>
#include <memory/mappedmemory.h> #include <memory/mappedmemory.h>
#include <utils/logger.h>
#include <fs/DirList.h>
#include <coreinit/screen.h> #include <coreinit/screen.h>
#include <vpad/input.h> #include <fs/DirList.h>
#include <rpxloader.h> #include <rpxloader.h>
#include <utils/logger.h>
#include <vpad/input.h>
#define TEXT_SEL(x, text1, text2) ((x) ? (text1) : (text2)) #define TEXT_SEL(x, text1, text2) ((x) ? (text1) : (text2))
@ -59,8 +59,7 @@ void HandleMultiModPacks(uint64_t titleID) {
OSScreenInit(); OSScreenInit();
uint32_t screen_buf0_size = OSScreenGetBufferSizeEx(SCREEN_TV); uint32_t screen_buf0_size = OSScreenGetBufferSizeEx(SCREEN_TV);
uint32_t screen_buf1_size = OSScreenGetBufferSizeEx(SCREEN_DRC); uint32_t screen_buf1_size = OSScreenGetBufferSizeEx(SCREEN_DRC);
uint8_t *screenBuffer = (uint8_t *) MEMAllocFromMappedMemoryForGX2Ex(screen_buf0_size + screen_buf1_size, 0x100 uint8_t *screenBuffer = (uint8_t *) MEMAllocFromMappedMemoryForGX2Ex(screen_buf0_size + screen_buf1_size, 0x100);
);
if (screenBuffer == nullptr) { if (screenBuffer == nullptr) {
DEBUG_FUNCTION_LINE("Failed to alloc"); DEBUG_FUNCTION_LINE("Failed to alloc");
return; return;
@ -189,7 +188,6 @@ void console_print_pos(int x, int y, const char *format, ...) {
OSScreenPutFontEx(SCREEN_TV, x, y, tmp); OSScreenPutFontEx(SCREEN_TV, x, y, tmp);
OSScreenPutFontEx(SCREEN_DRC, x, y, tmp); OSScreenPutFontEx(SCREEN_DRC, x, y, tmp);
} }
va_end(va); va_end(va);

View File

@ -1,15 +1,14 @@
#ifndef _MODPACK_SELECTOR_H_ #pragma once
#define _MODPACK_SELECTOR_H_
#include <stdint.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
void HandleMultiModPacks(uint64_t titleid/*,bool showMenu = true*/); void HandleMultiModPacks(uint64_t titleid /*,bool showMenu = true*/);
void console_print_pos(int x, int y, const char *format, ...); void console_print_pos(int x, int y, const char *format, ...);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif //_MODPACK_SELECTOR_H_

View File

@ -23,17 +23,16 @@
* *
* for WiiXplorer 2010 * for WiiXplorer 2010
***************************************************************************/ ***************************************************************************/
#include <vector>
#include <string>
#include <string.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <string.h>
#include <wchar.h> #include <string>
#include <strings.h> #include <strings.h>
#include <wut_types.h>
#include <stdio.h>
#include <utils/StringTools.h> #include <utils/StringTools.h>
#include <vector>
#include <wchar.h>
#include <wut_types.h>
BOOL StringTools::EndsWith(const std::string &a, const std::string &b) { BOOL StringTools::EndsWith(const std::string &a, const std::string &b) {

View File

@ -26,8 +26,8 @@
#ifndef __STRING_TOOLS_H #ifndef __STRING_TOOLS_H
#define __STRING_TOOLS_H #define __STRING_TOOLS_H
#include <vector>
#include <string> #include <string>
#include <vector>
#include <wut_types.h> #include <wut_types.h>
class StringTools { class StringTools {
@ -85,4 +85,3 @@ public:
}; };
#endif /* __STRING_TOOLS_H */ #endif /* __STRING_TOOLS_H */

View File

@ -1,8 +1,8 @@
#ifdef DEBUG #ifdef DEBUG
#include <stdint.h> #include <stdint.h>
#include <whb/log_udp.h>
#include <whb/log_cafe.h> #include <whb/log_cafe.h>
#include <whb/log_module.h> #include <whb/log_module.h>
#include <whb/log_udp.h>
uint32_t moduleLogInit = false; uint32_t moduleLogInit = false;
uint32_t cafeLogInit = false; uint32_t cafeLogInit = false;

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include <whb/log.h>
#include <string.h> #include <string.h>
#include <whb/log.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -14,12 +14,14 @@ extern "C" {
#define DEBUG_FUNCTION_LINE_VERBOSE(FMT, ARGS...) while (0) #define DEBUG_FUNCTION_LINE_VERBOSE(FMT, ARGS...) while (0)
#define DEBUG_FUNCTION_LINE(FMT, ARGS...)do { \ #define DEBUG_FUNCTION_LINE(FMT, ARGS...) \
WHBLogPrintf("[%23s]%30s@L%04d: " FMT "",__FILENAME__,__FUNCTION__, __LINE__, ## ARGS); \ do { \
WHBLogPrintf("[%23s]%30s@L%04d: " FMT "", __FILENAME__, __FUNCTION__, __LINE__, ##ARGS); \
} while (0) } while (0)
#define DEBUG_FUNCTION_LINE_WRITE(FMT, ARGS...)do { \ #define DEBUG_FUNCTION_LINE_WRITE(FMT, ARGS...) \
WHBLogWritef("[%23s]%30s@L%04d: " FMT "",__FILENAME__,__FUNCTION__, __LINE__, ## ARGS); \ do { \
WHBLogWritef("[%23s]%30s@L%04d: " FMT "", __FILENAME__, __FUNCTION__, __LINE__, ##ARGS); \
} while (0) } while (0)
#else #else
@ -39,4 +41,3 @@ void deinitLogging();
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif