Skip to content

Commit 5d8f103

Browse files
committed
Fixed compiler warnings
1 parent 2837986 commit 5d8f103

File tree

4 files changed

+30
-38
lines changed

4 files changed

+30
-38
lines changed

BinaryNotes.NET/BinaryNotes/BinaryNotes.csproj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,6 @@
104104
<Reference Include="System.Data">
105105
<Name>System.Data</Name>
106106
</Reference>
107-
<Reference Include="System.Design">
108-
<Name>System.Design</Name>
109-
</Reference>
110107
<Reference Include="System.Drawing">
111108
<Name>System.Drawing</Name>
112109
</Reference>

BinaryNotes.NET/BinaryNotes/org/bn/coders/CoderUtils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ public static SortedList<int, PropertyInfo> getSetOrder(Type objClass)
213213
fieldOrder.Add(tagNA--, field);
214214
}
215215
}
216-
catch (ArgumentException ex)
216+
catch (ArgumentException)
217217
{
218218
if (element.HasTag)
219219
{

BinaryNotes.NET/BinaryNotes/org/bn/coders/per/PERUnalignedDecoder.cs

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,18 @@ You may obtain a copy of the License at
1414
See the License for the specific language governing permissions and
1515
limitations under the License.
1616
*/
17-
using System;
18-
using System.Reflection;
19-
using System.Collections.Generic;
2017
using org.bn.utils;
21-
using org.bn.attributes;
22-
using org.bn.attributes.constraints;
18+
using System;
19+
using System.IO;
20+
using System.Text;
2321

2422
namespace org.bn.coders.per
2523
{
2624

2725
public class PERUnalignedDecoder:PERAlignedDecoder
2826
{
2927

30-
protected override void skipAlignedBits(System.IO.Stream stream)
28+
protected override void skipAlignedBits(Stream stream)
3129
{
3230
// Do nothing! Unaligned encoding ;)
3331
}
@@ -43,48 +41,49 @@ protected override long decodeConstraintNumber(long min, long max, BitArrayInput
4341
{
4442
return max;
4543
}
46-
//For the UNALIGNED variant the value is always encoded in the minimum
44+
// For the UNALIGNED variant the value is always encoded in the minimum
4745
// number of bits necessary to represent the range (defined in 10.5.3).
4846
int currentBit = maxBitLen;
4947
while (currentBit > 7)
5048
{
5149
currentBit -= 8;
52-
result |= stream.ReadByte() << currentBit;
50+
result |= (uint)(stream.ReadByte() << currentBit);
5351
}
5452
if (currentBit > 0)
5553
{
56-
result |= stream.readBits(currentBit);
54+
result |= (uint)stream.readBits(currentBit);
5755
}
5856
result += min;
5957
return result;
6058
}
6159

62-
public override DecodedObject<object> decodeString(DecodedObject<object> decodedTag, System.Type objectClass, ElementInfo elementInfo, System.IO.Stream stream)
60+
public override DecodedObject<object> decodeString(DecodedObject<object> decodedTag, Type objectClass, ElementInfo elementInfo, Stream stream)
6361
{
64-
if (!PERCoderUtils.is7BitEncodedString(elementInfo))
62+
if (!PERCoderUtils.is7BitEncodedString(elementInfo))
63+
{
6564
return base.decodeString(decodedTag, objectClass, elementInfo, stream);
66-
else
67-
{
65+
}
66+
else
67+
{
6868
DecodedObject<object> result = new DecodedObject<object>();
6969
int strLen = decodeLength(elementInfo, stream);
70-
7170
if (strLen <= 0)
7271
{
73-
result.Value = ("");
74-
return result;
72+
result.Value = "";
73+
}
74+
else
75+
{
76+
BitArrayInputStream bitStream = (BitArrayInputStream)stream;
77+
// 7-bit decoding of string
78+
byte[] buffer = new byte[strLen];
79+
for (int i = 0; i < strLen; i++)
80+
{
81+
buffer[i] = (byte)bitStream.readBits(7);
82+
}
83+
result.Value = new string(ASCIIEncoding.ASCII.GetChars(buffer));
7584
}
76-
77-
BitArrayInputStream bitStream = (BitArrayInputStream) stream;
78-
byte[] buffer = new byte[strLen];
79-
// 7-bit decoding of string
80-
for (int i = 0; i < strLen; i++)
81-
buffer[i] = (byte)bitStream.readBits(7);
82-
result.Value = new string(
83-
System.Text.ASCIIEncoding.ASCII.GetChars(buffer)
84-
);
8585
return result;
86-
}
87-
86+
}
8887
}
8988
}
9089
}

BinaryNotes.NET/BinaryNotes/org/bn/metadata/ASN1StringMetadata.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,18 @@ namespace org.bn.metadata
2626
public class ASN1StringMetadata : ASN1FieldMetadata
2727
{
2828
private bool isUCS = false;
29-
private int stringType = UniversalTags.PrintableString ;
30-
private bool hasDefaults = false;
29+
private int stringType = UniversalTags.PrintableString;
3130

3231
public ASN1StringMetadata() {
33-
hasDefaults = true;
3432
}
3533

3634
public ASN1StringMetadata(ASN1String annotation)
3735
: this(annotation.Name, annotation.IsUCS, annotation.StringType)
3836
{
3937
}
4038

41-
public ASN1StringMetadata(String name,
42-
bool isUCS,
43-
int stringType): base(name)
39+
public ASN1StringMetadata(String name, bool isUCS, int stringType)
40+
: base(name)
4441
{
4542
this.isUCS = isUCS;
4643
this.stringType = stringType;
@@ -65,7 +62,6 @@ public override void setParentAnnotated(ICustomAttributeProvider parent) {
6562
}
6663
}
6764

68-
6965
public override int encode(IASN1TypesEncoder encoder, object obj, Stream stream, ElementInfo elementInfo)
7066
{
7167
return encoder.encodeString(obj, stream, elementInfo);

0 commit comments

Comments
 (0)