Merge pull request #85 from nonoo/master

Fix file source rewind and read after it is finished
This commit is contained in:
AlexandreRouma 2021-03-23 00:45:18 +01:00 committed by GitHub
commit b72246d769
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

View File

@ -12,6 +12,8 @@ file(GLOB_RECURSE SRC "src/*.cpp" "src/*.c")
include_directories("src/") include_directories("src/")
include_directories("src/libcorrect/") include_directories("src/libcorrect/")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native")
add_library(falcon9_decoder SHARED ${SRC}) add_library(falcon9_decoder SHARED ${SRC})
target_link_libraries(falcon9_decoder PRIVATE sdrpp_core) target_link_libraries(falcon9_decoder PRIVATE sdrpp_core)
set_target_properties(falcon9_decoder PROPERTIES PREFIX "") set_target_properties(falcon9_decoder PROPERTIES PREFIX "")

View File

@ -43,6 +43,7 @@ public:
file.read(_data, size); file.read(_data, size);
int read = file.gcount(); int read = file.gcount();
if (read < size) { if (read < size) {
file.clear();
file.seekg(sizeof(WavHeader_t)); file.seekg(sizeof(WavHeader_t));
file.read(&_data[read], size - read); file.read(&_data[read], size - read);
} }