src/osd/winui/directories.c
| r7842 | r7843 | |
| 54 | 54 | typedef struct |
| 55 | 55 | { |
| 56 | 56 | tPath *m_Path; |
| 57 | | TCHAR *m_Directory; |
| 57 | TCHAR *m_tDirectory; |
| 58 | 58 | } tDirInfo; |
| 59 | 59 | |
| 60 | 60 | /*************************************************************************** |
| r7842 | r7843 | |
| 147 | 147 | |
| 148 | 148 | static void DirInfo_SetDir(tDirInfo *pInfo, int nType, int nItem, LPCTSTR pText) |
| 149 | 149 | { |
| 150 | | TCHAR *s; |
| 151 | | TCHAR *pOldText; |
| 150 | TCHAR *t_s; |
| 151 | TCHAR *t_pOldText; |
| 152 | 152 | |
| 153 | 153 | if (IsMultiDir(nType)) |
| 154 | 154 | { |
| r7842 | r7843 | |
| 158 | 158 | } |
| 159 | 159 | else |
| 160 | 160 | { |
| 161 | | s = win_tstring_strdup(pText); |
| 162 | | if (!s) |
| 161 | t_s = win_tstring_strdup(pText); |
| 162 | if (!t_s) |
| 163 | 163 | return; |
| 164 | | pOldText = pInfo[nType].m_Directory; |
| 165 | | if (pOldText) |
| 166 | | global_free(pOldText); |
| 167 | | pInfo[nType].m_Directory = s; |
| 164 | t_pOldText = pInfo[nType].m_tDirectory; |
| 165 | if (t_pOldText) |
| 166 | global_free(t_pOldText); |
| 167 | pInfo[nType].m_tDirectory = t_s; |
| 168 | 168 | } |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | static TCHAR* DirInfo_Dir(tDirInfo *pInfo, int nType) |
| 172 | 172 | { |
| 173 | 173 | assert(!IsMultiDir(nType)); |
| 174 | | return pInfo[nType].m_Directory; |
| 174 | return pInfo[nType].m_tDirectory; |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | static TCHAR* DirInfo_Path(tDirInfo *pInfo, int nType, int nItem) |
| r7842 | r7843 | |
| 366 | 366 | for (i = 0; i < nDirInfoCount; i++) |
| 367 | 367 | { |
| 368 | 368 | if (g_pDirInfo[i].m_Path) |
| 369 | | global_free(g_pDirInfo[i].m_Path); |
| 370 | | if (g_pDirInfo[i].m_Directory) |
| 371 | | global_free(g_pDirInfo[i].m_Directory); |
| 369 | free(g_pDirInfo[i].m_Path); |
| 370 | if (g_pDirInfo[i].m_tDirectory) |
| 371 | global_free(g_pDirInfo[i].m_tDirectory); |
| 372 | 372 | } |
| 373 | | global_free(g_pDirInfo); |
| 373 | free(g_pDirInfo); |
| 374 | 374 | g_pDirInfo = NULL; |
| 375 | 375 | } |
| 376 | 376 | } |
src/osd/winui/screenshot.c
| r7842 | r7843 | |
| 211 | 211 | header = zip_file_next_file(zip); |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | | global_free(new_filename); |
| 214 | free(new_filename); |
| 215 | 215 | return header; |
| 216 | 216 | } |
| 217 | 217 | |
| r7842 | r7843 | |
| 345 | 345 | |
| 346 | 346 | // free the buffer if we have to |
| 347 | 347 | if (buffer != NULL) { |
| 348 | | global_free(buffer); |
| 348 | free(buffer); |
| 349 | 349 | } |
| 350 | 350 | return success; |
| 351 | 351 | } |
| r7842 | r7843 | |
| 498 | 498 | |
| 499 | 499 | *pPal = CreatePalette(pLP); |
| 500 | 500 | |
| 501 | | global_free (pLP); |
| 501 | free (pLP); |
| 502 | 502 | } |
| 503 | 503 | |
| 504 | 504 | copy_size = dibSize; |
| r7842 | r7843 | |
| 520 | 520 | if (p.color_type != 3 && p.color_type != 2) |
| 521 | 521 | { |
| 522 | 522 | logerror("Unsupported color type %i (has to be 3)\n", p.color_type); |
| 523 | | global_free(p.image); |
| 523 | png_free(&p); |
| 524 | 524 | return 0; |
| 525 | 525 | } |
| 526 | 526 | if (p.interlace_method != 0) |
| 527 | 527 | { |
| 528 | 528 | logerror("Interlace unsupported\n"); |
| 529 | | global_free (p.image); |
| 529 | png_free(&p); |
| 530 | 530 | return 0; |
| 531 | 531 | } |
| 532 | 532 | |
| r7842 | r7843 | |
| 536 | 536 | if (!AllocatePNG(&p, phDIB, pPAL)) |
| 537 | 537 | { |
| 538 | 538 | logerror("Unable to allocate memory for artwork\n"); |
| 539 | | global_free(p.image); |
| 539 | png_free(&p); |
| 540 | 540 | return 0; |
| 541 | 541 | } |
| 542 | 542 | |
| r7842 | r7843 | |
| 562 | 562 | store_pixels(p.image + i * (p.width * bytespp), p.width * bytespp); |
| 563 | 563 | } |
| 564 | 564 | |
| 565 | | global_free(p.image); |
| 565 | png_free(&p); |
| 566 | 566 | |
| 567 | 567 | return 1; |
| 568 | 568 | } |
src/osd/winui/picker.c
| r7842 | r7843 | |
| 256 | 256 | { |
| 257 | 257 | // Free up all resources associated with this picker structure |
| 258 | 258 | if (pPickerInfo->pnColumnsShown) |
| 259 | | global_free(pPickerInfo->pnColumnsShown); |
| 259 | free(pPickerInfo->pnColumnsShown); |
| 260 | 260 | if (pPickerInfo->pnColumnsOrder) |
| 261 | | global_free(pPickerInfo->pnColumnsOrder); |
| 262 | | global_free(pPickerInfo); |
| 261 | free(pPickerInfo->pnColumnsOrder); |
| 262 | free(pPickerInfo); |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | |
| r7842 | r7843 | |
| 420 | 420 | |
| 421 | 421 | done: |
| 422 | 422 | if (widths) |
| 423 | | global_free(widths); |
| 423 | free(widths); |
| 424 | 424 | if (order) |
| 425 | | global_free(order); |
| 425 | free(order); |
| 426 | 426 | if (shown) |
| 427 | | global_free(shown); |
| 427 | free(shown); |
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | |
| r7842 | r7843 | |
| 1172 | 1172 | } |
| 1173 | 1173 | } |
| 1174 | 1174 | |
| 1175 | | global_free(shown); |
| 1175 | free(shown); |
| 1176 | 1176 | return nColumnCount; |
| 1177 | 1177 | } |
| 1178 | 1178 | |
| r7842 | r7843 | |
| 1569 | 1569 | |
| 1570 | 1570 | SetTextColor(hDC, clrTextSave); |
| 1571 | 1571 | SetBkColor(hDC, clrBkSave); |
| 1572 | | global_free(order); |
| 1572 | free(order); |
| 1573 | 1573 | } |
| 1574 | 1574 | |
| 1575 | 1575 | |
| r7842 | r7843 | |
| 1669 | 1669 | |
| 1670 | 1670 | done: |
| 1671 | 1671 | if (widths) |
| 1672 | | global_free(widths); |
| 1672 | free(widths); |
| 1673 | 1673 | if (order) |
| 1674 | | global_free(order); |
| 1674 | free(order); |
| 1675 | 1675 | if (tmpOrder) |
| 1676 | | global_free(tmpOrder); |
| 1676 | free(tmpOrder); |
| 1677 | 1677 | return bSuccess; |
| 1678 | 1678 | } |
src/osd/winui/treeview.c
| r7842 | r7843 | |
| 194 | 194 | treeFolders[i] = NULL; |
| 195 | 195 | numFolders--; |
| 196 | 196 | } |
| 197 | | global_free(treeFolders); |
| 197 | free(treeFolders); |
| 198 | 198 | treeFolders = NULL; |
| 199 | 199 | } |
| 200 | 200 | numFolders = 0; |
| r7842 | r7843 | |
| 1518 | 1518 | folderArrayLength += 500; |
| 1519 | 1519 | tmpTree = (TREEFOLDER **)malloc(sizeof(TREEFOLDER **) * folderArrayLength); |
| 1520 | 1520 | memcpy(tmpTree,treeFolders,sizeof(TREEFOLDER **) * oldFolderArrayLength); |
| 1521 | | if (treeFolders) global_free(treeFolders); |
| 1521 | if (treeFolders) free(treeFolders); |
| 1522 | 1522 | treeFolders = tmpTree; |
| 1523 | 1523 | } |
| 1524 | 1524 | |
| r7842 | r7843 | |
| 1561 | 1561 | } |
| 1562 | 1562 | global_free(lpFolder->m_lptTitle); |
| 1563 | 1563 | lpFolder->m_lptTitle = 0; |
| 1564 | | global_free(lpFolder->m_lpTitle); |
| 1564 | free(lpFolder->m_lpTitle); |
| 1565 | 1565 | lpFolder->m_lpTitle = 0; |
| 1566 | | global_free(lpFolder); |
| 1566 | free(lpFolder); |
| 1567 | 1567 | lpFolder = 0; |
| 1568 | 1568 | } |
| 1569 | 1569 | } |
| r7842 | r7843 | |
| 2047 | 2047 | { |
| 2048 | 2048 | if (ExtraFolderData[i]) |
| 2049 | 2049 | { |
| 2050 | | global_free(ExtraFolderData[i]); |
| 2050 | free(ExtraFolderData[i]); |
| 2051 | 2051 | ExtraFolderData[i] = NULL; |
| 2052 | 2052 | } |
| 2053 | 2053 | } |
| 2054 | 2054 | |
| 2055 | 2055 | for (i = 0; i < numExtraIcons; i++) |
| 2056 | 2056 | { |
| 2057 | | global_free(ExtraFolderIcons[i]); |
| 2057 | free(ExtraFolderIcons[i]); |
| 2058 | 2058 | } |
| 2059 | 2059 | |
| 2060 | 2060 | numExtraIcons = 0; |
| r7842 | r7843 | |
| 2252 | 2252 | if (TrySaveExtraFolder(lpFolder) == FALSE) |
| 2253 | 2253 | { |
| 2254 | 2254 | // failed, so free newly allocated title and restore old |
| 2255 | | global_free(lpFolder->m_lpTitle); |
| 2255 | free(lpFolder->m_lpTitle); |
| 2256 | 2256 | lpFolder->m_lpTitle = old_title; |
| 2257 | 2257 | return FALSE; |
| 2258 | 2258 | } |
| 2259 | 2259 | TryRenameCustomFolderIni(lpFolder, old_title, new_name); |
| 2260 | 2260 | // successful, so free old title |
| 2261 | | global_free(old_title); |
| 2261 | free(old_title); |
| 2262 | 2262 | return TRUE; |
| 2263 | 2263 | } |
| 2264 | 2264 | |
| r7842 | r7843 | |
| 2272 | 2272 | if (retval) |
| 2273 | 2273 | { |
| 2274 | 2274 | TryRenameCustomFolderIni(lpFolder, lpFolder->m_lpTitle, new_name); |
| 2275 | | global_free(lpFolder->m_lpTitle); |
| 2275 | free(lpFolder->m_lpTitle); |
| 2276 | 2276 | lpFolder->m_lpTitle = (char *)malloc(strlen(new_name) + 1); |
| 2277 | 2277 | strcpy(lpFolder->m_lpTitle,new_name); |
| 2278 | 2278 | } |
src/osd/winui/winui.c
| r7842 | r7843 | |
| 1018 | 1018 | /* free arguments */ |
| 1019 | 1019 | for (i = 0; i < __argc; i++) |
| 1020 | 1020 | global_free(utf8_argv[i]); |
| 1021 | | global_free(utf8_argv); |
| 1021 | free(utf8_argv); |
| 1022 | 1022 | |
| 1023 | 1023 | exit(rc); |
| 1024 | 1024 | } |
| r7842 | r7843 | |
| 1225 | 1225 | { |
| 1226 | 1226 | hIcon = FormatICOInMemoryToHICON(bufferPtr, entry->uncompressed_length); |
| 1227 | 1227 | } |
| 1228 | | global_free(bufferPtr); |
| 1228 | free(bufferPtr); |
| 1229 | 1229 | } |
| 1230 | 1230 | } |
| 1231 | 1231 | entry = zip_file_next_file(zip); |
| r7842 | r7843 | |
| 1685 | 1685 | ResetBackground(szFile); |
| 1686 | 1686 | } |
| 1687 | 1687 | |
| 1688 | | global_free(buf); |
| 1688 | free(buf); |
| 1689 | 1689 | } |
| 1690 | 1690 | |
| 1691 | 1691 | static void SetMainTitle(void) |
| r7842 | r7843 | |
| 3404 | 3404 | { |
| 3405 | 3405 | TV_DISPINFO *ptvdi = (TV_DISPINFO *)nm; |
| 3406 | 3406 | LPTREEFOLDER folder = (LPTREEFOLDER)ptvdi->item.lParam; |
| 3407 | | char* szText; |
| 3407 | char* utf8_szText; |
| 3408 | 3408 | BOOL result; |
| 3409 | 3409 | |
| 3410 | 3410 | g_in_treeview_edit = FALSE; |
| r7842 | r7843 | |
| 3412 | 3412 | if (ptvdi->item.pszText == NULL || _tcslen(ptvdi->item.pszText) == 0) |
| 3413 | 3413 | return FALSE; |
| 3414 | 3414 | |
| 3415 | | szText = utf8_from_tstring(ptvdi->item.pszText); |
| 3416 | | if( !szText ) |
| 3415 | utf8_szText = utf8_from_tstring(ptvdi->item.pszText); |
| 3416 | if( !utf8_szText ) |
| 3417 | 3417 | return FALSE; |
| 3418 | 3418 | |
| 3419 | | result = TryRenameCustomFolder(folder,szText); |
| 3419 | result = TryRenameCustomFolder(folder, utf8_szText); |
| 3420 | 3420 | |
| 3421 | | global_free(szText); |
| 3421 | global_free(utf8_szText); |
| 3422 | 3422 | |
| 3423 | 3423 | return result; |
| 3424 | 3424 | } |
src/osd/winui/properties.c
| r7842 | r7843 | |
| 489 | 489 | win_message_box_utf8(0, temp, "Error", IDOK); |
| 490 | 490 | } |
| 491 | 491 | |
| 492 | | global_free(pspage); |
| 492 | free(pspage); |
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | /* Initilize the property pages for anything but the Default option set */ |
| r7842 | r7843 | |
| 608 | 608 | } |
| 609 | 609 | |
| 610 | 610 | global_free(t_description); |
| 611 | | global_free(pspage); |
| 611 | free(pspage); |
| 612 | 612 | } |
| 613 | 613 | |
| 614 | 614 | |
| r7842 | r7843 | |
| 2102 | 2102 | int selected = 0; |
| 2103 | 2103 | int index = 0; |
| 2104 | 2104 | LPCTSTR t_ctrlr_option = 0; |
| 2105 | | LPTSTR buf = 0; |
| 2105 | LPTSTR t_buf = 0; |
| 2106 | 2106 | const char *ctrlr_option; |
| 2107 | 2107 | TCHAR* t_ctrldir; |
| 2108 | 2108 | |
| r7842 | r7843 | |
| 2110 | 2110 | ctrlr_option = options_get_string(opts, OPTION_CTRLR); |
| 2111 | 2111 | if( ctrlr_option != NULL ) |
| 2112 | 2112 | { |
| 2113 | | buf = tstring_from_utf8(ctrlr_option); |
| 2114 | | if( !buf ) |
| 2113 | t_buf = tstring_from_utf8(ctrlr_option); |
| 2114 | if( !t_buf ) |
| 2115 | 2115 | return FALSE; |
| 2116 | | t_ctrlr_option = buf; |
| 2116 | t_ctrlr_option = t_buf; |
| 2117 | 2117 | } |
| 2118 | 2118 | else |
| 2119 | 2119 | { |
| r7842 | r7843 | |
| 2129 | 2129 | t_ctrldir = tstring_from_utf8(GetCtrlrDir()); |
| 2130 | 2130 | if( !t_ctrldir ) |
| 2131 | 2131 | { |
| 2132 | | if( buf ) |
| 2133 | | global_free(buf); |
| 2132 | if( t_buf ) |
| 2133 | global_free(t_buf); |
| 2134 | 2134 | return FALSE; |
| 2135 | 2135 | } |
| 2136 | 2136 | |
| r7842 | r7843 | |
| 2175 | 2175 | |
| 2176 | 2176 | (void)ComboBox_SetCurSel(control, selected); |
| 2177 | 2177 | |
| 2178 | | if( buf ) |
| 2179 | | global_free(buf); |
| 2178 | if( t_buf ) |
| 2179 | global_free(t_buf); |
| 2180 | 2180 | |
| 2181 | 2181 | return FALSE; |
| 2182 | 2182 | } |