Back to index

php5  5.3.10
Functions
zip_error_to_str.c File Reference
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "zipint.h"

Go to the source code of this file.

Functions

 zip_error_to_str (char *buf, size_t len, int ze, int se)

Function Documentation

zip_error_to_str ( char *  buf,
size_t  len,
int  ze,
int  se 
)

Definition at line 46 of file zip_error_to_str.c.

{
    const char *zs, *ss;

    if (ze < 0 || ze >= _zip_nerr_str)
       return snprintf(buf, len, "Unknown error %d", ze);

    zs = _zip_err_str[ze];
       
    switch (_zip_err_type[ze]) {
    case ZIP_ET_SYS:
       ss = strerror(se);
       break;
       
    case ZIP_ET_ZLIB:
       ss = zError(se);
       break;
       
    default:
       ss = NULL;
    }

    return snprintf(buf, len, "%s%s%s",
                  zs, (ss ? ": " : ""), (ss ? ss : ""));
}

Here is the call graph for this function: