Skip to content

Commit

Permalink
Merge pull request #27 from am11/c99
Browse files Browse the repository at this point in the history
Convert to plain C99
  • Loading branch information
yuk7 authored Dec 26, 2018
2 parents 153f6d3 + 9578fad commit c7907c9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ compiler:
addons:
apt:
packages:
- g++-mingw-w64-x86-64
- gcc-mingw-w64-x86-64
- binutils-mingw-w64-x86-64
- zip
script:
- '[ -z "$TRAVIS_TAG" ] || SW_VER=-DSW_VER=L\"$TRAVIS_TAG\"'
- 'mkdir out zip'
- 'x86_64-w64-mingw32-g++ --static main.cpp -o out/Launcher.exe $SW_VER'
- 'x86_64-w64-mingw32-gcc -std=c99 --static main.c -o out/Launcher.exe $SW_VER'
- 'find ./res/* -maxdepth 1 -type d -printf ''%f\n'' > resl.txt'
- 'xargs -a resl.txt -I{} x86_64-w64-mingw32-windres res/{}/res.rc -o res/{}.o'
- 'xargs -a resl.txt -I{} x86_64-w64-mingw32-g++ --static main.cpp res/{}.o -o zip/{}.exe $SW_VER'
- 'xargs -a resl.txt -I{} x86_64-w64-mingw32-gcc -std=c99 --static main.c res/{}.o -o zip/{}.exe $SW_VER'
- 'cd zip'
- 'zip ../out/icons.zip *'
- 'cd ..'
Expand Down
5 changes: 3 additions & 2 deletions main.cpp → main.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/


#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -88,7 +89,7 @@ int main()

if(wargc == 1)
{
WslInstallation wslInstallation = WslGetInstallationInfo(TargetName);
struct WslInstallation wslInstallation = WslGetInstallationInfo(TargetName);
char buffer[MAX_BASEPATH_SIZE];
wcstombs(buffer, wslInstallation.basePath, MAX_BASEPATH_SIZE);
if (!dirExists(buffer))
Expand Down Expand Up @@ -200,7 +201,7 @@ int main()
}
else if(wcscmp(wargv[2],L"--lxuid") == 0)
{
WslInstallation wsl = WslGetInstallationInfo(TargetName);
struct WslInstallation wsl = WslGetInstallationInfo(TargetName);
if(wsl.uuid == NULL)
{
hr = E_FAIL;
Expand Down
6 changes: 3 additions & 3 deletions wsld.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ WSLLAUNCH WslLaunch;
struct WslInstallation {
wchar_t uuid[UUID_SIZE];
wchar_t basePath[MAX_BASEPATH_SIZE];
};
} WslInstallation;

void WslApiFree()
{
Expand Down Expand Up @@ -82,8 +82,8 @@ int WslApiInit()
return 0;
}

WslInstallation WslGetInstallationInfo(wchar_t *DistributionName) {
WslInstallation wslInstallation;
struct WslInstallation WslGetInstallationInfo(wchar_t *DistributionName) {
struct WslInstallation wslInstallation;

wchar_t RKey[]=L"Software\\Microsoft\\Windows\\CurrentVersion\\Lxss";
HKEY hKey;
Expand Down

0 comments on commit c7907c9

Please sign in to comment.