| 4249 | ZRESULT lasterrorU=ZR_OK; |
| 4250 | |
| 4251 | unsigned int FormatZipMessageU(ZRESULT code, char *buf,unsigned int len) |
| 4252 | { if (code==ZR_RECENT) code=lasterrorU; |
| 4253 | const char *msg="unknown zip result code"; |
| 4254 | switch (code) |
| 4255 | { case ZR_OK: msg="Success"; break; |
| 4256 | case ZR_NODUPH: msg="Culdn't duplicate handle"; break; |
| 4257 | case ZR_NOFILE: msg="Couldn't create/open file"; break; |
| 4258 | case ZR_NOALLOC: msg="Failed to allocate memory"; break; |
| 4259 | case ZR_WRITE: msg="Error writing to file"; break; |
| 4260 | case ZR_NOTFOUND: msg="File not found in the zipfile"; break; |
| 4261 | case ZR_MORE: msg="Still more data to unzip"; break; |
| 4262 | case ZR_CORRUPT: msg="Zipfile is corrupt or not a zipfile"; break; |
| 4263 | case ZR_READ: msg="Error reading file"; break; |
| 4264 | case ZR_ARGS: msg="Caller: faulty arguments"; break; |
| 4265 | case ZR_PARTIALUNZ: msg="Caller: the file had already been partially unzipped"; break; |
| 4266 | case ZR_NOTMMAP: msg="Caller: can only get memory of a memory zipfile"; break; |
| 4267 | case ZR_MEMSIZE: msg="Caller: not enough space allocated for memory zipfile"; break; |
| 4268 | case ZR_FAILED: msg="Caller: there was a previous error"; break; |
| 4269 | case ZR_ENDED: msg="Caller: additions to the zip have already been ended"; break; |
| 4270 | case ZR_ZMODE: msg="Caller: mixing creation and opening of zip"; break; |
| 4271 | case ZR_NOTINITED: msg="Zip-bug: internal initialisation not completed"; break; |
| 4272 | case ZR_SEEK: msg="Zip-bug: trying to seek the unseekable"; break; |
| 4273 | case ZR_MISSIZE: msg="Zip-bug: the anticipated size turned out wrong"; break; |
| 4274 | case ZR_NOCHANGE: msg="Zip-bug: tried to change mind, but not allowed"; break; |
| 4275 | case ZR_FLATE: msg="Zip-bug: an internal error during flation"; break; |
| 4276 | } |
| 4277 | unsigned int mlen=(unsigned int)strlen(msg); |
| 4278 | if (buf==0 || len==0) return mlen; |
| 4279 | unsigned int n=mlen; if (n+1>len) n=len-1; |
| 4280 | strncpy(buf,msg,n); buf[n]=0; |
| 4281 | return mlen; |
| 4282 | } |
| 4283 | |
| 4284 | |
| 4285 | typedef struct |
nothing calls this directly
no outgoing calls
no test coverage detected