| 4048 | ZRESULT lasterrorU=ZR_OK; |
| 4049 | |
| 4050 | unsigned int FormatZipMessageU(ZRESULT code, TCHAR *buf,unsigned int len) |
| 4051 | { if (code==ZR_RECENT) code=lasterrorU; |
| 4052 | const TCHAR *msg=_T("unknown zip result code"); |
| 4053 | switch (code) |
| 4054 | { case ZR_OK: msg=_T("Success"); break; |
| 4055 | case ZR_NODUPH: msg=_T("Culdn't duplicate handle"); break; |
| 4056 | case ZR_NOFILE: msg=_T("Couldn't create/open file"); break; |
| 4057 | case ZR_NOALLOC: msg=_T("Failed to allocate memory"); break; |
| 4058 | case ZR_WRITE: msg=_T("Error writing to file"); break; |
| 4059 | case ZR_NOTFOUND: msg=_T("File not found in the zipfile"); break; |
| 4060 | case ZR_MORE: msg=_T("Still more data to unzip"); break; |
| 4061 | case ZR_CORRUPT: msg=_T("Zipfile is corrupt or not a zipfile"); break; |
| 4062 | case ZR_READ: msg=_T("Error reading file"); break; |
| 4063 | case ZR_PASSWORD: msg=_T("Correct password required"); break; |
| 4064 | case ZR_ARGS: msg=_T("Caller: faulty arguments"); break; |
| 4065 | case ZR_PARTIALUNZ: msg=_T("Caller: the file had already been partially unzipped"); break; |
| 4066 | case ZR_NOTMMAP: msg=_T("Caller: can only get memory of a memory zipfile"); break; |
| 4067 | case ZR_MEMSIZE: msg=_T("Caller: not enough space allocated for memory zipfile"); break; |
| 4068 | case ZR_FAILED: msg=_T("Caller: there was a previous error"); break; |
| 4069 | case ZR_ENDED: msg=_T("Caller: additions to the zip have already been ended"); break; |
| 4070 | case ZR_ZMODE: msg=_T("Caller: mixing creation and opening of zip"); break; |
| 4071 | case ZR_NOTINITED: msg=_T("Zip-bug: internal initialisation not completed"); break; |
| 4072 | case ZR_SEEK: msg=_T("Zip-bug: trying to seek the unseekable"); break; |
| 4073 | case ZR_MISSIZE: msg=_T("Zip-bug: the anticipated size turned out wrong"); break; |
| 4074 | case ZR_NOCHANGE: msg=_T("Zip-bug: tried to change mind, but not allowed"); break; |
| 4075 | case ZR_FLATE: msg=_T("Zip-bug: an internal error during flation"); break; |
| 4076 | } |
| 4077 | unsigned int mlen=(unsigned int)_tcslen(msg); |
| 4078 | if (buf==0 || len==0) return mlen; |
| 4079 | unsigned int n=mlen; if (n+1>len) n=len-1; |
| 4080 | _tcsncpy_s(buf,MAX_PATH,msg,n); buf[n]=0; |
| 4081 | return mlen; |
| 4082 | } |
| 4083 | |
| 4084 | |
| 4085 | typedef struct |
nothing calls this directly
no outgoing calls
no test coverage detected