Skip to content

Commit

Permalink
Finally fixed bug for Windows compatibility. Added working tests for …
Browse files Browse the repository at this point in the history
…Windows.
  • Loading branch information
ptrstr committed Feb 26, 2020
1 parent 199f29c commit 79c432b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 18 deletions.
39 changes: 25 additions & 14 deletions .github/workflows/build_cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,36 @@ on: [push]
jobs:
build-Linux-x86_64:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Build
run: |
./build.sh
- name: Test
run: |
./tests.sh ./build/stegano
- name: Upload Artifact
uses: actions/upload-artifact@v1
with:
name: Linux-x86_64
path: ./build/stegano

build-MacOS-x86_64:
runs-on: macos-latest

steps:
- uses: actions/checkout@v1
- name: Build
run: |
./build.sh
- name: Test
run: |
./tests.sh ./build/stegano
- name: Upload Artifact
uses: actions/upload-artifact@v1
with:
Expand All @@ -43,25 +43,36 @@ jobs:

build-MinGW-x86_64:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Configure
run: |
sudo apt install mingw-w64 libz-mingw-w64-dev
- name: Build
run: |
export CC=/usr/bin/x86_64-w64-mingw32-gcc
./build.sh
mv ./build/stegano* ./build/stegano.exe
- name: Test
run: |
./tests.sh ./build/stegano.exe
- name: Upload Artifact
uses: actions/upload-artifact@v1
with:
name: MinGW-x86_64
path: ./build/stegano.exe

test-MinGW-x86_64:
runs-on: windows-latest
needs: [build-MinGW-x86_64]

steps:
- uses: actions/checkout@v1
- uses: actions/download-artifact@v1
with:
name: MinGW-x86_64

- name: Test
shell: bash
run: |
./tests.sh ./MinGW-x86_64/stegano.exe
8 changes: 4 additions & 4 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ int main(int argc, char *argv[]) {
uint64_t offsetsSize = 0;

uint8_t isUsingHeader = 0;

uint8_t isUsingCustomOffsets = 0;

// Verify Parameters and Assign Them
Expand Down Expand Up @@ -145,7 +145,7 @@ int main(int argc, char *argv[]) {
uint8_t requiredArguments = 4;
if (getBit(mandatoryCheck, 1, 0) == 1 && isEncoding == 1)
requiredArguments = 5;

if (countBits(mandatoryCheck) < requiredArguments || isEncoding == 2) {
for (uint8_t i = 0; i < requiredArguments; i++) {
if (getBit(mandatoryCheck, i, 0) == 0) {
Expand Down Expand Up @@ -195,7 +195,7 @@ int main(int argc, char *argv[]) {
FORMAT format = getFormat(targetBuffer, targetSize);
if (format == NULLFORMAT && !isUsingCustomOffsets)
showError("The target filetype is unrecognized! See the -v argument to show all current supported formats.");

if (isUsingCustomOffsets)
format = NULLFORMAT;

Expand All @@ -207,7 +207,7 @@ int main(int argc, char *argv[]) {
// Prepare buffer for exceptions
startFormatBuffer(&targetBuffer, &targetSize, format, &offsets, &offsetsSize);

outputFile = fopen(outputFileName, "w");
outputFile = fopen(outputFileName, "wb");
if (!outputFile)
showError("Output file could not be opened for writing! Make sure you have permissions.");

Expand Down

0 comments on commit 79c432b

Please sign in to comment.