pike.git / src / post_modules / Nettle / hash.cmod

version» Context lines:

pike.git/src/post_modules/Nettle/hash.cmod:1:   /* hash.cmod -*- c -*- */      #include "global.h" - RCSID("$Id: hash.cmod,v 1.21 2004/04/28 19:54:31 nilsson Exp $"); + RCSID("$Id: hash.cmod,v 1.22 2004/04/29 12:23:17 nilsson Exp $");   #include "interpret.h"   #include "svalue.h"   #include "threads.h"      /* For this_object() */   #include "object.h"   #include "module_support.h"      #include "nettle_config.h"   
pike.git/src/post_modules/Nettle/hash.cmod:138:    *! @expr{obj->update(Stdio.read_file(file))->digest()@}.    *!    *! @seealso    *! @[Stdio.File], @[HashState()->update()] and    *! @[HashState()->digest()].    */    PIKEFUN string hash(object in)    optflags OPT_EXTERNAL_DEPEND;    {    void *ctx; -  int len; +  int len, fd;    char *read_buffer;    PIKE_STAT_T st;    struct pike_string *out;    const struct nettle_hash *meta = THIS->meta;       if (!meta)    Pike_error("HashInfo not properly initialized.\n");       /* Verify that the input is a Stdio.Fd_ref */    if (!Fd_ref_program)
pike.git/src/post_modules/Nettle/hash.cmod:165:    Pike_error("Unable to resolv files.Fd_ref.\n");    }    add_ref(Fd_ref_program);    pop_stack( );    }       if (!get_storage(in, Fd_ref_program ) )    Pike_error("Object not Fd_ref or subclass.\n");       safe_apply(in, "query_fd", 0); -  int fd = Pike_sp[-1].u.integer; +  fd = Pike_sp[-1].u.integer;    pop_stack();       if (fd_fstat(fd, &st)<0)    Pike_error("File not found!\n");       if (!S_ISREG(st.st_mode))    Pike_error("Non-regular file.\n");       ctx = (void *)alloca(meta->context_size);    if (!ctx)