[med-svn] [Git][med-team/libbigwig][upstream] New upstream version 0.4.7+dfsg

Andreas Tille (@tille) gitlab at salsa.debian.org
Thu Aug 25 07:01:58 BST 2022



Andreas Tille pushed to branch upstream at Debian Med / libbigwig


Commits:
09617c2b by Andreas Tille at 2022-08-25T07:52:12+02:00
New upstream version 0.4.7+dfsg
- - - - -


15 changed files:

- + CMakeLists.txt
- Makefile
- README.md
- bigWig.h
- bigWigIO.h
- bwCommon.h
- bwRead.c
- bwStats.c
- bwValues.c
- bwWrite.c
- io.c
- + test/CMakeLists.txt
- test/exampleWrite.c
- test/test.py
- test/testWrite.c


Changes:

=====================================
CMakeLists.txt
=====================================
@@ -0,0 +1,65 @@
+cmake_minimum_required(VERSION 3.8)
+
+project(libBigWig LANGUAGES C)
+
+set(CMAKE_C_STANDARD 11)
+set(CMAKE_C_STANDARD_REQUIRED ON)
+
+option(WITH_CURL "Enable CURL support" ON)
+option(WITH_ZLIBNG "Link to zlib-ng instead of zlib" OFF)
+option(BUILD_SHARED_LIBS "Build shared library" OFF)
+option(ENABLE_TESTING "Build tests" OFF)
+
+if(WITH_ZLIBNG)
+  find_package(zlib-ng REQUIRED)
+else()
+  find_package(ZLIB REQUIRED)
+endif()
+
+if(WITH_CURL)
+  find_package(CURL REQUIRED)
+endif()
+
+add_library(BigWig)
+add_library(libBigWig::libbigwig ALIAS BigWig)
+
+target_sources(
+  BigWig
+  PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/bwRead.c
+          ${CMAKE_CURRENT_SOURCE_DIR}/bwStats.c
+          ${CMAKE_CURRENT_SOURCE_DIR}/bwValues.c
+          ${CMAKE_CURRENT_SOURCE_DIR}/bwWrite.c
+          ${CMAKE_CURRENT_SOURCE_DIR}/io.c)
+
+target_include_directories(BigWig PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
+
+if(NOT WITH_CURL)
+  target_compile_definitions(BigWig PUBLIC NOCURL)
+endif()
+
+target_link_libraries(
+  BigWig PUBLIC $<IF:$<BOOL:${WITH_ZLIBNG}>,zlib-ng::zlib-ng,ZLIB::ZLIB>
+                $<$<BOOL:${WITH_CURL}>:CURL::libcurl> m)
+
+target_compile_features(BigWig PRIVATE c_std_${CMAKE_C_STANDARD})
+
+set(LIBBIGWIG_COMPILER_WARNINGS -Wall -Wsign-compare)
+target_compile_options(BigWig PRIVATE ${LIBBIGWIG_COMPILER_WARNINGS})
+
+set(LIBBIGWIG_PUBLIC_HEADERS "bigWig.h;bigWigIO.h;bwCommon.h;bwValues.h")
+
+set_target_properties(BigWig PROPERTIES PUBLIC_HEADER
+                                        "${LIBBIGWIG_PUBLIC_HEADERS}")
+
+if(ENABLE_TESTING)
+  add_subdirectory(test)
+endif()
+
+include(GNUInstallDirs)
+install(
+  TARGETS BigWig
+  BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR}
+  RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+  LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+  ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+  PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libbigwig)


=====================================
Makefile
=====================================
@@ -72,7 +72,7 @@ test/testWrite: libBigWig.a
 	$(CC) -o $@ -I. $(CFLAGS) test/testWrite.c libBigWig.a $(LIBS)
 
 test/exampleWrite: libBigWig.so
-	$(CC) -o $@ -I. -L. $(CFLAGS) test/exampleWrite.c -lBigWig $(LIBS) -Wl,-rpath .
+	$(CC) -o $@ -I. -L. $(CFLAGS) test/exampleWrite.c libBigWig.a $(LIBS)
 
 test/testBigBed: libBigWig.a
 	$(CC) -o $@ -I. $(CFLAGS) test/testBigBed.c libBigWig.a $(LIBS)
@@ -81,7 +81,7 @@ test/testIterator: libBigWig.a
 	$(CC) -o $@ -I. $(CFLAGS) test/testIterator.c libBigWig.a $(LIBS)
 
 test: test/testLocal test/testRemote test/testWrite test/testLocal test/exampleWrite test/testRemoteManyContigs test/testBigBed test/testIterator
-	./test/test.py
+	./test/test.py test test/test.bw
 
 clean:
 	rm -f *.o libBigWig.a libBigWig.so *.pico test/testLocal test/testRemote test/testWrite test/exampleWrite test/testRemoteManyContigs test/testBigBed test/testIterator example_output.bw


