Ticket #9120: sci_uninitialized_variable_warnings.patch

File sci_uninitialized_variable_warnings.patch, 2.2 KB (added by Templier, 14 years ago)

Patch for sci engine

  • engines/sci/gui/gui_text.cpp

     
    355355
    356356// Draws a text in rect.
    357357void SciGuiText::Box(const char *text, int16 bshow, const Common::Rect &rect, GuiTextAlignment alignment, GuiResourceId fontId) {
    358         int16 textWidth, textHeight, charCount, offset;
     358        int16 textWidth, textHeight, charCount;
     359        int16 offset = 0;
    359360        int16 hline = 0;
    360361        GuiResourceId orgFontId = GetFontId();
    361362        int16 orgPenColor = _gfx->_curPort->penClr;
     
    380381                        offset = (rect.width() - textWidth) / 2;
    381382                        break;
    382383                case SCI_TEXT_ALIGNMENT_LEFT:
    383                         offset = 0;
     384                        // Nothing to do
    384385                        break;
    385386
    386387                default: // left-aligned
  • engines/sci/resource.cpp

     
    955955
    956956        Common::String mask, name;
    957957        Common::ArchiveMemberList files;
    958         int number;
     958        int number = -1;
    959959        const char *szResType;
    960960        ResourceSource *psrcPatch;
    961         bool bAdd;
    962961
    963962        for (int i = kResourceTypeView; i < kResourceTypeAudio36; i ++) {
    964963                files.clear();
     
    972971                mask += resourceTypeSuffixes[i];
    973972                SearchMan.listMatchingMembers(files, mask);
    974973                for (Common::ArchiveMemberList::const_iterator x = files.begin(); x != files.end(); x++) {
    975                         bAdd = false;
    976974                        name = (*x)->getName();
    977975                        // SCI1 scheme
    978976                        if (isdigit(name[0])) {
    979977                                number = atoi(name.c_str());
    980                                 bAdd = true;
    981978                        } else {
    982979                                // SCI0 scheme
    983980                                int resname_len = strlen(szResType);
    984981                                if (scumm_strnicmp(name.c_str(), szResType, resname_len) == 0
    985982                                        && !isalpha(name[resname_len + 1])) {
    986983                                        number = atoi(name.c_str() + resname_len + 1);
    987                                         bAdd = true;
    988984                                }
    989985                        }
    990986
    991                         if (bAdd) {
    992                                 psrcPatch = new ResourceSource;
    993                                 psrcPatch->source_type = kSourcePatch;
    994                                 psrcPatch->location_name = name;
    995                                 processPatch(psrcPatch, (ResourceType)i, number);
    996                         }
     987                        psrcPatch = new ResourceSource;
     988                        psrcPatch->source_type = kSourcePatch;
     989                        psrcPatch->location_name = name;
     990                        processPatch(psrcPatch, (ResourceType)i, number);
    997991                }
    998992        }
    999993}