Previous 15994 Revisions Next

r7922 Wednesday 28th April, 2010 at 11:33:31 UTC by Firewave
[WIMGTOOL] Use "proper" free calls to avoid breking into the debugger - still leaks memory. Also renamed some variables to reflect their type
[src/mess/tools/imgtool/windows]wimgtool.c

src/mess/tools/imgtool/windows/wimgtool.c
r7921r7922
336336      {
337337         t_extension = tstring_from_utf8(extension);
338338         _tcscat(file_path, t_extension);
339         free(t_extension);
339         global_free(t_extension);
340340      }
341341
342342      file = CreateFile(file_path, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, NULL);
r7921r7922
457457
458458   new_index = ListView_InsertItem(info->listview, &lvi);
459459
460   free(t_entry_filename);
460   global_free(t_entry_filename);
461461
462462   if (entry->directory)
463463   {
r7921r7922
501501   // set attributes and corruption notice
502502   if (entry->attr)
503503   {
504      TCHAR *tempstr = tstring_from_utf8(entry->attr);
505      ListView_SetItemText(info->listview, new_index, column_index++, tempstr);
506      free(tempstr);
504      TCHAR *t_tempstr = tstring_from_utf8(entry->attr);
505      ListView_SetItemText(info->listview, new_index, column_index++, t_tempstr);
506      global_free(t_tempstr);
507507   }
508508   if (entry->corrupt)
509509   {
r7921r7922
597597
598598   tempstr = tstring_from_utf8(size_buf);
599599   SendMessage(info->statusbar, SB_SETTEXT, 2, (LPARAM) tempstr);
600   free(tempstr);
600   global_free(tempstr);
601601
602602done:
603603   if (imageenum)
r7921r7922
617617   char imageinfo_buf[256];
618618   const char *imageinfo = NULL;
619619   TCHAR file_title_buf[MAX_PATH];
620   char *file_title;
620   char *utf8_file_title;
621621   const char *statusbar_text[2];
622622   TCHAR *t_filename;
623623   imgtool_partition_features features;
r7921r7922
635635      // get file title from Windows
636636      t_filename = tstring_from_utf8(info->filename);
637637      GetFileTitle(t_filename, file_title_buf, ARRAY_LENGTH(file_title_buf));
638      free(t_filename);
639      file_title = utf8_from_tstring(file_title_buf);
638      global_free(t_filename);
639      utf8_file_title = utf8_from_tstring(file_title_buf);
640640
641641      // get info from image
642642      if (info->image && (imgtool_image_info(info->image, imageinfo_buf, sizeof(imageinfo_buf)
r7921r7922
653653         if (imageinfo)
654654         {
655655            snprintf(buf, ARRAY_LENGTH(buf),
656               "%s (\"%s\") - %s", file_title, imageinfo, info->current_directory);
656               "%s (\"%s\") - %s", utf8_file_title, imageinfo, info->current_directory);
657657         }
658658         else
659659         {
660660            snprintf(buf, ARRAY_LENGTH(buf),
661               "%s - %s", file_title, info->current_directory);
661               "%s - %s", utf8_file_title, info->current_directory);
662662         }
663663      }
664664      else
r7921r7922
666666         // no current directory
667667         snprintf(buf, ARRAY_LENGTH(buf),
668668            imageinfo ? "%s (\"%s\")" : "%s",
669            file_title, imageinfo);
669            utf8_file_title, imageinfo);
670670      }
671671
672672      statusbar_text[0] = imgtool_basename((char *) info->filename);
673673      statusbar_text[1] = imgtool_image_module(info->image)->description;
674674
675      free(file_title);
675      global_free(utf8_file_title);
676676   }
677677   else
678678   {
r7921r7922
686686
687687   for (i = 0; i < ARRAY_LENGTH(statusbar_text); i++)
688688   {
689      TCHAR *tempstr = statusbar_text[i] ? tstring_from_utf8(statusbar_text[i]) : NULL;
690      SendMessage(info->statusbar, SB_SETTEXT, i, (LPARAM) tempstr);
691      if (tempstr)
692         free(tempstr);
689      TCHAR *t_tempstr = statusbar_text[i] ? tstring_from_utf8(statusbar_text[i]) : NULL;
690      SendMessage(info->statusbar, SB_SETTEXT, i, (LPARAM) t_tempstr);
691      if (t_tempstr)
692         global_free(t_tempstr);
693693   }
694694
695695   // set the icon

Previous 15994 Revisions Next


© 1998-2018 The MESS Team