mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
* DiscImageChef/Main.cs:
* DiscImageChef/Options.cs: * DiscImageChef/DiscImageChef.csproj: * DiscImageChef/Commands/MediaScan.cs: Added media-scan command. * DiscImageChef.Decoders/SCSI/Inquiry.cs: Fixes decoding for devices that follow old 5-byte SCSI INQUIRY format. * DiscImageChef.Decoders/SCSI/Sense.cs: Fixes printing of sense block missing a newline. * DiscImageChef.Devices/Device/Variables.cs: * DiscImageChef.Devices/Device/Constructor.cs: Added an IsRemovable field. * DiscImageChef.Devices/Device/ScsiCommands.cs: Fixed SCSI READ CAPACITY CDB size. Fixed READ CD-DA MSF method name. Implemented SCSI SEEK (6) and SEEK (10) commands. * DiscImageChef.Devices/Linux/Command.cs: * DiscImageChef.Devices/Windows/Command.cs: Fixed memory leaking on unmanaged heap. * DiscImageChef.Helpers/StringHandlers.cs: Fixed string conversion when input byte array is null. * DiscImageChef/Commands/MediaInfo.cs: Check for inserted medium only on removable media devices.
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
2015-12-30 Natalia Portillo <claunia@claunia.com>
|
||||
|
||||
* StringHandlers.cs:
|
||||
Fixed string conversion when input byte array is null.
|
||||
|
||||
2015-12-04 Natalia Portillo <claunia@claunia.com>
|
||||
|
||||
* StringHandlers.cs:
|
||||
|
||||
@@ -61,6 +61,9 @@ namespace DiscImageChef
|
||||
/// <param name="encoding">Encoding.</param>
|
||||
public static string CToString(byte[] CString, Encoding encoding)
|
||||
{
|
||||
if (CString == null)
|
||||
return null;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
for (int i = 0; i < CString.Length; i++)
|
||||
@@ -81,6 +84,9 @@ namespace DiscImageChef
|
||||
/// <param name="PascalString">A length-prefixed (aka Pascal string) ASCII byte array</param>
|
||||
public static string PascalToString(byte[] PascalString)
|
||||
{
|
||||
if (PascalString == null)
|
||||
return null;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
byte length = PascalString[0];
|
||||
@@ -100,6 +106,9 @@ namespace DiscImageChef
|
||||
/// <param name="SpacePaddedString">A space (' ', 0x20, ASCII SPACE) padded ASCII byte array</param>
|
||||
public static string SpacePaddedToString(byte[] SpacePaddedString)
|
||||
{
|
||||
if (SpacePaddedString == null)
|
||||
return null;
|
||||
|
||||
int length = 0;
|
||||
|
||||
for (int i = SpacePaddedString.Length; i >= 0; i--)
|
||||
@@ -114,10 +123,7 @@ namespace DiscImageChef
|
||||
}
|
||||
}
|
||||
|
||||
if (length == 0)
|
||||
return "";
|
||||
|
||||
return Encoding.ASCII.GetString(SpacePaddedString, 0, length);
|
||||
return length == 0 ? "" : Encoding.ASCII.GetString(SpacePaddedString, 0, length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user