Fix some warnings

This commit is contained in:
Bond_009 2021-09-09 15:59:13 +02:00
parent 448125f2b4
commit 0d16c48998
9 changed files with 27 additions and 26 deletions

View File

@ -1015,17 +1015,17 @@ namespace MediaBrowser.Controller.Entities
if (!string.IsNullOrEmpty(query.NameStartsWithOrGreater))
{
items = items.Where(i => string.Compare(query.NameStartsWithOrGreater, i.SortName, StringComparison.CurrentCultureIgnoreCase) < 1);
items = items.Where(i => string.Compare(query.NameStartsWithOrGreater, i.SortName, StringComparison.InvariantCultureIgnoreCase) < 1);
}
if (!string.IsNullOrEmpty(query.NameStartsWith))
{
items = items.Where(i => i.SortName.StartsWith(query.NameStartsWith, StringComparison.CurrentCultureIgnoreCase));
items = items.Where(i => i.SortName.StartsWith(query.NameStartsWith, StringComparison.InvariantCultureIgnoreCase));
}
if (!string.IsNullOrEmpty(query.NameLessThan))
{
items = items.Where(i => string.Compare(query.NameLessThan, i.SortName, StringComparison.CurrentCultureIgnoreCase) == 1);
items = items.Where(i => string.Compare(query.NameLessThan, i.SortName, StringComparison.InvariantCultureIgnoreCase) == 1);
}
// This must be the last filter

View File

