Codechange: automatic adding of _t to (u)int types, and WChar to char32_t

for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
This commit is contained in:
Rubidium
2023-05-08 19:01:06 +02:00
committed by rubidium42
parent 4f4810dc28
commit eaae0bb5e7
564 changed files with 4561 additions and 4561 deletions

View File

@@ -15,15 +15,15 @@
void *Blitter_32bppBase::MoveTo(void *video, int x, int y)
{
return (uint32 *)video + x + y * _screen.pitch;
return (uint32_t *)video + x + y * _screen.pitch;
}
void Blitter_32bppBase::SetPixel(void *video, int x, int y, uint8 colour)
void Blitter_32bppBase::SetPixel(void *video, int x, int y, uint8_t colour)
{
*((Colour *)video + x + y * _screen.pitch) = LookupColourInPalette(colour);
}
void Blitter_32bppBase::DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash)
void Blitter_32bppBase::DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8_t colour, int width, int dash)
{
const Colour c = LookupColourInPalette(colour);
this->DrawLineGeneric(x, y, x2, y2, screen_width, screen_height, width, dash, [=](int x, int y) {
@@ -31,7 +31,7 @@ void Blitter_32bppBase::DrawLine(void *video, int x, int y, int x2, int y2, int
});
}
void Blitter_32bppBase::DrawRect(void *video, int width, int height, uint8 colour)
void Blitter_32bppBase::DrawRect(void *video, int width, int height, uint8_t colour)
{
Colour colour32 = LookupColourInPalette(colour);
@@ -41,17 +41,17 @@ void Blitter_32bppBase::DrawRect(void *video, int width, int height, uint8 colou
*dst = colour32;
dst++;
}
video = (uint32 *)video + _screen.pitch;
video = (uint32_t *)video + _screen.pitch;
} while (--height);
}
void Blitter_32bppBase::CopyFromBuffer(void *video, const void *src, int width, int height)
{
uint32 *dst = (uint32 *)video;
const uint32 *usrc = (const uint32 *)src;
uint32_t *dst = (uint32_t *)video;
const uint32_t *usrc = (const uint32_t *)src;
for (; height > 0; height--) {
memcpy(dst, usrc, width * sizeof(uint32));
memcpy(dst, usrc, width * sizeof(uint32_t));
usrc += width;
dst += _screen.pitch;
}
@@ -59,11 +59,11 @@ void Blitter_32bppBase::CopyFromBuffer(void *video, const void *src, int width,
void Blitter_32bppBase::CopyToBuffer(const void *video, void *dst, int width, int height)
{
uint32 *udst = (uint32 *)dst;
const uint32 *src = (const uint32 *)video;
uint32_t *udst = (uint32_t *)dst;
const uint32_t *src = (const uint32_t *)video;
for (; height > 0; height--) {
memcpy(udst, src, width * sizeof(uint32));
memcpy(udst, src, width * sizeof(uint32_t));
src += _screen.pitch;
udst += width;
}
@@ -71,11 +71,11 @@ void Blitter_32bppBase::CopyToBuffer(const void *video, void *dst, int width, in
void Blitter_32bppBase::CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch)
{
uint32 *udst = (uint32 *)dst;
const uint32 *src = (const uint32 *)video;
uint32_t *udst = (uint32_t *)dst;
const uint32_t *src = (const uint32_t *)video;
for (; height > 0; height--) {
memcpy(udst, src, width * sizeof(uint32));
memcpy(udst, src, width * sizeof(uint32_t));
src += _screen.pitch;
udst += dst_pitch;
}
@@ -83,12 +83,12 @@ void Blitter_32bppBase::CopyImageToBuffer(const void *video, void *dst, int widt
void Blitter_32bppBase::ScrollBuffer(void *video, int &left, int &top, int &width, int &height, int scroll_x, int scroll_y)
{
const uint32 *src;
uint32 *dst;
const uint32_t *src;
uint32_t *dst;
if (scroll_y > 0) {
/* Calculate pointers */
dst = (uint32 *)video + left + (top + height - 1) * _screen.pitch;
dst = (uint32_t *)video + left + (top + height - 1) * _screen.pitch;
src = dst - scroll_y * _screen.pitch;
/* Decrease height and increase top */
@@ -107,13 +107,13 @@ void Blitter_32bppBase::ScrollBuffer(void *video, int &left, int &top, int &widt
}
for (int h = height; h > 0; h--) {
memcpy(dst, src, width * sizeof(uint32));
memcpy(dst, src, width * sizeof(uint32_t));
src -= _screen.pitch;
dst -= _screen.pitch;
}
} else {
/* Calculate pointers */
dst = (uint32 *)video + left + top * _screen.pitch;
dst = (uint32_t *)video + left + top * _screen.pitch;
src = dst - scroll_y * _screen.pitch;
/* Decrease height. (scroll_y is <=0). */
@@ -133,7 +133,7 @@ void Blitter_32bppBase::ScrollBuffer(void *video, int &left, int &top, int &widt
/* the y-displacement may be 0 therefore we have to use memmove,
* because source and destination may overlap */
for (int h = height; h > 0; h--) {
memmove(dst, src, width * sizeof(uint32));
memmove(dst, src, width * sizeof(uint32_t));
src += _screen.pitch;
dst += _screen.pitch;
}
@@ -142,7 +142,7 @@ void Blitter_32bppBase::ScrollBuffer(void *video, int &left, int &top, int &widt
size_t Blitter_32bppBase::BufferSize(uint width, uint height)
{
return sizeof(uint32) * width * height;
return sizeof(uint32_t) * width * height;
}
void Blitter_32bppBase::PaletteAnimate(const Palette &palette)
@@ -150,22 +150,22 @@ void Blitter_32bppBase::PaletteAnimate(const Palette &palette)
/* By default, 32bpp doesn't have palette animation */
}
Colour Blitter_32bppBase::ReallyAdjustBrightness(Colour colour, uint8 brightness)
Colour Blitter_32bppBase::ReallyAdjustBrightness(Colour colour, uint8_t brightness)
{
assert(DEFAULT_BRIGHTNESS == 1 << 7);
uint64 combined = (((uint64) colour.r) << 32) | (((uint64) colour.g) << 16) | ((uint64) colour.b);
uint64_t combined = (((uint64_t) colour.r) << 32) | (((uint64_t) colour.g) << 16) | ((uint64_t) colour.b);
combined *= brightness;
uint16 r = GB(combined, 39, 9);
uint16 g = GB(combined, 23, 9);
uint16 b = GB(combined, 7, 9);
uint16_t r = GB(combined, 39, 9);
uint16_t g = GB(combined, 23, 9);
uint16_t b = GB(combined, 7, 9);
if ((combined & 0x800080008000L) == 0L) {
return Colour(r, g, b, colour.a);
}
uint16 ob = 0;
uint16_t ob = 0;
/* Sum overbright */
if (r > 255) ob += r - 255;
if (g > 255) ob += g - 255;