summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--generic/Handle.cpp14
-rw-r--r--generic/String.cpp8
-rw-r--r--lib/cdabstract.cpp4
3 files changed, 24 insertions, 2 deletions
diff --git a/generic/Handle.cpp b/generic/Handle.cpp
index 4e318c6..8aa48b8 100644
--- a/generic/Handle.cpp
+++ b/generic/Handle.cpp
@@ -10,11 +10,17 @@
#define _(x) x
#endif
-Handle::Handle(const Handle & nh) : itell(0), h(nh.h >= 0 ? dup(nh.h) : nh.h), closed(nh.closed), nonblock(nh.closed), zfile(0), z(0) {
+Handle::Handle(const Handle & nh) : itell(0), h(nh.h >= 0 ? dup(nh.h) : nh.h), closed(nh.closed), nonblock(nh.closed)
+#ifdef HAVE_ZLIB
+, zfile(0), z(0)
+#endif
+{
// cerr << "Duplication of handle " << nh.h << " to " << h << endl;
+#ifdef HAVE_ZLIB
if ((h >= 0) && (nh.z)) {
SetZ(nh.z);
}
+#endif
}
Handle::~Handle() {
@@ -22,7 +28,11 @@ Handle::~Handle() {
close();
}
-Handle::Handle(int nh) : h(nh), closed(false), nonblock(false), zfile(0), z(0) {
+Handle::Handle(int nh) : h(nh), closed(false), nonblock(false)
+#ifdef HAVE_ZLIB
+, zfile(0), z(0)
+#endif
+{
// cerr << "Initialising handle " << h << endl;
}
diff --git a/generic/String.cpp b/generic/String.cpp
index d879308..4c8e399 100644
--- a/generic/String.cpp
+++ b/generic/String.cpp
@@ -8,10 +8,12 @@
#include "config.h"
#endif
+#ifdef USE_DATE
extern "C" {
double dateCalc(char *, char *);
int isDateArgument(char *);
}
+#endif
char String::t[BUFSIZ + 1];
@@ -302,10 +304,12 @@ int String::strchrcnt(char c) const {
return cnt;
}
+#ifdef USE_DATE
String String::to_sqldate(void) const {
/* DD/MM/YYYY ==> YYYYMMMDD */
return (is_date() ? extract(6, 9) + extract(3, 4) + extract(0, 1) : "");
}
+#endif
String String::to_sqltime(void) const {
/* h:m ==> h * 60 + m */
@@ -313,10 +317,12 @@ String String::to_sqltime(void) const {
return (is_time() ? String(extract(0, p - 1).to_int() * 60 + extract(p + 1).to_int()) : "");
}
+#ifdef USE_DATE
String String::from_sqldate(void) const {
/* YYYYMMDD ==> DD/MM/YYYY */
return ((strlen() == 8) && is_number() ? extract(6, 7) + '/' + extract(4, 5) + '/' + extract(0, 3) : "");
}
+#endif
String String::from_sqltime(void) const {
/* t ==> (t / 60):(t % 60) */
@@ -324,6 +330,7 @@ String String::from_sqltime(void) const {
return (is_number() ? String((int) (t / 60)) + ':' + (t % 60) : "");
}
+#ifdef USE_DATE
bool String::is_date(void) const {
/* 'DD/MM/YYYY'
0123456789 */
@@ -348,6 +355,7 @@ double String::datedif(const String & s) const {
return -1;
}
+#endif
bool String::is_number(void) const {
for (size_t i = ((str[0] == '-') ? 1 : 0); i < siz; i++) {
diff --git a/lib/cdabstract.cpp b/lib/cdabstract.cpp
index 083aa4d..b79960f 100644
--- a/lib/cdabstract.cpp
+++ b/lib/cdabstract.cpp
@@ -3,9 +3,13 @@
#include "cdreader.h"
Handle * open_iso(const String & nom) {
+#ifdef USE_CDREADER
if (nom.extract(0, 2).toupper() == "CD:") {
return new cdreader(nom.extract(3));
} else {
+#else
+ {
+#endif
return new Input(nom);
}
}