diff options
author | Willem Jan Palenstijn | 2013-10-01 23:20:24 +0200 |
---|---|---|
committer | Willem Jan Palenstijn | 2013-10-01 23:20:43 +0200 |
commit | a97907241051b493875950285f858c6e215238e3 (patch) | |
tree | 1c0223a2843cd141f4cfacf6c2ee9612a083cc18 /engines/wintermute/ui/ui_window.cpp | |
parent | e0dd19a21cb07ab4704991800e23bf4ac2dfb0ef (diff) | |
download | scummvm-rg350-a97907241051b493875950285f858c6e215238e3.tar.gz scummvm-rg350-a97907241051b493875950285f858c6e215238e3.tar.bz2 scummvm-rg350-a97907241051b493875950285f858c6e215238e3.zip |
WINTERMUTE: Clean up byte/char casts in loading/parsing
Diffstat (limited to 'engines/wintermute/ui/ui_window.cpp')
-rw-r--r-- | engines/wintermute/ui/ui_window.cpp | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/engines/wintermute/ui/ui_window.cpp b/engines/wintermute/ui/ui_window.cpp index da681b9153..9051ce8217 100644 --- a/engines/wintermute/ui/ui_window.cpp +++ b/engines/wintermute/ui/ui_window.cpp @@ -239,7 +239,7 @@ bool UIWindow::display(int offsetX, int offsetY) { ////////////////////////////////////////////////////////////////////////// bool UIWindow::loadFile(const char *filename) { - byte *buffer = BaseFileManager::getEngineInstance()->readWholeFile(filename); + char *buffer = (char *)BaseFileManager::getEngineInstance()->readWholeFile(filename); if (buffer == nullptr) { _gameRef->LOG(0, "UIWindow::LoadFile failed for file '%s'", filename); return STATUS_FAILED; @@ -298,7 +298,7 @@ TOKEN_DEF(EDITOR_PROPERTY) TOKEN_DEF(EDIT) TOKEN_DEF_END ////////////////////////////////////////////////////////////////////////// -bool UIWindow::loadBuffer(byte *buffer, bool complete) { +bool UIWindow::loadBuffer(char *buffer, bool complete) { TOKEN_TABLE_START(commands) TOKEN_TABLE(WINDOW) TOKEN_TABLE(ALPHA_COLOR) @@ -338,7 +338,7 @@ bool UIWindow::loadBuffer(byte *buffer, bool complete) { TOKEN_TABLE(EDIT) TOKEN_TABLE_END - byte *params; + char *params; int cmd = 2; BaseParser parser; @@ -346,33 +346,33 @@ bool UIWindow::loadBuffer(byte *buffer, bool complete) { int ar = 0, ag = 0, ab = 0, alpha = 0; if (complete) { - if (parser.getCommand((char **)&buffer, commands, (char **)¶ms) != TOKEN_WINDOW) { + if (parser.getCommand(&buffer, commands, ¶ms) != TOKEN_WINDOW) { _gameRef->LOG(0, "'WINDOW' keyword expected."); return STATUS_FAILED; } buffer = params; } - while (cmd >= PARSERR_TOKENNOTFOUND && (cmd = parser.getCommand((char **)&buffer, commands, (char **)¶ms)) >= PARSERR_TOKENNOTFOUND) { + while (cmd >= PARSERR_TOKENNOTFOUND && (cmd = parser.getCommand(&buffer, commands, ¶ms)) >= PARSERR_TOKENNOTFOUND) { switch (cmd) { case TOKEN_TEMPLATE: - if (DID_FAIL(loadFile((char *)params))) { + if (DID_FAIL(loadFile(params))) { cmd = PARSERR_GENERIC; } break; case TOKEN_NAME: - setName((char *)params); + setName(params); break; case TOKEN_CAPTION: - setCaption((char *)params); + setCaption(params); break; case TOKEN_BACK: delete _back; _back = new UITiledImage(_gameRef); - if (!_back || DID_FAIL(_back->loadFile((char *)params))) { + if (!_back || DID_FAIL(_back->loadFile(params))) { delete _back; _back = nullptr; cmd = PARSERR_GENERIC; @@ -382,7 +382,7 @@ bool UIWindow::loadBuffer(byte *buffer, bool complete) { case TOKEN_BACK_INACTIVE: delete _backInactive; _backInactive = new UITiledImage(_gameRef); - if (!_backInactive || DID_FAIL(_backInactive->loadFile((char *)params))) { + if (!_backInactive || DID_FAIL(_backInactive->loadFile(params))) { delete _backInactive; _backInactive = nullptr; cmd = PARSERR_GENERIC; @@ -392,7 +392,7 @@ bool UIWindow::loadBuffer(byte *buffer, bool complete) { case TOKEN_IMAGE: delete _image; _image = new BaseSprite(_gameRef); - if (!_image || DID_FAIL(_image->loadFile((char *)params))) { + if (!_image || DID_FAIL(_image->loadFile(params))) { delete _image; _image = nullptr; cmd = PARSERR_GENERIC; @@ -402,7 +402,7 @@ bool UIWindow::loadBuffer(byte *buffer, bool complete) { case TOKEN_IMAGE_INACTIVE: delete _imageInactive; _imageInactive = new BaseSprite(_gameRef); - if (!_imageInactive || DID_FAIL(_imageInactive->loadFile((char *)params))) { + if (!_imageInactive || DID_FAIL(_imageInactive->loadFile(params))) { delete _imageInactive; _imageInactive = nullptr; cmd = PARSERR_GENERIC; @@ -413,7 +413,7 @@ bool UIWindow::loadBuffer(byte *buffer, bool complete) { if (_font) { _gameRef->_fontStorage->removeFont(_font); } - _font = _gameRef->_fontStorage->addFont((char *)params); + _font = _gameRef->_fontStorage->addFont(params); if (!_font) { cmd = PARSERR_GENERIC; } @@ -423,21 +423,21 @@ bool UIWindow::loadBuffer(byte *buffer, bool complete) { if (_fontInactive) { _gameRef->_fontStorage->removeFont(_fontInactive); } - _fontInactive = _gameRef->_fontStorage->addFont((char *)params); + _fontInactive = _gameRef->_fontStorage->addFont(params); if (!_fontInactive) { cmd = PARSERR_GENERIC; } break; case TOKEN_TITLE: - setText((char *)params); + setText(params); _gameRef->expandStringByStringTable(&_text); break; case TOKEN_TITLE_ALIGN: - if (scumm_stricmp((char *)params, "left") == 0) { + if (scumm_stricmp(params, "left") == 0) { _titleAlign = TAL_LEFT; - } else if (scumm_stricmp((char *)params, "right") == 0) { + } else if (scumm_stricmp(params, "right") == 0) { _titleAlign = TAL_RIGHT; } else { _titleAlign = TAL_CENTER; @@ -445,33 +445,33 @@ bool UIWindow::loadBuffer(byte *buffer, bool complete) { break; case TOKEN_TITLE_RECT: - parser.scanStr((char *)params, "%d,%d,%d,%d", &_titleRect.left, &_titleRect.top, &_titleRect.right, &_titleRect.bottom); + parser.scanStr(params, "%d,%d,%d,%d", &_titleRect.left, &_titleRect.top, &_titleRect.right, &_titleRect.bottom); break; case TOKEN_DRAG_RECT: - parser.scanStr((char *)params, "%d,%d,%d,%d", &_dragRect.left, &_dragRect.top, &_dragRect.right, &_dragRect.bottom); + parser.scanStr(params, "%d,%d,%d,%d", &_dragRect.left, &_dragRect.top, &_dragRect.right, &_dragRect.bottom); break; case TOKEN_X: - parser.scanStr((char *)params, "%d", &_posX); + parser.scanStr(params, "%d", &_posX); break; case TOKEN_Y: - parser.scanStr((char *)params, "%d", &_posY); + parser.scanStr(params, "%d", &_posY); break; case TOKEN_WIDTH: - parser.scanStr((char *)params, "%d", &_width); + parser.scanStr(params, "%d", &_width); break; case TOKEN_HEIGHT: - parser.scanStr((char *)params, "%d", &_height); + parser.scanStr(params, "%d", &_height); break; case TOKEN_CURSOR: delete _cursor; _cursor = new BaseSprite(_gameRef); - if (!_cursor || DID_FAIL(_cursor->loadFile((char *)params))) { + if (!_cursor || DID_FAIL(_cursor->loadFile(params))) { delete _cursor; _cursor = nullptr; cmd = PARSERR_GENERIC; @@ -532,48 +532,48 @@ bool UIWindow::loadBuffer(byte *buffer, bool complete) { case TOKEN_TRANSPARENT: - parser.scanStr((char *)params, "%b", &_transparent); + parser.scanStr(params, "%b", &_transparent); break; case TOKEN_SCRIPT: - addScript((char *)params); + addScript(params); break; case TOKEN_PARENT_NOTIFY: - parser.scanStr((char *)params, "%b", &_parentNotify); + parser.scanStr(params, "%b", &_parentNotify); break; case TOKEN_PAUSE_MUSIC: - parser.scanStr((char *)params, "%b", &_pauseMusic); + parser.scanStr(params, "%b", &_pauseMusic); break; case TOKEN_DISABLED: - parser.scanStr((char *)params, "%b", &_disable); + parser.scanStr(params, "%b", &_disable); break; case TOKEN_VISIBLE: - parser.scanStr((char *)params, "%b", &_visible); + parser.scanStr(params, "%b", &_visible); break; case TOKEN_MENU: - parser.scanStr((char *)params, "%b", &_isMenu); + parser.scanStr(params, "%b", &_isMenu); break; case TOKEN_IN_GAME: - parser.scanStr((char *)params, "%b", &_inGame); + parser.scanStr(params, "%b", &_inGame); break; case TOKEN_CLIP_CONTENTS: - parser.scanStr((char *)params, "%b", &_clipContents); + parser.scanStr(params, "%b", &_clipContents); break; case TOKEN_FADE_COLOR: - parser.scanStr((char *)params, "%d,%d,%d", &fadeR, &fadeG, &fadeB); + parser.scanStr(params, "%d,%d,%d", &fadeR, &fadeG, &fadeB); _fadeBackground = true; break; case TOKEN_FADE_ALPHA: - parser.scanStr((char *)params, "%d", &fadeA); + parser.scanStr(params, "%d", &fadeA); _fadeBackground = true; break; @@ -582,16 +582,16 @@ bool UIWindow::loadBuffer(byte *buffer, bool complete) { break; case TOKEN_ALPHA_COLOR: - parser.scanStr((char *)params, "%d,%d,%d", &ar, &ag, &ab); + parser.scanStr(params, "%d,%d,%d", &ar, &ag, &ab); break; case TOKEN_ALPHA: - parser.scanStr((char *)params, "%d", &alpha); + parser.scanStr(params, "%d", &alpha); break; default: - if (DID_FAIL(_gameRef->windowLoadHook(this, (char **)&buffer, (char **)params))) { + if (DID_FAIL(_gameRef->windowLoadHook(this, &buffer, ¶ms))) { cmd = PARSERR_GENERIC; } } |