Fixed some things so far. It looks like I can't have __FILE__, etc. turned into wide strings because the way to do so works *ahead of time* :| Have to restructure debug.cpp.
This commit is contained in:
parent
ee6fa439f7
commit
050cc3aa16
|
@ -33,12 +33,15 @@ CFLAGS += \
|
|||
-bigobj -nologo \
|
||||
-RTC1 -RTCc -RTCs -RTCu
|
||||
|
||||
# TODO prune these
|
||||
# -EHsc is to shut the compiler up in some cases
|
||||
CXXFLAGS += \
|
||||
-W4 \
|
||||
-wd4100 \
|
||||
-TP \
|
||||
-bigobj -nologo \
|
||||
-RTC1 -RTCc -RTCs -RTCu
|
||||
-RTC1 -RTCc -RTCs -RTCu \
|
||||
-EHsc
|
||||
|
||||
# TODO warnings on undefined symbols
|
||||
LDFLAGS += \
|
||||
|
|
|
@ -56,7 +56,7 @@ _UI_EXTERN void uiWindowsControlQueueRelayout(uiWindowsControl *);
|
|||
} \
|
||||
static void _ ## type ## Relayout(uiWindowsControl *c, intmax_t x, intmax_t y, intmax_t width, intmax_t height) \
|
||||
{ \
|
||||
uiWindowsEnsureMoveWindow(type(c)->hwnd, x, y, width, height); \
|
||||
uiWindowsEnsureMoveWindowDuringResize(type(c)->hwnd, x, y, width, height); \
|
||||
} \
|
||||
static void minimumSize(uiWindowsControl *c, uiWindowsSizing *d, intmax_t *width, intmax_t *height); \
|
||||
static void _ ## type ## AssignControlIDZOrder(uiWindowsControl *c, LONG_PTR *controlID, HWND *insertAfter) \
|
||||
|
|
|
@ -29,18 +29,21 @@ void uninitAlloc(void)
|
|||
complain("either you left something around or there's a bug in libui");
|
||||
}
|
||||
|
||||
#define rawBytes(pa) (&((*pa)[0]))
|
||||
|
||||
void *uiAlloc(size_t size, const char *type)
|
||||
{
|
||||
byteArray *out;
|
||||
|
||||
out = new byteArray(size, 0);
|
||||
heap[&out[0]] = out;
|
||||
heap[rawBytes(out)] = out;
|
||||
types[out] = type;
|
||||
return &out[0];
|
||||
return rawBytes(out);
|
||||
}
|
||||
|
||||
void *uiRealloc(void *p, size_t size, const char *type)
|
||||
void *uiRealloc(void *_p, size_t size, const char *type)
|
||||
{
|
||||
uint8_t *p = (uint8_t *) _p;
|
||||
byteArray *arr;
|
||||
|
||||
if (p == NULL)
|
||||
|
@ -48,12 +51,14 @@ void *uiRealloc(void *p, size_t size, const char *type)
|
|||
arr = heap[p];
|
||||
arr->resize(size, 0);
|
||||
heap.erase(p);
|
||||
heap[&arr[0]] = arr;
|
||||
return &arr[0];
|
||||
heap[rawBytes(arr)] = arr;
|
||||
return rawBytes(arr);
|
||||
}
|
||||
|
||||
void uiFree(void *p)
|
||||
void uiFree(void *_p)
|
||||
{
|
||||
uint8_t *p = (uint8_t *) _p;
|
||||
|
||||
if (p == NULL)
|
||||
complain("attempt to uiFree(NULL); there's a bug somewhere");
|
||||
types.erase(heap[p]);
|
||||
|
|
|
@ -35,19 +35,22 @@ extern char *toUTF8(const WCHAR *wstr);
|
|||
extern WCHAR *utf16dup(const WCHAR *orig);
|
||||
extern WCHAR *strf(const WCHAR *format, ...);
|
||||
extern WCHAR *vstrf(const WCHAR *format, va_list ap);
|
||||
extern WCHAR *debugstrf(const WCHAR *format, ..);
|
||||
extern WCHAR *debugstrf(const WCHAR *format, ...);
|
||||
extern WCHAR *debugvstrf(const WCHAR *format, va_list ap);
|
||||
extern char *LFtoCRLF(const char *lfonly);
|
||||
extern void CRLFtoLF(const char *s);
|
||||
|
||||
// debug.cpp
|
||||
#define debugargs const WCHAR *file, uintmax_t line, const WCHAR *file
|
||||
extern HRESULT _logLastError(debugargs, const WCHAR *func, const WCHAR *s);
|
||||
#define logLastError(s) _logLastError(L ## __FILE__, __LINE__, L ## __func__, s)
|
||||
// see http://stackoverflow.com/questions/14421656/is-there-widely-available-wide-character-variant-of-file
|
||||
// TODO turn line into a const WCHAR* this way
|
||||
#define _ws(m) L ## m
|
||||
#define debugargs const WCHAR *file, uintmax_t line, const WCHAR *func
|
||||
extern HRESULT _logLastError(debugargs, const WCHAR *s);
|
||||
#define logLastError(s) _logLastError(_ws(__FILE__), __LINE__, _ws(__func__), s)
|
||||
extern HRESULT _logHRESULT(debugargs, const WCHAR *s, HRESULT hr);
|
||||
#define logHRESULT(s, hr) _logHRESULT(L ## __FILE__, __LINE__, L ## __func__, s, hr)
|
||||
#define logHRESULT(s, hr) _logHRESULT(_ws(__FILE__), __LINE__, _ws(__func__), s, hr)
|
||||
extern void _implbug(debugargs, const WCHAR *format, ...);
|
||||
#define implbug(...) _implbug(L ## __FILE__, __LINE__, L ## __func__, __VA_LIST__)
|
||||
#define implbug(...) _implbug(_ws(__FILE__), __LINE__, _ws(__func__), __VA_LIST__)
|
||||
|
||||
// winutil.cpp
|
||||
extern int windowClassOf(HWND hwnd, ...);
|
||||
|
|
Loading…
Reference in New Issue