Fixed all real warnings. I need to figure out how to remove -Wparentheses suggestions from qo.

This commit is contained in:
Pietro Gagliardi 2015-02-13 16:19:54 -05:00
parent 4b9e2fb8d1
commit 980e36a0f0
5 changed files with 20 additions and 12 deletions

View File

@ -1,7 +1,7 @@
// 24 december 2014 // 24 december 2014
struct tableAcc { struct tableAcc {
IAccessibleVtbl *vtbl; const IAccessibleVtbl *vtbl;
ULONG refcount; ULONG refcount;
struct table *t; struct table *t;
IAccessible *std; IAccessible *std;
@ -20,8 +20,7 @@ static HRESULT STDMETHODCALLTYPE tableAccQueryInterface(IAccessible *this, REFII
if (IsEqualIID(riid, &IID_IUnknown) || if (IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_IDispatch) || IsEqualIID(riid, &IID_IDispatch) ||
IsEqualIID(riid, &IID_IAccessible)) { IsEqualIID(riid, &IID_IAccessible)) {
// TODO figure out what pointer to use here IAccessible_AddRef(this);
TA->vtbl->AddRef(TA);
*ppvObject = (void *) this; *ppvObject = (void *) this;
return S_OK; return S_OK;
} }
@ -218,9 +217,10 @@ static struct tableAcc *newTableAcc(struct table *t)
ta = (struct tableAcc *) tableAlloc(sizeof (struct tableAcc), "error creating Table accessibility object"); ta = (struct tableAcc *) tableAlloc(sizeof (struct tableAcc), "error creating Table accessibility object");
ta->vtbl = &tableAccVtbl; ta->vtbl = &tableAccVtbl;
ta->vtbl->AddRef(ta); // TODO
IAccessible_AddRef((IAccessible *) ta);
ta->t = t; ta->t = t;
hr = CreateStdAccessibleObject(t->hwnd, OBJID_CLIENT, &IID_IAccessible, &std); hr = CreateStdAccessibleObject(t->hwnd, OBJID_CLIENT, &IID_IAccessible, (void *) (&std));
if (hr != S_OK) if (hr != S_OK)
// TODO panichresult // TODO panichresult
panic("error creating standard accessible object for Table"); panic("error creating standard accessible object for Table");
@ -234,16 +234,23 @@ static struct tableAcc *newTableAcc(struct table *t)
static void freeTableAcc(struct tableAcc *ta) static void freeTableAcc(struct tableAcc *ta)
{ {
ta->t = NULL; ta->t = NULL;
ta->vtbl->Release(ta); // TODO
IAccessible_Release((IAccessible *) ta);
} }
HANDLER(accessibilityHandler) HANDLER(accessibilityHandler)
{ {
if (uMsg != WM_GETOBJECT) if (uMsg != WM_GETOBJECT)
return FALSE; return FALSE;
if (((DWORD) lParam) != OBJID_CLIENT) // OBJID_CLIENT evaluates to an expression of type LONG
// the documentation for WM_GETOBJECT says to cast "it" to a DWORD before comparing
// https://msdn.microsoft.com/en-us/library/windows/desktop/dd373624%28v=vs.85%29.aspx casts them both to DWORDs; let's do that
// its two siblings only cast lParam, resulting in an erroneous DWORD to LONG comparison
// The Old New Thing book does not cast anything
// Microsoft's MSAA sample casts lParam to LONG instead!
if (((DWORD) lParam) != ((DWORD) OBJID_CLIENT))
return FALSE; return FALSE;
*lResult = LresultFromObject(&IID_IAccessible, wParam, t->ta); *lResult = LresultFromObject(&IID_IAccessible, wParam, (LPUNKNOWN) (t->ta));
// TODO check *lResult // TODO check *lResult
return TRUE; return TRUE;
} }

View File

@ -131,7 +131,6 @@ static void redrawCheckboxRect(struct table *t, LPARAM lParam)
{ {
struct rowcol rc; struct rowcol rc;
RECT r; RECT r;
POINT pt;
rc = lParamToRowColumn(t, lParam); rc = lParamToRowColumn(t, lParam);
if (rc.row == -1 && rc.column == -1) if (rc.row == -1 && rc.column == -1)

View File

@ -140,7 +140,6 @@ static void drawCell(struct table *t, HDC dc, struct drawCellParams *p)
static void draw(struct table *t, HDC dc, RECT cliprect, RECT client) static void draw(struct table *t, HDC dc, RECT cliprect, RECT client)
{ {
intptr_t i, j; intptr_t i, j;
int x = 0;
HFONT prevfont, newfont; HFONT prevfont, newfont;
struct drawCellParams p; struct drawCellParams p;

View File

@ -1,5 +1,8 @@
// 7 january 2015 // 7 january 2015
// TODO remove
#include <stdio.h>
// TODO // TODO
// - should tablePanic be CALLBACK or some other equivalent macro? and definitely export initTable somehow, but which alias macro to use? // - should tablePanic be CALLBACK or some other equivalent macro? and definitely export initTable somehow, but which alias macro to use?
// - make panic messages grammatically correct ("Table error: adding...") // - make panic messages grammatically correct ("Table error: adding...")
@ -185,7 +188,7 @@ printf("destroy\n");
static void deftablePanic(const char *msg, DWORD lastError) static void deftablePanic(const char *msg, DWORD lastError)
{ {
fprintf(stderr, "Table error: %s (last error %d)\n", msg, lastError); fprintf(stderr, "Table error: %s (last error %I32u)\n", msg, lastError);
fprintf(stderr, "This is the default Table error handler function; programs that use Table should provide their own instead.\nThe program will now break into the debugger.\n"); fprintf(stderr, "This is the default Table error handler function; programs that use Table should provide their own instead.\nThe program will now break into the debugger.\n");
DebugBreak(); DebugBreak();
} }

View File

@ -5,7 +5,7 @@ typedef BOOL (*handlerfunc)(struct table *, UINT, WPARAM, LPARAM, LRESULT *);
static BOOL runHandlers(const handlerfunc list[], struct table *t, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *lResult) static BOOL runHandlers(const handlerfunc list[], struct table *t, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *lResult)
{ {
handlerfunc *p; const handlerfunc *p;
for (p = list; *p != NULL; p++) for (p = list; *p != NULL; p++)
if ((*(*p))(t, uMsg, wParam, lParam, lResult)) if ((*(*p))(t, uMsg, wParam, lParam, lResult))