/src/karchive_fuzzer_common.h
Line | Count | Source |
1 | | /* |
2 | | # SPDX-FileCopyrightText: 2025 Google LLC |
3 | | # SPDX-License-Identifier: Apache-2.0 |
4 | | # |
5 | | # Copyright 2025 Google LLC |
6 | | # |
7 | | # Licensed under the Apache License, Version 2.0 (the "License"); |
8 | | # you may not use this file except in compliance with the License. |
9 | | # You may obtain a copy of the License at |
10 | | # |
11 | | # http://www.apache.org/licenses/LICENSE-2.0 |
12 | | # |
13 | | # Unless required by applicable law or agreed to in writing, software |
14 | | # distributed under the License is distributed on an "AS IS" BASIS, |
15 | | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
16 | | # See the License for the specific language governing permissions and |
17 | | # limitations under the License. |
18 | | # |
19 | | ################################################################################ |
20 | | */ |
21 | | |
22 | | #include <karchive.h> |
23 | | |
24 | | inline void traverseArchive(const KArchiveDirectory *dir, const QString &path = QString()) |
25 | 182k | { |
26 | 203k | for (const auto &entryName : dir->entries()) { |
27 | 203k | auto entry = dir->entry(entryName); |
28 | | |
29 | 203k | if (entry->isFile()) { |
30 | 44.2k | auto file = static_cast<const KArchiveFile *>(entry); |
31 | 44.2k | auto data = file->data(); |
32 | 159k | } else if (entry->isDirectory()) { |
33 | 159k | auto subDir = static_cast<const KArchiveDirectory *>(entry); |
34 | 159k | traverseArchive(subDir, path + QString::fromUtf8("/") + entryName); |
35 | 159k | } |
36 | 203k | } |
37 | 182k | } |