Squash  0.7.0
status.c
1 /* Copyright (c) 2013 The Squash Authors
2  *
3  * Permission is hereby granted, free of charge, to any person
4  * obtaining a copy of this software and associated documentation
5  * files (the "Software"), to deal in the Software without
6  * restriction, including without limitation the rights to use, copy,
7  * modify, merge, publish, distribute, sublicense, and/or sell copies
8  * of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be
12  * included in all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
18  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
19  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21  * SOFTWARE.
22  *
23  * Authors:
24  * Evan Nemerson <evan@nemerson.com>
25  */
26 
27 #include "internal.h"
28 
29 #include <assert.h>
30 
120 const char*
122  switch (status) {
123  case SQUASH_OK:
124  return "Operation completed successfully";
125  case SQUASH_PROCESSING:
126  return "Operation partially completed";
128  return "End of stream reached";
129  case SQUASH_FAILED:
130  return "Operation failed";
132  return "Unable to load the requested resource";
133  case SQUASH_BAD_PARAM:
134  return "One or more of the parameters were not valid";
135  case SQUASH_BAD_VALUE:
136  return "One or more parameter values was not valid";
137  case SQUASH_MEMORY:
138  return "Not enough memory is available";
139  case SQUASH_BUFFER_FULL:
140  return "Insufficient space in buffer";
141  case SQUASH_BUFFER_EMPTY:
142  return "Unable to read from buffer";
143  case SQUASH_STATE:
144  return "Performing the requested operation from the current state is not supported";
146  return "The requested operation is not available";
147  case SQUASH_NOT_FOUND:
148  return "The requested codec could not be found";
150  return "Invalid buffer";
151  case SQUASH_IO:
152  return "I/O error";
153  default:
154  return "Unknown.";
155  }
156 }
157 
174  assert (status < SQUASH_OK);
175  return status;
176 }
177 
Performing the requested operation from the current state is not supported.
Definition: status.h:48
Supplied buffer was empty.
Definition: status.h:47
The requested operation is not available.
Definition: status.h:49
Operation failed.
Definition: status.h:41
A buffer passed to squash was invalid.
Definition: status.h:51
Reached the end of the stream while decoding.
Definition: status.h:39
Operation partially completed.
Definition: status.h:38
The requested codec could not be found.
Definition: status.h:50
const char * squash_status_to_string(SquashStatus status)
Get a string representation of a status code.
Definition: status.c:121
Insufficient space in buffer.
Definition: status.h:46
Not enough memory is available.
Definition: status.h:45
SquashStatus
Status codes.
Definition: status.h:36
SquashStatus squash_error(SquashStatus status)
Emit an error.
Definition: status.c:173
One or more parameter values was not valid.
Definition: status.h:44
Unable to load the requested resource.
Definition: status.h:42
Operation completed successfully.
Definition: status.h:37
One or more of the parameters were not valid.
Definition: status.h:43