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
struct tableAcc {
IAccessibleVtbl *vtbl;
const IAccessibleVtbl *vtbl;
ULONG refcount;
struct table *t;
IAccessible *std;
@ -20,8 +20,7 @@ static HRESULT STDMETHODCALLTYPE tableAccQueryInterface(IAccessible *this, REFII
if (IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_IDispatch) ||
IsEqualIID(riid, &IID_IAccessible)) {
// TODO figure out what pointer to use here
TA->vtbl->AddRef(TA);
IAccessible_AddRef(this);
*ppvObject = (void *) this;
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->vtbl = &tableAccVtbl;
ta->vtbl->AddRef(ta);
// TODO
IAccessible_AddRef((IAccessible *) ta);
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)
// TODO panichresult
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)
{
ta->t = NULL;
ta->vtbl->Release(ta);
// TODO
IAccessible_Release((IAccessible *) ta);
}
HANDLER(accessibilityHandler)
{
if (uMsg != WM_GETOBJECT)
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;
*lResult = LresultFromObject(&IID_IAccessible, wParam, t->ta);
*lResult = LresultFromObject(&IID_IAccessible, wParam, (LPUNKNOWN) (t->ta));
// TODO check *lResult
return TRUE;
}

View File

@ -131,7 +131,6 @@ static void redrawCheckboxRect(struct table *t, LPARAM lParam)
{
struct rowcol rc;
RECT r;
POINT pt;
rc = lParamToRowColumn(t, lParam);
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)
{
intptr_t i, j;
int x = 0;
HFONT prevfont, newfont;
struct drawCellParams p;

View File

@ -1,5 +1,8 @@
// 7 january 2015
// TODO remove
#include <stdio.h>
// TODO
// - 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...")
@ -185,7 +188,7 @@ printf("destroy\n");
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");
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)
{
handlerfunc *p;
const handlerfunc *p;
for (p = list; *p != NULL; p++)
if ((*(*p))(t, uMsg, wParam, lParam, lResult))