You've already forked linux-packaging-mono
Imported Upstream version 6.8.0.73
Former-commit-id: d18deab1b47cfd3ad8cba82b3f37d00eec2170af
This commit is contained in:
parent
bceda29824
commit
73ee7591e8
@@ -1,19 +1,20 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// This code is licensed under the Microsoft Public License.
|
||||
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
|
||||
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
|
||||
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
|
||||
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Microsoft.Cci.Pdb {
|
||||
internal class PdbFileHeader {
|
||||
private readonly byte[] windowsPdbMagic = new byte[32] {
|
||||
0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, // "Microsof"
|
||||
0x74, 0x20, 0x43, 0x2F, 0x43, 0x2B, 0x2B, 0x20, // "t C/C++ "
|
||||
0x4D, 0x53, 0x46, 0x20, 0x37, 0x2E, 0x30, 0x30, // "MSF 7.00"
|
||||
0x0D, 0x0A, 0x1A, 0x44, 0x53, 0x00, 0x00, 0x00 // "^^^DS^^^"
|
||||
};
|
||||
|
||||
//internal PdbFileHeader(int pageSize) {
|
||||
// this.magic = new byte[32] {
|
||||
// 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, // "Microsof"
|
||||
@@ -24,8 +25,6 @@ namespace Microsoft.Cci.Pdb {
|
||||
// this.pageSize = pageSize;
|
||||
//}
|
||||
|
||||
const string MAGIC = "Microsoft C/C++ MSF 7.00";
|
||||
|
||||
internal PdbFileHeader(Stream reader, BitAccess bits) {
|
||||
bits.MinCapacity(56);
|
||||
reader.Seek(0, SeekOrigin.Begin);
|
||||
@@ -39,18 +38,20 @@ namespace Microsoft.Cci.Pdb {
|
||||
bits.ReadInt32(out this.directorySize); // 44..47
|
||||
bits.ReadInt32(out this.zero); // 48..51
|
||||
|
||||
if (Magic != MAGIC) {
|
||||
throw new InvalidOperationException("Magic is wrong.");
|
||||
if (!this.magic.SequenceEqual(windowsPdbMagic))
|
||||
{
|
||||
throw new PdbException("The PDB file is not recognized as a Windows PDB file");
|
||||
}
|
||||
|
||||
int directoryPages = ((((directorySize + pageSize - 1) / pageSize) * 4) + pageSize - 1) / pageSize;
|
||||
this.directoryRoot = new int[directoryPages];
|
||||
bits.FillBuffer(reader, directoryPages * 4);
|
||||
bits.ReadInt32(this.directoryRoot);
|
||||
}
|
||||
|
||||
string Magic {
|
||||
get { return StringFromBytesUTF8(magic, 0, MAGIC.Length); }
|
||||
}
|
||||
//internal string Magic {
|
||||
// get { return StringFromBytesUTF8(magic); }
|
||||
//}
|
||||
|
||||
//internal void Write(Stream writer, BitAccess bits) {
|
||||
// bits.MinCapacity(pageSize);
|
||||
@@ -68,18 +69,18 @@ namespace Microsoft.Cci.Pdb {
|
||||
|
||||
//////////////////////////////////////////////////// Helper Functions.
|
||||
//
|
||||
static string StringFromBytesUTF8(byte[] bytes) {
|
||||
return StringFromBytesUTF8(bytes, 0, bytes.Length);
|
||||
}
|
||||
//internal static string StringFromBytesUTF8(byte[] bytes) {
|
||||
// return StringFromBytesUTF8(bytes, 0, bytes.Length);
|
||||
//}
|
||||
|
||||
static string StringFromBytesUTF8(byte[] bytes, int offset, int length) {
|
||||
for (int i = 0; i < length; i++) {
|
||||
if (bytes[offset + i] < ' ') {
|
||||
length = i;
|
||||
}
|
||||
}
|
||||
return Encoding.UTF8.GetString(bytes, offset, length);
|
||||
}
|
||||
//internal static string StringFromBytesUTF8(byte[] bytes, int offset, int length) {
|
||||
// for (int i = 0; i < length; i++) {
|
||||
// if (bytes[offset + i] < ' ') {
|
||||
// length = i;
|
||||
// }
|
||||
// }
|
||||
// return Encoding.UTF8.GetString(bytes, offset, length);
|
||||
//}
|
||||
|
||||
////////////////////////////////////////////////////////////// Fields.
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user