Skip to content

Commit

Permalink
Fix compiler warnings
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@6451 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
g_j_m committed Jan 22, 2007
1 parent b6b92c9 commit f2eab1f
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 65 deletions.
2 changes: 1 addition & 1 deletion src/app/composer/qgscomposeritem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

QgsComposerItem::QgsComposerItem(void)
{
mSelected;
mSelected = false;
mPlotStyle = QgsComposition::Preview;
}

Expand Down
6 changes: 5 additions & 1 deletion src/app/composer/qgscomposermap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/composer/qgscomposerscalebar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() );

Expand Down
6 changes: 3 additions & 3 deletions src/app/composer/qgscomposervectorlegend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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-- ) {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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() );

Expand Down
2 changes: 1 addition & 1 deletion src/app/composer/qgscomposition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ){
Expand Down
114 changes: 62 additions & 52 deletions src/app/qgscustomprojectiondialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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
{
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsdbsourceselect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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],
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgspastetransformations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 + "/" +
Expand Down
6 changes: 3 additions & 3 deletions src/app/qgsserversourceselect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit f2eab1f

Please sign in to comment.