1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:07:35 +00:00

AK: Rename the common integer typedefs to make it obvious what they are.

These types can be picked up by including <AK/Types.h>:

* u8, u16, u32, u64 (unsigned)
* i8, i16, i32, i64 (signed)
This commit is contained in:
Andreas Kling 2019-07-03 21:17:35 +02:00
parent c4c4bbc5ba
commit 27f699ef0c
208 changed files with 1603 additions and 1621 deletions

View file

@ -159,13 +159,13 @@ struct WSAPI_ServerMessage {
WSAPI_Point position;
WSAPI_MouseButton button;
unsigned buttons;
byte modifiers;
u8 modifiers;
int wheel_delta;
} mouse;
struct {
char character;
byte key;
byte modifiers;
u8 key;
u8 modifiers;
bool ctrl : 1;
bool alt : 1;
bool shift : 1;

View file

@ -44,8 +44,8 @@ void WSCPUMonitor::get_cpu_usage(unsigned& busy, unsigned& idle)
auto json = JsonValue::from_string({ file_contents.data(), file_contents.size() });
json.as_array().for_each([&](auto& value) {
const JsonObject& process_object = value.as_object();
pid_t pid = process_object.get("pid").to_dword();
unsigned nsched = process_object.get("times_scheduled").to_dword();
pid_t pid = process_object.get("pid").to_u32();
unsigned nsched = process_object.get("times_scheduled").to_u32();
if (pid == 0)
idle += nsched;
else

View file

@ -86,7 +86,7 @@ void WSClientConnection::post_message(const WSAPI_ServerMessage& message, const
iov[0].iov_len = sizeof(message);
if (!extra_data.is_empty()) {
iov[1].iov_base = const_cast<byte*>(extra_data.data());
iov[1].iov_base = const_cast<u8*>(extra_data.data());
iov[1].iov_len = extra_data.size();
++iov_count;
}

View file

@ -16,11 +16,11 @@ WSClipboard::~WSClipboard()
{
}
const byte* WSClipboard::data() const
const u8* WSClipboard::data() const
{
if (!m_shared_buffer)
return nullptr;
return (const byte*)m_shared_buffer->data();
return (const u8*)m_shared_buffer->data();
}
int WSClipboard::size() const

View file

@ -13,7 +13,7 @@ public:
return m_shared_buffer;
}
const byte* data() const;
const u8* data() const;
int size() const;
void clear();

View file

@ -186,9 +186,9 @@ void WSCompositor::flush(const Rect& a_rect)
size_t pitch = m_back_bitmap->pitch();
for (int y = 0; y < rect.height(); ++y) {
fast_dword_copy(back_ptr, front_ptr, rect.width());
front_ptr = (const RGBA32*)((const byte*)front_ptr + pitch);
back_ptr = (RGBA32*)((byte*)back_ptr + pitch);
fast_u32_copy(back_ptr, front_ptr, rect.width());
front_ptr = (const RGBA32*)((const u8*)front_ptr + pitch);
back_ptr = (RGBA32*)((u8*)back_ptr + pitch);
}
}

View file

@ -726,7 +726,7 @@ private:
Vector<Rect, 32> m_rects;
};
enum class MouseButton : byte {
enum class MouseButton : u8 {
None = 0,
Left = 1,
Right = 2,
@ -735,7 +735,7 @@ enum class MouseButton : byte {
class WSKeyEvent final : public WSEvent {
public:
WSKeyEvent(Type type, int key, char character, byte modifiers)
WSKeyEvent(Type type, int key, char character, u8 modifiers)
: WSEvent(type)
, m_key(key)
, m_character(character)
@ -748,7 +748,7 @@ public:
bool alt() const { return m_modifiers & Mod_Alt; }
bool shift() const { return m_modifiers & Mod_Shift; }
bool logo() const { return m_modifiers & Mod_Logo; }
byte modifiers() const { return m_modifiers; }
u8 modifiers() const { return m_modifiers; }
char character() const { return m_character; }
private:
@ -756,7 +756,7 @@ private:
friend class WSScreen;
int m_key { 0 };
char m_character { 0 };
byte m_modifiers { 0 };
u8 m_modifiers { 0 };
};
class WSMouseEvent final : public WSEvent {

View file

@ -92,7 +92,7 @@ void WSEventLoop::drain_keyboard()
auto& screen = WSScreen::the();
for (;;) {
KeyEvent event;
ssize_t nread = read(m_keyboard_fd, (byte*)&event, sizeof(KeyEvent));
ssize_t nread = read(m_keyboard_fd, (u8*)&event, sizeof(KeyEvent));
if (nread == 0)
break;
ASSERT(nread == sizeof(KeyEvent));

View file

@ -44,5 +44,5 @@ private:
inline RGBA32* WSScreen::scanline(int y)
{
size_t pitch = sizeof(RGBA32) * width();
return reinterpret_cast<RGBA32*>(((byte*)m_framebuffer) + (y * pitch));
return reinterpret_cast<RGBA32*>(((u8*)m_framebuffer) + (y * pitch));
}

View file

@ -51,7 +51,7 @@ WSWindowManager::WSWindowManager()
{ "/bin/ProcessManager", "Open ProcessManager..." }
};
byte system_menu_name[] = { 0xf8, 0 };
u8 system_menu_name[] = { 0xf8, 0 };
m_system_menu = make<WSMenu>(nullptr, -1, String((const char*)system_menu_name));
int appIndex = 1;

View file

@ -232,7 +232,7 @@ private:
Point m_resize_origin;
ResizeDirection m_resize_direction { ResizeDirection::None };
byte m_keyboard_modifiers { 0 };
u8 m_keyboard_modifiers { 0 };
OwnPtr<WSMenu> m_system_menu;
Color m_menu_selection_color;