=====================================
README.md
=====================================
@@ -246,3 +246,5 @@ There are currently two python interfaces that make use of libBigWig: [pyBigWig]
 # Building without remote file access
 
 If you want to compile without remote file access (e.g., you don't have curl installed), then you can append `-DNOCURL` to the `CFLAGS` line in the `Makefile`. You will also need to remove `-lcurl` from the `LIBS` line.
+
+If you are building libBigWig using CMake you can instead pass `-DWITH_CURL=OFF` when calling CMake at configuration time.


=====================================
bigWig.h
=====================================
@@ -56,7 +56,7 @@ extern "C" {
 /*!
  * The library version number
  */
-#define LIBBIGWIG_VERSION 0.4.6
+#define LIBBIGWIG_VERSION 0.4.7
 
 /*!
  * If 1, then this library was compiled with remote file support.
@@ -279,7 +279,7 @@ void bwCleanup(void);
  * @param callBack An optional user-supplied function. This is applied to remote connections so users can specify things like proxy and password information. See `test/testRemote` for an example.
  * @return 1 if the file appears to be bigWig, otherwise 0.
  */
-int bwIsBigWig(char *fname, CURLcode (*callBack)(CURL*));
+int bwIsBigWig(const char *fname, CURLcode (*callBack)(CURL*));
 
 /*!
  * @brief Determine is a file is a bigBed file.
@@ -288,7 +288,7 @@ int bwIsBigWig(char *fname, CURLcode (*callBack)(CURL*));
  * @param callBack An optional user-supplied function. This is applied to remote connections so users can specify things like proxy and password information. See `test/testRemote` for an example.
  * @return 1 if the file appears to be bigWig, otherwise 0.
  */
-int bbIsBigBed(char *fname, CURLcode (*callBack)(CURL*));
+int bbIsBigBed(const char *fname, CURLcode (*callBack)(CURL*));
 
 /*!
  * @brief Opens a local or remote bigWig file.
@@ -298,7 +298,7 @@ int bbIsBigBed(char *fname, CURLcode (*callBack)(CURL*));
  * @param mode The mode, by default "r". Both local and remote files can be read, but only local files can be written. For files being written the callback function is ignored. If and only if the mode contains "w" will the file be opened for writing (in all other cases the file will be opened for reading.
  * @return A bigWigFile_t * on success and NULL on error.
  */
-bigWigFile_t *bwOpen(char *fname, CURLcode (*callBack)(CURL*), const char* mode);
+bigWigFile_t *bwOpen(const char *fname, CURLcode (*callBack)(CURL*), const char* mode);
 
 /*!
  * @brief Opens a local or remote bigBed file.
@@ -307,7 +307,7 @@ bigWigFile_t *bwOpen(char *fname, CURLcode (*callBack)(CURL*), const char* mode)
  * @param callBack An optional user-supplied function. This is applied to remote connections so users can specify things like proxy and password information. See `test/testRemote` for an example.
  * @return A bigWigFile_t * on success and NULL on error.
  */
-bigWigFile_t *bbOpen(char *fname, CURLcode (*callBack)(CURL*));
+bigWigFile_t *bbOpen(const char *fname, CURLcode (*callBack)(CURL*));
 
 /*!
  * @brief Returns a string containing the SQL entry (or NULL).
@@ -339,7 +339,7 @@ void bwClose(bigWigFile_t *fp);
  * @param chrom A chromosome name
  * @return An ID, -1 will be returned on error (note that this is an unsigned value, so that's ~4 billion. bigWig/bigBed files can't store that many chromosomes anyway.
  */
-uint32_t bwGetTid(bigWigFile_t *fp, char *chrom);
+uint32_t bwGetTid(const bigWigFile_t *fp, const char *chrom);
 
 /*!
  * @brief Frees space allocated by `bwGetOverlappingIntervals`
@@ -367,7 +367,7 @@ void bbDestroyOverlappingEntries(bbOverlappingEntries_t *o);
  * @see bwDestroyOverlappingIntervals
  * @see bwGetValues
  */
-bwOverlappingIntervals_t *bwGetOverlappingIntervals(bigWigFile_t *fp, char *chrom, uint32_t start, uint32_t end);
+bwOverlappingIntervals_t *bwGetOverlappingIntervals(bigWigFile_t *fp, const char *chrom, uint32_t start, uint32_t end);
 
 /*!
  * @brief Return bigBed entries overlapping an interval.
@@ -381,7 +381,7 @@ bwOverlappingIntervals_t *bwGetOverlappingIntervals(bigWigFile_t *fp, char *chro
  * @see bbOverlappingEntries_t
  * @see bbDestroyOverlappingEntries
  */
-bbOverlappingEntries_t *bbGetOverlappingEntries(bigWigFile_t *fp, char *chrom, uint32_t start, uint32_t end, int withString);
+bbOverlappingEntries_t *bbGetOverlappingEntries(bigWigFile_t *fp, const char *chrom, uint32_t start, uint32_t end, int withString);
 
 /*!
  * @brief Creates an iterator over intervals in a bigWig file
@@ -397,7 +397,7 @@ bbOverlappingEntries_t *bbGetOverlappingEntries(bigWigFile_t *fp, char *chrom, u
  * @see bwIteratorNext
  * @see bwIteratorDestroy
  */ 
-bwOverlapIterator_t *bwOverlappingIntervalsIterator(bigWigFile_t *fp, char *chrom, uint32_t start, uint32_t end, uint32_t blocksPerIteration);
+bwOverlapIterator_t *bwOverlappingIntervalsIterator(bigWigFile_t *fp, const char *chrom, uint32_t start, uint32_t end, uint32_t blocksPerIteration);
 
 /*!
  * @brief Creates an iterator over entries in a bigBed file
@@ -415,7 +415,7 @@ bwOverlapIterator_t *bwOverlappingIntervalsIterator(bigWigFile_t *fp, char *chro
  * @see bwIteratorNext
  * @see bwIteratorDestroy
  */ 
-bwOverlapIterator_t *bbOverlappingEntriesIterator(bigWigFile_t *fp, char *chrom, uint32_t start, uint32_t end, int withString, uint32_t blocksPerIteration);
+bwOverlapIterator_t *bbOverlappingEntriesIterator(bigWigFile_t *fp, const char *chrom, uint32_t start, uint32_t end, int withString, uint32_t blocksPerIteration);
 
 /*!
  * @brief Traverses to the entries/intervals in the next group of blocks.
@@ -445,7 +445,7 @@ void bwIteratorDestroy(bwOverlapIterator_t *iter);
  * @see bwDestroyOverlappingIntervals
  * @see bwGetOverlappingIntervals
  */
-bwOverlappingIntervals_t *bwGetValues(bigWigFile_t *fp, char *chrom, uint32_t start, uint32_t end, int includeNA);
+bwOverlappingIntervals_t *bwGetValues(bigWigFile_t *fp, const char *chrom, uint32_t start, uint32_t end, int includeNA);
 
 /*!
  * @brief Determines per-interval bigWig statistics
@@ -459,7 +459,7 @@ bwOverlappingIntervals_t *bwGetValues(bigWigFile_t *fp, char *chrom, uint32_t st
  * @see bwStatsType
  * @return A pointer to an array of double precission floating point values. Note that bigWig files only hold 32-bit values, so this is done to help prevent overflows.
  */
-double *bwStats(bigWigFile_t *fp, char *chrom, uint32_t start, uint32_t end, uint32_t nBins, enum bwStatsType type);
+double *bwStats(bigWigFile_t *fp, const char *chrom, uint32_t start, uint32_t end, uint32_t nBins, enum bwStatsType type);
 
 /*!
  * @brief Determines per-interval bigWig statistics
@@ -473,7 +473,7 @@ double *bwStats(bigWigFile_t *fp, char *chrom, uint32_t start, uint32_t end, uin
  * @see bwStatsType
  * @return A pointer to an array of double precission floating point values. Note that bigWig files only hold 32-bit values, so this is done to help prevent overflows.
 */
-double *bwStatsFromFull(bigWigFile_t *fp, char *chrom, uint32_t start, uint32_t end, uint32_t nBins, enum bwStatsType type);
+double *bwStatsFromFull(bigWigFile_t *fp, const char *chrom, uint32_t start, uint32_t end, uint32_t nBins, enum bwStatsType type);
 
 //Writer functions
 
@@ -494,7 +494,7 @@ int bwCreateHdr(bigWigFile_t *fp, int32_t maxZooms);
  * @param n The number of chromosomes (thus, the length of `chroms` and `lengths`)
  * @return A pointer to a chromList_t or NULL on error.
  */
-chromList_t *bwCreateChromList(char **chroms, uint32_t *lengths, int64_t n);
+chromList_t *bwCreateChromList(const char* const* chroms, const uint32_t *lengths, int64_t n);
 
 /*!
  * @brief Write a the header to a bigWig file.
@@ -521,7 +521,7 @@ int bwWriteHdr(bigWigFile_t *bw);
  * @return 0 on success and another value on error.
  * @see bwAppendIntervals
  */
-int bwAddIntervals(bigWigFile_t *fp, char **chrom, uint32_t *start, uint32_t *end, float *values, uint32_t n);
+int bwAddIntervals(bigWigFile_t *fp, const char* const* chrom, const uint32_t *start, const uint32_t *end, const float *values, uint32_t n);
 
 /*!
  * @brief Append bedGraph-like intervals to a previous block of bedGraph-like intervals in a bigWig file.
@@ -535,7 +535,7 @@ int bwAddIntervals(bigWigFile_t *fp, char **chrom, uint32_t *start, uint32_t *en
  * @warning Do NOT use this after `bwAddIntervalSpanSteps()`, `bwAppendIntervalSpanSteps()`, `bwAddIntervalSpanSteps()`, or `bwAppendIntervalSpanSteps()`.
  * @see bwAddIntervals
  */
-int bwAppendIntervals(bigWigFile_t *fp, uint32_t *start, uint32_t *end, float *values, uint32_t n);
+int bwAppendIntervals(bigWigFile_t *fp, const uint32_t *start, const uint32_t *end, const float *values, uint32_t n);
 
 /*!
  * @brief Add a new block of variable-step entries to a bigWig file
@@ -553,7 +553,7 @@ int bwAppendIntervals(bigWigFile_t *fp, uint32_t *start, uint32_t *end, float *v
  * @return 0 on success and another value on error.
  * @see bwAppendIntervalSpans
  */
-int bwAddIntervalSpans(bigWigFile_t *fp, char *chrom, uint32_t *start, uint32_t span, float *values, uint32_t n);
+int bwAddIntervalSpans(bigWigFile_t *fp, const char *chrom, const uint32_t *start, uint32_t span, const float *values, uint32_t n);
 
 /*!
  * @brief Append to a previous block of variable-step entries.
@@ -566,7 +566,7 @@ int bwAddIntervalSpans(bigWigFile_t *fp, char *chrom, uint32_t *start, uint32_t
  * @warning Do NOT use this after `bwAddIntervals()`, `bwAppendIntervals()`, `bwAddIntervalSpanSteps()` or `bwAppendIntervalSpanSteps()`
  * @see bwAddIntervalSpans
  */
-int bwAppendIntervalSpans(bigWigFile_t *fp, uint32_t *start, float *values, uint32_t n);
+int bwAppendIntervalSpans(bigWigFile_t *fp, const uint32_t *start, const float *values, uint32_t n);
 
 /*!
  * @brief Add a new block of fixed-step entries to a bigWig file
@@ -585,7 +585,7 @@ int bwAppendIntervalSpans(bigWigFile_t *fp, uint32_t *start, float *values, uint
  * @return 0 on success and another value on error.
  * @see bwAddIntervalSpanSteps
  */
-int bwAddIntervalSpanSteps(bigWigFile_t *fp, char *chrom, uint32_t start, uint32_t span, uint32_t step, float *values, uint32_t n);
+int bwAddIntervalSpanSteps(bigWigFile_t *fp, const char *chrom, uint32_t start, uint32_t span, uint32_t step, const float *values, uint32_t n);
 
 /*!
  * @brief Append to a previous block of fixed-step entries.
@@ -597,7 +597,7 @@ int bwAddIntervalSpanSteps(bigWigFile_t *fp, char *chrom, uint32_t start, uint32
  * @warning Do NOT use this after `bwAddIntervals()`, `bwAppendIntervals()`, `bwAddIntervalSpans()` or `bwAppendIntervalSpans()`
  * @see bwAddIntervalSpanSteps
  */
-int bwAppendIntervalSpanSteps(bigWigFile_t *fp, float *values, uint32_t n);
+int bwAppendIntervalSpanSteps(bigWigFile_t *fp, const float *values, uint32_t n);
 
 #ifdef __cplusplus
 }


=====================================
bigWigIO.h
=====================================
@@ -49,7 +49,7 @@ typedef struct {
     size_t bufLen; /**<The actual size of the buffer used.*/
     enum bigWigFile_type_enum type; /**<The connection type*/
     int isCompressed; /**<1 if the file is compressed, otherwise 0*/
-    char *fname; /**<Only needed for remote connections. The original URL/filename requested, since we need to make multiple connections.*/
+    const char *fname; /**<Only needed for remote connections. The original URL/filename requested, since we need to make multiple connections.*/
 } URL_t;
 
 /*!
@@ -94,7 +94,7 @@ CURLcode urlSeek(URL_t *URL, size_t pos);
  *
  *  @return A URL_t * or NULL on error.
  */
-URL_t *urlOpen(char *fname, CURLcode (*callBack)(CURL*), const char* mode);
+URL_t *urlOpen(const char *fname, CURLcode (*callBack)(CURL*), const char* mode);
 
 /*!
  *  @brief Close a local/remote file


=====================================
bwCommon.h
=====================================
@@ -68,3 +68,7 @@ void destroyBWOverlapBlock(bwOverlapBlock_t *b);
  * @return 0 on success
  */
 int bwFinalize(bigWigFile_t *fp);
+
+/// @cond SKIP
+char *bwStrdup(const char *s);
+/// @endcond


=====================================
bwRead.c
=====================================
@@ -194,7 +194,7 @@ static uint64_t readChromLeaf(bigWigFile_t *bw, chromList_t *cl, uint32_t valueS
         if(bwRead((void*) chrom, sizeof(char), valueSize, bw) != valueSize) goto error;
         if(bwRead((void*) &idx, sizeof(uint32_t), 1, bw) != 1) goto error;
         if(bwRead((void*) &(cl->len[idx]), sizeof(uint32_t), 1, bw) != 1) goto error;
-        cl->chrom[idx] = strdup(chrom);
+        cl->chrom[idx] = bwStrdup(chrom);
         if(!(cl->chrom[idx])) goto error;
     }
 
@@ -299,7 +299,7 @@ void bwClose(bigWigFile_t *fp) {
     free(fp);
 }
 
-int bwIsBigWig(char *fname, CURLcode (*callBack) (CURL*)) {
+int bwIsBigWig(const char *fname, CURLcode (*callBack) (CURL*)) {
     uint32_t magic = 0;
     URL_t *URL = NULL;
 
@@ -312,15 +312,15 @@ int bwIsBigWig(char *fname, CURLcode (*callBack) (CURL*)) {
     return 0;
 }
 
-char *bbGetSQL(bigWigFile_t *bw) {
+char *bbGetSQL(bigWigFile_t *fp) {
     char *o = NULL;
     uint64_t len;
-    if(!bw->hdr->sqlOffset) return NULL;
-    len = bw->hdr->summaryOffset - bw->hdr->sqlOffset; //This includes the NULL terminator
+    if(!fp->hdr->sqlOffset) return NULL;
+    len = fp->hdr->summaryOffset - fp->hdr->sqlOffset; //This includes the NULL terminator
     o = malloc(sizeof(char) * len);
     if(!o) goto error;
-    if(bwSetPos(bw, bw->hdr->sqlOffset)) goto error;
-    if(bwRead((void*) o, len, 1, bw) != 1) goto error;
+    if(bwSetPos(fp, fp->hdr->sqlOffset)) goto error;
+    if(bwRead((void*) o, len, 1, fp) != 1) goto error;
     return o;
 
 error:
@@ -329,7 +329,7 @@ error:
     return NULL;
 }
 
-int bbIsBigBed(char *fname, CURLcode (*callBack) (CURL*)) {
+int bbIsBigBed(const char *fname, CURLcode (*callBack) (CURL*)) {
     uint32_t magic = 0;
     URL_t *URL = NULL;
 
@@ -342,7 +342,7 @@ int bbIsBigBed(char *fname, CURLcode (*callBack) (CURL*)) {
     return 0;
 }
 
-bigWigFile_t *bwOpen(char *fname, CURLcode (*callBack) (CURL*), const char *mode) {
+bigWigFile_t *bwOpen(const char *fname, CURLcode (*callBack) (CURL*), const char *mode) {
     bigWigFile_t *bwg = calloc(1, sizeof(bigWigFile_t));
     if(!bwg) {
         fprintf(stderr, "[bwOpen] Couldn't allocate space to create the output object!\n");
@@ -394,7 +394,7 @@ error:
     return NULL;
 }
 
-bigWigFile_t *bbOpen(char *fname, CURLcode (*callBack) (CURL*)) {
+bigWigFile_t *bbOpen(const char *fname, CURLcode (*callBack) (CURL*)) {
     bigWigFile_t *bb = calloc(1, sizeof(bigWigFile_t));
     if(!bb) {
         fprintf(stderr, "[bbOpen] Couldn't allocate space to create the output object!\n");
@@ -425,3 +425,14 @@ error:
     bwClose(bb);
     return NULL;
 }
+
+
+//Implementation taken from musl:
+//https://git.musl-libc.org/cgit/musl/tree/src/string/strdup.c
+//License: https://git.musl-libc.org/cgit/musl/tree/COPYRIGHT
+char* bwStrdup(const char *s) {
+	size_t l = strlen(s);
+	char *d = malloc(l+1);
+	if (!d) return NULL;
+	return memcpy(d, s, l+1);
+}


=====================================
bwStats.c
=====================================
@@ -8,7 +8,7 @@
 
 //Returns -1 if there are no applicable levels, otherwise an integer indicating the most appropriate level.
 //Like Kent's library, this divides the desired bin size by 2 to minimize the effect of blocks overlapping multiple bins
-static int32_t determineZoomLevel(bigWigFile_t *fp, int basesPerBin) {
+static int32_t determineZoomLevel(const bigWigFile_t *fp, int basesPerBin) {
     int32_t out = -1;
     int64_t diff;
     uint32_t bestDiff = -1;
@@ -420,7 +420,7 @@ static double intSum(bwOverlappingIntervals_t* ints, uint32_t start, uint32_t en
 }
 
 //Returns NULL on error, otherwise a double* that needs to be free()d
-double *bwStatsFromZoom(bigWigFile_t *fp, int32_t level, uint32_t tid, uint32_t start, uint32_t end, uint32_t nBins, enum bwStatsType type) {
+static double *bwStatsFromZoom(bigWigFile_t *fp, int32_t level, uint32_t tid, uint32_t start, uint32_t end, uint32_t nBins, enum bwStatsType type) {
     bwOverlapBlock_t *blocks = NULL;
     double *output = NULL;
     uint32_t pos = start, i, end2;
@@ -482,7 +482,7 @@ error:
     return NULL;
 }
 
-double *bwStatsFromFull(bigWigFile_t *fp, char *chrom, uint32_t start, uint32_t end, uint32_t nBins, enum bwStatsType type) {
+double *bwStatsFromFull(bigWigFile_t *fp, const char *chrom, uint32_t start, uint32_t end, uint32_t nBins, enum bwStatsType type) {
     bwOverlappingIntervals_t *ints = NULL;
     double *output = malloc(sizeof(double)*nBins);
     uint32_t i, pos = start, end2;
@@ -527,7 +527,7 @@ double *bwStatsFromFull(bigWigFile_t *fp, char *chrom, uint32_t start, uint32_t
 
 //Returns a list of floats of length nBins that must be free()d
 //On error, NULL is returned
-double *bwStats(bigWigFile_t *fp, char *chrom, uint32_t start, uint32_t end, uint32_t nBins, enum bwStatsType type) {
+double *bwStats(bigWigFile_t *fp, const char *chrom, uint32_t start, uint32_t end, uint32_t nBins, enum bwStatsType type) {
     int32_t level = determineZoomLevel(fp, ((double)(end-start))/((int) nBins));
     uint32_t tid = bwGetTid(fp, chrom);
     if(tid == (uint32_t) -1) return NULL;


=====================================
bwValues.c
=====================================
@@ -140,7 +140,7 @@ static bwOverlapBlock_t *overlapsLeaf(bwRTreeNode_t *node, uint32_t tid, uint32_
 
         /*
           The individual blocks can theoretically span multiple contigs.
-          So if we treat the first/last contig in the range as special 
+          So if we treat the first/last contig in the range as special
           but anything in the middle is a guaranteed match
         */
         if(node->chrIdxStart[i] != node->chrIdxEnd[i]) {
@@ -281,7 +281,7 @@ bwOverlapBlock_t *walkRTreeNodes(bigWigFile_t *bw, bwRTreeNode_t *root, uint32_t
 
 //In reality, a hash or some sort of tree structure is probably faster...
 //Return -1 (AKA 0xFFFFFFFF...) on "not there", so we can hold (2^32)-1 items.
-uint32_t bwGetTid(bigWigFile_t *fp, char *chrom) {
+uint32_t bwGetTid(const bigWigFile_t *fp, const char *chrom) {
     uint32_t i;
     if(!chrom) return -1;
     for(i=0; i<fp->cl->nKeys; i++) {
@@ -290,7 +290,7 @@ uint32_t bwGetTid(bigWigFile_t *fp, char *chrom) {
     return -1;
 }
 
-static bwOverlapBlock_t *bwGetOverlappingBlocks(bigWigFile_t *fp, char *chrom, uint32_t start, uint32_t end) {
+static bwOverlapBlock_t *bwGetOverlappingBlocks(bigWigFile_t *fp, const char *chrom, uint32_t start, uint32_t end) {
     uint32_t tid = bwGetTid(fp, chrom);
 
     if(tid == (uint32_t) -1) {
@@ -379,7 +379,7 @@ static bbOverlappingEntries_t *pushBBIntervals(bbOverlappingEntries_t *o, uint32
     }
     o->start[o->l] = start;
     o->end[o->l] = end;
-    if(withString) o->str[o->l] = strdup(str);
+    if(withString) o->str[o->l] = bwStrdup(str);
     o->l++;
     return o;
 
@@ -437,7 +437,7 @@ bwOverlappingIntervals_t *bwGetOverlappingIntervalsCore(bigWigFile_t *fp, bwOver
         if(hdr.tid != tid) continue;
 
         if(hdr.type == 3) start = hdr.start - hdr.step;
-        
+
         //FIXME: We should ensure that sz is large enough to hold nItems of the given type
         for(j=0; j<hdr.nItems; j++) {
             switch(hdr.type) {
@@ -560,7 +560,7 @@ error:
 }
 
 //Returns NULL on error OR no intervals, which is a bad design...
-bwOverlappingIntervals_t *bwGetOverlappingIntervals(bigWigFile_t *fp, char *chrom, uint32_t start, uint32_t end) {
+bwOverlappingIntervals_t *bwGetOverlappingIntervals(bigWigFile_t *fp, const char *chrom, uint32_t start, uint32_t end) {
     bwOverlappingIntervals_t *output;
     uint32_t tid = bwGetTid(fp, chrom);
     if(tid == (uint32_t) -1) return NULL;
@@ -572,7 +572,7 @@ bwOverlappingIntervals_t *bwGetOverlappingIntervals(bigWigFile_t *fp, char *chro
 }
 
 //Like above, but for bigBed files
-bbOverlappingEntries_t *bbGetOverlappingEntries(bigWigFile_t *fp, char *chrom, uint32_t start, uint32_t end, int withString) {
+bbOverlappingEntries_t *bbGetOverlappingEntries(bigWigFile_t *fp, const char *chrom, uint32_t start, uint32_t end, int withString) {
     bbOverlappingEntries_t *output;
     uint32_t tid = bwGetTid(fp, chrom);
     if(tid == (uint32_t) -1) return NULL;
@@ -584,16 +584,16 @@ bbOverlappingEntries_t *bbGetOverlappingEntries(bigWigFile_t *fp, char *chrom, u
 }
 
 //Returns NULL on error
-bwOverlapIterator_t *bwOverlappingIntervalsIterator(bigWigFile_t *bw, char *chrom, uint32_t start, uint32_t end, uint32_t blocksPerIteration) {
+bwOverlapIterator_t *bwOverlappingIntervalsIterator(bigWigFile_t *fp, const char *chrom, uint32_t start, uint32_t end, uint32_t blocksPerIteration) {
     bwOverlapIterator_t *output = NULL;
     uint64_t n;
-    uint32_t tid = bwGetTid(bw, chrom);
+    uint32_t tid = bwGetTid(fp, chrom);
     if(tid == (uint32_t) -1) return output;
     output = calloc(1, sizeof(bwOverlapIterator_t));
     if(!output) return output;
-    bwOverlapBlock_t *blocks = bwGetOverlappingBlocks(bw, chrom, start, end);
+    bwOverlapBlock_t *blocks = bwGetOverlappingBlocks(fp, chrom, start, end);
 
-    output->bw = bw;
+    output->bw = fp;
     output->tid = tid;
     output->start = start;
     output->end = end;
@@ -603,7 +603,7 @@ bwOverlapIterator_t *bwOverlappingIntervalsIterator(bigWigFile_t *bw, char *chro
     if(blocks) {
         n = blocks->n;
         if(n>blocksPerIteration) blocks->n = blocksPerIteration;
-        output->intervals = bwGetOverlappingIntervalsCore(bw, blocks,tid, start, end);
+        output->intervals = bwGetOverlappingIntervalsCore(fp, blocks,tid, start, end);
         blocks->n = n;
         output->offset = blocksPerIteration;
     }
@@ -612,16 +612,16 @@ bwOverlapIterator_t *bwOverlappingIntervalsIterator(bigWigFile_t *bw, char *chro
 }
 
 //Returns NULL on error
-bwOverlapIterator_t *bbOverlappingEntriesIterator(bigWigFile_t *bw, char *chrom, uint32_t start, uint32_t end, int withString, uint32_t blocksPerIteration) {
+bwOverlapIterator_t *bbOverlappingEntriesIterator(bigWigFile_t *fp, const char *chrom, uint32_t start, uint32_t end, int withString, uint32_t blocksPerIteration) {
     bwOverlapIterator_t *output = NULL;
     uint64_t n;
-    uint32_t tid = bwGetTid(bw, chrom);
+    uint32_t tid = bwGetTid(fp, chrom);
     if(tid == (uint32_t) -1) return output;
     output = calloc(1, sizeof(bwOverlapIterator_t));
     if(!output) return output;
-    bwOverlapBlock_t *blocks = bwGetOverlappingBlocks(bw, chrom, start, end);
+    bwOverlapBlock_t *blocks = bwGetOverlappingBlocks(fp, chrom, start, end);
 
-    output->bw = bw;
+    output->bw = fp;
     output->tid = tid;
     output->start = start;
     output->end = end;
@@ -632,7 +632,7 @@ bwOverlapIterator_t *bbOverlappingEntriesIterator(bigWigFile_t *bw, char *chrom,
     if(blocks) {
         n = blocks->n;
         if(n>blocksPerIteration) blocks->n = blocksPerIteration;
-        output->entries = bbGetOverlappingEntriesCore(bw, blocks,tid, start, end, withString);
+        output->entries = bbGetOverlappingEntriesCore(fp, blocks,tid, start, end, withString);
         blocks->n = n;
         output->offset = blocksPerIteration;
     }
@@ -710,7 +710,7 @@ error:
 //The ->end member is NULL
 //If includeNA is not 0 then ->start is also NULL, since it's implied
 //Note that bwDestroyOverlappingIntervals() will work in either case
-bwOverlappingIntervals_t *bwGetValues(bigWigFile_t *fp, char *chrom, uint32_t start, uint32_t end, int includeNA) {
+bwOverlappingIntervals_t *bwGetValues(bigWigFile_t *fp, const char *chrom, uint32_t start, uint32_t end, int includeNA) {
     uint32_t i, j, n;
     bwOverlappingIntervals_t *output = NULL;
     bwOverlappingIntervals_t *intermediate = bwGetOverlappingIntervals(fp, chrom, start, end);


=====================================
bwWrite.c
=====================================
@@ -19,7 +19,7 @@ struct val_t {
 
 //Create a chromList_t and attach it to a bigWigFile_t *. Returns NULL on error
 //Note that chroms and lengths are duplicated, so you MUST free the input
-chromList_t *bwCreateChromList(char **chroms, uint32_t *lengths, int64_t n) {
+chromList_t *bwCreateChromList(const char* const* chroms, const uint32_t *lengths, int64_t n) {
     int64_t i = 0;
     chromList_t *cl = calloc(1, sizeof(chromList_t));
     if(!cl) return NULL;
@@ -32,7 +32,7 @@ chromList_t *bwCreateChromList(char **chroms, uint32_t *lengths, int64_t n) {
 
     for(i=0; i<n; i++) {
         cl->len[i] = lengths[i];
-        cl->chrom[i] = strdup(chroms[i]);
+        cl->chrom[i] = bwStrdup(chroms[i]);
         if(!cl->chrom[i]) goto error;
     }
 
@@ -188,7 +188,8 @@ int bwWriteHdr(bigWigFile_t *bw) {
     uint32_t magic = BIGWIG_MAGIC;
     uint16_t two = 4;
     FILE *fp;
-    void *p = calloc(58, sizeof(uint8_t)); //58 bytes of nothing
+    const uint8_t pbuff[58] = {0}; // 58 bytes of nothing
+    const void *p = (const void *)&pbuff;
     if(!bw->isWrite) return 1;
 
     //The header itself, largely just reserving space...
@@ -223,7 +224,6 @@ int bwWriteHdr(bigWigFile_t *bw) {
     //Save space for the number of blocks
     if(fwrite(p, sizeof(uint8_t), 8, fp) != 8) return 13;
 
-    free(p);
     return 0;
 }
 
@@ -371,9 +371,9 @@ static void updateStats(bigWigFile_t *fp, uint32_t span, float val) {
 }
 
 //12 bytes per entry
-int bwAddIntervals(bigWigFile_t *fp, char **chrom, uint32_t *start, uint32_t *end, float *values, uint32_t n) {
+int bwAddIntervals(bigWigFile_t *fp, const char* const* chrom, const uint32_t *start, const uint32_t *end, const float *values, uint32_t n) {
     uint32_t tid = 0, i;
-    char *lastChrom = NULL;
+    const char *lastChrom = NULL;
     bwWriteBuffer_t *wb = fp->writeBuffer;
     if(!n) return 0; //Not an error per se
     if(!fp->isWrite) return 1;
@@ -431,7 +431,7 @@ int bwAddIntervals(bigWigFile_t *fp, char **chrom, uint32_t *start, uint32_t *en
     return 0;
 }
 
-int bwAppendIntervals(bigWigFile_t *fp, uint32_t *start, uint32_t *end, float *values, uint32_t n) {
+int bwAppendIntervals(bigWigFile_t *fp, const uint32_t *start, const uint32_t *end, const float *values, uint32_t n) {
     uint32_t i;
     bwWriteBuffer_t *wb = fp->writeBuffer;
     if(!n) return 0;
@@ -459,7 +459,7 @@ int bwAppendIntervals(bigWigFile_t *fp, uint32_t *start, uint32_t *end, float *v
 }
 
 //8 bytes per entry
-int bwAddIntervalSpans(bigWigFile_t *fp, char *chrom, uint32_t *start, uint32_t span, float *values, uint32_t n) {
+int bwAddIntervalSpans(bigWigFile_t *fp, const char *chrom, const uint32_t *start, uint32_t span, const float *values, uint32_t n) {
     uint32_t i, tid;
     bwWriteBuffer_t *wb = fp->writeBuffer;
     if(!n) return 0;
@@ -492,7 +492,7 @@ int bwAddIntervalSpans(bigWigFile_t *fp, char *chrom, uint32_t *start, uint32_t
     return 0;
 }
 
-int bwAppendIntervalSpans(bigWigFile_t *fp, uint32_t *start, float *values, uint32_t n) {
+int bwAppendIntervalSpans(bigWigFile_t *fp, const uint32_t *start, const float *values, uint32_t n) {
     uint32_t i;
     bwWriteBuffer_t *wb = fp->writeBuffer;
     if(!n) return 0;
@@ -517,7 +517,7 @@ int bwAppendIntervalSpans(bigWigFile_t *fp, uint32_t *start, float *values, uint
 }
 
 //4 bytes per entry
-int bwAddIntervalSpanSteps(bigWigFile_t *fp, char *chrom, uint32_t start, uint32_t span, uint32_t step, float *values, uint32_t n) {
+int bwAddIntervalSpanSteps(bigWigFile_t *fp, const char *chrom, uint32_t start, uint32_t span, uint32_t step, const float *values, uint32_t n) {
     uint32_t i, tid;
     bwWriteBuffer_t *wb = fp->writeBuffer;
     if(!n) return 0;
@@ -549,7 +549,7 @@ int bwAddIntervalSpanSteps(bigWigFile_t *fp, char *chrom, uint32_t start, uint32
     return 0;
 }
 
-int bwAppendIntervalSpanSteps(bigWigFile_t *fp, float *values, uint32_t n) {
+int bwAppendIntervalSpanSteps(bigWigFile_t *fp, const float *values, uint32_t n) {
     uint32_t i;
     bwWriteBuffer_t *wb = fp->writeBuffer;
     if(!n) return 0;


=====================================
io.c
=====================================
@@ -12,7 +12,7 @@
 size_t GLOBAL_DEFAULTBUFFERSIZE;
 
 #ifndef NOCURL
-uint64_t getContentLength(URL_t *URL) {
+uint64_t getContentLength(const URL_t *URL) {
     double size;
     if(curl_easy_getinfo(URL->x.curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &size) != CURLE_OK) {
         return 0;
@@ -98,7 +98,7 @@ size_t urlRead(URL_t *URL, void *buf, size_t bufSize) {
 #endif
 }
 
-size_t bwFillBuffer(void *inBuf, size_t l, size_t nmemb, void *pURL) {
+size_t bwFillBuffer(const void *inBuf, size_t l, size_t nmemb, void *pURL) {
     URL_t *URL = (URL_t*) pURL;
     void *p = URL->memBuf;
     size_t copied = l*nmemb;
@@ -158,7 +158,7 @@ CURLcode urlSeek(URL_t *URL, size_t pos) {
 #endif
 }
 
-URL_t *urlOpen(char *fname, CURLcode (*callBack)(CURL*), const char *mode) {
+URL_t *urlOpen(const char *fname, CURLcode (*callBack)(CURL*), const char *mode) {
     URL_t *URL = calloc(1, sizeof(URL_t));
     if(!URL) return NULL;
     char *url = NULL, *req = NULL;


=====================================
test/CMakeLists.txt
=====================================
@@ -0,0 +1,22 @@
+set(CMAKE_C_STANDARD 11)
+set(CMAKE_C_STANDARD_REQUIRED ON)
+
+set(LOCAL_TEST_TARGETS "exampleWrite;testBigBed;testIterator;testLocal;testWrite")
+
+set(REMOTE_TEST_TARGETS "testRemote;testRemoteManyContigs")
+
+if (WITH_CURL)
+  set(TEST_TARGETS "${LOCAL_TEST_TARGETS};${REMOTE_TEST_TARGETS}")
+else()
+  set(TEST_TARGETS "${LOCAL_TEST_TARGETS}")
+endif()
+
+set(LIBBIGWIG_COMPILER_WARNINGS -Wall -Wsign-compare)
+
+foreach(TEST_TARGET ${TEST_TARGETS})
+  add_executable(${TEST_TARGET} ${CMAKE_CURRENT_SOURCE_DIR}/${TEST_TARGET}.c)
+  target_link_libraries(${TEST_TARGET} PUBLIC ${CONAN_LIBS}
+                                              libBigWig::libbigwig)
+  target_compile_features(${TEST_TARGET} PRIVATE c_std_${CMAKE_C_STANDARD})
+  target_compile_options(${TEST_TARGET} PRIVATE ${LIBBIGWIG_COMPILER_WARNINGS})
+endforeach()


=====================================
test/exampleWrite.c
=====================================
@@ -2,8 +2,8 @@
 
 int main(int argc, char *argv[]) {
     bigWigFile_t *fp = NULL;
-    char *chroms[] = {"1", "2"};
-    char *chromsUse[] = {"1", "1", "1"};
+    const char *chroms[] = {"1", "2"};
+    const char *chromsUse[] = {"1", "1", "1"};
     uint32_t chrLens[] = {1000000, 1500000};
     uint32_t starts[] = {0, 100, 125,
                          200, 220, 230,


=====================================
test/test.py
=====================================
@@ -1,75 +1,90 @@
-#!/usr/bin/env python2.7
-from subprocess import Popen, PIPE, check_call
-from os import remove
-
-# N.B., this MUST be run from within the source directory!
-
-# local test
-p1 = Popen(["./test/testLocal", "test/test.bw"], stdout=PIPE)
-try:
-    p2 = Popen(["md5sum"], stdin=p1.stdout, stdout=PIPE)
-except:
-    p2 = Popen(["md5"], stdin=p1.stdout, stdout=PIPE)
-md5sum = p2.communicate()[0].strip().split()[0]
-assert(md5sum == "1c52065211fdc44eea45751a9cbfffe0")
-
-# remote http test
-p1 = Popen(["./test/testRemote", "http://hgdownload.cse.ucsc.edu/goldenPath/hg19/encodeDCC/wgEncodeMapability/wgEncodeCrgMapabilityAlign50mer.bigWig"], stdout=PIPE)
-try:
-    p2 = Popen(["md5sum"], stdin=p1.stdout, stdout=PIPE)
-except:
-    p2 = Popen(["md5"], stdin=p1.stdout, stdout=PIPE)
-md5sum = p2.communicate()[0].strip().split()[0]
-assert(md5sum == "9ccecd6c32ff31042714c1da3c0d0eba")
-
-# test recreating a file
-p1 = check_call(["./test/testWrite", "test/test.bw", "test/output.bw"])
-assert(p1 == 0)
-try:
-    p2 = Popen(["md5sum", "test/output.bw"], stdout=PIPE)
-except:
-    p2 = Popen(["md5", "test/output.bw"], stdout=PIPE)
-md5sum = p2.communicate()[0].strip()
-md5sumuse = md5sum.split()[0]
-try:
-    assert(md5sumuse == "8e116bd114ffd2eb625011d451329c03")
-except:
-    md5sum = md5sum.split(" ")[-1]
-    assert(md5sum == "8e116bd114ffd2eb625011d451329c03")
-remove("test/output.bw")
-
-# test creation from scratch with multiple interval types
-p1 = check_call(["./test/exampleWrite"])
-assert(p1 == 0)
-try:
-    p2 = Popen(["md5sum", "test/example_output.bw"], stdout=PIPE)
-except:
-    p2 = Popen(["md5", "test/example_output.bw"], stdout=PIPE)
-md5sum = p2.communicate()[0].strip()
-md5sumuse = md5sum.split()[0]
-try:
-    assert(md5sumuse == "ef104f198c6ce8310acc149d0377fc16")
-except:
-    md5sum = md5sum.split(" ")[-1]
-    assert(md5sum == "ef104f198c6ce8310acc149d0377fc16")
-remove("test/example_output.bw")
-
-## Ensure that we can properly parse chromosome trees with non-leaf nodes
-# The UCSC FTP site is timing out for OSX!
-p1 = Popen(["./test/testRemoteManyContigs", "http://hgdownload.cse.ucsc.edu/gbdb/dm6/bbi/gc5BaseBw/gc5Base.bw"], stdout=PIPE)
-try:
-    p2 = Popen(["md5sum"], stdin=p1.stdout, stdout=PIPE)
-except:
-    p2 = Popen(["md5"], stdin=p1.stdout, stdout=PIPE)
-md5sum = p2.communicate()[0].strip().split()[0]
-assert(md5sum == "a15a3120c03ba44a81b025ebd411966c")
-
-# Try a bigBed file
-p1 = Popen(["./test/testBigBed", "https://www.encodeproject.org/files/ENCFF001JBR/@@download/ENCFF001JBR.bigBed"], stdout=PIPE)
-try:
-    p2 = Popen(["md5sum"], stdin=p1.stdout, stdout=PIPE)
-except:
-    p2 = Popen(["md5"], stdin=p1.stdout, stdout=PIPE)
-md5sum = p2.communicate()[0].strip().split()[0]
-assert(md5sum == "33ef99571bdaa8c9130149e99332b17b")
-print("success")
+#!/usr/bin/env python
+import os
+from tempfile import TemporaryDirectory
+from subprocess import check_output, check_call
+
+from sys import argv, stderr, exit
+import hashlib
+
+
+def local_test():
+    out = check_output([test_bin + "/testLocal", test_bw])
+    md5sum = hashlib.md5(out).hexdigest()
+    assert md5sum == "1c52065211fdc44eea45751a9cbfffe0"
+
+
+def remote_http_test():
+    if not os.path.exists(test_bin + "/testRemote"):
+        print("libBigWig was compiled without CURL. Skipping test with testRemote!", file=stderr)
+        return
+
+    out = check_output([test_bin + "/testRemote",
+                        "http://hgdownload.cse.ucsc.edu/goldenPath/hg19/encodeDCC/wgEncodeMapability/wgEncodeCrgMapabilityAlign50mer.bigWig"])
+    md5sum = hashlib.md5(out).hexdigest()
+    assert md5sum == "9ccecd6c32ff31042714c1da3c0d0eba"
+
+
+def test_recreating_file():
+    with TemporaryDirectory(prefix="libbigwig-test") as tmpdir:
+        tmpout = os.path.join(tmpdir, "output.bw")
+        p1 = check_call([test_bin + "/testWrite", test_bw, tmpout])
+        assert p1 == 0
+        with open(tmpout, mode="rb") as f:
+            md5sum = hashlib.md5(f.read()).hexdigest()
+            assert md5sum == "8e116bd114ffd2eb625011d451329c03"
+
+
+def test_creation_from_scratch():
+    with TemporaryDirectory(prefix="libbigwig-test") as tmpdir:
+        tmpout = os.path.join(tmpdir, "test", "example_output.bw")
+        os.mkdir(os.path.dirname(tmpout))
+        p1 = check_call([test_bin + "/exampleWrite"], cwd=tmpdir)
+        assert p1 == 0
+        with open(tmpout, mode="rb") as f:
+            md5sum = hashlib.md5(f.read()).hexdigest()
+            assert md5sum == "ef104f198c6ce8310acc149d0377fc16"
+
+
+def remote_test2():
+    ## Ensure that we can properly parse chromosome trees with non-leaf nodes
+    # The UCSC FTP site is timing out for OSX!
+    if not os.path.exists(test_bin + "/testRemoteManyContigs"):
+        print("libBigWig was compiled without CURL. Skipping test with testRemoteManyContigs!", file=stderr)
+        return
+
+    out = check_output([test_bin + "/testRemoteManyContigs",
+                        "http://hgdownload.cse.ucsc.edu/gbdb/dm6/bbi/gc5BaseBw/gc5Base.bw"])
+
+    md5sum = hashlib.md5(out).hexdigest()
+    assert md5sum == "a15a3120c03ba44a81b025ebd411966c"
+
+
+def test_bigbed():
+    if not os.path.exists(test_bin + "/testBigBed"):
+        print("libBigWig was compiled without CURL. Skipping test with testBigBed!", file=stderr)
+        return
+
+    out = check_output([test_bin + "/testBigBed",
+                        "https://www.encodeproject.org/files/ENCFF001JBR/@@download/ENCFF001JBR.bigBed"])
+
+    md5sum = hashlib.md5(out).hexdigest()
+    assert md5sum == "33ef99571bdaa8c9130149e99332b17b"
+
+
+if __name__ == "__main__":
+    if len(argv) != 3:
+        print("Usage: {} path/to/test/bin path/to/test.bw".format(argv[0]), file=stderr)
+        print("Example: {} build/test/ test/test.bw".format(argv[0]), file=stderr)
+        exit(1)
+
+    test_bin = os.path.abspath(argv[1])
+    test_bw = os.path.abspath(argv[2])
+
+    local_test()
+    remote_http_test()
+    test_recreating_file()
+    test_creation_from_scratch()
+    remote_test2()
+    test_bigbed()
+
+    print("success", file=stderr)


=====================================
test/testWrite.c
=====================================
@@ -34,7 +34,7 @@ int main(int argc, char *argv[]) {
     }
 
     if(bwCreateHdr(ofp, 10)) goto error; //ten zoom levels
-    ofp->cl = bwCreateChromList(ifp->cl->chrom, ifp->cl->len, ifp->cl->nKeys);
+    ofp->cl = bwCreateChromList((const char* const*)ifp->cl->chrom, ifp->cl->len, ifp->cl->nKeys);
     if(!ofp->cl) goto error;
 
     if(bwWriteHdr(ofp)) goto error;
@@ -47,7 +47,7 @@ int main(int argc, char *argv[]) {
             chroms = malloc(o->l * sizeof(char*));
             if(!chroms) goto error;
             for(i=0; i<o->l; i++) chroms[i] = ofp->cl->chrom[tid];
-            bwAddIntervals(ofp, chroms, o->start, o->end, o->value, o->l);
+            bwAddIntervals(ofp, (const char* const*)chroms, o->start, o->end, o->value, o->l);
             free(chroms);
         }
         bwDestroyOverlappingIntervals(o);



View it on GitLab: https://salsa.debian.org/med-team/libbigwig/-/commit/09617c2b7326531a08a9f8ad0a9c50e55e580589

-- 
View it on GitLab: https://salsa.debian.org/med-team/libbigwig/-/commit/09617c2b7326531a08a9f8ad0a9c50e55e580589
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20220825/0fddf75f/attachment-0001.htm>


More information about the debian-med-commit mailing list