Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions OpenXmlFormats/Wordprocessing/Document.cs
Original file line number Diff line number Diff line change
Expand Up @@ -854,8 +854,8 @@ public class CT_DocPartPr

public CT_DocPartPr()
{
this.itemsElementNameField = new ItemsChoiceType11[0];
this.itemsField = new object[0];
this.itemsElementNameField = Array.Empty<ItemsChoiceType11>();
this.itemsField = Array.Empty<object>();
}

[XmlElement("behaviors", typeof(CT_DocPartBehaviors), Order = 0)]
Expand Down
2 changes: 1 addition & 1 deletion OpenXmlFormats/Wordprocessing/Frame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class CT_Frameset

public CT_Frameset()
{
this.itemsField = new object[0];
this.itemsField = Array.Empty<object>();
this.frameLayoutField = new CT_FrameLayout();
this.framesetSplitbarField = new CT_FramesetSplitbar();
this.szField = new CT_String();
Expand Down
4 changes: 2 additions & 2 deletions OpenXmlFormats/Wordprocessing/wml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ public class CT_TxbxContent

public CT_TxbxContent()
{
this.itemsElementNameField = new ItemsChoiceType[0];
this.itemsField = new object[0];
this.itemsElementNameField = Array.Empty<ItemsChoiceType>();
this.itemsField = Array.Empty<object>();
}

[XmlElement("oMath", typeof(CT_OMath), Namespace = "http://schemas.openxmlformats.org/officeDocument/2006/math", Order = 0)]
Expand Down
2 changes: 1 addition & 1 deletion main/DDF/DefaultEscherRecordFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ private static Dictionary<short, ConstructorInfo> RecordsToMap(Type[] records)
{
Dictionary<short, ConstructorInfo> result = new Dictionary<short, ConstructorInfo>();
//ConstructorInfo constructor;
Type[] EMPTY_CLASS_ARRAY = new Type[0];
Type[] EMPTY_CLASS_ARRAY = Array.Empty<Type>();
for (int i = 0; i < records.Length; i++)
{
Type recordType = records[i];
Expand Down
6 changes: 3 additions & 3 deletions main/DDF/EscherBSERecord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class EscherBSERecord : EscherRecord
private byte field_11_unused3;
private EscherBlipRecord field_12_blipRecord;

private byte[] _remainingData = new byte[0];
private byte[] _remainingData = Array.Empty<byte>();

/// <summary>
/// This method deSerializes the record from a byte array.
Expand Down Expand Up @@ -114,7 +114,7 @@ public override int Serialize(int offset, byte[] data, EscherSerializationListen
listener.BeforeRecordSerialize(offset, RecordId, this);

if (_remainingData == null)
_remainingData = new byte[0];
_remainingData = Array.Empty<byte>();

LittleEndian.PutShort(data, offset, Options);
LittleEndian.PutShort(data, offset + 2, RecordId);
Expand Down Expand Up @@ -322,7 +322,7 @@ public byte[] RemainingData
{
if (value == null)
{
_remainingData = new byte[0];
_remainingData = Array.Empty<byte>();
}
else
{
Expand Down
6 changes: 3 additions & 3 deletions main/DDF/EscherClientAnchorRecord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class EscherClientAnchorRecord : EscherRecord
private short field_7_dx2;
private short field_8_row2;
private short field_9_dy2;
private byte[] remainingData = new byte[0];
private byte[] remainingData = Array.Empty<byte>();
private bool shortRecord = false;

/// <summary>
Expand Down Expand Up @@ -110,7 +110,7 @@ public override int Serialize(int offset, byte[] data, EscherSerializationListen
{
listener.BeforeRecordSerialize(offset, RecordId, this);

if (remainingData == null) remainingData = new byte[0];
if (remainingData == null) remainingData = Array.Empty<byte>();
LittleEndian.PutShort(data, offset, Options);
LittleEndian.PutShort(data, offset + 2, RecordId);
int remainingBytes = remainingData.Length + (shortRecord ? 8 : 18);
Expand Down Expand Up @@ -329,7 +329,7 @@ public byte[] RemainingData
{
if (value == null)
{
this.remainingData = new byte[0];
this.remainingData = Array.Empty<byte>();
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions main/DDF/EscherClientDataRecord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public override int Serialize(int offset, byte[] data, EscherSerializationListen
{
listener.BeforeRecordSerialize(offset, RecordId, this);

if (remainingData == null) remainingData = new byte[0];
if (remainingData == null) remainingData = Array.Empty<byte>();
LittleEndian.PutShort(data, offset, Options);
LittleEndian.PutShort(data, offset + 2, RecordId);
LittleEndian.PutInt(data, offset + 4, remainingData.Length);
Expand Down Expand Up @@ -137,7 +137,7 @@ public byte[] RemainingData
get { return remainingData; }
set
{
this.remainingData = (value == null) ? new byte[0] : (byte[])value.Clone();
this.remainingData = (value == null) ? Array.Empty<byte>() : (byte[])value.Clone();
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion main/DDF/EscherComplexProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace NPOI.DDF
/// </summary>
public class EscherComplexProperty : EscherProperty
{
private byte[] _complexData = new byte[0];
private byte[] _complexData = Array.Empty<byte>();

/// <summary>
/// Create a complex property using the property id and a byte array containing the complex
Expand Down
2 changes: 1 addition & 1 deletion main/DDF/EscherTextboxRecord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class EscherTextboxRecord : EscherRecord, ICloneable
public const short RECORD_ID = unchecked((short)0xF00D);
public const string RECORD_DESCRIPTION = "msofbtClientTextbox";

private static readonly byte[] NO_BYTES = new byte[0];
private static readonly byte[] NO_BYTES = Array.Empty<byte>();

/** The data for this record not including the the 8 byte header */
private byte[] _thedata = NO_BYTES;
Expand Down
4 changes: 2 additions & 2 deletions main/DDF/UnknownEscherRecord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace NPOI.DDF
/// </summary>
public class UnknownEscherRecord : EscherRecord, ICloneable
{
private static byte[] NO_BYTES = new byte[0];
private static byte[] NO_BYTES = Array.Empty<byte>();

/** The data for this record not including the the 8 byte header */
private byte[] _thedata = NO_BYTES;
Expand Down Expand Up @@ -65,7 +65,7 @@ public override int FillFields(byte[] data, int offset, IEscherRecordFactory rec
if (IsContainerRecord)
{
int bytesWritten = 0;
_thedata = new byte[0];
_thedata = Array.Empty<byte>();
offset += 8;
bytesWritten += 8;
while (bytesRemaining > 0)
Expand Down
2 changes: 1 addition & 1 deletion main/HPSF/Blob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public Blob(byte[] data, int offset)

if (size == 0)
{
_value = new byte[0];
_value = System.Array.Empty<byte>();
return;
}

Expand Down
2 changes: 1 addition & 1 deletion main/HPSF/ClipboardData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public ClipboardData(byte[] data, int offset)
// + "(doesn't even have format field!). "
// + "Setting to format == 0 and hope for the best" );
_format = 0;
_value = new byte[0];
_value = System.Array.Empty<byte>();
return;
}

Expand Down
2 changes: 1 addition & 1 deletion main/HPSF/UnicodeString.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public UnicodeString(byte[] data, int offset)

if (length == 0)
{
_value = new byte[0];
_value = System.Array.Empty<byte>();
return;
}

Expand Down
10 changes: 5 additions & 5 deletions main/HSSF/Model/LinkTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ private class ExternalBookBlock
public ExternalBookBlock()
{
_externalBookRecord = SupBookRecord.CreateAddInFunctions();
_externalNameRecords = new ExternalNameRecord[0];
_crnBlocks = new CRNBlock[0];
_externalNameRecords = Array.Empty<ExternalNameRecord>();
_crnBlocks = Array.Empty<CRNBlock>();
}
public ExternalBookBlock(RecordStream rs)
{
Expand All @@ -152,7 +152,7 @@ public ExternalBookBlock(RecordStream rs)
public ExternalBookBlock(String url, String[] sheetNames)
{
_externalBookRecord = SupBookRecord.CreateExternalReferences(url, sheetNames);
_crnBlocks = new CRNBlock[0];
_crnBlocks = Array.Empty<CRNBlock>();
}

/**
Expand All @@ -163,8 +163,8 @@ public ExternalBookBlock(String url, String[] sheetNames)
public ExternalBookBlock(int numberOfSheets)
{
_externalBookRecord = SupBookRecord.CreateInternalReferences((short)numberOfSheets);
_externalNameRecords = new ExternalNameRecord[0];
_crnBlocks = new CRNBlock[0];
_externalNameRecords = Array.Empty<ExternalNameRecord>();
_crnBlocks = Array.Empty<CRNBlock>();
}

public int NumberOfNames
Expand Down
4 changes: 2 additions & 2 deletions main/HSSF/Record/Aggregates/SharedValueManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public bool IsFirstCell(int row, int column)
}

public static readonly SharedValueManager EMPTY = new SharedValueManager(
new SharedFormulaRecord[0], new CellReference[0], new List<ArrayRecord>(), new List<TableRecord>());
Array.Empty<SharedFormulaRecord>(), Array.Empty<CellReference>(), new List<ArrayRecord>(), new List<TableRecord>());
private List<ArrayRecord> _arrayRecords;
private List<TableRecord> _tableRecords;
private Dictionary<SharedFormulaRecord, SharedFormulaGroup> _groupsBySharedFormulaRecord;
Expand Down Expand Up @@ -149,7 +149,7 @@ public static SharedValueManager CreateEmpty()
{
// Note - must create distinct instances because they are assumed to be mutable.
return new SharedValueManager(
new SharedFormulaRecord[0], new CellReference[0], new List<ArrayRecord>(), new List<TableRecord>());
Array.Empty<SharedFormulaRecord>(), Array.Empty<CellReference>(), new List<ArrayRecord>(), new List<TableRecord>());
}
/**
* @param firstCells
Expand Down
2 changes: 1 addition & 1 deletion main/HSSF/Record/CFRule12Record.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public CFRule12Record(RecordInputStream in1) {
int field_4_formula2_len = in1.ReadUShort();

ext_formatting_length = in1.ReadInt();
ext_formatting_data = new byte[0];
ext_formatting_data = Array.Empty<byte>();
if (ext_formatting_length == 0) {
// 2 bytes reserved
in1.ReadUShort();
Expand Down
2 changes: 1 addition & 1 deletion main/HSSF/Record/Chart/ChartEndBlockRecord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public ChartEndBlockRecord(RecordInputStream in1)
iObjectKind = in1.ReadShort();
// Often, but not always has 6 unused bytes at the end
if(in1.Available() == 0) {
unused = new byte[0];
unused = Array.Empty<byte>();
} else {
unused = new byte[6];
in1.ReadFully(unused);
Expand Down
2 changes: 1 addition & 1 deletion main/HSSF/Record/Chart/EndBlockRecord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public EndBlockRecord(RecordInputStream in1)
ObjectKind = (ObjectKind) in1.ReadShort();
// Often, but not always has 6 unused bytes at the end
if(in1.Available() == 0) {
unused = new byte[0];
unused = Array.Empty<byte>();
} else {
unused = new byte[6];
in1.ReadFully(unused);
Expand Down
2 changes: 1 addition & 1 deletion main/HSSF/Record/Common/FeatProtection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class FeatProtection : SharedFeature

public FeatProtection()
{
securityDescriptor = new byte[0];
securityDescriptor = Array.Empty<byte>();
}

public FeatProtection(RecordInputStream in1)
Expand Down
2 changes: 1 addition & 1 deletion main/HSSF/Record/Common/FeatSmartTag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class FeatSmartTag : SharedFeature

public FeatSmartTag()
{
data = new byte[0];
data = Array.Empty<byte>();
}

public FeatSmartTag(RecordInputStream in1)
Expand Down
4 changes: 2 additions & 2 deletions main/HSSF/Record/Common/UnicodeString.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ private void populateEmpty()
{
reserved = 1;
phoneticText = "";
phRuns = new PhRun[0];
extraData = new byte[0];
phRuns = Array.Empty<PhRun>();
extraData = Array.Empty<byte>();
}
public override int GetHashCode()
{
Expand Down
2 changes: 1 addition & 1 deletion main/HSSF/Record/DBCellRecord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class DBCellRecord : StandardRecord, ICloneable

public DBCellRecord()
{
field_2_cell_offsets = new short[0];
field_2_cell_offsets = Array.Empty<short>();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion main/HSSF/Record/Drawing/OfficeArtFOPT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class OfficeArtFOPT
private OfficeArtRecordHeader _rh;
private List<OfficeArtFOPTE> _fopt;
private Dictionary<int, OfficeArtFOPTE> dictOptions = new Dictionary<int, OfficeArtFOPTE>();
//private byte[] complexData = new byte[0];
//private byte[] complexData = Array.Empty<byte>();

public OfficeArtFOPT(RecordInputStream ris)
{
Expand Down
2 changes: 1 addition & 1 deletion main/HSSF/Record/Drawing/OfficeArtFOPTE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class OfficeArtFOPTE
{
//private OfficeArtFOPTEOPID field_1_opid;
//private int field_2_op;
private byte[] complexData = new byte[0];
private byte[] complexData = Array.Empty<byte>();

public OfficeArtFOPTE(RecordInputStream ris)
{
Expand Down
2 changes: 1 addition & 1 deletion main/HSSF/Record/ExtSSTRecord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class ExtSSTRecord : ContinuableRecord

public ExtSSTRecord()
{
_sstInfos = new InfoSubRecord[0];
_sstInfos = Array.Empty<InfoSubRecord>();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion main/HSSF/Record/RecordInputStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ public byte[] ReadRemainder()
int size = Remaining;
if (size == 0)
{
return new byte[0];
return Array.Empty<byte>();
}
byte[] result = new byte[size];
ReadFully(result);
Expand Down
2 changes: 1 addition & 1 deletion main/HSSF/UserModel/HSSFPolygon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public void SetPoints(int[] xPoints, int[] yPoints)
{
logger.Log(POILogger.ERROR, "HSSFPolygon must have at least one point");
}
EscherArrayProperty verticesProp = new EscherArrayProperty(EscherProperties.GEOMETRY__VERTICES, false, new byte[0]);
EscherArrayProperty verticesProp = new EscherArrayProperty(EscherProperties.GEOMETRY__VERTICES, false, System.Array.Empty<byte>());
verticesProp.NumberOfElementsInArray = (xPoints.Length + 1);
verticesProp.NumberOfElementsInMemory = (xPoints.Length + 1);
verticesProp.SizeOfElements = unchecked((short)(0xFFF0));
Expand Down
12 changes: 6 additions & 6 deletions main/POIFS/Crypt/Standard/StandardDecryptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -317,17 +317,17 @@ public string AlgorithmName

public byte[] DoFinal()
{
return new byte[0];
return Array.Empty<byte>();
}

public byte[] DoFinal(byte[] input)
{
return new byte[0];
return Array.Empty<byte>();
}

public byte[] DoFinal(byte[] input, int inOff, int length)
{
return new byte[0];
return Array.Empty<byte>();
}

public int DoFinal(byte[] output, int outOff)
Expand Down Expand Up @@ -367,7 +367,7 @@ public void Init(bool forEncryption, ICipherParameters parameters)

public byte[] ProcessByte(byte input)
{
return new byte[0];
return Array.Empty<byte>();
}

public int ProcessByte(byte input, byte[] output, int outOff)
Expand All @@ -377,12 +377,12 @@ public int ProcessByte(byte input, byte[] output, int outOff)

public byte[] ProcessBytes(byte[] input)
{
return new byte[0];
return Array.Empty<byte>();
}

public byte[] ProcessBytes(byte[] input, int inOff, int length)
{
return new byte[0];
return Array.Empty<byte>();
}

public int ProcessBytes(byte[] input, byte[] output, int outOff)
Expand Down
2 changes: 1 addition & 1 deletion main/POIFS/FileSystem/DirectoryNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ public Object[] ViewableArray
{
get
{
return new Object[0];
return Array.Empty<Object>();
}
}

Expand Down
2 changes: 1 addition & 1 deletion main/POIFS/FileSystem/DocumentNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ protected override bool IsDeleteOK

public Object[] ViewableArray
{
get { return new Object[0]; }
get { return Array.Empty<Object>(); }
}

/**
Expand Down
Loading