mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	White space and clarifying braces
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									8f4a047cf0
								
							
						
					
					
						commit
						b19db6afb5
					
				
					 2 changed files with 13 additions and 10 deletions
				
			
		| 
						 | 
					@ -19,7 +19,8 @@
 | 
				
			||||||
#include <QEventLoop>
 | 
					#include <QEventLoop>
 | 
				
			||||||
#include <QTimer>
 | 
					#include <QTimer>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ReverseGeoLookupThread* ReverseGeoLookupThread::instance() {
 | 
					ReverseGeoLookupThread* ReverseGeoLookupThread::instance()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
	static ReverseGeoLookupThread* self = new ReverseGeoLookupThread();
 | 
						static ReverseGeoLookupThread* self = new ReverseGeoLookupThread();
 | 
				
			||||||
	return self;
 | 
						return self;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -28,8 +29,8 @@ ReverseGeoLookupThread::ReverseGeoLookupThread(QObject *obj) : QThread(obj)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void ReverseGeoLookupThread::run() {
 | 
					void ReverseGeoLookupThread::run()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
	QNetworkRequest request;
 | 
						QNetworkRequest request;
 | 
				
			||||||
	QNetworkAccessManager *rgl = new QNetworkAccessManager();
 | 
						QNetworkAccessManager *rgl = new QNetworkAccessManager();
 | 
				
			||||||
	QEventLoop loop;
 | 
						QEventLoop loop;
 | 
				
			||||||
| 
						 | 
					@ -54,9 +55,9 @@ void ReverseGeoLookupThread::run() {
 | 
				
			||||||
	timer.start(5000);   // 5 secs. timeout
 | 
						timer.start(5000);   // 5 secs. timeout
 | 
				
			||||||
	loop.exec();
 | 
						loop.exec();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(timer.isActive()) {
 | 
						if (timer.isActive()) {
 | 
				
			||||||
		timer.stop();
 | 
							timer.stop();
 | 
				
			||||||
		if(reply->error() > 0) {
 | 
							if (reply->error() > 0) {
 | 
				
			||||||
			report_error("got error accessing geonames.org: %s", qPrintable(reply->errorString()));
 | 
								report_error("got error accessing geonames.org: %s", qPrintable(reply->errorString()));
 | 
				
			||||||
			goto clear_reply;
 | 
								goto clear_reply;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -95,7 +96,7 @@ void ReverseGeoLookupThread::run() {
 | 
				
			||||||
				if (firstData[taxonomy_api_names[j]].isValid()) {
 | 
									if (firstData[taxonomy_api_names[j]].isValid()) {
 | 
				
			||||||
					ds->taxonomy.category[ri].category = j;
 | 
										ds->taxonomy.category[ri].category = j;
 | 
				
			||||||
					ds->taxonomy.category[ri].origin = taxonomy_origin::GEOCODED;
 | 
										ds->taxonomy.category[ri].origin = taxonomy_origin::GEOCODED;
 | 
				
			||||||
					free((void*)ds->taxonomy.category[ri].value);
 | 
										free((void *)ds->taxonomy.category[ri].value);
 | 
				
			||||||
					ds->taxonomy.category[ri].value = copy_string(qPrintable(firstData[taxonomy_api_names[j]].toString()));
 | 
										ds->taxonomy.category[ri].value = copy_string(qPrintable(firstData[taxonomy_api_names[j]].toString()));
 | 
				
			||||||
					ri++;
 | 
										ri++;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
| 
						 | 
					@ -128,9 +129,9 @@ void ReverseGeoLookupThread::run() {
 | 
				
			||||||
	connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
 | 
						connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
 | 
				
			||||||
	timer.start(5000);   // 5 secs. timeout
 | 
						timer.start(5000);   // 5 secs. timeout
 | 
				
			||||||
	loop.exec();
 | 
						loop.exec();
 | 
				
			||||||
	if(timer.isActive()) {
 | 
						if (timer.isActive()) {
 | 
				
			||||||
		timer.stop();
 | 
							timer.stop();
 | 
				
			||||||
		if(reply->error() > 0) {
 | 
							if (reply->error() > 0) {
 | 
				
			||||||
			report_error("got error accessing oceans API of geonames.org: %s", qPrintable(reply->errorString()));
 | 
								report_error("got error accessing oceans API of geonames.org: %s", qPrintable(reply->errorString()));
 | 
				
			||||||
			goto clear_reply;
 | 
								goto clear_reply;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -51,20 +51,22 @@ int taxonomy_index_for_category(struct taxonomy_data *t, enum taxonomy_category
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const char *taxonomy_get_country(struct taxonomy_data *t)
 | 
					const char *taxonomy_get_country(struct taxonomy_data *t)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	for (int i = 0; i < t->nr; i++)
 | 
						for (int i = 0; i < t->nr; i++) {
 | 
				
			||||||
		if (t->category[i].category == TC_COUNTRY)
 | 
							if (t->category[i].category == TC_COUNTRY)
 | 
				
			||||||
			return t->category[i].value;
 | 
								return t->category[i].value;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	return NULL;
 | 
						return NULL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void taxonomy_set_country(struct taxonomy_data *t, const char *country, enum taxonomy_origin origin)
 | 
					void taxonomy_set_country(struct taxonomy_data *t, const char *country, enum taxonomy_origin origin)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int idx = -1;
 | 
						int idx = -1;
 | 
				
			||||||
	for (int i = 0; i < t->nr; i++)
 | 
						for (int i = 0; i < t->nr; i++) {
 | 
				
			||||||
		if (t->category[i].category == TC_COUNTRY) {
 | 
							if (t->category[i].category == TC_COUNTRY) {
 | 
				
			||||||
			idx = i;
 | 
								idx = i;
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	if (idx == -1) {
 | 
						if (idx == -1) {
 | 
				
			||||||
		if (t->nr == TC_NR_CATEGORIES - 1) {
 | 
							if (t->nr == TC_NR_CATEGORIES - 1) {
 | 
				
			||||||
			// can't add another one
 | 
								// can't add another one
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue