diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-12-29 16:38:08 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-12-29 16:38:08 +0300 |
commit | 0a8a00cd1060ee7aa9eae4223fc8c2577533247f (patch) | |
tree | 6dc09a68c1d8e35bd807d784f3507b57c9c1f62f /source/blender/blenlib/intern/BLI_dynstr.c | |
parent | d51bc24384a70f3cdcd4b72091873c96d542d642 (diff) |
2.5: Error reporting
* Added a report list to operator, to which they can report errors and
warnings. When the operator ends, it will display them with a popup. For
python these should become exceptions when calling operators.
* Added a function to make a popup menu from a report list.
* Also added a utility function to prepend a string before the reports to
indicate what they relates to. Also made the report functions used
BLI_dynstr to simplify the code.
* Made file reading and writing report errors to the user again using this
system, also replacing the left over uncommented bad level error() calls.
Diffstat (limited to 'source/blender/blenlib/intern/BLI_dynstr.c')
-rw-r--r-- | source/blender/blenlib/intern/BLI_dynstr.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/source/blender/blenlib/intern/BLI_dynstr.c b/source/blender/blenlib/intern/BLI_dynstr.c index 1c539af2957..04388ea946f 100644 --- a/source/blender/blenlib/intern/BLI_dynstr.c +++ b/source/blender/blenlib/intern/BLI_dynstr.c @@ -83,9 +83,8 @@ void BLI_dynstr_append(DynStr *ds, const char *cstr) { ds->curlen+= cstrlen; } -void BLI_dynstr_appendf(DynStr *ds, const char *format, ...) +void BLI_dynstr_vappendf(DynStr *ds, const char *format, va_list args) { - va_list args; char *message, fixedmessage[256]; int len= 256, maxlen= 65536, retval; @@ -95,9 +94,7 @@ void BLI_dynstr_appendf(DynStr *ds, const char *format, ...) else message= MEM_callocN(sizeof(char)*len+1, "BLI_dynstr_appendf"); - va_start(args, format); retval= vsnprintf(message, len, format, args); - va_end(args); if(retval == -1) { /* -1 means not enough space, but on windows it may also mean @@ -132,6 +129,15 @@ void BLI_dynstr_appendf(DynStr *ds, const char *format, ...) } } +void BLI_dynstr_appendf(DynStr *ds, const char *format, ...) +{ + va_list args; + + va_start(args, format); + BLI_dynstr_vappendf(ds, format, args); + va_end(args); +} + int BLI_dynstr_get_len(DynStr *ds) { return ds->curlen; } |