Skip to content

Commit

Permalink
libbladeRF: gcc-14 fixes (#362314)
Browse files Browse the repository at this point in the history
  • Loading branch information
markuskowa authored Dec 6, 2024
2 parents 3a8426d + 8a5d6f5 commit db7c809
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
26 changes: 26 additions & 0 deletions pkgs/by-name/li/libbladeRF/gcc-14-calloc-fixes.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/host/utilities/bladeRF-fsk/c/src/fir_filter.c b/host/utilities/bladeRF-fsk/c/src/fir_filter.c
index 59f34f0..7def697 100644
--- a/host/utilities/bladeRF-fsk/c/src/fir_filter.c
+++ b/host/utilities/bladeRF-fsk/c/src/fir_filter.c
@@ -213,18 +213,18 @@ int main(int argc, char *argv[])
return EXIT_FAILURE;
}

- inbuf = calloc(2*sizeof(int16_t), chunk_size);
+ inbuf = calloc(chunk_size, 2*sizeof(int16_t));
if (!inbuf) {
perror("calloc");
goto out;
}
- tempbuf = calloc(2*sizeof(int16_t), chunk_size);
+ tempbuf = calloc(chunk_size, 2*sizeof(int16_t));
if (!tempbuf) {
perror("calloc");
goto out;
}

- outbuf = calloc(sizeof(struct complex_sample), chunk_size);
+ outbuf = calloc(chunk_size, sizeof(struct complex_sample));
if (!outbuf) {
perror("calloc");
goto out;
5 changes: 5 additions & 0 deletions pkgs/by-name/li/libbladeRF/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ stdenv.mkDerivation rec {
fetchSubmodules = true;
};

patches = [
# https://github.com/Nuand/bladeRF/issues/994
./gcc-14-calloc-fixes.diff
];

nativeBuildInputs = [ cmake pkg-config git doxygen help2man ];
# ncurses used due to https://github.com/Nuand/bladeRF/blob/ab4fc672c8bab4f8be34e8917d3f241b1d52d0b8/host/utilities/bladeRF-cli/CMakeLists.txt#L208
buildInputs = [ tecla libusb1 ]
Expand Down

0 comments on commit db7c809

Please sign in to comment.