summaryrefslogtreecommitdiff
path: root/src/htslib.h
diff options
context:
space:
mode:
authorXavier Roche <xroche@users.noreply.github.com>2014-05-29 08:30:43 +0000
committerXavier Roche <xroche@users.noreply.github.com>2014-05-29 08:30:43 +0000
commit194ebad4c6f4d259d5b2fd7349246ea19493cb04 (patch)
tree49f49c1eb0b73580c86793cd7dfb6168ada583f6 /src/htslib.h
parentae6d05fbb30ca8c0370b2be8cc1810b028616830 (diff)
Added off_t_to_size_t()
Diffstat (limited to 'src/htslib.h')
-rw-r--r--src/htslib.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/htslib.h b/src/htslib.h
index 30bd2f4..d56b379 100644
--- a/src/htslib.h
+++ b/src/htslib.h
@@ -612,6 +612,14 @@ HTS_STATIC int compare_mime(httrackp * opt, const char *mime, const char *file,
#endif
+// returns (size_t) -1 upon error
+static size_t off_t_to_size_t(off_t o) {
+ if (o >= 0 && o < ( (size_t) -1 ) / 2) {
+ } else {
+ return (size_t) -1;
+ }
+}
+
/* dirent() compatibility */
#ifdef _WIN32
#define HTS_DIRENT_SIZE 256