Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'warnings2' into 'master'
fix compiler warnings



See merge request !4
  • Loading branch information
lpotter committed Nov 20, 2016
2 parents 6e5acd5 + fa6681b commit d361752
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 44 deletions.
2 changes: 1 addition & 1 deletion adaptors/hybrisalsadaptor/hybrisalsadaptor.cpp
Expand Up @@ -86,7 +86,7 @@ void HybrisAlsAdaptor::sendInitialData()
if ((fd = open(inputDev.toLatin1(), O_RDONLY)) > -1) {

if (!ioctl(fd, EVIOCGABS(ABS_MISC), &absinfo)) {
if (absinfo.value != lastLightValue)
if (absinfo.value != (signed)lastLightValue)
lastLightValue = absinfo.value;

TimedUnsigned *d = buffer->nextSlot();
Expand Down
10 changes: 3 additions & 7 deletions adaptors/magnetometeradaptor-ncdk/magnetometeradaptor-ncdk.cpp
Expand Up @@ -66,18 +66,14 @@ void MagnetometerAdaptorNCDK::processSample(int pathId, int fd)
int bytesRead = 0;
bool isOK = (bytesRead = read(fd, &buf, sizeof(buf))) > 0;

switch (isOK)
{
case true:
if (isOK) {
strList = QByteArray(buf, bytesRead).split(':');
if (strList.size() == 3)
{
if (strList.size() == 3) {
x = adjustPos(strList.at(0).toInt(), x_adj);
y = adjustPos(strList.at(1).toInt(), y_adj);
z = adjustPos(strList.at(2).toInt(), z_adj);
break;
}
case false:
} else {
sensordLogW() << "Reading magnetometer error: " << strerror(errno);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion adaptors/magnetometeradaptor/magnetometeradaptor.cpp
Expand Up @@ -93,7 +93,7 @@ bool MagnetometerAdaptor::setInterval(const unsigned int value, const int sessio
{
if(intervalCompensation_)
{
return SysfsAdaptor::setInterval(value > intervalCompensation_ ? value - intervalCompensation_ : 0, sessionId);
return SysfsAdaptor::setInterval((signed)value >intervalCompensation_ ? value - intervalCompensation_ : 0, sessionId);
}
return SysfsAdaptor::setInterval(value, sessionId);
}
Expand Down
4 changes: 2 additions & 2 deletions adaptors/proximityadaptor-evdev/proximityadaptor-evdev.cpp
Expand Up @@ -57,8 +57,8 @@ ProximityAdaptorEvdev::~ProximityAdaptorEvdev()
void ProximityAdaptorEvdev::interpretEvent(int src, struct input_event *ev)
{
Q_UNUSED(src);
if (ev->type == EV_SW && ev->code == SW_FRONT_PROXIMITY ||
ev->type == EV_ABS && ev->code == ABS_DISTANCE) {
if ((ev->type == EV_SW && ev->code == SW_FRONT_PROXIMITY) ||
(ev->type == EV_ABS && ev->code == ABS_DISTANCE)) {
if (ev->value == 0) {
currentState_ = ProximityStateClosed;
} else if (ev->value == 1) {
Expand Down
2 changes: 1 addition & 1 deletion adaptors/proximityadaptor/proximityadaptor.cpp
Expand Up @@ -136,7 +136,7 @@ void ProximityAdaptor::processSample(int pathId, int fd)
return;
}
sscanf(buffer, "%d", &rawdata);
if ( rawdata > threshold_ ) {
if ( (signed)rawdata > threshold_ ) {
ret = 1;
}
sensordLogT() << "Proximity value: " << rawdata;
Expand Down
28 changes: 1 addition & 27 deletions adaptors/steaccelerometeradaptor/steaccelerometeradaptor.cpp
Expand Up @@ -47,31 +47,6 @@ power_state/frequency
powerStatePath = Config::configuration()->value("accelerometer/mode_path").toByteArray();
frequency = Config::configuration()->value("accelerometer/frequency_mode").toInt();


int interval;
switch(frequency) {
case 0:
interval = 0; //off
case 1:
interval = 1;
break;
case 2:
interval = 10;
break;
case 3:
interval = 25;
break;
case 4:
interval = 50;
break;
case 6:
interval = 200;
break;
case 7:
interval = 400;
break;
};

setDescription("ste accelerometer");
}

Expand Down Expand Up @@ -102,9 +77,9 @@ void SteAccelAdaptor::stopSensor()

void SteAccelAdaptor::processSample(int pathId, int fd)
{
Q_UNUSED(pathId);
char buf[32];
int x, y, z;
qlonglong ts;

// if (pathId != devId) {
// sensordLogW () << "Wrong pathId" << pathId;
Expand All @@ -122,7 +97,6 @@ void SteAccelAdaptor::processSample(int pathId, int fd)
x = line.section(":",0,0).toInt();
y = line.section(":",1,1).toInt();
z = line.section(":",2,2).toInt();
ts = line.section(":",3,3).toLongLong();

AccelerationData *d = buffer->nextSlot();

Expand Down
1 change: 0 additions & 1 deletion core/core.pro
Expand Up @@ -2,7 +2,6 @@ QT += network

TEMPLATE = lib
TARGET = sensorfw

include( ../common-config.pri )

CONFIG += link_pkgconfig
Expand Down
1 change: 1 addition & 0 deletions core/deviceadaptor.cpp
Expand Up @@ -111,6 +111,7 @@ AdaptedSensorEntry* DeviceAdaptor::getAdaptedSensor() const

RingBufferBase* DeviceAdaptor::findBuffer(const QString& name) const
{
Q_UNUSED(name)
AdaptedSensorEntry* entry = getAdaptedSensor();
if ( !entry )
return NULL;
Expand Down
6 changes: 3 additions & 3 deletions core/sensormanager.cpp
Expand Up @@ -479,7 +479,7 @@ DeviceAdaptor* SensorManager::requestDeviceAdaptor(const QString& id)
if( id.contains(';') ) // no parameter passing in release
{
setError( SmIdNotRegistered, QString(tr("unknown adaptor id '%1'").arg(id)) );
return NULL;
return Q_NULLPTR;
}

DeviceAdaptor* da = NULL;
Expand Down Expand Up @@ -619,9 +619,9 @@ bool SensorManager::write(int id, const void* source, int size)
void SensorManager::sensorDataHandler(int)
{
PipeData pipeData;
read(pipefds_[0], &pipeData, sizeof(pipeData));
ssize_t bytesRead = read(pipefds_[0], &pipeData, sizeof(pipeData));

if (!socketHandler_->write(pipeData.id, pipeData.buffer, pipeData.size)) {
if (!bytesRead || !socketHandler_->write(pipeData.id, pipeData.buffer, pipeData.size)) {
sensordLogW() << "Failed to write data to socket.";
}

Expand Down
4 changes: 3 additions & 1 deletion core/sysfsadaptor.cpp
Expand Up @@ -300,7 +300,9 @@ void SysfsAdaptor::stopReaderThread()
{
if (mode_ == SelectMode) {
quint64 dummy = 1;
write(pipeDescriptors_[1], &dummy, 8);
ssize_t bytesWritten = write(pipeDescriptors_[1], &dummy, 8);
if (!bytesWritten)
qWarning() << "Could not write pipe descriptors";
}
else
reader_.stopReader();
Expand Down

0 comments on commit d361752

Please sign in to comment.