@ -24,6 +24,14 @@ namespace MediaBrowser.Controller.Entities
private readonly object _childIdsLock = new object();
private List<Guid> _childrenIds = null;
/// <summary>
/// Initializes a new instance of the <see cref="UserRootFolder"/> class.
/// </summary>
public UserRootFolder()
{
IsRoot = true;
}
[JsonIgnore]
public override bool SupportsInheritedParentImages => false;
@ -44,14 +52,6 @@ namespace MediaBrowser.Controller.Entities
}
}
/// <summary>
/// Initializes a new instance of the <see cref="UserRootFolder"/> class.
/// </summary>
public UserRootFolder()
{
IsRoot = true;
}
protected override List<BaseItem> LoadChildren()
{
lock (_childIdsLock)

View File

@ -37,7 +37,7 @@ namespace MediaBrowser.Controller.MediaEncoding
"ConstrainedHigh"
};
private static readonly Version minVersionForCudaOverlay = new Version(4, 4);
private static readonly Version _minVersionForCudaOverlay = new Version(4, 4);
public EncodingHelper(
IMediaEncoder mediaEncoder,
@ -647,8 +647,8 @@ namespace MediaBrowser.Controller.MediaEncoding
}
if (state.IsVideoRequest
&& ((string.Equals(options.HardwareAccelerationType, "nvenc", StringComparison.OrdinalIgnoreCase)
&& (isNvdecDecoder || isCuvidHevcDecoder || isCuvidVp9Decoder || isSwDecoder))))
&& string.Equals(options.HardwareAccelerationType, "nvenc", StringComparison.OrdinalIgnoreCase)
&& (isNvdecDecoder || isCuvidHevcDecoder || isCuvidVp9Decoder || isSwDecoder))
{
if (!isCudaTonemappingSupported && isOpenclTonemappingSupported)
{
@ -2099,7 +2099,7 @@ namespace MediaBrowser.Controller.MediaEncoding
var isVppTonemappingSupported = IsVppTonemappingSupported(state, options);
var mediaEncoderVersion = _mediaEncoder.GetMediaEncoderVersion();
var isCudaOverlaySupported = _mediaEncoder.SupportsFilter("overlay_cuda") && mediaEncoderVersion != null && mediaEncoderVersion >= minVersionForCudaOverlay;
var isCudaOverlaySupported = _mediaEncoder.SupportsFilter("overlay_cuda") && mediaEncoderVersion != null && mediaEncoderVersion >= _minVersionForCudaOverlay;
var isCudaFormatConversionSupported = _mediaEncoder.SupportsFilterWithOption(FilterOptionType.ScaleCudaFormat);
// Tonemapping and burn-in graphical subtitles requires overlay_vaapi.
@ -2380,7 +2380,7 @@ namespace MediaBrowser.Controller.MediaEncoding
var isCudaTonemappingSupported = IsCudaTonemappingSupported(state, options);
var isTonemappingSupportedOnNvenc = string.Equals(options.HardwareAccelerationType, "nvenc", StringComparison.OrdinalIgnoreCase);
var mediaEncoderVersion = _mediaEncoder.GetMediaEncoderVersion();
var isCudaOverlaySupported = _mediaEncoder.SupportsFilter("overlay_cuda") && mediaEncoderVersion != null && mediaEncoderVersion >= minVersionForCudaOverlay;
var isCudaOverlaySupported = _mediaEncoder.SupportsFilter("overlay_cuda") && mediaEncoderVersion != null && mediaEncoderVersion >= _minVersionForCudaOverlay;
var isCudaFormatConversionSupported = _mediaEncoder.SupportsFilterWithOption(FilterOptionType.ScaleCudaFormat);
var hasGraphicalSubs = state.SubtitleStream != null && !state.SubtitleStream.IsTextSubtitleStream && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;
@ -2683,7 +2683,7 @@ namespace MediaBrowser.Controller.MediaEncoding
var isVppTonemappingSupported = IsVppTonemappingSupported(state, options);
var isCudaTonemappingSupported = IsCudaTonemappingSupported(state, options);
var mediaEncoderVersion = _mediaEncoder.GetMediaEncoderVersion();
var isCudaOverlaySupported = _mediaEncoder.SupportsFilter("overlay_cuda") && mediaEncoderVersion != null && mediaEncoderVersion >= minVersionForCudaOverlay;
var isCudaOverlaySupported = _mediaEncoder.SupportsFilter("overlay_cuda") && mediaEncoderVersion != null && mediaEncoderVersion >= _minVersionForCudaOverlay;
var hasSubs = state.SubtitleStream != null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;
var hasTextSubs = state.SubtitleStream != null && state.SubtitleStream.IsTextSubtitleStream && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode;

View File

@ -19,7 +19,6 @@ namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
/// <param name="items">The playlist ids of the items to remove.</param>
/// <param name="clearPlaylist">Whether to clear the entire playlist. The items list will be ignored.</param>
/// <param name="clearPlayingItem">Whether to remove the playing item as well. Used only when clearing the playlist.</param>
public RemoveFromPlaylistGroupRequest(IReadOnlyList<Guid> items, bool clearPlaylist = false, bool clearPlayingItem = false)
{
PlaylistItemIds = items ?? Array.Empty<Guid>();

View File

@ -1,5 +1,5 @@
#nullable disable
#pragma warning disable CS1591
#pragma warning disable CS1591, CA1819
using System;

View File

@ -5,7 +5,7 @@ using System;
namespace MediaBrowser.Model.Dlna
{
public class ResolutionNormalizer
public static class ResolutionNormalizer
{
private static readonly ResolutionConfiguration[] Configurations =
new[]

View File

@ -1,5 +1,5 @@
#nullable disable
#pragma warning disable CS1591
#pragma warning disable CS1591, CA1819
using System;
using System.Xml.Serialization;

View File

@ -29,8 +29,6 @@
<TargetFramework>net5.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<AnalysisMode Condition=" '$(Configuration)' == 'Debug'">AllEnabledByDefault</AnalysisMode>
<CodeAnalysisRuleSet>../jellyfin.ruleset</CodeAnalysisRuleSet>
<Nullable>disable</Nullable>
</PropertyGroup>

View File

@ -1,9 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="Rules for Jellyfin.Server" Description="Code analysis rules for Jellyfin.Server.csproj" ToolsVersion="14.0">
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
<!-- disable warning CA1040: Avoid empty interfaces -->
<Rule Id="CA1040" Action="Info" />
<!-- disable warning SA1009: Closing parenthesis should be followed by a space. -->
<Rule Id="SA1009" Action="None" />
<!-- disable warning SA1011: Closing square bracket should be followed by a space. -->
@ -57,12 +54,19 @@
<Rule Id="CA1031" Action="Info" />
<!-- disable warning CA1032: Implement standard exception constructors -->
<Rule Id="CA1032" Action="Info" />
<!-- disable warning CA1040: Avoid empty interfaces -->
<Rule Id="CA1040" Action="Info" />
<!-- disable warning CA1062: Validate arguments of public methods -->
<Rule Id="CA1062" Action="Info" />
<!-- TODO: enable when false positives are fixed -->
<!-- disable warning CA1508: Avoid dead conditional code -->
<Rule Id="CA1508" Action="Info" />
<!-- disable warning CA1716: Identifiers should not match keywords -->
<Rule Id="CA1716" Action="Info" />
<!-- disable warning CA1720: Identifiers should not contain type names -->
<Rule Id="CA1720" Action="Info" />
<!-- disable warning CA1724: Type names should not match namespaces -->
<Rule Id="CA1724" Action="Info" />
<!-- disable warning CA1805: Do not initialize unnecessarily -->
<Rule Id="CA1805" Action="Info" />
<!-- disable warning CA1812: internal class that is apparently never instantiated.