cebix / macemu

Basilisk II and SheepShaver Macintosh emulators
1.37k stars 285 forks source link

SheepShaver Video.cpp Build Issue: Unsigned Integer Error since June 2020 #226

Open boomer3200 opened 3 years ago

boomer3200 commented 3 years ago

The last commit to Sheepshaver's src/video.cpp in June 2020 was intended to fix an error with gcc 10 by adding unsigned to the integer "work_id = ReadMacInt32(param + csPreviousDisplayModeID);" on line 736.

This now results in an error about an unsigned integer on line 744 for kDisplayModeIDFindFirstResolution when building with gcc 10:

../video.cpp: In function ‘int16 VideoStatus(uint32, VidLocals*)’:
../video.cpp:744:10: error: narrowing conversion of ‘kDisplayModeIDFindFirstResolution’ from ‘int’ to ‘unsigned int’ [-Wnarrowing]
  744 |     case kDisplayModeIDFindFirstResolution:

Reverting the change allowed SheepShaver to build and run with gcc 10:

--- video.cpp   2020-09-09 22:06:04.186963471 -0400
+++ video.cpp.new       2020-11-26 22:24:35.472863413 -0500
@@ -736,7 +736,7 @@

                case cscGetNextResolution: {
                        D(bug("GetNextResolution \n"));
-                       unsigned int work_id = ReadMacInt32(param + csPreviousDisplayModeID);
+                       int work_id = ReadMacInt32(param + csPreviousDisplayModeID);
                        switch (work_id) {
                                case kDisplayModeIDCurrent:
                                        work_id = csSave->saveData;