mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Divelogs.de: use qDebug() instead of fprintf()
Use qDebug() instead of fprintf(stderr, ...) in prepare_dives_for_divelogs(). Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									8ac58181f7
								
							
						
					
					
						commit
						8f29df6e5a
					
				
					 1 changed files with 9 additions and 8 deletions
				
			
		|  | @ -112,6 +112,7 @@ static char *prepare_dives_for_divelogs(const bool selected) | ||||||
| 	struct zip_source *s[dive_table.nr]; | 	struct zip_source *s[dive_table.nr]; | ||||||
| 	struct zip *zip; | 	struct zip *zip; | ||||||
| 	char *error = NULL; | 	char *error = NULL; | ||||||
|  | 	const QString errPrefix("divelog.de-upload:"); | ||||||
| 
 | 
 | ||||||
| 	/* generate a random filename and create/open that file with zip_open */ | 	/* generate a random filename and create/open that file with zip_open */ | ||||||
| 	QString tempfileQ = QDir::tempPath() + "/import-" + QString::number(qrand() % 99999999) + ".dld"; | 	QString tempfileQ = QDir::tempPath() + "/import-" + QString::number(qrand() % 99999999) + ".dld"; | ||||||
|  | @ -119,11 +120,11 @@ static char *prepare_dives_for_divelogs(const bool selected) | ||||||
| 	zip = zip_open(tempfile, ZIP_CREATE, NULL); | 	zip = zip_open(tempfile, ZIP_CREATE, NULL); | ||||||
| 
 | 
 | ||||||
| 	if (!zip) { | 	if (!zip) { | ||||||
| 		fprintf(stderr, "divelog.de-upload: cannot open file as zip\n"); | 		qDebug() << errPrefix << "cannot open file as zip"; | ||||||
| 		return NULL; | 		return NULL; | ||||||
| 	} | 	} | ||||||
| 	if (!amount_selected) { | 	if (!amount_selected) { | ||||||
| 		fprintf(stderr, "divelog.de-upload: no dives selected\n"); | 		qDebug() << errPrefix << "no dives selected"; | ||||||
| 		return NULL; | 		return NULL; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -136,7 +137,7 @@ static char *prepare_dives_for_divelogs(const bool selected) | ||||||
| 			continue; | 			continue; | ||||||
| 		f = tmpfile(); | 		f = tmpfile(); | ||||||
| 		if (!f) { | 		if (!f) { | ||||||
| 			fprintf(stderr, "divelog.de-upload: cannot create temp file\n"); | 			qDebug() << errPrefix << "cannot create temp file"; | ||||||
| 			return NULL; | 			return NULL; | ||||||
| 		} | 		} | ||||||
| 		save_dive(f, dive); | 		save_dive(f, dive); | ||||||
|  | @ -145,7 +146,7 @@ static char *prepare_dives_for_divelogs(const bool selected) | ||||||
| 		rewind(f); | 		rewind(f); | ||||||
| 		membuf = (char *)malloc(streamsize + 1); | 		membuf = (char *)malloc(streamsize + 1); | ||||||
| 		if (!membuf || !fread(membuf, streamsize, 1, f)) { | 		if (!membuf || !fread(membuf, streamsize, 1, f)) { | ||||||
| 			fprintf(stderr, "divelog.de-upload: memory error\n"); | 			qDebug() << errPrefix << "memory error"; | ||||||
| 			return NULL; | 			return NULL; | ||||||
| 		} | 		} | ||||||
| 		membuf[streamsize] = 0; | 		membuf[streamsize] = 0; | ||||||
|  | @ -157,14 +158,14 @@ static char *prepare_dives_for_divelogs(const bool selected) | ||||||
| 		 */ | 		 */ | ||||||
| 		doc = xmlReadMemory(membuf, strlen(membuf), "divelog", NULL, 0); | 		doc = xmlReadMemory(membuf, strlen(membuf), "divelog", NULL, 0); | ||||||
| 		if (!doc) { | 		if (!doc) { | ||||||
| 			fprintf(stderr, "divelog.de-upload: xml error\n"); | 			qDebug() << errPrefix << "xml error"; | ||||||
| 			continue; | 			return NULL; | ||||||
| 		} | 		} | ||||||
| 		free((void *)membuf); | 		free((void *)membuf); | ||||||
| 		// this call is overriding our local variable tempfile! not a good sign!
 | 		// this call is overriding our local variable tempfile! not a good sign!
 | ||||||
| 		xslt = get_stylesheet("divelogs-export.xslt"); | 		xslt = get_stylesheet("divelogs-export.xslt"); | ||||||
| 		if (!xslt) { | 		if (!xslt) { | ||||||
| 			fprintf(stderr, "divelog.de-upload: missing stylesheet\n"); | 			qDebug() << errPrefix << "missing stylesheet"; | ||||||
| 			return NULL; | 			return NULL; | ||||||
| 		} | 		} | ||||||
| 		transformed = xsltApplyStylesheet(xslt, doc, NULL); | 		transformed = xsltApplyStylesheet(xslt, doc, NULL); | ||||||
|  | @ -180,7 +181,7 @@ static char *prepare_dives_for_divelogs(const bool selected) | ||||||
| 		if (s[i]) { | 		if (s[i]) { | ||||||
| 			int64_t ret = zip_add(zip, filename, s[i]); | 			int64_t ret = zip_add(zip, filename, s[i]); | ||||||
| 			if (ret == -1) | 			if (ret == -1) | ||||||
| 				fprintf(stderr, "divelog.de-upload: failed to include dive %d\n", i); | 				qDebug() << errPrefix << "failed to include dive:" << i; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	zip_close(zip); | 	zip_close(zip); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue