mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Many filenames are const strings
So we can use string constants for those Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
		
							parent
							
								
									508387b1e1
								
							
						
					
					
						commit
						dbd99f706e
					
				
					 4 changed files with 11 additions and 11 deletions
				
			
		| 
						 | 
					@ -3603,7 +3603,7 @@ struct picture *alloc_picture()
 | 
				
			||||||
	return pic;
 | 
						return pic;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool new_picture_for_dive(struct dive *d, char *filename)
 | 
					static bool new_picture_for_dive(struct dive *d, const char *filename)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	FOR_EACH_PICTURE (d) {
 | 
						FOR_EACH_PICTURE (d) {
 | 
				
			||||||
		if (same_string(picture->filename, filename))
 | 
							if (same_string(picture->filename, filename))
 | 
				
			||||||
| 
						 | 
					@ -3628,7 +3628,7 @@ bool dive_check_picture_time(struct dive *d, int shift_time, timestamp_t timesta
 | 
				
			||||||
	return false;
 | 
						return false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool picture_check_valid(char *filename, int shift_time)
 | 
					bool picture_check_valid(const char *filename, int shift_time)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int i;
 | 
						int i;
 | 
				
			||||||
	struct dive *dive;
 | 
						struct dive *dive;
 | 
				
			||||||
| 
						 | 
					@ -3640,7 +3640,7 @@ bool picture_check_valid(char *filename, int shift_time)
 | 
				
			||||||
	return false;
 | 
						return false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void dive_create_picture(struct dive *dive, char *filename, int shift_time, bool match_all)
 | 
					void dive_create_picture(struct dive *dive, const char *filename, int shift_time, bool match_all)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	timestamp_t timestamp = picture_get_timestamp(filename);
 | 
						timestamp_t timestamp = picture_get_timestamp(filename);
 | 
				
			||||||
	if (!new_picture_for_dive(dive, filename))
 | 
						if (!new_picture_for_dive(dive, filename))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -400,13 +400,13 @@ struct picture {
 | 
				
			||||||
extern struct picture *alloc_picture();
 | 
					extern struct picture *alloc_picture();
 | 
				
			||||||
extern struct picture *clone_picture(struct picture *src);
 | 
					extern struct picture *clone_picture(struct picture *src);
 | 
				
			||||||
extern bool dive_check_picture_time(struct dive *d, int shift_time, timestamp_t timestamp);
 | 
					extern bool dive_check_picture_time(struct dive *d, int shift_time, timestamp_t timestamp);
 | 
				
			||||||
extern void dive_create_picture(struct dive *d, char *filename, int shift_time, bool match_all);
 | 
					extern void dive_create_picture(struct dive *d, const char *filename, int shift_time, bool match_all);
 | 
				
			||||||
extern void dive_add_picture(struct dive *d, struct picture *newpic);
 | 
					extern void dive_add_picture(struct dive *d, struct picture *newpic);
 | 
				
			||||||
extern void dive_remove_picture(char *filename);
 | 
					extern void dive_remove_picture(char *filename);
 | 
				
			||||||
extern unsigned int dive_get_picture_count(struct dive *d);
 | 
					extern unsigned int dive_get_picture_count(struct dive *d);
 | 
				
			||||||
extern bool picture_check_valid(char *filename, int shift_time);
 | 
					extern bool picture_check_valid(const char *filename, int shift_time);
 | 
				
			||||||
extern void picture_load_exif_data(struct picture *p);
 | 
					extern void picture_load_exif_data(struct picture *p);
 | 
				
			||||||
extern timestamp_t picture_get_timestamp(char *filename);
 | 
					extern timestamp_t picture_get_timestamp(const char *filename);
 | 
				
			||||||
extern void dive_set_geodata_from_picture(struct dive *d, struct picture *pic);
 | 
					extern void dive_set_geodata_from_picture(struct dive *d, struct picture *pic);
 | 
				
			||||||
extern void picture_free(struct picture *picture);
 | 
					extern void picture_free(struct picture *picture);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -352,7 +352,7 @@ extern "C" xsltStylesheetPtr get_stylesheet(const char *name)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern "C" timestamp_t picture_get_timestamp(char *filename)
 | 
					extern "C" timestamp_t picture_get_timestamp(const char *filename)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	easyexif::EXIFInfo exif;
 | 
						easyexif::EXIFInfo exif;
 | 
				
			||||||
	memblock mem;
 | 
						memblock mem;
 | 
				
			||||||
| 
						 | 
					@ -999,7 +999,7 @@ QMutex hashOfMutex;
 | 
				
			||||||
QHash<QByteArray, QString> localFilenameOf;
 | 
					QHash<QByteArray, QString> localFilenameOf;
 | 
				
			||||||
QHash <QString, QImage > thumbnailCache;
 | 
					QHash <QString, QImage > thumbnailCache;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern "C" char * hashstring(char * filename)
 | 
					extern "C" char * hashstring(const char *filename)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	QMutexLocker locker(&hashOfMutex);
 | 
						QMutexLocker locker(&hashOfMutex);
 | 
				
			||||||
	return hashOf[QString(filename)].toHex().data();
 | 
						return hashOf[QString(filename)].toHex().data();
 | 
				
			||||||
| 
						 | 
					@ -1084,7 +1084,7 @@ void learnHash(struct picture *picture, QByteArray hash)
 | 
				
			||||||
	picture->hash = strdup(hash.toHex());
 | 
						picture->hash = strdup(hash.toHex());
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool haveHash(QString &filename)
 | 
					bool haveHash(const QString &filename)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	QMutexLocker locker(&hashOfMutex);
 | 
						QMutexLocker locker(&hashOfMutex);
 | 
				
			||||||
	return hashOf.contains(filename);
 | 
						return hashOf.contains(filename);
 | 
				
			||||||
| 
						 | 
					@ -1100,7 +1100,7 @@ QString localFilePath(const QString originalFilename)
 | 
				
			||||||
		return originalFilename;
 | 
							return originalFilename;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
QString fileFromHash(char *hash)
 | 
					QString fileFromHash(const char *hash)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (!hash || !*hash)
 | 
						if (!hash || !*hash)
 | 
				
			||||||
		return "";
 | 
							return "";
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -27,7 +27,7 @@ void learnImages(const QDir dir, int max_recursions);
 | 
				
			||||||
void add_hash(const QString filename, QByteArray hash);
 | 
					void add_hash(const QString filename, QByteArray hash);
 | 
				
			||||||
void hashPicture(struct picture *picture);
 | 
					void hashPicture(struct picture *picture);
 | 
				
			||||||
QString localFilePath(const QString originalFilename);
 | 
					QString localFilePath(const QString originalFilename);
 | 
				
			||||||
QString fileFromHash(char *hash);
 | 
					QString fileFromHash(const char *hash);
 | 
				
			||||||
void learnHash(struct picture *picture, QByteArray hash);
 | 
					void learnHash(struct picture *picture, QByteArray hash);
 | 
				
			||||||
extern "C" void cache_picture(struct picture *picture);
 | 
					extern "C" void cache_picture(struct picture *picture);
 | 
				
			||||||
weight_t string_to_weight(const char *str);
 | 
					weight_t string_to_weight(const char *str);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue