Ver Fonte

Userspace: Add missing #includes now that AK/StdLibExtras.h is smaller

Andreas Kling há 5 anos atrás
pai
commit
37fc6c117c
44 ficheiros alterados com 67 adições e 25 exclusões
  1. 1 0
      Applications/FileManager/PropertiesDialog.cpp
  2. 1 0
      Applications/FileManager/main.cpp
  3. 2 1
      Applications/Help/main.cpp
  4. 1 0
      Applications/HexEditor/HexEditorWidget.cpp
  5. 1 0
      Applications/TextEditor/TextEditorWidget.cpp
  6. 1 0
      DevTools/HackStudio/EditorWrapper.h
  7. 2 1
      DevTools/HackStudio/TerminalWrapper.cpp
  8. 6 5
      Libraries/LibAudio/Buffer.h
  9. 1 0
      Libraries/LibC/grp.cpp
  10. 1 0
      Libraries/LibC/malloc.cpp
  11. 1 0
      Libraries/LibC/pwd.cpp
  12. 1 0
      Libraries/LibCore/ArgsParser.cpp
  13. 1 0
      Libraries/LibCore/DirIterator.h
  14. 1 0
      Libraries/LibCore/IODevice.cpp
  15. 1 0
      Libraries/LibCore/SocketAddress.h
  16. 1 0
      Libraries/LibCore/SyscallUtils.h
  17. 2 2
      Libraries/LibELF/ELFDynamicLoader.cpp
  18. 1 0
      Libraries/LibELF/ELFDynamicObject.cpp
  19. 1 0
      Libraries/LibELF/ELFImage.cpp
  20. 4 3
      Libraries/LibELF/ELFLoader.cpp
  21. 1 0
      Libraries/LibGUI/FilePicker.cpp
  22. 1 0
      Libraries/LibGfx/Bitmap.cpp
  23. 3 2
      Libraries/LibGfx/Font.cpp
  24. 1 0
      Libraries/LibGfx/GIFLoader.cpp
  25. 8 7
      Libraries/LibGfx/Painter.cpp
  26. 1 0
      Libraries/LibGfx/Palette.cpp
  27. 1 0
      Libraries/LibGfx/Point.h
  28. 1 0
      Libraries/LibGfx/Rect.h
  29. 1 0
      Libraries/LibMarkdown/MDText.cpp
  30. 1 0
      Libraries/LibPthread/pthread.cpp
  31. 1 0
      Libraries/LibVT/Terminal.cpp
  32. 1 0
      Servers/WindowServer/Compositor.cpp
  33. 1 0
      Servers/WindowServer/main.cpp
  34. 1 0
      Userland/allocate.cpp
  35. 1 0
      Userland/cal.cpp
  36. 3 2
      Userland/disk_benchmark.cpp
  37. 1 1
      Userland/head.cpp
  38. 1 0
      Userland/ifconfig.cpp
  39. 1 0
      Userland/md.cpp
  40. 1 0
      Userland/mount.cpp
  41. 1 0
      Userland/pidof.cpp
  42. 1 0
      Userland/sleep.cpp
  43. 2 1
      Userland/sort.cpp
  44. 1 0
      Userland/su.cpp

+ 1 - 0
Applications/FileManager/PropertiesDialog.cpp

@@ -35,6 +35,7 @@
 #include <limits.h>
 #include <pwd.h>
 #include <stdio.h>
+#include <string.h>
 #include <unistd.h>
 
 PropertiesDialog::PropertiesDialog(GUI::FileSystemModel& model, String path, bool disable_rename, Window* parent_window)

+ 1 - 0
Applications/FileManager/main.cpp

@@ -55,6 +55,7 @@
 #include <LibGUI/Window.h>
 #include <signal.h>
 #include <stdio.h>
+#include <string.h>
 #include <unistd.h>
 
 int main(int argc, char** argv)

+ 2 - 1
Applications/Help/main.cpp

@@ -40,13 +40,14 @@
 #include <LibGUI/ToolBar.h>
 #include <LibGUI/TreeView.h>
 #include <LibGUI/Window.h>
+#include <LibMarkdown/MDDocument.h>
 #include <LibWeb/HtmlView.h>
 #include <LibWeb/Layout/LayoutNode.h>
 #include <LibWeb/Parser/CSSParser.h>
 #include <LibWeb/Parser/HTMLParser.h>
-#include <LibMarkdown/MDDocument.h>
 #include <libgen.h>
 #include <stdio.h>
+#include <string.h>
 
 int main(int argc, char* argv[])
 {

+ 1 - 0
Applications/HexEditor/HexEditorWidget.cpp

@@ -43,6 +43,7 @@
 #include <LibGUI/TextEditor.h>
 #include <LibGUI/ToolBar.h>
 #include <stdio.h>
+#include <string.h>
 
 HexEditorWidget::HexEditorWidget()
 {

+ 1 - 0
Applications/TextEditor/TextEditorWidget.cpp

@@ -45,6 +45,7 @@
 #include <LibGUI/TextEditor.h>
 #include <LibGUI/ToolBar.h>
 #include <LibGfx/Font.h>
+#include <string.h>
 
 TextEditorWidget::TextEditorWidget()
 {

+ 1 - 0
DevTools/HackStudio/EditorWrapper.h

@@ -27,6 +27,7 @@
 #pragma once
 
 #include <LibGUI/Widget.h>
+#include <string.h>
 
 class Editor;
 

+ 2 - 1
DevTools/HackStudio/TerminalWrapper.cpp

@@ -35,6 +35,7 @@
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/ioctl.h>
 #include <sys/types.h>
 #include <sys/wait.h>
@@ -142,7 +143,7 @@ void TerminalWrapper::run_command(const String& command)
 
         auto parts = command.split(' ');
         ASSERT(!parts.is_empty());
-        const char** args = (const char**) calloc(parts.size() + 1, sizeof(const char*));
+        const char** args = (const char**)calloc(parts.size() + 1, sizeof(const char*));
         for (size_t i = 0; i < parts.size(); i++) {
             args[i] = parts[i].characters();
         }

+ 6 - 5
Libraries/LibAudio/Buffer.h

@@ -27,9 +27,10 @@
 #pragma once
 
 #include <AK/ByteBuffer.h>
+#include <AK/SharedBuffer.h>
 #include <AK/Types.h>
 #include <AK/Vector.h>
-#include <AK/SharedBuffer.h>
+#include <string.h>
 
 namespace Audio {
 
@@ -126,15 +127,15 @@ public:
 
 private:
     explicit Buffer(Vector<Sample>&& samples)
-        : m_buffer(*SharedBuffer::create_with_size(samples.size() * sizeof(Sample))),
-        m_sample_count(samples.size())
+        : m_buffer(*SharedBuffer::create_with_size(samples.size() * sizeof(Sample)))
+        , m_sample_count(samples.size())
     {
         memcpy(m_buffer->data(), samples.data(), samples.size() * sizeof(Sample));
     }
 
     explicit Buffer(NonnullRefPtr<SharedBuffer>&& buffer, int sample_count)
-        : m_buffer(move(buffer)),
-        m_sample_count(sample_count)
+        : m_buffer(move(buffer))
+        , m_sample_count(sample_count)
     {
     }
 

+ 1 - 0
Libraries/LibC/grp.cpp

@@ -29,6 +29,7 @@
 #include <grp.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/mman.h>
 #include <unistd.h>
 

+ 1 - 0
Libraries/LibC/malloc.cpp

@@ -34,6 +34,7 @@
 #include <serenity.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/mman.h>
 
 // FIXME: Thread safety.

+ 1 - 0
Libraries/LibC/pwd.cpp

@@ -29,6 +29,7 @@
 #include <pwd.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/mman.h>
 #include <unistd.h>
 

+ 1 - 0
Libraries/LibCore/ArgsParser.cpp

@@ -29,6 +29,7 @@
 #include <getopt.h>
 #include <limits.h>
 #include <stdio.h>
+#include <string.h>
 
 namespace Core {
 

+ 1 - 0
Libraries/LibCore/DirIterator.h

@@ -28,6 +28,7 @@
 
 #include <AK/String.h>
 #include <dirent.h>
+#include <string.h>
 
 namespace Core {
 

+ 1 - 0
Libraries/LibCore/IODevice.cpp

@@ -30,6 +30,7 @@
 #include <LibCore/SyscallUtils.h>
 #include <errno.h>
 #include <stdio.h>
+#include <string.h>
 #include <sys/select.h>
 #include <sys/stat.h>
 #include <sys/time.h>

+ 1 - 0
Libraries/LibCore/SocketAddress.h

@@ -29,6 +29,7 @@
 #include <AK/IPv4Address.h>
 #include <arpa/inet.h>
 #include <netinet/in.h>
+#include <string.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 

+ 1 - 0
Libraries/LibCore/SyscallUtils.h

@@ -29,6 +29,7 @@
 #include <AK/LogStream.h>
 #include <AK/StdLibExtras.h>
 #include <errno.h>
+#include <string.h>
 #include <sys/types.h>
 #include <unistd.h>
 

+ 2 - 2
Libraries/LibELF/ELFDynamicLoader.cpp

@@ -32,6 +32,7 @@
 #include <mman.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
 #define DYNAMIC_LOAD_DEBUG
 //#define DYNAMIC_LOAD_VERBOSE
@@ -163,8 +164,7 @@ void ELFDynamicLoader::load_program_headers(const ELFImage& elf_image)
                 text_region_ptr = &region;
             else
                 data_region_ptr = &region;
-        }
-        else if (region.is_dynamic()) {
+        } else if (region.is_dynamic()) {
             dynamic_region_desired_vaddr = region.desired_load_address();
         }
     });

+ 1 - 0
Libraries/LibELF/ELFDynamicObject.cpp

@@ -29,6 +29,7 @@
 #include <LibELF/ELFDynamicObject.h>
 #include <LibELF/exec_elf.h>
 #include <stdio.h>
+#include <string.h>
 
 static const char* name_for_dtag(Elf32_Sword d_tag);
 

+ 1 - 0
Libraries/LibELF/ELFImage.cpp

@@ -24,6 +24,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include <AK/Memory.h>
 #include <AK/StringBuilder.h>
 #include <LibELF/ELFImage.h>
 

+ 4 - 3
Libraries/LibELF/ELFLoader.cpp

@@ -26,13 +26,14 @@
 
 #include "ELFLoader.h"
 #include <AK/Demangle.h>
+#include <AK/Memory.h>
 #include <AK/QuickSort.h>
 
 #ifdef KERNEL
-#include <Kernel/VM/MemoryManager.h>
-#define do_memcpy copy_to_user
+#    include <Kernel/VM/MemoryManager.h>
+#    define do_memcpy copy_to_user
 #else
-#define do_memcpy memcpy
+#    define do_memcpy memcpy
 #endif
 
 //#define ELFLOADER_DEBUG

+ 1 - 0
Libraries/LibGUI/FilePicker.cpp

@@ -38,6 +38,7 @@
 #include <LibGUI/SortingProxyModel.h>
 #include <LibGUI/TextBox.h>
 #include <LibGUI/ToolBar.h>
+#include <string.h>
 
 namespace GUI {
 

+ 1 - 0
Libraries/LibGfx/Bitmap.cpp

@@ -24,6 +24,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include <AK/Memory.h>
 #include <AK/SharedBuffer.h>
 #include <AK/String.h>
 #include <LibGfx/Bitmap.h>

+ 3 - 2
Libraries/LibGfx/Font.cpp

@@ -25,8 +25,8 @@
  */
 
 #include "Font.h"
-#include "Emoji.h"
 #include "Bitmap.h"
+#include "Emoji.h"
 #include <AK/BufferStream.h>
 #include <AK/MappedFile.h>
 #include <AK/StdLibExtras.h>
@@ -35,9 +35,10 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 #include <sys/mman.h>
 #include <unistd.h>
-#include <stdlib.h>
 
 namespace Gfx {
 

+ 1 - 0
Libraries/LibGfx/GIFLoader.cpp

@@ -31,6 +31,7 @@
 #include <AK/NonnullOwnPtrVector.h>
 #include <LibGfx/GIFLoader.h>
 #include <stdio.h>
+#include <string.h>
 
 namespace Gfx {
 

+ 8 - 7
Libraries/LibGfx/Painter.cpp

@@ -25,10 +25,11 @@
  */
 
 #include "Painter.h"
+#include "Bitmap.h"
 #include "Emoji.h"
 #include "Font.h"
-#include "Bitmap.h"
 #include <AK/Assertions.h>
+#include <AK/Memory.h>
 #include <AK/StdLibExtras.h>
 #include <AK/StringBuilder.h>
 #include <AK/Utf8View.h>
@@ -38,15 +39,15 @@
 #include <unistd.h>
 
 #if defined(__GNUC__) && !defined(__clang__)
-#pragma GCC optimize("O3")
+#    pragma GCC optimize("O3")
 #endif
 
 #ifndef ALWAYS_INLINE
-#if __has_attribute(always_inline)
-#define ALWAYS_INLINE __attribute__((always_inline))
-#else
-#define ALWAYS_INLINE inline
-#endif
+#    if __has_attribute(always_inline)
+#        define ALWAYS_INLINE __attribute__((always_inline))
+#    else
+#        define ALWAYS_INLINE inline
+#    endif
 #endif
 
 namespace Gfx {

+ 1 - 0
Libraries/LibGfx/Palette.cpp

@@ -27,6 +27,7 @@
 #include <AK/Badge.h>
 #include <AK/SharedBuffer.h>
 #include <LibGfx/Palette.h>
+#include <string.h>
 
 namespace Gfx {
 

+ 1 - 0
Libraries/LibGfx/Point.h

@@ -29,6 +29,7 @@
 #include <AK/Forward.h>
 #include <AK/StdLibExtras.h>
 #include <LibGfx/Orientation.h>
+#include <stdlib.h>
 
 namespace Gfx {
 

+ 1 - 0
Libraries/LibGfx/Rect.h

@@ -31,6 +31,7 @@
 #include <LibGfx/Point.h>
 #include <LibGfx/Size.h>
 #include <LibGfx/TextAlignment.h>
+#include <stdlib.h>
 
 namespace Gfx {
 

+ 1 - 0
Libraries/LibMarkdown/MDText.cpp

@@ -26,6 +26,7 @@
 
 #include <AK/StringBuilder.h>
 #include <LibMarkdown/MDText.h>
+#include <string.h>
 
 static String unescape(const StringView& text)
 {

+ 1 - 0
Libraries/LibPthread/pthread.cpp

@@ -33,6 +33,7 @@
 #include <serenity.h>
 #include <signal.h>
 #include <stdio.h>
+#include <string.h>
 #include <sys/mman.h>
 #include <time.h>
 #include <unistd.h>

+ 1 - 0
Libraries/LibVT/Terminal.cpp

@@ -26,6 +26,7 @@
 
 #include <AK/StringBuilder.h>
 #include <LibVT/Terminal.h>
+#include <string.h>
 
 //#define TERMINAL_DEBUG
 

+ 1 - 0
Servers/WindowServer/Compositor.cpp

@@ -30,6 +30,7 @@
 #include "Screen.h"
 #include "Window.h"
 #include "WindowManager.h"
+#include <AK/Memory.h>
 #include <LibCore/Timer.h>
 #include <LibGfx/Font.h>
 #include <LibGfx/Painter.h>

+ 1 - 0
Servers/WindowServer/main.cpp

@@ -35,6 +35,7 @@
 #include <LibGfx/SystemTheme.h>
 #include <signal.h>
 #include <stdio.h>
+#include <string.h>
 
 int main(int, char**)
 {

+ 1 - 0
Userland/allocate.cpp

@@ -27,6 +27,7 @@
 #include <AK/String.h>
 #include <LibCore/ElapsedTimer.h>
 #include <stdio.h>
+#include <string.h>
 #include <unistd.h>
 
 void usage(void)

+ 1 - 0
Userland/cal.cpp

@@ -26,6 +26,7 @@
 
 #include <LibCore/ArgsParser.h>
 #include <stdio.h>
+#include <string.h>
 #include <time.h>
 
 const int line_width = 70;

+ 3 - 2
Userland/disk_benchmark.cpp

@@ -29,12 +29,13 @@
 #include <AK/Types.h>
 #include <AK/Vector.h>
 #include <LibCore/ElapsedTimer.h>
+#include <fcntl.h>
 #include <getopt.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <fcntl.h>
-#include <unistd.h>
+#include <string.h>
 #include <sys/stat.h>
+#include <unistd.h>
 
 struct Result {
     u64 write_bps;

+ 1 - 1
Userland/head.cpp

@@ -26,10 +26,10 @@
 
 #include <AK/StdLibExtras.h>
 #include <LibCore/ArgsParser.h>
-
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
 int head(const String& filename, bool print_filename, int line_count, int char_count);
 

+ 1 - 0
Userland/ifconfig.cpp

@@ -32,6 +32,7 @@
 #include <net/if.h>
 #include <netinet/in.h>
 #include <stdio.h>
+#include <string.h>
 #include <sys/ioctl.h>
 #include <sys/socket.h>
 

+ 1 - 0
Userland/md.cpp

@@ -29,6 +29,7 @@
 #include <LibCore/File.h>
 #include <LibMarkdown/MDDocument.h>
 #include <stdio.h>
+#include <string.h>
 
 int main(int argc, char* argv[])
 {

+ 1 - 0
Userland/mount.cpp

@@ -30,6 +30,7 @@
 #include <LibCore/ArgsParser.h>
 #include <LibCore/File.h>
 #include <stdio.h>
+#include <string.h>
 #include <unistd.h>
 
 int parse_options(const StringView& options)

+ 1 - 0
Userland/pidof.cpp

@@ -32,6 +32,7 @@
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <unistd.h>
 
 static int pid_of(const String& process_name, bool single_shot, bool omit_pid, pid_t pid)

+ 1 - 0
Userland/sleep.cpp

@@ -27,6 +27,7 @@
 #include <AK/String.h>
 #include <signal.h>
 #include <stdio.h>
+#include <string.h>
 #include <unistd.h>
 
 void handle_sigint(int)

+ 2 - 1
Userland/sort.cpp

@@ -24,11 +24,12 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include <AK/String.h>
 #include <AK/QuickSort.h>
+#include <AK/String.h>
 #include <AK/Vector.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
 int main(int argc, char** argv)
 {

+ 1 - 0
Userland/su.cpp

@@ -29,6 +29,7 @@
 #include <grp.h>
 #include <pwd.h>
 #include <stdio.h>
+#include <string.h>
 #include <unistd.h>
 
 extern "C" int main(int, char**);