Mercurial > hg > dmlib
comparison tests/dzlibtest.c @ 2004:161e731eb152
Improve dmGetIntVal() to accept an optional negative value boolean flag
pointer. Also improve error handling in it.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 07 Jul 2018 01:11:22 +0300 |
parents | cd5643794195 |
children | 647671a9a0b8 |
comparison
equal
deleted
inserted
replaced
2003:2ae47dcaaf10 | 2004:161e731eb152 |
---|---|
59 optUseZLIB = TRUE; | 59 optUseZLIB = TRUE; |
60 optCompress = TRUE; | 60 optCompress = TRUE; |
61 break; | 61 break; |
62 | 62 |
63 case 4: | 63 case 4: |
64 if (!dmGetIntVal(optArg, &optCompressLevel) || | 64 if (!dmGetIntVal(optArg, &optCompressLevel, NULL) || |
65 optCompressLevel < 1 || optCompressLevel > 9) | 65 optCompressLevel < 1 || optCompressLevel > 9) |
66 { | 66 { |
67 dmErrorMsg("Invalid compression level argument '%s', must be 1 .. 9.\n", optArg); | 67 dmErrorMsg("Invalid compression level argument '%s', must be 1 .. 9.\n", optArg); |
68 return FALSE; | 68 return FALSE; |
69 } | 69 } |
70 break; | 70 break; |
71 | 71 |
72 case 5: | 72 case 5: |
73 if (!dmGetIntVal(optArg, &optSkip)) | 73 if (!dmGetIntVal(optArg, &optSkip, NULL)) |
74 { | 74 { |
75 dmErrorMsg("Invalid skip value.\n", optArg); | 75 dmErrorMsg("Invalid skip value '%s'.\n", optArg); |
76 return FALSE; | 76 return FALSE; |
77 } | 77 } |
78 break; | 78 break; |
79 | 79 |
80 default: | 80 default: |