Commit e9e3d6a0 authored by Jan Becker's avatar Jan Becker
Browse files

[system] Fix compiler warnings and remove dead code

parent eb59bd65
......@@ -62,20 +62,6 @@ namespace {
std::string CONF_NULL_OBJECT = "___CONFIG_NULL_OBJECT___";
std::string quotable = "\\\t\n\v\f\r ,${}";
std::string removeApostrophe(const std::string &str)
{
std::string tmpString(str);
std::string::size_type pos = tmpString.find("\"");
if (pos != std::string::npos)
tmpString.erase(pos, pos + 1);
pos = tmpString.rfind("\"");
if (pos != std::string::npos)
tmpString.erase(pos);
return tmpString;
}
std::string stripEscapes(const std::string &str) {
std::string tmpString(str);
size_t pos = tmpString.find('\\');
......
......@@ -163,15 +163,6 @@ bool loadEventParam(DataModel::EventParametersPtr &ep, const string &data,
}
#if BOOST_VERSION >= 103500
boost::posix_time::time_duration wait(const Core::Time &until) {
double diff = until - Core::Time::GMT();
if ( diff <= 0 ) diff = 0.001; // make sure wait is positive
int s = (int) boost::posix_time::time_duration::ticks_per_second() * diff;
return boost::posix_time::time_duration(0, 0, 0, s);
}
#endif
/** Adds all PublicObjects to a cache */
class SC_SYSTEM_CORE_API PublicObjectCacheFeeder : protected DataModel::Visitor {
public:
......
......@@ -1987,7 +1987,7 @@ void DatabaseArchive::locateNullObjectByName(const char* name, const char* targe
if ( !isEmpty(name) ) {
if ( !isEmpty(targetClass) ) {
if ( !(hint() & DB_TABLE) ) {
_currentAttributeName = std::string(name) + ATTRIBUTE_SEPERATOR""OBJECT_USED_POSTFIX;
_currentAttributeName = std::string(name) + ATTRIBUTE_SEPERATOR "" OBJECT_USED_POSTFIX;
write((bool)false);
return;
}
......
......@@ -92,22 +92,6 @@ class CloneVisitor : public Visitor {
}
namespace {
std::ostream &operator<<(std::ostream &os, const ComplexArray &ar) {
os << "Complex Array of " << ar.content().size() << " elements";
return os;
}
std::ostream &operator<<(std::ostream &os, const RealArray &ar) {
os << "Real Array of " << ar.content().size() << " elements";
return os;
}
std::ostream &operator<<(std::ostream &os, const Blob &ar) {
os << "Blob size: " << ar.content().size();
return os;
}
}
ThreeComponents::ThreeComponents() {
comps[0] = NULL;
......
......@@ -60,12 +60,12 @@ struct jsonstring {
ostream &operator<<(ostream &os, const jsontime_t &js) {
//os << js.ref << "000";
os << Core::Time(js.ref).toString("\""DATE_FORMAT"\"");
os << Core::Time(js.ref).toString("\"" DATE_FORMAT "\"");
return os;
}
ostream &operator<<(ostream &os, const jsontime &js) {
os << js.ref.toString("\""DATE_FORMAT"\"");
os << js.ref.toString("\"" DATE_FORMAT "\"");
return os;
}
......
......@@ -42,14 +42,6 @@ namespace {
const char *null_file = "";
void xmlGenericErrorHandler(void *ctx, const char* msg, ...) {
va_list argp;
va_start(argp, msg);
vfprintf(stderr, msg, argp);
va_end(argp);
}
void xmlStructuredErrorHandler(void * userData, xmlErrorPtr error) {
SEISCOMP_ERROR("%s: %s", (const char*)userData, error->message);
}
......@@ -157,15 +149,6 @@ xmlNodePtr findNextTag(xmlDocPtr doc, xmlNodePtr node, const char* name, const c
}
xmlNodePtr getFirstElementNode(xmlNodePtr node) {
for ( xmlNodePtr child = node->xmlChildrenNode; child != NULL; child = child->next )
if ( child->type == XML_ELEMENT_NODE )
return child;
return NULL;
}
xmlChar *nodeGetContent(xmlNodePtr node) {
for ( xmlNodePtr child = node->xmlChildrenNode; child != NULL; child = child->next )
if ( child->type == XML_TEXT_NODE || child->type == XML_CDATA_SECTION_NODE )
......
......@@ -42,7 +42,7 @@ template <typename SocketType>
std::streamsize HttpSource<SocketType>::read(char* buf, std::streamsize size) {
std::string data = _sock->httpReadRaw(size);
if ( data.size() > size ) {
if ( (int)data.size() > size ) {
SEISCOMP_ERROR("impossible thing happened");
memcpy(buf, data.data(), size);
return size;
......@@ -306,7 +306,7 @@ std::string HttpSocket<SocketType>::httpRead(int size)
{
std::string data;
while ( data.size() < size ) {
while ( (int)data.size() < size ) {
std::string::size_type bytesRead = data.size();
data += httpReadSome(size - bytesRead);
......
......@@ -31,40 +31,6 @@ using namespace Seiscomp::RecordStream;
REGISTER_RECORDSTREAM(Resample, "resample");
namespace {
GenericRecord *createRecord(const Record *rec) {
return new GenericRecord(rec->networkCode(), rec->stationCode(),
rec->locationCode(), rec->channelCode(),
rec->startTime(), rec->samplingFrequency());
}
GenericRecord *convert(const Record *rec) {
if ( rec->data() == NULL ) return NULL;
GenericRecord *out;
switch ( rec->dataType() ) {
case Array::CHAR:
case Array::INT:
case Array::FLOAT:
case Array::DOUBLE:
out = createRecord(rec);
break;
default:
return NULL;
}
ArrayPtr data = rec->data()->clone();
out->setData(data.get());
return out;
}
}
Resample::Resample()
: _stream(stringstream::in|stringstream::out|stringstream::binary) {
// Default target rate is 1Hz
......
......@@ -72,52 +72,6 @@ class NamespaceCollector : public OutputHandler {
};
std::string convertUTF8(const std::string &in, const char *encoding, bool fromEncoding) {
if ( in.empty() ) return in;
xmlCharEncodingHandlerPtr handler = xmlFindCharEncodingHandler(encoding);
if ( handler == NULL ) {
SEISCOMP_ERROR("No encoding handler found for '%s'\n",
encoding ? encoding : "");
return in;
}
int size = in.size(),
bytesIn = size,
bytesOut;
int (*func)(unsigned char*, int*, const unsigned char*, int*) = NULL;
if ( fromEncoding ) {
func = handler->input;
bytesOut = size * 2 + 1;
}
else {
func = handler->output;
bytesOut = size + 1;
}
xmlChar* out = new xmlChar[bytesOut];
if ( out == NULL ) return in;
int ret = func(out, &bytesOut, (const xmlChar *) in.c_str(), &bytesIn);
if ((ret < 0) || (bytesIn != size) ) {
if ( bytesIn < 0 )
SEISCOMP_ERROR("Transcoding of %s failed with code %d", in.c_str(), bytesIn);
delete[] out;
return in;
}
out = (unsigned char *) realloc(out, bytesOut + 1);
out[bytesOut] = 0;
std::string result = (char*)out;
delete[] out;
return result;
}
}
......
......@@ -37,21 +37,6 @@ namespace Processing {
namespace {
// [density]=kg/m^3
double rho(void) {
return 3400.;
}
// [velocity]=m/s
double alpha(void) {
return 7900.;
}
// radiation pattern
double fp(void) {
return 1.;
}
/*
double calcSlope(DoubleArray& ar, double dt) {
double varx = 0.;
......
......@@ -80,7 +80,7 @@ bool Environment::init()
#ifdef SEISCOMP_SHARE_DIR
_shareDir = _installDir + "/"SEISCOMP_SHARE_DIR;
_shareDir = _installDir + "/" SEISCOMP_SHARE_DIR;
#else
_shareDir = _installDir + "/share";
#endif
......@@ -104,7 +104,7 @@ bool Environment::init()
#ifdef SEISCOMP_CONFIG_DIR
_globalConfigDir = _installDir + "/"SEISCOMP_CONFIG_DIR;
_globalConfigDir = _installDir + "/" SEISCOMP_CONFIG_DIR;
#else
_globalConfigDir = _installDir + "/etc/defaults";
#endif
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment