Commit graph

12773 commits

Author SHA1 Message Date
Andreas Kling a8d52a68f6 LibWeb: Take care of a FIXME in the "in table text" insertion mode 2020-08-31 18:51:34 +02:00
thankyouverycool 60872a7c5a DevTools+Apps: Set correct icons for ThemeEditor and VisualBuilder
VB appears deprecated in favor of HackStudio, but until it's
officially gone-no app left behind!
2020-08-31 09:14:18 +02:00
AnotherTest 9adbbff4dd LibC: Partially implement 'freopen' 2020-08-31 09:14:11 +02:00
AnotherTest cb7526fca0 Userland: Make 'pro' capable of guessing a filename
The whole thing with `pro url > filename` was getting annoying, so let's
just have it support Content-Disposition and guessing from the URL.
2020-08-31 09:14:11 +02:00
thankyouverycool 199c1da31c LibGUI: Hide ResizeCorner in StatusBar when window is maximized
Fully expands status bars when maximized and prevents maximized
windows from being erroneously resized.
2020-08-31 09:08:26 +02:00
thankyouverycool 72deaa3423 WindowServer: Return correct IsMaximized response 2020-08-31 09:08:26 +02:00
Nico Weber 4b5cfce6b1 UserspaceEmulator: Emulate two FPU instructions! 2020-08-30 19:48:59 +02:00
Tibor Nagy 463ffbf83e Base: Remove obsolete .gitignore files
Leftovers from the time when the system used raw icons instead of PNGs.
2020-08-30 17:37:45 +02:00
Nico Weber d1990281e1 ntpquery: Add routines for converting timeval<->ntp timestamps
Use them to set the transmit timestamp on the outgoing packet and
to print the returned timestamps as ISO 8601 strings.
2020-08-30 17:37:20 +02:00
Nico Weber 73db67e806 Userland: Add an extremely simple NTP client
This only queries a single NTP server, only does a point-to-point
request, doens't do any filtering, doesn't display the response
in any useful format, and is generally very bare-bones.

But maybe, over time it can learn to query more servers, do
filtering, run as a service that keeps state over time to
improve filtering, adjust system time, and maybe learn to
run as an NTP server then.
2020-08-30 17:37:20 +02:00
Nico Weber f2135d7d00 AK: Make %llx work in printf 2020-08-30 17:37:20 +02:00
Sergey Bugaev 3d936d51fd Userland: Fix passing a non-format string to fprintf() 2020-08-30 17:35:27 +02:00
Sergey Bugaev f808810d00 LibC: Deprecate strcpy(), strncpy(), strcat() and strncat() :^)
And also mark strlcpy() and strlcat() with __attribute__((warn_unused_result)).

Since our code is warning-free, this ensures we never misuse those functions.
(Or are very sure about doing it when turning off the warning for a particular
piece of code.)
2020-08-30 17:35:27 +02:00
Sergey Bugaev 0106647ab8 Tests: Assert the path fits 2020-08-30 17:35:27 +02:00
Sergey Bugaev 1cdd798ac7 LibC: Replace some strncpy() calls with memcpy()
In case we know exactly how many bytes we're copying (and not copying a string
while limiting its length to that of a buffer), memcpy() is a more appropriate
function to call.

Also, fix null-terminating the %c pointer.
2020-08-30 17:35:27 +02:00
Sergey Bugaev 34353e18cf LibC: Misc fixes and improvements in netdb 2020-08-30 17:35:27 +02:00
Sergey Bugaev 0817ef563e LibC: strcpy a socket address at compile time
This way, we'd get compile-time errors if the address was too long for the buffer.
2020-08-30 17:35:27 +02:00
Sergey Bugaev 852454746e Everywhere: Port to String::copy_characters_to_buffer() 2020-08-30 17:35:27 +02:00
Sergey Bugaev be6cce5530 AK: Add String::copy_characters_to_buffer()
This is a strcpy()-like method with actually sane semantics:

* It accepts a non-empty buffer along with its size in bytes.
* It copies as much of the string as fits into the buffer.
* It always null-terminates the result.
* It returns, as a non-discardable boolean, whether the whole string has been
copied.

Intended usage looks like this:

bool fits = string.copy_characters_to_buffer(buffer, sizeof(buffer));

and then either

if (!fits) {
    fprintf(stderr, "The name does not fit!!11");
    return nullptr;
}

or, if you're sure the buffer is large enough,

// I'm totally sure it fits because [reasons go here].
ASSERT(fits);

or if you're feeling extremely adventurous,

(void)fits;

but don't do that, please.
2020-08-30 17:35:27 +02:00
Sergey Bugaev 17109a3a31 LibC: Use AK::String-backed buffers instead of static buffers
Also, refactor the hell out of pwd.cpp & grp.cpp
2020-08-30 17:35:27 +02:00
Luke 5fd88e51c5 HackStudio: Highlight register changes, minor disassembly view fix
Also adds shortcuts for step in (F11), step out (Shift-F11) and
step over (F10).
2020-08-30 17:31:33 +02:00
Linus Groh 16da91b7e7 LibWeb: Remove redundant .prettierrc
Now that LibJS's .prettierrc has been moved to the repository root (as
we start having .js files in /res), we don't need to keep a second,
identical copy for the LibWeb tests.
2020-08-30 17:31:08 +02:00
Tom 80560d1be3 AK: Fix FixedArray zero bytes allocations 2020-08-30 17:30:48 +02:00
Tom f5bc7dbfda AK: Fix ByteBuffer zero bytes allocations 2020-08-30 17:30:48 +02:00
Nico Weber 9ad5a261f7 LibCore: Let DateTime::create()/set_time() take summer time into account
DateTime::create() takes a date/time in local time, but it set
tm_isdst to 0, which meant it was in local winter time always.
Set tm_isdst to -1 so that times during summer time are treated
in summer time, and times in winter time are treated as winter
time (when appropriate). When the time is adjusted backward by
one hour, the same time can be in winter time or summer time,
so this isn't 100% reliable, but for most of the year it should
work fine.

Since LibJS uses DateTime, this means that the Date tuple
ctor (which creates a timestamp from year/month/day/hours/etc
in local time) and getTime() should now have consistent (and
correct) output, which should fix #3327.

In Serenity itself, dst handling (and timezones) are unimplemented
and this doens't have any effect yet, but in Lagom this has an effect.
2020-08-30 16:56:47 +02:00
Andreas Kling 57dd3b66c5 Kernel+LibC+UE: Implement sleep() via sys$clock_nanosleep()
This doesn't need to be its own syscall either. :^)
2020-08-30 13:21:24 +02:00
Andreas Kling cc5403f77b Kernel: Remove unused variable PhysicalRegion::m_last 2020-08-30 13:13:55 +02:00
Tom 4b66692a55 Kernel: Make Heap implementation reusable, and make kmalloc expandable
Add an ExpandableHeap and switch kmalloc to use it, which allows
for the kmalloc heap to grow as needed.

In order to make heap expansion to work, we keep around a 1 MiB backup
memory region, because creating a region would require space in the
same heap. This means, the heap will grow as soon as the reported
utilization is less than 1 MiB. It will also return memory if an entire
subheap is no longer needed, although that is rarely possible.
2020-08-30 11:39:38 +02:00
Andreas Kling 8ecc3d31d1 AK: Add missing declaration in StringImpl.cpp 2020-08-30 10:48:08 +02:00
Andreas Kling f857f3ce4c Kernel+LibC+UE: Implement usleep() via sys$clock_nanosleep()
This doesn't need to be its own syscall. Thanks @BenWiederhake for
the idea. :^)
2020-08-30 10:45:51 +02:00
Andreas Kling 95ed363b15 LibGfx: Fix Lagom build (possible uninitialized variable warnings) 2020-08-30 10:40:40 +02:00
Luke 453affb101 Kernel: Add shutdown commands for other virtualizers
Source: https://wiki.osdev.org/Shutdown
2020-08-30 10:31:39 +02:00
Ben Wiederhake 1a0c11cea2 VisualBuilder: Avoid unnecessary lambda 2020-08-30 10:31:04 +02:00
Ben Wiederhake c587db387c TextEditor: Don't try to move(lambda)
The move constructor of a lambda just copies it anyway.

Even if the first move() left an 'empty' closure behind, then
'm_editor->on_cursor_change' would only be able to see an empty
closure, which is certainly not what was intended.
2020-08-30 10:31:04 +02:00
Ben Wiederhake db422fa499 LibJS: Avoid unnecessary lambda
Especially when it's evaluated immediately and unconditionally.
2020-08-30 10:31:04 +02:00
Ben Wiederhake 737c9f0a14 Kernel: Explain correctness of reference to local lambda 2020-08-30 10:31:04 +02:00
Ben Wiederhake 70a2adaace Calendar: Avoid unnecessary lambda
Especially when a constant is passed as a boolean that contradicts the default value.
2020-08-30 10:31:04 +02:00
Ben Wiederhake c9bafa9467 FontEditor: Cannot take reference to local lambda
Under the hood, a lambda is just a struct full of pointers/references/copies and whatever else
the compiler deems necessary. In the case of 'update_demo', the struct lives on the stack
frame of FontEditorWidget::FontEditorWidget(). Hence it is still alive when it's called
during the constructor.

However, when 'fixed_width_checkbox.on_checked' fires, that stack frame is no longer alive,
and thus the *reference* to the (struct of) the lambda is invalid\! This meant that
'update_demo' silently read invalid data, tried to call '.update()' on some innocent arbitrary
memory address, and it crashed somewhere unrelated.

Passing 'update_demo' by value (like with all the other event handlers) fixes this issue.
Note that this solution only works because 'update_demo' itself has no state; otherwise
the various copies of 'update_demo' might notice that they are, in fact, independent copies
of the original lambda. But that doesn't matter here.
2020-08-30 10:31:04 +02:00
Ben Wiederhake 61521315ed FontEditor: Enforce boundaries of GlyphEditorWidget
Drawing out of bounds no longer affects any neighboring glyphs.
2020-08-30 10:31:04 +02:00
Peter Nelson b742d593dd LibGfx: use Gfx::Color instead of local struct for GIF colour map 2020-08-30 10:27:36 +02:00
Peter Nelson c8eccc00b1 LibGfx: only cache last decoded GIF frame
GIFLoader now uses a single frame buffer to cache the last decoded
frame. This drastically reduces memory usage at the small expense of
re-decoding frames on each loop.
2020-08-30 10:27:36 +02:00
Peter Nelson 786872e4c9 LibGfx: add support for interlaced GIFs 2020-08-30 10:27:36 +02:00
Peter Nelson 1341025da7 LibGfx: correctly handle GIF frame disposal modes
RestoreBackground disposal mode is now a transparent fill to allow
background to show through.

RestorePrevious disposal mode now restores the previous frame.
2020-08-30 10:27:36 +02:00
Linus Groh 3ae55770c8 LibGfxDemo: Set window icon to app-libgfx-demo.png 2020-08-30 10:02:52 +02:00
Linus Groh d61ea0da5f HelloWorld: Set window icon to app-hello-world.png 2020-08-30 10:02:52 +02:00
asynts c288b499aa Userland: add gunzip utility. 2020-08-30 09:56:10 +02:00
asynts 3f1dfc2e97 LibCompress: Implement gzip. 2020-08-30 09:56:10 +02:00
asynts 9664453739 LibCore: Add InputFileStream and OutputFileStream. 2020-08-30 09:56:10 +02:00
asynts e7df17d146 AK: Stream operators for String for generic streams.
I think this should really be a member function of InputStream instead,
but I don't want to include String in Stream.h. This will do for now...
2020-08-30 09:56:10 +02:00
asynts deb85c47b5 AK: Add Optional::emplace method. 2020-08-30 09:56:10 +02:00