Commit Graph

268 Commits

Author SHA1 Message Date
Pietro Gagliardi 4fae662575 Revert "Started restructuring common/errors.c to only produce a single error string (so we can pass it to Haiku's debugger() function without further allocations). In this case, the buffer size is 256 + the size of the prefix + the size of the suffix now."
Okay, this is actually going to be more complicated than I at first thought...

This reverts commit 44e13e53bf.
2020-02-09 20:49:47 -05:00
Pietro Gagliardi 44e13e53bf Started restructuring common/errors.c to only produce a single error string (so we can pass it to Haiku's debugger() function without further allocations). In this case, the buffer size is 256 + the size of the prefix + the size of the suffix now. 2020-02-09 18:27:19 -05:00
Pietro Gagliardi 83129eeef5 Normalized uiprivInternalError() calls to always try to fail gracefully, and make sure errors don't call abort() so we can resume when debugging (and because this isn't really our decision to make...). (The debugger breaks will be removed from release builds when we get to that point.) Finally, refined some TODOs and removed some stale ones (in this case, that were related to the first few things). 2020-02-09 13:37:45 -05:00
Pietro Gagliardi edee2b930c Re-added uiControlSetParent() to allow finishing testing uiControlFree() errors. That will come next, alongside its own errors. 2019-06-16 19:52:09 -04:00
Pietro Gagliardi fda6c4a743 And strengthened the uiControlType() test a bit. 2019-06-16 17:32:47 -04:00
Pietro Gagliardi c28adcbd01 Added test hook for checking a malformed uiControl whose type field is invalid. 2019-06-16 17:26:03 -04:00
Pietro Gagliardi 29ce809772 And FINALLY fixed the NULL name error in uiRegisterControlType(). 2019-06-15 21:38:21 -04:00
Pietro Gagliardi b6a8d24c3e And fixed const issues and other build errors. 2019-06-15 20:48:20 -04:00
Pietro Gagliardi 65226ac416 Refactored the programmer error test hook to not needlessly pass in the prefix, suffix, or internal flag, and to allow passing in arbitrary data so we can get rid of the global state in the tests. This will make the tests a LOT easier. 2019-06-09 13:49:53 -04:00
Pietro Gagliardi a2b9145931 Did the same rewording to most of the other programmer errors. Only the first two are left, because I can't think of a good rewording... 2019-06-09 13:39:14 -04:00
Pietro Gagliardi 87a2195027 Renamed the uiControl programmer errors to more clearly indicate they are uiControl programmer errors, and reworded their messages to put the function name first. 2019-06-09 13:32:31 -04:00
Pietro Gagliardi 0f41bb2188 Made all programmer error functions take the function name as an argument. 2019-06-09 13:18:18 -04:00
Pietro Gagliardi 9b11ec4a6f Changed the IntID error into a uiEvent-specific one. 2019-06-09 10:30:47 -04:00
Pietro Gagliardi 14c80eefb8 Started organizing common/programmererrors.h. 2019-06-09 10:27:28 -04:00
Pietro Gagliardi e808d85e01 Added function names to the wrong struct size error. 2019-06-09 08:50:12 -04:00
Pietro Gagliardi 379fc230e5 More compile fixes. sharedbits is starting to get really messy. 2019-06-08 18:39:59 -04:00
Pietro Gagliardi 22cc5ad834 More error fixing. 2019-06-08 18:22:16 -04:00
Pietro Gagliardi 19fc6f674f Oops, forgot to add controls.c to the build. 2019-06-08 18:09:37 -04:00
Pietro Gagliardi 9f776c140d Fixed compile errors. 2019-06-08 18:09:12 -04:00
Pietro Gagliardi 7aa1b0870d And finished filling in controls.c. This is gonna be fun to debug... 2019-06-08 15:31:40 -04:00
Pietro Gagliardi 1189877ca5 Started writing the uiControl implementation. 2019-06-08 13:00:30 -04:00
Pietro Gagliardi 6cf92b2058 Wrote and started testing uiEventInvalidateSender(). The rest of the tests come next. 2019-06-07 10:58:39 -04:00
Pietro Gagliardi 26e492539d Renamed uiFreeEvent() to uiEventFree() for consistency with uiControlFree(). 2019-06-02 22:04:25 -04:00
Pietro Gagliardi 9f2796ebac Added uiEventFree(). Now to add it to the tests and see what AddressSanitizer says afterward. 2019-06-02 10:06:50 -04:00
Pietro Gagliardi ece22bdddc Split programmer errors into their own header file for readability and turned the names from string constants into full-fledged uiprivProgrammerError() calls to increase safety. 2019-06-02 08:35:40 -04:00
Pietro Gagliardi 623575f25a Changed uiprivProgrammerError() to use format strings directly, so errors can be more easily caught. We'll make things even more robust when I change the programmer error macros to be functions. 2019-06-02 02:23:12 -04:00
Pietro Gagliardi 8980a8663b Cleaned up a TODO. 2019-06-01 20:46:41 -04:00
Pietro Gagliardi 6ffe0a4c99 Added functionality to mark printf() functions for compilers with warning checks, and marked such. Sadly it appears ms_printf is ignored with -pedantic, so we'll need to stop using I32... 2019-06-01 20:20:11 -04:00
Pietro Gagliardi a8ad49fead Made the names of format string arguments across the board consistent. Only the "public" functions in the testing library are kept expanded for documentation purposes. 2019-06-01 11:40:16 -04:00
Pietro Gagliardi 76fabb37cf Renamed common/init.c to common/main.c. 2019-06-01 11:24:34 -04:00
Pietro Gagliardi 48cd6e1dd8 Cleaned #include directives so C standard library headers are sorted and so each source file only includes one header file. This makes things clenaer, and alos allows us to more properly strip unneeded headers later. 2019-06-01 09:27:17 -04:00
Pietro Gagliardi 7d0f8403ab Fixed build errors on other platforms. This is a headache and a half :D I should split the files into strsafe_vsnprintf and strsafe_strncpy, but I want to share this file as is in one piece for now. 2019-05-31 22:07:51 -04:00
Pietro Gagliardi a17b7c8c14 Fixed build errors and simplified error handling in test/noinitwrongthread.c. Now to test this at runtime on all platforms. 2019-05-31 11:17:11 -04:00
Pietro Gagliardi 644e188e05 And rewrote strncpy(), since strncpy_s() also exists. Now to test the build. 2019-05-31 10:38:47 -04:00
Pietro Gagliardi 1814745646 Wrote a wrapper for vsnprintf() that calls _vcsprintf()/vsnprintf_s() on Windows, because lol. I'm going to try switching from strcpy() to strncpy() for the other cases; let's see if this works. 2019-05-31 02:52:51 -04:00
Pietro Gagliardi 3ddaf3052e Fixed build issues on other platforms. That dumb msvcrt macro is next. 2019-05-31 00:24:12 -04:00
Pietro Gagliardi b5a109c063 And wrote array_impl.h. No more code duplication in this respect! Now for some more loose ends before we move on to controls. 2019-05-31 00:12:08 -04:00
Pietro Gagliardi dca2e5f038 Wrote array_header.h. Now for array_impl.h. 2019-05-30 23:47:07 -04:00
Pietro Gagliardi 0f4602ee0f Moved the allocation functions to sharedbits/. Not fully working yet... 2019-05-30 23:11:08 -04:00
Pietro Gagliardi 9daef443b2 Moved uiQueueMain() to common/init.c to avoid having multiple initialized variables; the per-OS versions are now uiprivSysQueueMain(). Also more TODOs. 2019-05-30 01:39:43 -04:00
Pietro Gagliardi ab5b3076ed Removed uiInitError length checking and just truncated too-long messages with an ellipsis. Also removed the non-printf version of uiprivReportInitError. 2019-05-30 01:16:33 -04:00
Pietro Gagliardi 19ad0d33a3 Changed uiInit() to return bool instead of int, now that we've settled on using bool. 2019-05-29 21:10:44 -04:00
Pietro Gagliardi fd770430a9 And properly added init and thread checks to the uiEvent functions. Now we just need to do the same on the other platforms and THEN FINALLY we can move on to controls. 2019-05-29 00:41:36 -04:00
Pietro Gagliardi b5927353e0 Started work to test that functions dislike being called before uiInit() or on a different thread; better to do it now than later. 2019-05-28 21:54:13 -04:00
Pietro Gagliardi b3f2214f3e okay what the fuck 2019-05-27 11:36:59 -04:00
Pietro Gagliardi 79ecadb909 Fuck the industry domination of C++ and its standard not forcing compliance in both C and C++ modes, if this is the case here. If not, then fuck MSVC. 2019-05-27 11:18:52 -04:00
Pietro Gagliardi a6c1e1ed17 Fixed build errors. Now to fix runtime errors. 2019-05-27 11:02:23 -04:00
Pietro Gagliardi 7808b3ee94 Added the hook for checking programmer error responses, and made sure it works. Now to simplify it. 2019-05-26 15:41:22 -04:00
Pietro Gagliardi 9f0bb3aacb Fixed uiprivArray/testingprivArray bugs that led to the crash. Now to fix up the rest of the code. 2019-05-20 11:12:16 -04:00
Pietro Gagliardi 9bec2005a1 Added smprintf() and outbuf to the testingpriv.h functions, introducing a simpler outbuf API along the way. Changing the test suite to actually use this comes next. 2019-05-19 23:15:35 -04:00