Skip to content

Commit

Permalink
Merge branch 'dev41' into unicode
Browse files Browse the repository at this point in the history
  • Loading branch information
starg2 committed Dec 20, 2023
2 parents b54bb50 + 766c7f3 commit fa8146f
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 31 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,9 @@ if(MSVC)
string(APPEND CMAKE_EXE_LINKER_FLAGS_DEBUG " /DEBUG:FASTLINK")
string(APPEND CMAKE_SHARED_LINKER_FLAGS_DEBUG " /DEBUG:FASTLINK")

string(APPEND CMAKE_EXE_LINKER_FLAGS_RELEASE " /OPT:REF /OPT:ICF /LTCG:incremental /DEBUG:FULL /GUARD:CF")
string(APPEND CMAKE_SHARED_LINKER_FLAGS_RELEASE " /OPT:REF /OPT:ICF /LTCG:incremental /DEBUG:FULL /GUARD:CF")
string(APPEND CMAKE_STATIC_LINKER_FLAGS_RELEASE " /LTCG:incremental")
string(APPEND CMAKE_EXE_LINKER_FLAGS_RELEASE " /OPT:REF /OPT:ICF /LTCG /DEBUG:FULL /GUARD:CF")
string(APPEND CMAKE_SHARED_LINKER_FLAGS_RELEASE " /OPT:REF /OPT:ICF /LTCG /DEBUG:FULL /GUARD:CF")
string(APPEND CMAKE_STATIC_LINKER_FLAGS_RELEASE " /LTCG")

string(APPEND CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO " /OPT:REF /DEBUG:FASTLINK")
string(APPEND CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO " /OPT:REF /DEBUG:FASTLINK")
Expand Down
40 changes: 21 additions & 19 deletions interface/w32g_utl.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@
#include "rtsyn.h"

#include <wchar.h>
#define CINTERFACE
#define COBJMACROS
#include <shobjidl.h>

///r
Expand Down Expand Up @@ -1693,7 +1695,7 @@ void BitBltRect(HDC dst, HDC src, const RECT *rc)
}

