Merge pull request #1897 from Gymnasiast/fix-warnings

Fix some warnings
This commit is contained in:
Ted John 2015-09-07 17:20:06 +01:00
commit 1a5a4d2e05
7 changed files with 21 additions and 21 deletions

View File

@ -1164,7 +1164,7 @@ MMRESULT mmio_open(const char* filename, HMMIO* hmmio, HGLOBAL* hmem, LPMMCKINFO
goto label20; goto label20;
} }
memcpy(hmemold2, &waveformat, 16); memcpy(hmemold2, &waveformat, 16);
*((uint16*)*hmemold + 8) = (uint16)hmem; *((uint16*)*hmemold + 8) = *(uint16*)*hmem;
if (!hmem || mmioRead(hmmio1, (char*)*hmemold + 18, (LONG)hmem) == (LONG)hmem) { if (!hmem || mmioRead(hmmio1, (char*)*hmemold + 18, (LONG)hmem) == (LONG)hmem) {
result = mmioAscend(hmmio1, &mmckinfo1, 0); result = mmioAscend(hmmio1, &mmckinfo1, 0);
if (!result) { if (!result) {

View File

@ -329,7 +329,7 @@ void config_set_defaults()
if (property->type == CONFIG_VALUE_TYPE_STRING) { if (property->type == CONFIG_VALUE_TYPE_STRING) {
// Copy the string to new memory // Copy the string to new memory
const utf8 *src = property->default_value.value_string; const utf8 *src = property->default_value.value_string;
const utf8 **dst = &(destValue->value_string); const utf8 **dst = (const utf8**)&(destValue->value_string);
if (src != NULL) { if (src != NULL) {
*dst = _strdup(property->default_value.value_string); *dst = _strdup(property->default_value.value_string);
} }
@ -507,7 +507,7 @@ bool config_get_section(const utf8string line, const utf8 **sectionName, int *se
if (*ch != '[') return false; if (*ch != '[') return false;
*sectionName = ++ch; *sectionName = ++ch;
while ((c = utf8_get_next(ch, &ch)) != 0) { while ((c = utf8_get_next(ch, (const utf8**)&ch)) != 0) {
if (c == '#') return false; if (c == '#') return false;
if (c == '[') return false; if (c == '[') return false;
if (c == ' ') break; if (c == ' ') break;
@ -530,7 +530,7 @@ bool config_get_property_name_value(const utf8string line, utf8 **propertyName,
if (*ch == 0) return false; if (*ch == 0) return false;
*propertyName = ch; *propertyName = ch;
while ((c = utf8_get_next(ch, &ch)) != 0) { while ((c = utf8_get_next(ch, (const utf8**)&ch)) != 0) {
if (isspace(c) || c == '=') { if (isspace(c) || c == '=') {
*propertyNameSize = ch - *propertyName - 1; *propertyNameSize = ch - *propertyName - 1;
break; break;
@ -554,7 +554,7 @@ bool config_get_property_name_value(const utf8string line, utf8 **propertyName,
} }
*value = ch; *value = ch;
while ((c = utf8_get_next(ch, &ch)) != 0) { while ((c = utf8_get_next(ch, (const utf8**)&ch)) != 0) {
if (isspace(c) || c == '#') { if (isspace(c) || c == '#') {
if (!quotes) break; if (!quotes) break;
} }
@ -716,7 +716,7 @@ static void utf8_skip_whitespace(utf8 **outch)
utf8 *ch; utf8 *ch;
while (**outch != 0) { while (**outch != 0) {
ch = *outch; ch = *outch;
if (!isspace(utf8_get_next(*outch, outch))) { if (!isspace(utf8_get_next(*outch, (const utf8**)outch))) {
*outch = ch; *outch = ch;
break; break;
} }
@ -726,7 +726,7 @@ static void utf8_skip_whitespace(utf8 **outch)
static void utf8_skip_non_whitespace(utf8 **outch) static void utf8_skip_non_whitespace(utf8 **outch)
{ {
while (**outch != 0) { while (**outch != 0) {
if (isspace(utf8_get_next(*outch, outch))) if (isspace(utf8_get_next(*outch, (const utf8**)outch)))
break; break;
} }
} }

View File

@ -153,7 +153,7 @@ void scrolling_text_set_bitmap_for_sprite(utf8 *text, int scroll, uint8 *bitmap,
utf8 *ch = text; utf8 *ch = text;
while (true) { while (true) {
uint32 codepoint = utf8_get_next(ch, &ch); uint32 codepoint = utf8_get_next(ch, (const utf8**)&ch);
// If at the end of the string loop back to the start // If at the end of the string loop back to the start
if (codepoint == 0) { if (codepoint == 0) {
@ -213,7 +213,7 @@ void scrolling_text_set_bitmap_for_ttf(utf8 *text, int scroll, uint8 *bitmap, si
utf8 *dstCh = text; utf8 *dstCh = text;
utf8 *ch = text; utf8 *ch = text;
int codepoint; int codepoint;
while ((codepoint = utf8_get_next(ch, &ch)) != 0) { while ((codepoint = utf8_get_next(ch, (const utf8**)&ch)) != 0) {
if (utf8_is_format_code(codepoint)) { if (utf8_is_format_code(codepoint)) {
if (codepoint >= FORMAT_COLOUR_CODE_START && codepoint <= FORMAT_COLOUR_CODE_END) { if (codepoint >= FORMAT_COLOUR_CODE_START && codepoint <= FORMAT_COLOUR_CODE_END) {
colour = (uint8)codepoint; colour = (uint8)codepoint;

View File

@ -70,7 +70,7 @@ int gfx_get_string_width_new_lined(utf8 *text)
int width = 0; int width = 0;
int maxWidth = 0; int maxWidth = 0;
while ((codepoint = utf8_get_next(ch, &nextCh)) != 0) { while ((codepoint = utf8_get_next(ch, (const utf8**)&nextCh)) != 0) {
if (codepoint == FORMAT_NEWLINE || codepoint == FORMAT_NEWLINE_SMALLER) { if (codepoint == FORMAT_NEWLINE || codepoint == FORMAT_NEWLINE_SMALLER) {
backup = *nextCh; backup = *nextCh;
*nextCh = 0; *nextCh = 0;
@ -122,7 +122,7 @@ int gfx_clip_string(utf8 *text, int width)
utf8 *nextCh = text; utf8 *nextCh = text;
utf8 *clipCh = text; utf8 *clipCh = text;
int codepoint; int codepoint;
while ((codepoint = utf8_get_next(ch, &nextCh)) != 0) { while ((codepoint = utf8_get_next(ch, (const utf8**)&nextCh)) != 0) {
if (utf8_is_format_code(codepoint)) { if (utf8_is_format_code(codepoint)) {
ch = nextCh; ch = nextCh;
ch += utf8_get_format_code_arg_length(codepoint); ch += utf8_get_format_code_arg_length(codepoint);
@ -179,7 +179,7 @@ int gfx_wrap_string(utf8 *text, int width, int *outNumLines, int *outFontHeight)
utf8 *nextCh; utf8 *nextCh;
int codepoint; int codepoint;
int numCharactersOnLine = 0; int numCharactersOnLine = 0;
while ((codepoint = utf8_get_next(ch, &nextCh)) != 0) { while ((codepoint = utf8_get_next(ch, (const utf8**)&nextCh)) != 0) {
if (codepoint == ' ') { if (codepoint == ' ') {
currentWord = ch; currentWord = ch;
currentWidth = lineWidth; currentWidth = lineWidth;
@ -712,7 +712,7 @@ void gfx_draw_string_centred_wrapped_partial(rct_drawpixelinfo *dpi, int x, int
utf8 *ch = buffer; utf8 *ch = buffer;
utf8 *nextCh; utf8 *nextCh;
int codepoint; int codepoint;
while ((codepoint = utf8_get_next(ch, &nextCh)) != 0) { while ((codepoint = utf8_get_next(ch, (const utf8**)&nextCh)) != 0) {
if (!utf8_is_format_code(codepoint)) { if (!utf8_is_format_code(codepoint)) {
numCharactersDrawn++; numCharactersDrawn++;
if (numCharactersDrawn > numCharactersToDraw) { if (numCharactersDrawn > numCharactersToDraw) {

View File

@ -113,7 +113,7 @@ void utf8_remove_format_codes(utf8 *text)
utf8 *dstCh = text; utf8 *dstCh = text;
utf8 *ch = text; utf8 *ch = text;
int codepoint; int codepoint;
while ((codepoint = utf8_get_next(ch, &ch)) != 0) { while ((codepoint = utf8_get_next(ch, (const utf8**)&ch)) != 0) {
if (!utf8_is_format_code(codepoint)) { if (!utf8_is_format_code(codepoint)) {
dstCh = utf8_write_codepoint(dstCh, codepoint); dstCh = utf8_write_codepoint(dstCh, codepoint);
} }
@ -240,7 +240,7 @@ static int language_open_file(const utf8 *filename, language_data *language)
// Handle UTF-8 // Handle UTF-8
char *srcNext; char *srcNext;
uint32 utf8Char = utf8_get_next(src, &srcNext); uint32 utf8Char = utf8_get_next(src, (const utf8**)&srcNext);
i += srcNext - src - 1; i += srcNext - src - 1;
switch (mode) { switch (mode) {
@ -343,7 +343,7 @@ void utf8_trim_string(utf8 *text)
int codepoint; int codepoint;
// Trim left // Trim left
while ((codepoint = utf8_get_next(src, &src)) != 0) { while ((codepoint = utf8_get_next(src, (const utf8**)&src)) != 0) {
if (codepoint != ' ') { if (codepoint != ' ') {
dst = utf8_write_codepoint(dst, codepoint); dst = utf8_write_codepoint(dst, codepoint);
last = dst; last = dst;
@ -352,7 +352,7 @@ void utf8_trim_string(utf8 *text)
} }
if (codepoint != 0) { if (codepoint != 0) {
// Trim right // Trim right
while ((codepoint = utf8_get_next(src, &src)) != 0) { while ((codepoint = utf8_get_next(src, (const utf8**)&src)) != 0) {
dst = utf8_write_codepoint(dst, codepoint); dst = utf8_write_codepoint(dst, codepoint);
if (codepoint != ' ') { if (codepoint != ' ') {
last = dst; last = dst;

View File

@ -70,7 +70,7 @@ bool rct1_read_sc4(const char *path, rct1_s4 *s4)
long length, decodedLength; long length, decodedLength;
bool success; bool success;
if (!readentirefile(path, (void**)&buffer, &length)) { if (!readentirefile(path, (void**)&buffer, (int*)&length)) {
RCT2_GLOBAL(RCT2_ADDRESS_ERROR_TYPE, uint8) = 255; RCT2_GLOBAL(RCT2_ADDRESS_ERROR_TYPE, uint8) = 255;
RCT2_GLOBAL(RCT2_ADDRESS_ERROR_STRING_ID, uint16) = 3011; RCT2_GLOBAL(RCT2_ADDRESS_ERROR_STRING_ID, uint16) = 3011;
return 0; return 0;
@ -100,7 +100,7 @@ bool rct1_read_sv4(const char *path, rct1_s4 *s4)
long length, decodedLength; long length, decodedLength;
bool success; bool success;
if (!readentirefile(path, (void**)&buffer, &length)) { if (!readentirefile(path, (void**)&buffer, (int*)&length)) {
RCT2_GLOBAL(RCT2_ADDRESS_ERROR_TYPE, uint8) = 255; RCT2_GLOBAL(RCT2_ADDRESS_ERROR_TYPE, uint8) = 255;
RCT2_GLOBAL(RCT2_ADDRESS_ERROR_STRING_ID, uint16) = 3011; RCT2_GLOBAL(RCT2_ADDRESS_ERROR_STRING_ID, uint16) = 3011;
return 0; return 0;

View File

@ -194,7 +194,7 @@ static bool window_changelog_read_file()
window_changelog_dispose_file(); window_changelog_dispose_file();
utf8 path[MAX_PATH]; utf8 path[MAX_PATH];
sprintf(path, "%s%cchangelog.txt", gExePath, platform_get_path_separator()); sprintf(path, "%s%cchangelog.txt", gExePath, platform_get_path_separator());
if (!readentirefile(path, &_changelogText, &_changelogTextSize)) { if (!readentirefile(path, (void**)&_changelogText, (int*)&_changelogTextSize)) {
log_error("Unable to read changelog.txt"); log_error("Unable to read changelog.txt");
return false; return false;
} }
@ -246,4 +246,4 @@ static void window_changelog_dispose_file()
SafeFree(_changelogLines); SafeFree(_changelogLines);
_changelogTextSize = 0; _changelogTextSize = 0;
_changelogNumLines = 0; _changelogNumLines = 0;
} }