Skip to content

Commit

Permalink
test4
Browse files Browse the repository at this point in the history
  • Loading branch information
lrisora committed Aug 17, 2024
1 parent c36f42f commit 59bda07
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions MusicPlayer2/Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1822,12 +1822,12 @@ string CCommon::GetPngImageResourceData(UINT id)
HINSTANCE hIns = AfxGetInstanceHandle();
HRSRC hRsrc = ::FindResource(hIns, MAKEINTRESOURCE(id), _T("PNG")); // type
if (!hRsrc)
return nullptr;
return string();
// load resource into memory
DWORD len = SizeofResource(hIns, hRsrc);
BYTE* lpRsrc = (BYTE*)LoadResource(hIns, hRsrc);
if (!lpRsrc)
return nullptr;
return string();
string data((const char*)lpRsrc, len);
FreeResource(lpRsrc);
return data;
Expand Down
4 changes: 2 additions & 2 deletions MusicPlayer2/MusicPlayer2.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp20</LanguageStandard>
<LanguageStandard>stdcpplatest</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand Down Expand Up @@ -193,7 +193,7 @@
<PreprocessorDefinitions>_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<SDLCheck>true</SDLCheck>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<LanguageStandard>stdcpp20</LanguageStandard>
<LanguageStandard>stdcpplatest</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
Expand Down
4 changes: 2 additions & 2 deletions MusicPlayer2/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,11 @@ class CPlayer
static CPlayer m_instance; //CPlayer类唯一的对象
CCriticalSection m_critical;
CCriticalSection m_album_cover_sync; //用于专辑封面的线程同步对象
std::mutex m_play_status_sync; // 更改播放状态时加锁,请使用GetPlayStatusMutex获取
std::timed_mutex m_play_status_sync; // 更改播放状态时加锁,请使用GetPlayStatusMutex获取
public:
// 在“稳态”(稳定的播放/暂停/停止)之间切换期间请先持有此锁
// 避免其他线程中途介入以及当前操作发生重入
std::mutex& GetPlayStatusMutex() { return m_play_status_sync; }
std::timed_mutex& GetPlayStatusMutex() { return m_play_status_sync; }

public:
//获取CPlayer类的唯一的对象
Expand Down

0 comments on commit 59bda07

Please sign in to comment.