BOOL ShowFileDialog(
int mode,
FILEDIALOG_MODE mode,
HWND hParentWindow,
LPCWSTR pTitle,
char *pResult,
Expand All @@ -1715,16 +1717,16 @@ BOOL ShowFileDialog(
return FALSE;

if (guid)
pFileDialog->lpVtbl->SetClientGuid(pFileDialog, guid);
IFileDialog_SetClientGuid(pFileDialog, guid);

if (pTitle)
pFileDialog->lpVtbl->SetTitle(pFileDialog, pTitle);
IFileDialog_SetTitle(pFileDialog, pTitle);

if (filterCount > 0 && pFilters)
pFileDialog->lpVtbl->SetFileTypes(pFileDialog, filterCount, pFilters);
IFileDialog_SetFileTypes(pFileDialog, filterCount, pFilters);

FILEOPENDIALOGOPTIONS options;
pFileDialog->lpVtbl->GetOptions(pFileDialog, &options);
IFileDialog_GetOptions(pFileDialog, &options);
options |= FOS_NOCHANGEDIR | FOS_FORCEFILESYSTEM;

switch (mode) {
Expand All @@ -1740,29 +1742,29 @@ BOOL ShowFileDialog(
break;
}

pFileDialog->lpVtbl->SetOptions(pFileDialog, options);
IFileDialog_SetOptions(pFileDialog, options);

hr = pFileDialog->lpVtbl->Show(pFileDialog, hParentWindow);
hr = IFileDialog_Show(pFileDialog, hParentWindow);

if (hr == S_OK) {
if (mode == FILEDIALOG_OPEN_MULTIPLE_FILES) {
IFileOpenDialog *pFileOpenDialog;

if (SUCCEEDED(pFileDialog->lpVtbl->QueryInterface(pFileDialog, &IID_IFileOpenDialog, (void**)&pFileOpenDialog))) {
if (SUCCEEDED(IFileDialog_QueryInterface(pFileDialog, &IID_IFileOpenDialog, (void**)&pFileOpenDialog))) {
IShellItemArray *pShellItemArray;

if (SUCCEEDED(pFileOpenDialog->lpVtbl->GetResults(pFileOpenDialog, &pShellItemArray))) {
if (SUCCEEDED(IFileOpenDialog_GetResults(pFileOpenDialog, &pShellItemArray))) {
size_t pos = 0;
DWORD count = 0;
pShellItemArray->lpVtbl->GetCount(pShellItemArray, &count);
IShellItemArray_GetCount(pShellItemArray, &count);

for (DWORD i = 0; i < count; i++) {
IShellItem *pShellItem;

if (SUCCEEDED(pShellItemArray->lpVtbl->GetItemAt(pShellItemArray, i, &pShellItem))) {
if (SUCCEEDED(IShellItemArray_GetItemAt(pShellItemArray, i, &pShellItem))) {
wchar_t *pBuffer;

if (SUCCEEDED(pShellItem->lpVtbl->GetDisplayName(pShellItem, i == 0 ? SIGDN_FILESYSPATH : SIGDN_PARENTRELATIVEPARSING, &pBuffer))) {
if (SUCCEEDED(IShellItem_GetDisplayName(pShellItem, i == 0 ? SIGDN_FILESYSPATH : SIGDN_PARENTRELATIVEPARSING, &pBuffer))) {
int len = wcslen(pBuffer);

if (i == 0) {
Expand Down Expand Up @@ -1791,24 +1793,24 @@ BOOL ShowFileDialog(
CoTaskMemFree(pBuffer);
}

pShellItem->lpVtbl->Release(pShellItem);
IShellItem_Release(pShellItem);
}
}

pResult[pos] = '\0';
pResult[pos + 1] = '\0';
pShellItemArray->lpVtbl->Release(pShellItemArray);
IShellItemArray_Release(pShellItemArray);
}

pFileOpenDialog->lpVtbl->Release(pFileOpenDialog);
IFileOpenDialog_Release(pFileOpenDialog);
}
} else {
IShellItem* pShellItem;

if (SUCCEEDED(pFileDialog->lpVtbl->GetResult(pFileDialog, &pShellItem))) {
if (SUCCEEDED(IFileDialog_GetResult(pFileDialog, &pShellItem))) {
wchar_t* pBuffer;

if (SUCCEEDED(pShellItem->lpVtbl->GetDisplayName(pShellItem, SIGDN_FILESYSPATH, &pBuffer))) {
if (SUCCEEDED(IShellItem_GetDisplayName(pShellItem, SIGDN_FILESYSPATH, &pBuffer))) {
int c = WideCharToMultiByte(
#ifdef UNICODE
CP_UTF8,
Expand All @@ -1829,12 +1831,12 @@ BOOL ShowFileDialog(
CoTaskMemFree(pBuffer);
}

pShellItem->lpVtbl->Release(pShellItem);
IShellItem_Release(pShellItem);
}
}
}

pFileDialog->lpVtbl->Release(pFileDialog);
IFileDialog_Release(pFileDialog);
return hr == S_OK;
}

Expand Down
6 changes: 3 additions & 3 deletions interface/w32g_utl.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,16 +339,16 @@ extern int IniVersionCheck(void);
extern void BitBltRect(HDC dst, HDC src, const RECT *rc);

// mode option for ShowFileDialog()
enum {
typedef enum {
FILEDIALOG_OPEN_FILE,
FILEDIALOG_OPEN_MULTIPLE_FILES,
FILEDIALOG_OPEN_FOLDER,
FILEDIALOG_SAVE_FILE
};
} FILEDIALOG_MODE;

// pDirectory and pResult must point to an array of at least FILEPATH_MAX length!
extern BOOL ShowFileDialog(
int mode,
FILEDIALOG_MODE mode,
HWND hParentWindow,
LPCWSTR pTitle,
char *pResult,
Expand Down
2 changes: 1 addition & 1 deletion timidity/timidity.c
Original file line number Diff line number Diff line change
Expand Up @@ -9162,7 +9162,7 @@ int main(int argc, char **argv)

if (GetConsoleMode(hStdOut, &mode))
{
SetConsoleMode(hStdOut, mode | 0x0004 /* ENABLE_VIRTUAL_TERMINAL_PROCESSING */);
SetConsoleMode(hStdOut, mode | ENABLE_PROCESSED_OUTPUT | ENABLE_VIRTUAL_TERMINAL_PROCESSING);
}
}
}
Expand Down
8 changes: 3 additions & 5 deletions timidity/wasapi_a.c
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,6 @@ int open_output(void)
reset_temporary_encoding();
}
#endif
#ifdef __IAudioClient2_INTERFACE_DEFINED__
{
IAudioClient2 *pAudioClient2;
int ver = get_winver();
Expand All @@ -1037,15 +1036,15 @@ int open_output(void)

if (opt_wasapi_stream_option & 4) {
if (ver >= 6) // win10以上
acp.Options |= 4 /* AUDCLNT_STREAMOPTIONS_AMBISONICS */;
acp.Options |= AUDCLNT_STREAMOPTIONS_AMBISONICS;
}
if (opt_wasapi_stream_option & 2) {
if (ver >= 6) // win10以上
acp.Options |= 2 /* AUDCLNT_STREAMOPTIONS_MATCH_FORMAT */;
acp.Options |= AUDCLNT_STREAMOPTIONS_MATCH_FORMAT;
}
if (opt_wasapi_stream_option & 1){
if(ver >= 4) // win8.1以上
acp.Options |= 1 /* AUDCLNT_STREAMOPTIONS_RAW */;
acp.Options |= AUDCLNT_STREAMOPTIONS_RAW;
}

hr = IAudioClient2_SetClientProperties(pAudioClient2, (AudioClientProperties *)&acp);
Expand All @@ -1054,7 +1053,6 @@ int open_output(void)
goto error;
}
}
#endif
if(opt_wasapi_priority <= 0 || opt_wasapi_priority > 7)
ThreadPriorityNum = IsExclusive ? 6 : 1;
else
Expand Down

0 comments on commit fa8146f

Please sign in to comment.