[Scummvm-git-logs] scummvm master -> c7d1d13fa19dd75b132dd120edad7fac6c1bd63a
dreammaster
noreply at scummvm.org
Tue Dec 26 06:33:57 UTC 2023
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
c4d3c190ee M4: Change sizeof(short) to sizeof(uint16) for clarity
c7d1d13fa1 M4: Properly fix TextField::set_string
Commit: c4d3c190ee1380b57c8c96bc0d16c1a08d58f927
https://github.com/scummvm/scummvm/commit/c4d3c190ee1380b57c8c96bc0d16c1a08d58f927
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-25T18:58:53-10:00
Commit Message:
M4: Change sizeof(short) to sizeof(uint16) for clarity
Changed paths:
engines/m4/adv_db_r/db_catalog.cpp
engines/m4/graphics/gr_font.cpp
diff --git a/engines/m4/adv_db_r/db_catalog.cpp b/engines/m4/adv_db_r/db_catalog.cpp
index 65eca6240e2..449be8301e9 100644
--- a/engines/m4/adv_db_r/db_catalog.cpp
+++ b/engines/m4/adv_db_r/db_catalog.cpp
@@ -141,9 +141,9 @@ static void sort_catalog() {
switch (tag) {
case _T_ROOM:
- snprintf(&pCatalogIter[(3 * sizeof(short))], 256, "%03d!", room_number);
+ snprintf(&pCatalogIter[(3 * sizeof(uint16))], 256, "%03d!", room_number);
- i = (3 * sizeof(short)) + (5 * sizeof(char));
+ i = (3 * sizeof(uint16)) + (5 * sizeof(char));
for (;;) {
if (!pCatalogIter[i])
@@ -153,7 +153,7 @@ static void sort_catalog() {
break;
default:
- cstrupr(pCatalogIter + (2 * sizeof(short)));
+ cstrupr(pCatalogIter + (2 * sizeof(uint16)));
break;
}
@@ -196,7 +196,7 @@ static char *db_get_catalog_entry(char *c, short *tag, short *room, char *name,
if (c_size)
*c_size = 0;
- short size = convert_intel16(*(short *)&c[0]);
+ short size = convert_intel16(*(uint16 *)&c[0]);
if (!size)
return nullptr;
@@ -204,17 +204,17 @@ static char *db_get_catalog_entry(char *c, short *tag, short *room, char *name,
if (c_size)
*c_size = size;
- int32 x = sizeof(short);
+ int32 x = sizeof(uint16);
- int16 theTag = convert_intel16(*(short *)&c[x]);
+ int16 theTag = convert_intel16(*(uint16 *)&c[x]);
if (tag)
*tag = theTag;
- x += sizeof(short); // tag
+ x += sizeof(uint16); // tag
if ((theTag == _T_ROOM) && room) {
- *room = convert_intel16(*(short *)&c[x]);
- x += sizeof(short);
+ *room = convert_intel16(*(uint16 *)&c[x]);
+ x += sizeof(uint16);
}
for (i = 0; c[x]; x++) {
@@ -251,7 +251,7 @@ static char *db_get_catalog_entry(char *c, short *tag, short *room, char *name,
}
if ((theTag != _T_ROOM) && room)
- *room = convert_intel16(*(short *)&c[size - (sizeof(short))]);
+ *room = convert_intel16(*(uint16 *)&c[size - (sizeof(uint16))]);
return &c[size];
}
diff --git a/engines/m4/graphics/gr_font.cpp b/engines/m4/graphics/gr_font.cpp
index af3a59e592f..069dbb37984 100644
--- a/engines/m4/graphics/gr_font.cpp
+++ b/engines/m4/graphics/gr_font.cpp
@@ -408,12 +408,12 @@ Font *gr_font_load(const char *fontName) {
error_show(FL, 'FNTL', "font: %s chkpnt: %d", fontName, 2);
// offset table
- newFont->offset = (short *)mem_alloc(256 * sizeof(short), STR_FONTOFF);
+ newFont->offset = (short *)mem_alloc(256 * sizeof(int16), STR_FONTOFF);
if (!newFont->offset)
error_show(FL, 'OOM!', "font offset table");
bufferHandle = newFont->offset;
- fontFile.read(&bufferHandle, 256 * sizeof(short));
+ fontFile.read(&bufferHandle, 256 * sizeof(int16));
for (int i = 0; i < 256; i++)
newFont->offset[i] = convert_intel16(newFont->offset[i]);
Commit: c7d1d13fa19dd75b132dd120edad7fac6c1bd63a
https://github.com/scummvm/scummvm/commit/c7d1d13fa19dd75b132dd120edad7fac6c1bd63a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2023-12-25T20:33:42-10:00
Commit Message:
M4: Properly fix TextField::set_string
Changed paths:
engines/m4/burger/gui/gui_cheapo.cpp
diff --git a/engines/m4/burger/gui/gui_cheapo.cpp b/engines/m4/burger/gui/gui_cheapo.cpp
index 0f9df209966..3a71f78491f 100644
--- a/engines/m4/burger/gui/gui_cheapo.cpp
+++ b/engines/m4/burger/gui/gui_cheapo.cpp
@@ -111,7 +111,7 @@ TextField::~TextField() {
void TextField::set_string(const char *string) {
_must_redraw = true;
- if (string != nullptr && *string != '\0') {
+ if (string == nullptr && _string != nullptr) {
_string[0] = '\0';
return;
}
More information about the Scummvm-git-logs
mailing list