summaryrefslogtreecommitdiffstats
path: root/src/corelib/mimetypes/mime/hexdump.ps1
blob: 2a99b866365b13db03d2a7236a13a154bc605c45 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Copyright (C) 2019 Intel Corporation.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

param([String]$path, [String]$orig)

"static const unsigned char mimetype_database[] = {"
ForEach ($byte in Get-Content -Encoding byte -ReadCount 16 -path $path) {
#    if (($byte -eq 0).count -ne 16) {
        $hex = $byte | Foreach-Object {
            " 0x" + ("{0:x}" -f $_).PadLeft( 2, "0" ) + ","
        }
        "    $hex"
#    }
}
"};"

$file = Get-Childitem -file $orig
"static constexpr size_t MimeTypeDatabaseOriginalSize = " + $file.length + ";"