Skip to content

Commit

Permalink
Fix const-correctness in DirectShow library
Browse files Browse the repository at this point in the history
  • Loading branch information
samhocevar committed Feb 2, 2024
1 parent 35df1c8 commit 904ec03
Showing 6 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -23,8 +23,8 @@ const DWORD bits888[] = {0xFF0000,0x00FF00,0x0000FF};
const struct {
const GUID *pSubtype;
WORD BitCount;
CHAR *pName;
WCHAR *wszName;
const CHAR *pName;
const WCHAR *wszName;
} BitCountMap[] = { &MEDIASUBTYPE_RGB1, 1, "RGB Monochrome", L"RGB Monochrome",
&MEDIASUBTYPE_RGB4, 4, "RGB VGA", L"RGB VGA",
&MEDIASUBTYPE_RGB8, 8, "RGB 8", L"RGB 8",
@@ -173,12 +173,12 @@ int LocateSubtype(const GUID *pSubtype)



STDAPI_(WCHAR *) GetSubtypeNameW(const GUID *pSubtype)
STDAPI_(const WCHAR *) GetSubtypeNameW(const GUID *pSubtype)
{
return BitCountMap[LocateSubtype(pSubtype)].wszName;
}

STDAPI_(CHAR *) GetSubtypeNameA(const GUID *pSubtype)
STDAPI_(const CHAR *) GetSubtypeNameA(const GUID *pSubtype)
{
return BitCountMap[LocateSubtype(pSubtype)].pName;
}
@@ -190,7 +190,7 @@ STDAPI_(CHAR *) GetSubtypeNameA(const GUID *pSubtype)

// this is here for people that linked to it directly; most people
// would use the header file that picks the A or W version.
STDAPI_(CHAR *) GetSubtypeName(const GUID *pSubtype)
STDAPI_(const CHAR *) GetSubtypeName(const GUID *pSubtype)
{
return GetSubtypeNameA(pSubtype);
}
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@
// buffer in the property page class and use it for all string loading. It
// cannot be static as multiple property pages may be active simultaneously

LPTSTR WINAPI StringFromResource(__out_ecount(STR_MAX_LENGTH) LPTSTR pBuffer, int iResourceID)
LPCTSTR WINAPI StringFromResource(__out_ecount(STR_MAX_LENGTH) LPTSTR pBuffer, int iResourceID)
{
if (LoadString(g_hInst,iResourceID,pBuffer,STR_MAX_LENGTH) == 0) {
return TEXT("");
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@
// resource ID of a dialog box and returns the size of it in screen pixels

#define STR_MAX_LENGTH 256
LPTSTR WINAPI StringFromResource(__out_ecount(STR_MAX_LENGTH) LPTSTR pBuffer, int iResourceID);
LPCTSTR WINAPI StringFromResource(__out_ecount(STR_MAX_LENGTH) LPTSTR pBuffer, int iResourceID);

#ifdef UNICODE
#define WideStringFromResource StringFromResource
Original file line number Diff line number Diff line change
@@ -86,7 +86,7 @@ bool g_fAutoRefreshLevels = false;

LPCTSTR pBaseKey = TEXT("SOFTWARE\\Microsoft\\DirectShow\\Debug");
LPCTSTR pGlobalKey = TEXT("GLOBAL");
static CHAR *pUnknownName = "UNKNOWN";
static const CHAR *pUnknownName = "UNKNOWN";

LPCTSTR TimeoutName = TEXT("TIMEOUT");

@@ -1086,7 +1086,7 @@ void WINAPI DbgSetWaitTimeout(DWORD dwTimeout)
CGuidNameList GuidNames;
int g_cGuidNames = sizeof(g_GuidNames) / sizeof(g_GuidNames[0]);

char *CGuidNameList::operator [] (const GUID &guid)
const char *CGuidNameList::operator [] (const GUID &guid)
{
for (int i = 0; i < g_cGuidNames; i++) {
if (g_GuidNames[i].guid == guid) {
Original file line number Diff line number Diff line change
@@ -254,13 +254,13 @@ typedef struct tag_ObjectDesc {
// Returns the name defined in uuids.h as a string

typedef struct {
CHAR *szName;
const CHAR *szName;
GUID guid;
} GUID_STRING_ENTRY;

class CGuidNameList {
public:
CHAR *operator [] (const GUID& guid);
const CHAR *operator [] (const GUID& guid);
};

extern CGuidNameList GuidNames;
Original file line number Diff line number Diff line change
@@ -408,8 +408,8 @@ STDAPI_(WORD) GetBitCount(const GUID *pSubtype);
//
// STDAPI_(/* T */ CHAR *) GetSubtypeName(const GUID *pSubtype);

STDAPI_(CHAR *) GetSubtypeNameA(const GUID *pSubtype);
STDAPI_(WCHAR *) GetSubtypeNameW(const GUID *pSubtype);
STDAPI_(const CHAR *) GetSubtypeNameA(const GUID *pSubtype);
STDAPI_(const WCHAR *) GetSubtypeNameW(const GUID *pSubtype);

#ifdef UNICODE
#define GetSubtypeName GetSubtypeNameW

0 comments on commit 904ec03

Please sign in to comment.