1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
Fix the build with clang 6, which defaults to -std=gnu++14
plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp:264:20: error: comparison between pointer and integer ('char *' and 'int')
if( ade->value != '\0' )
~~~~~~~~~~ ^ ~~~~
plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp:277:20: error: comparison between pointer and integer ('char *' and 'int')
if( ade->value != '\0' )
~~~~~~~~~~ ^ ~~~~
plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp:290:20: error: comparison between pointer and integer ('char *' and 'int')
if( ade->value != '\0' )
~~~~~~~~~~ ^ ~~~~
commit 1777236203f21eed7a9baade632472094c8081d3
Author: Pino Toscano <pino@kde.org>
Date: Sat Feb 4 10:48:45 2017 +0100
ffmpeg: fix/simplify metadata conversion to string
Comparing a pointer with an integer value is (correctly) an error with
GCC 7.
diff --git a/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp b/plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp
index a4fc784b5..22928b279 100644
--- plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp
+++ plugins/decoder/ffmpeg/k3bffmpegwrapper.cpp
@@ -259,12 +259,7 @@ QString K3bFFMpegFile::title() const
{
// FIXME: is this UTF8 or something??
AVDictionaryEntry *ade = av_dict_get( d->formatContext->metadata, "TITLE", NULL, 0 );
- if( ade == NULL )
- return QString();
- if( ade->value != '\0' )
- return QString::fromLocal8Bit( ade->value );
- else
- return QString();
+ return ade && ade->value && ade->value[0] != '\0' ? QString::fromLocal8Bit( ade->value ) : QString();
}
@@ -272,12 +267,7 @@ QString K3bFFMpegFile::author() const
{
// FIXME: is this UTF8 or something??
AVDictionaryEntry *ade = av_dict_get( d->formatContext->metadata, "ARTIST", NULL, 0 );
- if( ade == NULL )
- return QString();
- if( ade->value != '\0' )
- return QString::fromLocal8Bit( ade->value );
- else
- return QString();
+ return ade && ade->value && ade->value[0] != '\0' ? QString::fromLocal8Bit( ade->value ) : QString();
}
@@ -285,12 +275,7 @@ QString K3bFFMpegFile::comment() const
{
// FIXME: is this UTF8 or something??
AVDictionaryEntry *ade = av_dict_get( d->formatContext->metadata, "COMMENT", NULL, 0 );
- if( ade == NULL )
- return QString();
- if( ade->value != '\0' )
- return QString::fromLocal8Bit( ade->value );
- else
- return QString();
+ return ade && ade->value && ade->value[0] != '\0' ? QString::fromLocal8Bit( ade->value ) : QString();
}
|