summaryrefslogtreecommitdiffstats
path: root/src/corelib/mimetypes/mime/hexdump.ps1
blob: 26fb9dd6e659816891dce8cb21c44ac3be6ff1ff (plain)
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 GPL-3.0-only WITH Qt-GPL-exception-1.0

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 + ";"