Skip to content

Commit 0e94a91

Browse files
authored
Fix compilation issue
Fix some compilation issue on linux
1 parent 008e9c2 commit 0e94a91

File tree

2 files changed

+33
-19
lines changed

2 files changed

+33
-19
lines changed

src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ target_link_libraries(fl2k_fm libosmo-fl2k_shared
103103

104104

105105
if(UNIX)
106+
target_link_libraries(fl2k_file2 m)
106107
target_link_libraries(fl2k_test m)
107108
target_link_libraries(fl2k_fm m)
108109
endif()

src/fl2k_file.c

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,21 @@
3131
#include <unistd.h>
3232

3333
#ifndef _WIN32
34-
#include <unistd.h>
35-
#define sleep_ms(ms) usleep(ms*1000)
34+
#include <unistd.h>
35+
#define sleep_ms(ms) usleep(ms*1000)
36+
#else
37+
#include <windows.h>
38+
#include <io.h>
39+
#include <fcntl.h>
40+
#define sleep_ms(ms) Sleep(ms)
41+
#endif
42+
43+
#define _FILE_OFFSET_BITS 64
44+
45+
#ifdef _WIN64
46+
#define FSEEK fseeko64
3647
#else
37-
#include <windows.h>
38-
#include <io.h>
39-
#include <fcntl.h>
40-
#define sleep_ms(ms) Sleep(ms)
48+
#define FSEEK fseeko
4149
#endif
4250

4351
#include "osmo-fl2k.h"
@@ -215,7 +223,7 @@ unsigned long calc_nb_skip(long sample_cnt,int linelength,long frame_lengt,long
215223
return (nb_skip * linelength);//multiply for giving the number of byte to skip
216224
}
217225

218-
int *read_sample_file(void *inpt_color)
226+
int read_sample_file(void *inpt_color)
219227
{
220228
//parametter
221229
void *buffer = NULL;
@@ -463,7 +471,7 @@ int *read_sample_file(void *inpt_color)
463471
{
464472
if(combine_mode == 0)//default
465473
{
466-
tmp_buf[i] = round((*value16_signed + *value16_2_signed)/ 256.0) + 128;//convert to 8 bit
474+
tmp_buf[i] = round((value16 + value16_2)/ 256.0);//convert to 8 bit
467475
}
468476
else//mode 1
469477
{
@@ -724,17 +732,22 @@ int main(int argc, char **argv)
724732
{
725733
#ifndef _WIN32
726734
struct sigaction sigact, sigign;
735+
#endif
736+
737+
#ifdef _WIN32 || _WIN64
727738
_setmode(_fileno(stdout), O_BINARY);
728739
_setmode(_fileno(stdin), O_BINARY);
729740
#endif
741+
730742
int r, opt, i;
731743
uint32_t buf_num = 0;
732744
int dev_index = 0;
733745
void *status;
734-
off64_t start_r = 0;
735-
off64_t start_g = 0;
736-
off64_t start_b = 0;
737-
off64_t start_audio = 0;
746+
747+
uint64_t start_r = 0;
748+
uint64_t start_g = 0;
749+
uint64_t start_b = 0;
750+
uint64_t start_audio = 0;
738751

739752
//file adress
740753
char *filename_r = NULL;
@@ -991,7 +1004,7 @@ if(red == 1)
9911004
}
9921005
else
9931006
{
994-
fseeko64(file_r,start_r,0);
1007+
FSEEK(file_r,start_r,0);
9951008
}
9961009
}
9971010

@@ -1017,7 +1030,7 @@ if(red2 == 1)
10171030
}
10181031
else
10191032
{
1020-
fseeko64(file2_r,start_r,0);
1033+
FSEEK(file2_r,start_r,0);
10211034
}
10221035
}
10231036
}
@@ -1038,7 +1051,7 @@ if(green == 1)
10381051
}
10391052
else
10401053
{
1041-
fseeko64(file_g,start_g,0);
1054+
FSEEK(file_g,start_g,0);
10421055
}
10431056
}
10441057

@@ -1064,7 +1077,7 @@ if(green2 == 1)
10641077
}
10651078
else
10661079
{
1067-
fseeko64(file2_g,start_g,0);
1080+
FSEEK(file2_g,start_g,0);
10681081
}
10691082
}
10701083
}
@@ -1085,7 +1098,7 @@ if(blue == 1)
10851098
}
10861099
else
10871100
{
1088-
fseeko64(file_b,start_b,0);
1101+
FSEEK(file_b,start_b,0);
10891102
}
10901103
}
10911104

@@ -1111,7 +1124,7 @@ if(blue2 == 1)
11111124
}
11121125
else
11131126
{
1114-
fseeko64(file2_b,start_b,0);
1127+
FSEEK(file2_b,start_b,0);
11151128
}
11161129
}
11171130
}
@@ -1131,7 +1144,7 @@ if(audio == 1)
11311144
}
11321145
else
11331146
{
1134-
fseeko64(file_audio,start_audio,0);
1147+
FSEEK(file_audio,start_audio,0);
11351148
}
11361149
}
11371150
}

0 commit comments

Comments
 (0)