Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Tatsh committed Oct 22, 2023
1 parent 2866223 commit d92a21c
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 68 deletions.
23 changes: 9 additions & 14 deletions .vs/launch.vs.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
{
"version": "0.2.1",
"defaults": {},
"configurations": [
{
"type": "default",
"project": "CMakeLists.txt",
"projectTarget": "winprefs.exe (native\\Debug\\winprefs.exe)",
"name": "winprefs.exe (native\\Debug\\winprefs.exe)",
"args": [
"-K",
"st",
"-c",
"-d"
]
"args": ["-K", "st", "-c", "-d"],
"name": "winprefs.exe (native\\Debug\\winprefs.exe)",
"project": "CMakeLists.txt",
"projectTarget": "winprefs.exe (native\\Debug\\winprefs.exe)",
"type": "default"
}
]
}
],
"defaults": {},
"version": "0.2.1"
}
71 changes: 34 additions & 37 deletions native/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@ wchar_t *get_git_branch(const wchar_t *git_dir_arg,
return NULL;
}
wmemset(cmd, L'\0', cmd_len);
_snwprintf(cmd,
cmd_len,
L"git.exe %ls %ls branch --show-current", git_dir_arg,
work_tree_arg);
_snwprintf(cmd, cmd_len, L"git.exe %ls %ls branch --show-current", git_dir_arg, work_tree_arg);
cmd[cmd_len - 1] = L'\0';
BOOL ret = CreateProcess(NULL, cmd, NULL, NULL, TRUE, CREATE_NEW_CONSOLE, NULL, NULL, &si, &pi);
if (!ret) {
Expand Down Expand Up @@ -280,19 +277,19 @@ int save_preferences(bool commit,
abort();
}
if (_wspawnlp(P_WAIT,
L"git.exe",
L"git",
git_dir_arg,
work_tree_arg,
L"commit",
L"--no-gpg-sign",
L"--quiet",
L"--no-verify",
L"\"--author=winprefs <[email protected]>\"",
L"-m",
L"git.exe",
L"git",
git_dir_arg,
work_tree_arg,
L"commit",
L"--no-gpg-sign",
L"--quiet",
L"--no-verify",
L"\"--author=winprefs <[email protected]>\"",
L"-m",
L"\"Automatic commit @ \"",
nullptr) != 0) {
abort();
abort();
}
if (deploy_key) {
size_t ssh_command_len = 68 + wcslen(full_deploy_key_path) + 3;
Expand All @@ -301,18 +298,18 @@ int save_preferences(bool commit,
abort();
}
wmemset(ssh_command, L'\0', ssh_command_len);
_snwprintf(ssh_command,
ssh_command_len,
L"\"ssh -i %ls -F nul -o UserKnownHostsFile=nul -o StrictHostKeyChecking=no\"",
full_deploy_key_path);
if (
_wspawnlp(P_WAIT,
L"git.exe",
L"git",
git_dir_arg,
work_tree_arg,
L"config",
L"core.sshCommand",
_snwprintf(
ssh_command,
ssh_command_len,
L"\"ssh -i %ls -F nul -o UserKnownHostsFile=nul -o StrictHostKeyChecking=no\"",
full_deploy_key_path);
if (_wspawnlp(P_WAIT,
L"git.exe",
L"git",
git_dir_arg,
work_tree_arg,
L"config",
L"core.sshCommand",
ssh_command,
nullptr) != 0) {
abort();
Expand All @@ -327,16 +324,16 @@ int save_preferences(bool commit,
branch_arg);
}
if (_wspawnlp(P_WAIT,
L"git.exe",
L"git",
git_dir_arg,
work_tree_arg,
L"push",
L"-u",
L"--porcelain",
L"--no-signed",
L"origin",
L"origin",
L"git.exe",
L"git",
git_dir_arg,
work_tree_arg,
L"push",
L"-u",
L"--porcelain",
L"--no-signed",
L"origin",
L"origin",
branch_arg,
nullptr) != 0) {
abort();
Expand Down
24 changes: 12 additions & 12 deletions native/msvc.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#ifndef MEH_H
#define MEH_H

#ifdef _MSC_VER
#define nullptr NULL
#define bool BOOL

#define true TRUE
#define false FALSE
#endif

#endif // MEH_H
#ifndef MEH_H
#define MEH_H

#ifdef _MSC_VER
#define nullptr NULL
#define bool BOOL

#define true TRUE
#define false FALSE
#endif

#endif // MEH_H
7 changes: 2 additions & 5 deletions native/reg_command.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,8 @@ void do_write_reg_command(FILE *out_fp,
free(escaped_reg_key);
}

void do_write_reg_commands(FILE *out_fp,
HKEY hk,
unsigned n_values,
const wchar_t *full_path,
bool debug) {
void do_write_reg_commands(
FILE *out_fp, HKEY hk, unsigned n_values, const wchar_t *full_path, bool debug) {
DWORD data_len;
DWORD i;
DWORD reg_type;
Expand Down

0 comments on commit d92a21c

Please sign in to comment.