File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -651,7 +651,7 @@ public sealed class OlympusCameraSettingsMakernoteDescriptor(OlympusCameraSettin
651
651
if ( Directory . GetObject ( OlympusCameraSettingsMakernoteDirectory . TagGradation ) is not short [ ] values || values . Length < 3 )
652
652
return null ;
653
653
654
- var ret = ( values [ 0 ] , values [ 1 ] , values [ 3 ] ) switch
654
+ var ret = ( values [ 0 ] , values [ 1 ] , values [ 2 ] ) switch
655
655
{
656
656
( 0 , 0 , 0 ) => "n/a" ,
657
657
( - 1 , - 1 , 1 ) => "Low Key" ,
Original file line number Diff line number Diff line change @@ -7,13 +7,33 @@ namespace MetadataExtractor.Formats.QuickTime
7
7
/// </summary>
8
8
public static class QuickTimeReaderExtensions
9
9
{
10
+ #if NET462 || NETSTANDARD1_3
11
+ public static unsafe string Get4ccString ( this SequentialReader reader )
12
+ #else
10
13
public static string Get4ccString ( this SequentialReader reader )
14
+ #endif
11
15
{
16
+ // https://en.wikipedia.org/wiki/FourCC
17
+
12
18
Span < byte > bytes = stackalloc byte [ 4 ] ;
19
+ Span < char > chars = stackalloc char [ 4 ] ;
13
20
14
21
reader . GetBytes ( bytes ) ;
15
22
16
- return Encoding . ASCII . GetString ( bytes ) ;
23
+ // NOTE we cannot just use Encoding.ASCII here, as that can replace certain non-printable characters with '?'
24
+ chars [ 0 ] = ( char ) bytes [ 0 ] ;
25
+ chars [ 1 ] = ( char ) bytes [ 1 ] ;
26
+ chars [ 2 ] = ( char ) bytes [ 2 ] ;
27
+ chars [ 3 ] = ( char ) bytes [ 3 ] ;
28
+
29
+ #if NET462 || NETSTANDARD1_3
30
+ fixed ( char * pChars = chars )
31
+ {
32
+ return new string ( pChars , startIndex : 0 , length : 4 ) ;
33
+ }
34
+ #else
35
+ return new string ( chars ) ;
36
+ #endif
17
37
}
18
38
19
39
public static decimal Get16BitFixedPoint ( this SequentialReader reader )
You can’t perform that action at this time.
0 commit comments