Commit Graph

35 Commits

Author SHA1 Message Date
Ali Mohammad Pur
5e1499d104 Everywhere: Rename {Deprecated => Byte}String
This commit un-deprecates DeprecatedString, and repurposes it as a byte
string.
As the null state has already been removed, there are no other
particularly hairy blockers in repurposing this type as a byte string
(what it _really_ is).

This commit is auto-generated:
  $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \
    Meta Ports Ladybird Tests Kernel)
  $ perl -pie 's/\bDeprecatedString\b/ByteString/g;
    s/deprecated_string/byte_string/g' $xs
  $ clang-format --style=file -i \
    $(git diff --name-only | grep \.cpp\|\.h)
  $ gn format $(git ls-files '*.gn' '*.gni')
2023-12-17 18:25:10 +03:30
kleines Filmröllchen
062e0db46c LibCore: Make MappedFile OwnPtr-based
Since it will become a stream in a little bit, it should behave like all
non-trivial stream classes, who are not primarily intended to have
shared ownership to make closing behavior more predictable. Across all
uses of MappedFile, there is only one use case of shared mapped files in
LibVideo, which now uses the thin SharedMappedFile wrapper.
2023-09-27 03:22:56 +02:00
Sam Atkins
8d53442187 LibArchive: Extract logic for calculating ZIP statistics 2023-07-30 22:16:40 +01:00
Romain Chardiny
dc65a2f2b8 unzip: Add option to list files of an archive 2023-06-15 21:01:51 +01:00
kleines Filmröllchen
939600d2d4 Kernel: Use UnixDateTime wherever applicable
"Wherever applicable" = most places, actually :^), especially for
networking and filesystem timestamps.

This includes changes to unzip, which uses DOSPackedTime, since that is
changed for the FAT file systems.
2023-05-24 23:18:07 +02:00
Ben Wiederhake
e935cb9f09 unzip: Prefer File over DeprecatedFile 2023-05-21 07:50:52 +02:00
Cameron Youell
1d24f394c6 Everywhere: Use LibFileSystem where trivial 2023-03-21 19:03:21 +00:00
Tim Schumacher
d43a7eae54 LibCore: Rename File to DeprecatedFile
As usual, this removes many unused includes and moves used includes
further down the chain.
2023-02-13 00:50:07 +00:00
Ollrogge
0ce1c52577 LibArchive: Add support for modification time and date 2023-02-12 13:13:15 -07:00
implicitfield
28c99e7a1f LibArchive+Utilities: Stop using DeprecatedString
This also slightly improves error propagation in tar, unzip and zip.
2023-01-08 09:54:08 +00:00
Tim Schumacher
9805f73704 LibCore: Remove the force parameter from File::remove
About half of the usages were not using `force` anyways, and the other
half presumably just got confused about what "force" really means in
this context (which is "ignore nonexistent files").

The only 'legitimate' user, which is `rm`, instead now handles this
completely internally instead.
2022-12-23 10:38:14 -05:00
implicitfield
9ae9d82a03 unzip: Use StringView instead of DeprecatedString 2022-12-20 10:44:02 +01:00
implicitfield
a520894522 unzip: Verify extracted files against CRC32 checksums
This removes one TODO.
2022-12-20 10:44:02 +01:00
Tim Schumacher
30abd47099 LibCompress: Port DeflateDecompressor to Core::Stream 2022-12-12 16:21:39 +00:00
Linus Groh
6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
2022-12-06 08:54:33 +01:00
sin-ack
3f3f45580a Everywhere: Add sv suffix to strings relying on StringView(char const*)
Each of these strings would previously rely on StringView's char const*
constructor overload, which would call __builtin_strlen on the string.
Since we now have operator ""sv, we can replace these with much simpler
versions. This opens the door to being able to remove
StringView(char const*).

No functional changes.
2022-07-12 23:11:35 +02:00
DexesTTP
7ceeb74535 AK: Use an enum instead of a bool for String::replace(all_occurences)
This commit has no behavior changes.

In particular, this does not fix any of the wrong uses of the previous
default parameter (which used to be 'false', meaning "only replace the
first occurence in the string"). It simply replaces the default uses by
String::replace(..., ReplaceMode::FirstOnly), leaving them incorrect.
2022-07-06 11:12:45 +02:00
Tim Schumacher
8a671154c3 unzip: Remove the arbitrary file size limit
Not being able to map the file chunk-by-chunk feels like a deficit of
MappedFile and/or LibArchive, so it's weird that `unzip` is enforcing
this size limit, and an especially arbitary one at that.

Since "replace one error message with another error message" is the best
possible outcome here, and making the user pass a useless flag in cases
where it may not even be needed is the worst, let's just remove that
file size limit.

However, the `FIXME` about mapping files partially is left in because
this is something that we definitely want to take a look at in the
future.
2022-07-02 11:12:49 +04:30
Tim Schumacher
a87c85f401 unzip: Create parent directory before extracting files 2022-04-27 11:54:57 +02:00
Sam Atkins
f92312e778 Utilities/unzip: Use Core::Directory to create output directory 2022-04-13 16:00:17 +02:00
Idan Horowitz
086969277e Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
serenitydev
083b58fd89 Utilities: Add the 'files' argument to the unzip utility 2022-02-16 10:57:14 +03:30
Rummskartoffel
4aaab80649 unzip: Don't fail from mmap when trying to decompress empty files
Given an empty file, unzip would try to create a zero-size memory
mapping of that file, which would fail with EINVAL. With this commit,
attempting to unzip an empty file of course still fails, since that's
not a valid PKZIP file, but it now fails for the correct reason and with
the correct error message.
2022-01-15 22:24:19 +02:00
mjz19910
1f1383fe1e unzip: Remove useless .characters() calls 2022-01-04 23:53:46 -08:00
mjz19910
154d33f240 unzip: Port to LibMain 2022-01-04 10:59:42 +00:00
Andreas Kling
58fb3ebf66 LibCore+AK: Move MappedFile from AK to LibCore
MappedFile is strictly a userspace thing, so it doesn't belong in AK
(which is supposed to be user/kernel agnostic.)
2021-11-23 11:33:36 +01:00
Jelle Raaijmakers
3fa5b27931 Utilites: Implement unzip -q 2021-06-13 17:05:48 +01:00
Jelle Raaijmakers
c247d7a662 Utilities: Change unzip -o option to -d
Other `unzip` implementations universally use `-d` to indicate the
output directory, so let's follow this convention.
2021-06-13 17:05:48 +01:00
Jean-Baptiste Boric
3038edab00 Utilities: Correct non-standard assert macros includes 2021-05-17 18:14:05 +01:00
Ali Mohammad Pur
a91a49337c LibCore+Everywhere: Move OpenMode out of IODevice
...and make it an enum class so people don't omit "OpenMode".
2021-05-12 11:00:45 +01:00
TheGeopard
6a4ea4bf55 unzip: Add output directory option
This allows setting the output directory for unzip by adding a new
optional argument
2021-04-25 18:40:42 +02:00
Brian Gianforcaro
1682f0b760 Everything: Move to SPDX license identifiers in all files.
SPDX License Identifiers are a more compact / standardized
way of representing file license information.

See: https://spdx.dev/resources/use/#identifiers

This was done with the `ambr` search and replace tool.

 ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-22 11:22:27 +02:00
Idan Horowitz
8eceef0b1b unzip: Use the new LibArchive Zip parser
This parser should be a little bit more modern and a little more
resilient to zip files from other operating systems. As a side
effect we now also support extracting zip files that are using
DEFLATE compression (using our own LibCompress).
2021-03-23 16:09:36 +01:00
Andreas Kling
5d180d1f99 Everywhere: Rename ASSERT => VERIFY
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED)

Since all of these checks are done in release builds as well,
let's rename them to VERIFY to prevent confusion, as everyone is
used to assertions being compiled out in release.

We can introduce a new ASSERT macro that is specifically for debug
checks, but I'm doing this wholesale conversion first since we've
accumulated thousands of these already, and it's not immediately
obvious which ones are suitable for ASSERT.
2021-02-23 20:56:54 +01:00
Andreas Kling
ececac65c2 Userland: Move command-line utilities to Userland/Utilities/ 2021-01-12 12:04:09 +01:00