QtBase  v6.3.1
cborerrorstrings.c
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2021 Intel Corporation
4 **
5 ** Permission is hereby granted, free of charge, to any person obtaining a copy
6 ** of this software and associated documentation files (the "Software"), to deal
7 ** in the Software without restriction, including without limitation the rights
8 ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 ** copies of the Software, and to permit persons to whom the Software is
10 ** furnished to do so, subject to the following conditions:
11 **
12 ** The above copyright notice and this permission notice shall be included in
13 ** all copies or substantial portions of the Software.
14 **
15 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 ** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 ** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 ** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 ** THE SOFTWARE.
22 **
23 ****************************************************************************/
24 
25 #include "cbor.h"
26 
27 #ifndef _
28 # define _(msg) msg
29 #endif
30 
81 {
82  switch (error) {
83  case CborNoError:
84  return "";
85 
86  case CborUnknownError:
87  return _("unknown error");
88 
90  return _("out of memory/need more memory");
91 
93  return _("unknown length (attempted to get the length of a map/array/string of indeterminate length");
94 
96  return _("attempted to advance past EOF");
97 
98  case CborErrorIO:
99  return _("I/O error");
100 
102  return _("garbage after the end of the content");
103 
105  return _("unexpected end of data");
106 
108  return _("unexpected 'break' byte");
109 
111  return _("illegal byte (encodes future extension type)");
112 
114  return _("mismatched string type in chunked string");
115 
117  return _("illegal initial byte (encodes unspecified additional information)");
118 
120  return _("illegal encoding of simple type smaller than 32");
121 
123  return _("no more byte or text strings available");
124 
126  return _("unknown simple type");
127 
128  case CborErrorUnknownTag:
129  return _("unknown tag");
130 
132  return _("inappropriate tag for type");
133 
135  return _("duplicate keys in object");
136 
138  return _("invalid UTF-8 content in string");
139 
141  return _("excluded type found");
142 
144  return _("excluded value found");
145 
148  return _("value encoded in non-canonical form");
149 
152  return _("key in map is not a string");
153 
155  return _("map is not sorted");
156 
158  return _("map keys are not unique");
159 
161  return _("too many items added to encoder");
162 
164  return _("too few items added to encoder");
165 
167  return _("internal error: data too large");
168 
170  return _("internal error: too many nested containers found in recursive function");
171 
173  return _("unsupported type");
174 
176  return _("validation not implemented for the current parser state");
177 
179  return _("conversion to JSON failed: key in object is an array or map");
180 
182  return _("conversion to JSON failed: open_memstream unavailable");
183 
185  return _("internal error");
186  }
188 }
CborError
Definition: cbor.h:152
@ CborErrorInternalError
Definition: cbor.h:201
@ CborErrorUnknownType
Definition: cbor.h:165
@ CborErrorIllegalSimpleType
Definition: cbor.h:168
@ CborErrorInvalidUtf8TextString
Definition: cbor.h:176
@ CborErrorDataTooLarge
Definition: cbor.h:190
@ CborErrorImproperValue
Definition: cbor.h:179
@ CborErrorTooFewItems
Definition: cbor.h:187
@ CborErrorUnsupportedType
Definition: cbor.h:192
@ CborErrorNestingTooDeep
Definition: cbor.h:191
@ CborErrorOverlongEncoding
Definition: cbor.h:180
@ CborErrorNoMoreStringChunks
Definition: cbor.h:169
@ CborErrorUnimplementedValidation
Definition: cbor.h:193
@ CborErrorInappropriateTagForType
Definition: cbor.h:174
@ CborErrorMapKeyNotString
Definition: cbor.h:181
@ CborErrorJsonObjectKeyIsAggregate
Definition: cbor.h:196
@ CborErrorUnknownLength
Definition: cbor.h:157
@ CborErrorAdvancePastEOF
Definition: cbor.h:158
@ CborErrorUnknownTag
Definition: cbor.h:173
@ CborErrorExcludedValue
Definition: cbor.h:178
@ CborErrorIO
Definition: cbor.h:159
@ CborErrorGarbageAtEnd
Definition: cbor.h:162
@ CborErrorMapKeysNotUnique
Definition: cbor.h:183
@ CborErrorDuplicateObjectKeys
Definition: cbor.h:175
@ CborErrorExcludedType
Definition: cbor.h:177
@ CborErrorOutOfMemory
Definition: cbor.h:200
@ CborErrorJsonObjectKeyNotString
Definition: cbor.h:197
@ CborUnknownError
Definition: cbor.h:156
@ CborErrorUnexpectedBreak
Definition: cbor.h:164
@ CborErrorMapNotSorted
Definition: cbor.h:182
@ CborErrorUnknownSimpleType
Definition: cbor.h:172
@ CborNoError
Definition: cbor.h:153
@ CborErrorIllegalType
Definition: cbor.h:166
@ CborErrorTooManyItems
Definition: cbor.h:186
@ CborErrorIllegalNumber
Definition: cbor.h:167
@ CborErrorJsonNotImplemented
Definition: cbor.h:198
@ CborErrorUnexpectedEOF
Definition: cbor.h:163
#define _(msg)
const char * cbor_error_string(CborError error)
FT_Error error
Definition: cffdrivr.c:657