]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
More analyzer fixes.
authorToni Wilen <twilen@winuae.net>
Tue, 6 Mar 2018 19:27:03 +0000 (21:27 +0200)
committerToni Wilen <twilen@winuae.net>
Tue, 6 Mar 2018 19:27:03 +0000 (21:27 +0200)
expansion.cpp
od-win32/hardfile_win32.cpp
od-win32/mp3decoder.cpp
od-win32/win32.cpp
od-win32/win32gui.cpp
scsitape.cpp

index cd2ad886fbd8d453b66c4c0a053b7d35561ba0bb..a11e0a27812f602147fe4e608a43a9b2b22af114 100644 (file)
@@ -314,18 +314,20 @@ static void addextrachip (uae_u32 sysbase)
                uae_u32 first = get_long (ml + 16);
                put_long (ml + 24, currprefs.chipmem_size); // mh_Upper
                put_long (ml + 28, get_long (ml + 28) + added); // mh_Free
-               uae_u32 next;
+               uae_u32 next = 0;
                while (first) {
                        next = first;
                        first = get_long (next);
                }
-               uae_u32 bytes = get_long (next + 4);
-               if (next + bytes == 0x00200000) {
-                       put_long (next + 4, currprefs.chipmem_size - next);
-               } else {
-                       put_long (0x00200000 + 0, 0);
-                       put_long (0x00200000 + 4, added);
-                       put_long (next, 0x00200000);
+               if (next) {
+                       uae_u32 bytes = get_long(next + 4);
+                       if (next + bytes == 0x00200000) {
+                               put_long(next + 4, currprefs.chipmem_size - next);
+                       } else {
+                               put_long(0x00200000 + 0, 0);
+                               put_long(0x00200000 + 4, added);
+                               put_long(next, 0x00200000);
+                       }
                }
                return;
        }
index 3302865fa5f5278df6a10a8765440660fb4718f1..5365bddd42db43aa5e1affd99488905841240153 100644 (file)
@@ -923,7 +923,7 @@ static bool hd_get_meta_hack(HWND hDlg, HANDLE h, uae_u8 *data, uae_u8 *inq, str
        uae_u8 cmd[16];
 
        memset(data, 0, 512);
-       if (udi->usb_vid == 0x152d && (udi->usb_pid == 0x2329 && udi->usb_pid == 0x2336 || udi->usb_pid == 0x2338 || udi->usb_pid == 0x2339)) {
+       if (udi->usb_vid == 0x152d && (udi->usb_pid == 0x2329 || udi->usb_pid == 0x2336 || udi->usb_pid == 0x2338 || udi->usb_pid == 0x2339)) {
                return hd_meta_hack_jmicron(h, data, inq);
        }
        if (!hDlg)
index 64987bc77164b4f45250aec46448831b34af0cd0..8a128fca4dc8ac9547ed5833b247490b84037cb6 100644 (file)
@@ -147,8 +147,8 @@ mp3decoder::mp3decoder(struct zfile *zf)
 {
        MMRESULT mmr;
        LPWAVEFORMATEX waveFormat, inwave;
-       LPMPEGLAYER3WAVEFORMAT mp3format;
-       LPMPEG1WAVEFORMAT mp2format;
+       LPMPEGLAYER3WAVEFORMAT mp3format = NULL;
+       LPMPEG1WAVEFORMAT mp2format = NULL;
        DWORD maxFormatSize;
        struct mpegaudio_header head;
 
index a38c1a85216e1b3cbad8ae77f087b3c623634e9d..bdd7260165cfe96959d307f34bae12da4a7b5186 100644 (file)
@@ -5766,7 +5766,7 @@ static TCHAR *getdefaultini (int *tempfile)
        int v = GetTempPath (sizeof path / sizeof (TCHAR), path);
        if (v == 0 || v > sizeof path / sizeof (TCHAR))
                return my_strdup (orgpath);
-       _tcsncat (path, _T("winuae.ini"), sizeof path / sizeof (TCHAR));
+       _tcsncat (path, _T("winuae.ini"), sizeof path / sizeof (TCHAR) - _tcslen(path));
        f = _tfopen (path, _T("w"));
        if (f) {
                fclose (f);
index 889d7539d018912f56f1329f9d528a164967a4d7..5adf2b8d65cf91bdb122be351313e22aa391a113 100644 (file)
@@ -2732,14 +2732,14 @@ int DiskSelection_2 (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs
                WIN32GUI_LoadUIString (IDS_SELECTADF, szTitle, MAX_DPATH);
                WIN32GUI_LoadUIString (IDS_ADF, szFormat, MAX_DPATH);
                _stprintf (szFilter, _T("%s "), szFormat);
-               memcpy (szFilter + _tcslen (szFilter), DISK_FORMAT_STRING, sizeof (DISK_FORMAT_STRING) + sizeof (TCHAR));
+               memcpy (szFilter + _tcslen (szFilter), DISK_FORMAT_STRING, sizeof (DISK_FORMAT_STRING));
                defext = _T("adf");
                break;
        case 22:
                _tcscpy(szTitle, prefs->floppyslots[wParam - IDC_DF0].df);
                WIN32GUI_LoadUIString (IDS_ADF, szFormat, MAX_DPATH);
                _stprintf (szFilter, _T("%s "), szFormat);
-               memcpy (szFilter + _tcslen (szFilter), DISK_FORMAT_STRING, sizeof (DISK_FORMAT_STRING) + sizeof (TCHAR));
+               memcpy (szFilter + _tcslen (szFilter), DISK_FORMAT_STRING, sizeof (DISK_FORMAT_STRING));
                defext = _T("adf");
                break;
        case 1:
@@ -2754,7 +2754,7 @@ int DiskSelection_2 (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs
                WIN32GUI_LoadUIString (IDS_SELECTHDF, szTitle, MAX_DPATH);
                WIN32GUI_LoadUIString (IDS_HDF, szFormat, MAX_DPATH);
                _stprintf (szFilter, _T("%s "), szFormat);
-               memcpy (szFilter + _tcslen (szFilter),  HDF_FORMAT_STRING, sizeof (HDF_FORMAT_STRING) + sizeof (TCHAR));
+               memcpy (szFilter + _tcslen (szFilter),  HDF_FORMAT_STRING, sizeof (HDF_FORMAT_STRING));
                defext = _T("hdf");
                break;
        case 4:
@@ -2769,7 +2769,7 @@ int DiskSelection_2 (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs
                WIN32GUI_LoadUIString (IDS_SELECTROM, szTitle, MAX_DPATH);
                WIN32GUI_LoadUIString (IDS_ROM, szFormat, MAX_DPATH);
                _stprintf (szFilter, _T("%s "), szFormat);
-               memcpy (szFilter + _tcslen (szFilter), ROM_FORMAT_STRING, sizeof (ROM_FORMAT_STRING) + sizeof (TCHAR));
+               memcpy (szFilter + _tcslen (szFilter), ROM_FORMAT_STRING, sizeof (ROM_FORMAT_STRING));
                defext = _T("rom");
                break;
        case 7:
@@ -2784,7 +2784,7 @@ int DiskSelection_2 (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs
                WIN32GUI_LoadUIString (flag == 15 ? IDS_RESTOREINP : IDS_SAVEINP, szTitle, MAX_DPATH);
                WIN32GUI_LoadUIString (IDS_INP, szFormat, MAX_DPATH);
                _stprintf (szFilter, _T("%s "), szFormat);
-               memcpy (szFilter + _tcslen (szFilter), INP_FORMAT_STRING, sizeof (INP_FORMAT_STRING) + sizeof (TCHAR));
+               memcpy (szFilter + _tcslen (szFilter), INP_FORMAT_STRING, sizeof (INP_FORMAT_STRING));
                defext = _T("inp");
                break;
        case 9:
@@ -2793,11 +2793,11 @@ int DiskSelection_2 (HWND hDlg, WPARAM wParam, int flag, struct uae_prefs *prefs
                WIN32GUI_LoadUIString (IDS_USS, szFormat, MAX_DPATH);
                _stprintf (szFilter, _T("%s "), szFormat);
                if (flag == 10) {
-                       memcpy (szFilter + _tcslen (szFilter), USS_FORMAT_STRING_RESTORE, sizeof (USS_FORMAT_STRING_RESTORE) + sizeof (TCHAR));
+                       memcpy (szFilter + _tcslen (szFilter), USS_FORMAT_STRING_RESTORE, sizeof (USS_FORMAT_STRING_RESTORE));
                        all = 1;
                } else {
                        TCHAR tmp[MAX_DPATH];
-                       memcpy (szFilter + _tcslen (szFilter), USS_FORMAT_STRING_SAVE, sizeof (USS_FORMAT_STRING_SAVE) + sizeof (TCHAR));
+                       memcpy (szFilter + _tcslen (szFilter), USS_FORMAT_STRING_SAVE, sizeof (USS_FORMAT_STRING_SAVE));
                        p = szFilter;
                        while (p[0] != 0 || p[1] !=0 ) p++;
                        p++;
@@ -5088,7 +5088,7 @@ static INT_PTR CALLBACK InfoSettingsProc (HWND hDlg, UINT msg, WPARAM wParam, LP
                        break;
                }
 
-               GetDlgItemText(hDlg, IDC_PATH_NAME, workprefs.info, sizeof workprefs.info);
+               GetDlgItemText(hDlg, IDC_PATH_NAME, workprefs.info, sizeof workprefs.info / sizeof(TCHAR));
                recursive--;
                break;
        }
@@ -19381,7 +19381,7 @@ static BOOL CALLBACK childenumproc (HWND hwnd, LPARAM lParam)
                *p++ = 0;
                *p++ = 0;
                if (p[0] == ' ')
-                       *p++;
+                       *p++ = 0;
                if (p[0] == '#')
                        imageid = _tstol (p + 1);
                tmp[_tcslen (tmp) - 1] = 0;
index 22b310e1e21b01eae82083aac1dea7eb8bc5aaa3..bc0bde0750a023e417e2c170b5ba3abe19d6bbc6 100644 (file)
@@ -51,11 +51,11 @@ void tape_free (struct scsi_data_tape *tape)
        zfile_fclose (tape->zf);
        zfile_fclose (tape->index);
        zfile_closedir_archive (tape->zd);
-       xfree(tape);
        for (int i = 0; i < MAX_FILESYSTEM_UNITS; i++) {
                if (tapeunits[i] == tape)
                        tapeunits[i] = NULL;
        }
+       xfree(tape);
 }
 
 static void tape_init (int unit, struct scsi_data_tape *tape, const TCHAR *tape_directory, bool readonly)