Fix compiler warnings

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@6451 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
g_j_m 2007-01-22 02:38:33 +00:00
parent f5ba57cc2f
commit ca4a1e7755
9 changed files with 79 additions and 65 deletions

View File

@ -24,7 +24,7 @@
QgsComposerItem::QgsComposerItem(void)
{
mSelected;
mSelected = false;
mPlotStyle = QgsComposition::Preview;
}

View File

@ -24,6 +24,7 @@
#include "qgsvectorlayer.h"
#include <QPainter>
#include <iostream>
#include <cmath>
QgsComposerMap::QgsComposerMap ( QgsComposition *composition, int id, int x, int y, int width, int height )
: QWidget(), Q3CanvasRectangle(x,y,width,height,0)
@ -236,7 +237,7 @@ void QgsComposerMap::cache ( void )
// 1 pixel in cache should have ia similar size as 1 pixel in canvas
// but it can result in big cache -> limit
int w = Q3CanvasRectangle::width() * mComposition->viewScale();
int w = static_cast<int>(round(Q3CanvasRectangle::width() * mComposition->viewScale()));
w = w < 1000 ? w : 1000;
int h = (int) ( mExtent.height() * w / mExtent.width() );
// It can happen that extent is not initialised well -> check
@ -397,6 +398,7 @@ double QgsComposerMap::scaleFromUserScale ( double us )
case QGis::FEET :
s = 304.8 * mComposition->scale() / us;
break;
case QGis::UNKNOWN :
case QGis::DEGREES :
s = mComposition->scale() / us;
break;
@ -416,6 +418,7 @@ double QgsComposerMap::userScaleFromScale ( double s )
us = 304.8 * mComposition->scale() / s;
break;
case QGis::DEGREES :
case QGis::UNKNOWN :
us = mComposition->scale() / s;
break;
}
@ -559,6 +562,7 @@ void QgsComposerMap::setOptions ( void )
mScaleLineEdit->setText ( QString("%1").arg((int)mUserScale) );
break;
case QGis::DEGREES :
case QGis::UNKNOWN :
mScaleLineEdit->setText ( QString("%1").arg(mUserScale,0,'f') );
break;
}

View File

@ -425,7 +425,7 @@ void QgsComposerScalebar::setOptions ( void )
bool found = false;
mMapComboBox->insertItem ( "", 0 );
mMaps.push_back ( 0 );
for ( int i = 0; i < maps.size(); i++ ) {
for ( uint i = 0; i < maps.size(); i++ ) {
mMapComboBox->insertItem ( maps[i]->name(), i+1 );
mMaps.push_back ( maps[i]->id() );

View File

@ -241,7 +241,7 @@ QRect QgsComposerVectorLegend::render ( QPainter *p )
std::vector<int> groupLayers; // vector of layers
std::vector<int> itemHeights; // maximum item sizes
std::vector<QString> itemLabels; // item labels
int sectionItemsCount = 0;
unsigned int sectionItemsCount = 0;
QString sectionTitle;
for ( int j = nlayers - 1; j >= 0; j-- ) {
@ -407,7 +407,7 @@ QRect QgsComposerVectorLegend::render ( QPainter *p )
}
/* add height of section items */
height = groupStartHeight;
for ( int j = 0; j < itemHeights.size(); j++ ) {
for ( uint j = 0; j < itemHeights.size(); j++ ) {
height += mSymbolSpace + itemHeights[j];
}
if ( sectionItemsCount > 1 ) { // add more space to separate section from next item
@ -615,7 +615,7 @@ void QgsComposerVectorLegend::setOptions ( void )
bool found = false;
mMapComboBox->insertItem ( "", 0 );
mMaps.push_back ( 0 );
for ( int i = 0; i < maps.size(); i++ ) {
for ( uint i = 0; i < maps.size(); i++ ) {
mMapComboBox->insertItem ( maps[i]->name(), i+1 );
mMaps.push_back ( maps[i]->id() );

View File

@ -95,7 +95,7 @@ QgsComposition::QgsComposition( QgsComposer *c, int id )
mPapers.push_back ( QgsCompositionPaper( tr("Legal (8.5x14 inches)"), 216, 356 ) );
mPaper = mDefaultPaper = mCustomPaper = 0;
for( int i = 0; i < mPapers.size(); i++ ) {
for( uint i = 0; i < mPapers.size(); i++ ) {
mPaperSizeComboBox->insertItem( mPapers[i].mName );
// Map - A4 land for now, if future read from template
if ( mPapers[i].mWidth == 210 && mPapers[i].mHeight == 297 ){

View File

@ -185,7 +185,7 @@ void QgsCustomProjectionDialog::on_pbnDelete_clicked()
#endif
if(myResult == SQLITE_OK)
{
sqlite3_step(myPreparedStatement) == SQLITE_ROW;
sqlite3_step(myPreparedStatement);
}
// close the sqlite3 statement
sqlite3_finalize(myPreparedStatement);
@ -242,9 +242,11 @@ long QgsCustomProjectionDialog::getRecordCount()
// XXX Need to free memory from the error msg if one is set
if(myResult == SQLITE_OK)
{
sqlite3_step(myPreparedStatement) == SQLITE_ROW;
QString myRecordCountString = QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,0));
myRecordCount=myRecordCountString.toLong();
if (sqlite3_step(myPreparedStatement) == SQLITE_ROW)
{
QString myRecordCountString = QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,0));
myRecordCount=myRecordCountString.toLong();
}
}
// close the sqlite3 statement
sqlite3_finalize(myPreparedStatement);
@ -275,8 +277,8 @@ QString QgsCustomProjectionDialog::getProjectionFamilyName(QString theProjection
// XXX Need to free memory from the error msg if one is set
if(myResult == SQLITE_OK)
{
sqlite3_step(myPreparedStatement) == SQLITE_ROW;
myName = QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,0));
if (sqlite3_step(myPreparedStatement) == SQLITE_ROW)
myName = QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,0));
}
// close the sqlite3 statement
sqlite3_finalize(myPreparedStatement);
@ -306,8 +308,8 @@ QString QgsCustomProjectionDialog::getEllipsoidName(QString theEllipsoidAcronym)
// XXX Need to free memory from the error msg if one is set
if(myResult == SQLITE_OK)
{
sqlite3_step(myPreparedStatement) == SQLITE_ROW;
myName = QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,0));
if (sqlite3_step(myPreparedStatement) == SQLITE_ROW)
myName = QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,0));
}
// close the sqlite3 statement
sqlite3_finalize(myPreparedStatement);
@ -337,8 +339,8 @@ QString QgsCustomProjectionDialog::getProjectionFamilyAcronym(QString theProject
// XXX Need to free memory from the error msg if one is set
if(myResult == SQLITE_OK)
{
sqlite3_step(myPreparedStatement) == SQLITE_ROW;
myName = QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,0));
if (sqlite3_step(myPreparedStatement) == SQLITE_ROW)
myName = QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,0));
}
// close the sqlite3 statement
sqlite3_finalize(myPreparedStatement);
@ -368,8 +370,8 @@ QString QgsCustomProjectionDialog::getEllipsoidAcronym(QString theEllipsoidName)
// XXX Need to free memory from the error msg if one is set
if(myResult == SQLITE_OK)
{
sqlite3_step(myPreparedStatement) == SQLITE_ROW;
myName = QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,0));
if (sqlite3_step(myPreparedStatement) == SQLITE_ROW)
myName = QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,0));
}
// close the sqlite3 statement
sqlite3_finalize(myPreparedStatement);
@ -405,16 +407,18 @@ void QgsCustomProjectionDialog::on_pbnFirst_clicked()
// XXX Need to free memory from the error msg if one is set
if(myResult == SQLITE_OK)
{
sqlite3_step(myPreparedStatement) == SQLITE_ROW;
mCurrentRecordId = QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,0));
leName->setText(QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,1)));
//QString myProjectionFamilyId = QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,2));
//cboProjectionFamily->setCurrentText(getProjectionFamilyName(myProjectionFamilyId));
//QString myEllipsoidId = QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,3));
//cboEllipsoid->setCurrentText(getEllipsoidName(myEllipsoidId));
leParameters->setText(QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,4)));
mCurrentRecordLong=1;
lblRecordNo->setText(QString::number(mCurrentRecordLong) + " of " + QString::number(mRecordCountLong));
if (sqlite3_step(myPreparedStatement) == SQLITE_ROW)
{
mCurrentRecordId = QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,0));
leName->setText(QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,1)));
//QString myProjectionFamilyId = QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,2));
//cboProjectionFamily->setCurrentText(getProjectionFamilyName(myProjectionFamilyId));
//QString myEllipsoidId = QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,3));
//cboEllipsoid->setCurrentText(getEllipsoidName(myEllipsoidId));
leParameters->setText(QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,4)));
mCurrentRecordLong=1;
lblRecordNo->setText(QString::number(mCurrentRecordLong) + " of " + QString::number(mRecordCountLong));
}
}
else
{
@ -481,16 +485,18 @@ void QgsCustomProjectionDialog::on_pbnPrevious_clicked()
// XXX Need to free memory from the error msg if one is set
if(myResult == SQLITE_OK)
{
sqlite3_step(myPreparedStatement) == SQLITE_ROW;
mCurrentRecordId = QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,0));
leName->setText(QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,1)));
//QString myProjectionFamilyId = QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,2));
//cboProjectionFamily->setCurrentText(getProjectionFamilyName(myProjectionFamilyId));
//QString myEllipsoidId = QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,3));
//cboEllipsoid->setCurrentText(getEllipsoidName(myEllipsoidId));
leParameters->setText(QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,4))),
--mCurrentRecordLong;
lblRecordNo->setText(QString::number(mCurrentRecordLong) + " of " + QString::number(mRecordCountLong));
if (sqlite3_step(myPreparedStatement) == SQLITE_ROW)
{
mCurrentRecordId = QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,0));
leName->setText(QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,1)));
//QString myProjectionFamilyId = QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,2));
//cboProjectionFamily->setCurrentText(getProjectionFamilyName(myProjectionFamilyId));
//QString myEllipsoidId = QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,3));
//cboEllipsoid->setCurrentText(getEllipsoidName(myEllipsoidId));
leParameters->setText(QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,4))),
--mCurrentRecordLong;
lblRecordNo->setText(QString::number(mCurrentRecordLong) + " of " + QString::number(mRecordCountLong));
}
}
else
{
@ -559,16 +565,18 @@ void QgsCustomProjectionDialog::on_pbnNext_clicked()
// XXX Need to free memory from the error msg if one is set
if(myResult == SQLITE_OK)
{
sqlite3_step(myPreparedStatement) == SQLITE_ROW;
mCurrentRecordId = QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,0));
leName->setText(QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,1)));
//QString myProjectionFamilyId = QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,2));
//cboProjectionFamily->setCurrentText(getProjectionFamilyName(myProjectionFamilyId));
//QString myEllipsoidId = QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,3));
//cboEllipsoid->setCurrentText(getEllipsoidName(myEllipsoidId));
leParameters->setText(QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,4)));
++mCurrentRecordLong;
lblRecordNo->setText(QString::number(mCurrentRecordLong) + " of " + QString::number(mRecordCountLong));
if (sqlite3_step(myPreparedStatement) == SQLITE_ROW)
{
mCurrentRecordId = QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,0));
leName->setText(QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,1)));
//QString myProjectionFamilyId = QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,2));
//cboProjectionFamily->setCurrentText(getProjectionFamilyName(myProjectionFamilyId));
//QString myEllipsoidId = QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,3));
//cboEllipsoid->setCurrentText(getEllipsoidName(myEllipsoidId));
leParameters->setText(QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,4)));
++mCurrentRecordLong;
lblRecordNo->setText(QString::number(mCurrentRecordLong) + " of " + QString::number(mRecordCountLong));
}
}
else
{
@ -632,16 +640,18 @@ void QgsCustomProjectionDialog::on_pbnLast_clicked()
// XXX Need to free memory from the error msg if one is set
if(myResult == SQLITE_OK)
{
sqlite3_step(myPreparedStatement) == SQLITE_ROW;
mCurrentRecordId = QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,0));
leName->setText(QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,1)));
//QString myProjectionFamilyId = QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,2));
//cboProjectionFamily->setCurrentText(getProjectionFamilyName(myProjectionFamilyId));
//QString myEllipsoidId = QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,3));
//cboEllipsoid->setCurrentText(getEllipsoidName(myEllipsoidId));
leParameters->setText(QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,4)));
mCurrentRecordLong =mRecordCountLong;
lblRecordNo->setText(QString::number(mCurrentRecordLong) + " of " + QString::number(mRecordCountLong));
if (sqlite3_step(myPreparedStatement) == SQLITE_ROW)
{
mCurrentRecordId = QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,0));
leName->setText(QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,1)));
//QString myProjectionFamilyId = QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,2));
//cboProjectionFamily->setCurrentText(getProjectionFamilyName(myProjectionFamilyId));
//QString myEllipsoidId = QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,3));
//cboEllipsoid->setCurrentText(getEllipsoidName(myEllipsoidId));
leParameters->setText(QString::fromUtf8((char *)sqlite3_column_text(myPreparedStatement,4)));
mCurrentRecordLong =mRecordCountLong;
lblRecordNo->setText(QString::number(mCurrentRecordLong) + " of " + QString::number(mRecordCountLong));
}
}
else
{

View File

@ -37,7 +37,7 @@ email : sherman at mrcc.com
#include <iostream>
QgsDbSourceSelect::QgsDbSourceSelect(QgisApp *app, Qt::WFlags fl)
: QDialog(app, fl), qgisApp(app), mColumnTypeThread(NULL), pd(0)
: QDialog(app, fl), mColumnTypeThread(NULL), qgisApp(app), pd(0)
{
setupUi(this);
btnAdd->setEnabled(false);
@ -729,7 +729,7 @@ void QgsGeomColumnTypeThread::getLayerTypes()
{
PQsetClientEncoding(pd, "UNICODE");
for (int i = 0; i < schemas.size(); ++i)
for (uint i = 0; i < schemas.size(); ++i)
{
QString query = QgsDbSourceSelect::makeGeomQuery(schemas[i],
tables[i],

View File

@ -71,7 +71,7 @@ void QgsPasteTransformations::accept()
QString sourceKey = sourceLayerComboBox ->currentText();
QString destinationKey = destinationLayerComboBox->currentText();
for (int i = 0; i < mSourceTransfers.size(); i++)
for (uint i = 0; i < mSourceTransfers.size(); i++)
{
settings.writeEntry(
baseKey + "/" + sourceKey + "/" + destinationKey + "/" +

View File

@ -45,9 +45,9 @@ static long DEFAULT_WMS_EPSG = 4326; // WGS 84
QgsServerSourceSelect::QgsServerSourceSelect(QgisApp * app, QWidget * parent, Qt::WFlags fl)
: QDialog(parent, fl),
m_Epsg(DEFAULT_WMS_EPSG),
qgisApp(app),
mWmsProvider(0),
m_Epsg(DEFAULT_WMS_EPSG)
mWmsProvider(0)
{
setupUi(this);
connect(btnCancel, SIGNAL(clicked()), this, SLOT(reject()));
@ -206,7 +206,7 @@ bool QgsServerSourceSelect::populateLayerList(QgsWmsProvider* wmsProvider)
// Also insert the styles
// Layer Styles
for (int j = 0; j < layer->style.size(); j++)
for (uint j = 0; j < layer->style.size(); j++)
{
#ifdef QGISDEBUG
std::cout << "QgsServerSourceSelect::populateLayerList: got style name " << layer->style[j].name.toLocal8Bit().data() << " and title '" << layer->style[j].title.toLocal8Bit().data() << "'." << std::endl;