Commit graph

12114 commits

Author SHA1 Message Date
Andreas Kling
b777640fef Kernel: Remove strdup() since nothing uses it 2020-08-13 20:18:11 +02:00
Andreas Kling
5099e76ce6 LibGUI: Remove unused bool SortingProxyModel::m_sorting 2020-08-13 20:18:11 +02:00
Andreas Kling
686ee2bf04 LibGUI: Rename ModelClient::on_model_update() => model_did_update()
This follows the typical client callback naming scheme used elsewhere
and doesn't collide with the "on_foo" Function hook convention.
2020-08-13 20:18:11 +02:00
Andreas Kling
4088beb8eb LibGUI: Remove Model::sibling() since it's the same as index()
... I'm not sure what the idea was here, but since these functions do
the same thing, let's only have index().
2020-08-13 20:18:11 +02:00
Andreas Kling
fe19cf0ff2 LibGUI: Move Model::index() out of line 2020-08-13 20:18:11 +02:00
Andreas Kling
82e949aa7c LibGUI: Rename SortingProxyModel "target" to "source" instead 2020-08-13 20:18:11 +02:00
Nico Weber
db6a4f2954 Kernel: Fix rng regression from bc7a149039 2020-08-13 19:28:15 +02:00
Muhammad Zahalqa
11b9e8b366 LibC: Some calloc() and realloc() improvements (#3108)
If the space cannot be allocated, the original memory block shall remain
unchanged and the function should return nullptr.

Also add a function attribute and some null checks.
2020-08-13 19:16:15 +02:00
Panagiotis Vasilopoulos
dcfc54d767 AK: Add initial support for obscure IPv4 address notations
This change aims to add support for obscure IPv4 address notations, such as 1.1 (which should be equal to 1.0.0.1), or the hypothetical address 1 (which is equal to 0.0.0.1). This is supported on other platforms as well, such as Linux, Windows, *BSD, and even Haiku.
2020-08-13 19:02:47 +02:00
Muhammad Zahalqa
138595961b LibC: mark strdup & strndup as __attribute__((malloc)) 2020-08-13 18:53:32 +02:00
Nico Weber
6e1d6d1ff5 Kernel: Don't request a random u32 when all but 5 bits are immediately masked off 2020-08-13 18:52:24 +02:00
Nico Weber
924951e426 Shell: Add test for 37d5e3e0df / #3073 2020-08-13 18:45:39 +02:00
Linus Groh
675d8eec60 LibGUI: Fix ColorPicker custom color offset
Previously the ColorPicker would get the custom color directly from the
window, this was changed in d7d5788469 to
get the color from the underlying bitmap instead - without taking the
bitmap's scaling into effect though, so resulting colors were off by
quite a bit.

Fixes #3113.
2020-08-13 16:58:31 +02:00
Linus Groh
728d4649e4 LibGUI: Fix ComboBox desktop intersection rect
Subtracting 128 from the desktop rect's height was far to much and
and leading to weird rendering issues - now it's calculated exactly from
taskbar and menubar heights as well as a little additional offset to
make it fit perfectly.

Fixes #3115.
2020-08-13 16:06:02 +02:00
Linus Groh
852770687a LibGUI: Add Desktop::{taskbar,menubar}_height() 2020-08-13 16:06:02 +02:00
Linus Groh
d979379a99 WindowServer: Handle global cursor tracking before ongoing drag/move/resize
In the case of an ongoing window drag/move/resize action
WindowManager::process_mouse_event() would return early, even before
delivering mouse events to windows with global cursor tracking enabled.
They would only continue to receive new mouse events once those actions
were completed.

Fixes #3116.
2020-08-13 15:54:17 +02:00
Peter Nelson
c8f8f4e6c3 LibGfx: use disposal method of previous frame in GIF transparency
The disposal method on a GIF animation frame now correctly applies to
rendering of the next frame.
2020-08-13 15:49:41 +02:00
Peter Nelson
daa762bb06 LibGfx: correctly handle transparency between GIF frames
This fixes an issue where transparent pixels in GIF animation frames
have their alpha values incorrectly set to zero, allowing the
background behind the GIF to show through, instead of the previous
animation frame.

Additionally, transparent pixels are now correctly identified based on
their index matching the image transparency index, instead of their
color values.
2020-08-13 15:49:41 +02:00
Andreas Kling
0ab37b44a1 Meta: Add Ben Wiederhake to the contributors list :^) 2020-08-12 20:51:47 +02:00
Andreas Kling
6caaa2bfdb FileManager: Remove one direct call to FileSystemModel from outside
We should stop accessing the FileSystemModel outside DirectoryView.
This whole app is pretty badly factored, due to LibGUI being in its
infancy while it first developed.
2020-08-12 20:41:13 +02:00
Andreas Kling
aae296ef08 FileManager: Use FileIconProvider in the properties dialog
This removes the need for the properties dialog to access the internal
data model used by the directory view.
2020-08-12 20:41:13 +02:00
Andreas Kling
3dd15da7b1 LibGUI: Move file icon lookup into a separate FileIconProvider
Let's get it out of FileSystemModel so you can look up a nice icon for
a path without needing a model.
2020-08-12 20:41:13 +02:00
Andreas Kling
686238cb94 Meta: Link to the serenityos-dev mailing list in ReadMe 2020-08-12 20:41:13 +02:00
Ben Wiederhake
ff590db7e5 LibC: Move C++ABI functions to cxxabi.cpp, typecheck cxa_atexit 2020-08-12 20:40:59 +02:00
Ben Wiederhake
9d2d97a059 LibC: Avoid ninja-imports of system functions
This adds a new header <sys/internals.h>, which provides access to LibC internals.
This is in the interest of type-checking LibC itself, as well as enabling less-hacky
access for uses like LinkDemo.

And, of course, this progresses LibC towards building cleanly with -Wmissing-declarations.
2020-08-12 20:40:59 +02:00
Ben Wiederhake
9221a25bbc LibC: Tell compiler about invisible call to _start
I'm not sure how else to handle this. Curiously, I can't find the string '_start'
anywhere else in the project. Could it be that we haven't NIH'd this yet?
And that we actually rely on magic from the compiler to call _start for us?
2020-08-12 20:40:59 +02:00
Ben Wiederhake
b493c6cd39 DynamicLink: Tell compiler about invisible calls
This makes DynamicLink, and in fact all Demos, build cleanly with -Wmissing-declarations.

Note that this won't be necessary for 'normal' dynamic shared objects, as those
usually already declare their symbols in a header file.
2020-08-12 20:40:59 +02:00
Ben Wiederhake
9e1ed4bb05 LibELF: Tell compiler about invisible calls
This makes LibELF build cleanly with -Wmissing-declarations.
2020-08-12 20:40:59 +02:00
Ben Wiederhake
936d5dcc01 Kernel: Tell compiler about invisible calls
This makes the Kernel build cleanly with -Wmissing-declarations.
2020-08-12 20:40:59 +02:00
Ben Wiederhake
8a41ce5cc7 Kernel: Group C++ ABI functions together
As suggested in #3096.
2020-08-12 20:40:59 +02:00
Ben Wiederhake
ff16da8c77 Kernel: Module symbol declarations for type-checking
With this, if a future module misses the 'extern "C"' or uses a wrong type,
they get a nice compiler error instead of runtime errors or weird behavior.

Also, this works towards getting the Kernel ready for -Wmissing-declarations.
2020-08-12 20:40:59 +02:00
Ben Wiederhake
7abd9c81c6 LibCompress: Mark compilation-unit-only functions as static
This enables a nice warning in case a function becomes dead code.
2020-08-12 20:40:59 +02:00
Ben Wiederhake
f7fe63c6b0 LibC: Mark compilation-unit-only functions as static
This enables a nice warning in case a function becomes dead code.
For example with the unused function malloc_good_size() :^)

I found these places by using -Wmissing-declarations.

The Kernel still shows these issues, which I think are false-positives,
but don't want to touch:
- Libraries/LibC/crt0.cpp:41:5: int _start(int, char**, char**)
	Not sure how to handle this.
- Libraries/LibC/cxxabi.cpp:48:5: int __cxa_atexit(AtExitFunction, void*, void*)
- Libraries/LibC/cxxabi.cpp:58:6: void __cxa_finalize(void*)
	Not sure how to tell the compiler that the compiler is already using them.
- Libraries/LibC/libcinit.cpp:36:6: void __libc_init()
- Libraries/LibC/libcinit.cpp:55:19: void __stack_chk_fail()
- Libraries/LibC/malloc.cpp:430:6: void __malloc_init()
- Libraries/LibC/stdio.cpp:562:6: void __stdio_init()
	These are ninja-imported by other LibC functions.
	Maybe we should have some kind of "internals.h" header.
2020-08-12 20:40:59 +02:00
Ben Wiederhake
69a0502f80 LibTextCodec: Mark compilation-unit-only functions as static
This enables a nice warning in case a function becomes dead code.
2020-08-12 20:40:59 +02:00
Ben Wiederhake
5fa771c8b2 LibPCIDB: Mark compilation-unit-only functions as static
This enables a nice warning in case a function becomes dead code.
2020-08-12 20:40:59 +02:00
Ben Wiederhake
1396ce8a9b LibGUI: Mark compilation-unit-only functions as static
This enables a nice warning in case a function becomes dead code.
2020-08-12 20:40:59 +02:00
Ben Wiederhake
7cb2b344c0 LibM: Mark compilation-unit-only functions as static
This enables a nice warning in case a function becomes dead code.
2020-08-12 20:40:59 +02:00
Ben Wiederhake
f2f0c22052 LibGfx: Mark compilation-unit-only functions as static
This enables a nice warning in case a function becomes dead code.
2020-08-12 20:40:59 +02:00
Ben Wiederhake
e050f21f36 LibWeb: Mark compilation-unit-only functions as static
This enables a nice warning in case a function becomes dead code. Also, in the
case of {Event,Node}WrapperFactory.cpp, the corresponding header was forgotten.
This would cause an issue later when we enable -Wmissing-declarations.

Is my clang-format misconfigured? Why is the diff for NodeWrapperFactory.cpp
so large?
2020-08-12 20:40:59 +02:00
Ben Wiederhake
3ec7b8b33c Services: Mark compilation-unit-only functions as static
This enables a nice warning in case a function becomes dead code.
2020-08-12 20:40:59 +02:00
Ben Wiederhake
76da9a4a7d Test: Mark compilation-unit-only functions as static
This enables a nice warning in case a function becomes dead code. Also,
in the case of test-crypto.cpp, I took the liberty to add the prefix 'g_'
to the global event loop.
2020-08-12 20:40:59 +02:00
Ben Wiederhake
2b76f48a17 Kernel: Avoid linking errors when calling Kernel API
The compiler can't see that the definitions inside the .h file aren't meant to be
public symbols. So in a hypothetical program which uses the Kernel API, each(\!)
compilation unit that includes FB.h would define those fb_get_size_in_bytes symbols.
If that happens twice or more times, that would cause linker errors.

Since the functions are very short, inlining them seems like a good idea.

Also, using FB.h should be possible even if the containing compilation unit
doesn't already define size_t, so I added that header (stddef), too.
2020-08-12 20:40:59 +02:00
Ben Wiederhake
5e48eda218 Kernel: Avoid ninja-import of global variable
This would have caused an issue later when we enable -Wmissing-declarations, as
the compiler didn't see that Kernel::all_inodes() was being used elsewhere, too.
Also, this means that if the type changes later, there's not going to be weird
run-time issues, but rather a nice type error during compile time.
2020-08-12 20:40:59 +02:00
Ben Wiederhake
ef9a3b8e46 Applications: Mark compilation-unit-only functions as static
This enables a nice warning in case a function becomes dead code.
2020-08-12 20:40:59 +02:00
Ben Wiederhake
5fe6ca75ca AK: Mark compilation-unit-only functions as static
This enables a nice warning in case a function becomes dead code. Also, add forgotten
header to Base64.cpp, which would cause an issue later when we enable -Wmissing-declarations.
2020-08-12 20:40:59 +02:00
Ben Wiederhake
0248ddc427 Userland: Mark compilation-unit-only functions as static
This enables a nice warning in case a function becomes dead code.
2020-08-12 20:40:59 +02:00
Ben Wiederhake
5574d45eda DevTools: Mark compilation-unit-only functions as static
This enables a nice warning in case a function becomes dead code. Also, in case
of signal_trampoline_dummy, marking it external (non-static) prevents it from
being 'optimized away', which would lead to surprising and weird linker errors.
2020-08-12 20:40:59 +02:00
Ben Wiederhake
84e112be6b Browser: Avoid ninja-import of global variable 2020-08-12 20:40:59 +02:00
Ben Wiederhake
7893871d5a HackStudio: Mark compilation-unit-only functions as static
This also resolves some typing issues that only 'accidentally' worked, like declaring
a function to return type A, and the definition actually returning type B (which works
if type B is a subtype of type A). I like to call these "ninja imports".

To prevent problems like this in the future, I put all globals in a HackStudio.h.
I'm not sure about the name, but main.h and common.h felt wrong.
2020-08-12 20:40:59 +02:00
Ben Wiederhake
42b057b0c9 Kernel: Mark compilation-unit-only functions as static
This enables a nice warning in case a function becomes dead code. Also, in case
of signal_trampoline_dummy, marking it external (non-static) prevents it from
being 'optimized away', which would lead to surprising and weird linker errors.

I found these places by using -Wmissing-declarations.

The Kernel still shows these issues, which I think are false-positives,
but don't want to touch:
- Kernel/Arch/i386/CPU.cpp:1081:17: void Kernel::enter_thread_context(Kernel::Thread*, Kernel::Thread*)
- Kernel/Arch/i386/CPU.cpp:1170:17: void Kernel::context_first_init(Kernel::Thread*, Kernel::Thread*, Kernel::TrapFrame*)
- Kernel/Arch/i386/CPU.cpp:1304:16: u32 Kernel::do_init_context(Kernel::Thread*, u32)
- Kernel/Arch/i386/CPU.cpp:1347:17: void Kernel::pre_init_finished()
- Kernel/Arch/i386/CPU.cpp:1360:17: void Kernel::post_init_finished()
	No idea, not gonna touch it.
- Kernel/init.cpp:104:30: void Kernel::init()
- Kernel/init.cpp:167:30: void Kernel::init_ap(u32, Kernel::Processor*)
- Kernel/init.cpp:184:17: void Kernel::init_finished(u32)
	Called by boot.S.
- Kernel/init.cpp:383:16: int Kernel::__cxa_atexit(void (*)(void*), void*, void*)
- Kernel/StdLib.cpp:285:19: void __cxa_pure_virtual()
- Kernel/StdLib.cpp:300:19: void __stack_chk_fail()
- Kernel/StdLib.cpp:305:19: void __stack_chk_fail_local()
	Not sure how to tell the compiler that the compiler is already using them.
	Also, maybe __cxa_atexit should go into StdLib.cpp?
- Kernel/Modules/TestModule.cpp:31:17: void module_init()
- Kernel/Modules/TestModule.cpp:40:17: void module_fini()
	Could maybe go into a new header. This would also provide type-checking for new modules.
2020-08-12 20:40:59 +02:00