New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PRINCE: fixed warnings #1338

Closed
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
3 participants
@mgerhardy
Contributor

mgerhardy commented Sep 14, 2018

No description provided.

mgerhardy added some commits Sep 14, 2018

PRINCE: fixed warning with gcc 8.2
engines/prince/inventory.cpp: In member function ‘void Prince::PrinceEngine::inventoryLeftMouseButton()’:
engines/prince/inventory.cpp:400:70: warning: cast from type ‘const char*’ to type ‘char*’ casts away qualifiers [-Wcast-qual]
    printAt(0, 216, (char *)_invMobList[_selectedMob]._examText.c_str(), kNormalWidth / 2, _invExamY);
PRINCE: fixed warning with gcc 8.2
engines/prince/script.cpp: In member function ‘void Prince::Interpreter::O_GETMOBTEXT()’:
engines/prince/script.cpp:1022:55: warning: cast from type ‘const char*’ to type ‘byte*’ {aka ‘unsigned char*’} casts away qualifiers [-Wcast-qual]
  _string = (byte *)_vm->_mobList[mob]._examText.c_str();
                                                       ^
engines/prince/script.cpp: In member function ‘void Prince::Interpreter::O_GETMOBNAME()’:
engines/prince/script.cpp:1844:53: warning: cast from type ‘const char*’ to type ‘byte*’ {aka ‘unsigned char*’} casts away qualifiers [-Wcast-qual]
  _string = (byte *)_vm->_mobList[modId]._name.c_str();

@mgerhardy mgerhardy closed this Sep 14, 2018

@digitall

This comment has been minimized.

Member

digitall commented Sep 14, 2018

@mgerhardy : Why was this closed? I assume because the proposed patch broke the build in Travis CI?

@bonki

This comment has been minimized.

Member

bonki commented Oct 22, 2018

Unfortunately it's not as simple as that and this is not the correct fix (see the corresponding comments I added a while ago).

@digitall

This comment has been minimized.

Member

digitall commented Oct 22, 2018

@bonki: Sorry, I didn't follow up my initial comment. I tried compling this myself and it failed badly. I am aware of the issue which produces the warnings and that it is tricky to solve since .c_str() values are not meant to be saved and they are freed... so either you do scumm_strdup() and have memory leakage ... or crashes :/

@mgerhardy

This comment has been minimized.

Contributor

mgerhardy commented Oct 23, 2018

I closed it, because it was an invalid attempt to fix the warnings.

@mgerhardy mgerhardy deleted the mgerhardy:prince-warnings branch Oct 23, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment