pike.git / src / modules / Wnotify / wnotify.cmod

version» Context lines:

pike.git/src/modules/Wnotify/wnotify.cmod:142:       /*! @decl void add_handle(NotificationHandle handle)    */    PIKEFUN void add_handle(object handle)    {    void * h;    int s, n;    struct array * ph;    HANDLE nh;    HANDLE * handles; -  h = get_storage(handle, NotificationHandle_program); +  h = get_storage(handle, Wnotify_NotificationHandle_program);    if(!h)    {    pop_stack();    Pike_error("add_handle: invalid object type.\n");    }       ph = append_array(THIS->phandles, &Pike_sp[-args]);    THIS->phandles = ph; -  nh = OBJ2_NOTIFICATIONHANDLE(handle)->handle; +  nh = OBJ2_WNOTIFY_NOTIFICATIONHANDLE(handle)->handle;       if(THIS->handles_size <= THIS->handles_used)    {    s = n = THIS->handles_size || 1;    s*=2;    handles = realloc(THIS->handles, sizeof(HANDLE) * s);    if(!handles)    {    pop_stack();    Pike_error("add_handle: failed to allocate memory.\n");
pike.git/src/modules/Wnotify/wnotify.cmod:185:    {    DWORD res;    DWORD to;       if(THIS->handles_used < 1)    {    pop_stack();    Pike_error("poll: no paths to monitor.\n");    }    -  if(!timeout || (timeout->type == PIKE_T_INT && timeout->u.integer == 0)) +  if(!timeout || SAFE_IS_ZERO(timeout))    {    to = INFINITE;    } -  else if(timeout->type == PIKE_T_FLOAT) +  else if(TYPEOF(*timeout) == PIKE_T_FLOAT)    {    to = (DWORD)timeout->u.float_number * 1000;    }    else    {    Pike_error("poll: invalid timeout.\n");    }       pop_n_elems(args);       res = WaitForMultipleObjects(THIS->handles_used, THIS->handles, FALSE, to);       if(res >= WAIT_OBJECT_0 && res <= (WAIT_OBJECT_0 + THIS->handles_used - 1))    {    /* we have a hit. */    struct svalue * sv;    sv = THIS->phandles->item+res;    /* TODO: proper value checking of the items in the array! */ -  OBJ2_NOTIFICATIONHANDLE(sv->u.object)->triggered = 1; +  OBJ2_WNOTIFY_NOTIFICATIONHANDLE(sv->u.object)->triggered = 1;    push_svalue(&ITEM(THIS->phandles)[res]);    FindNextChangeNotification(THIS->handles+res);       }    else if(res >= WAIT_ABANDONED_0 && res <= (WAIT_ABANDONED_0 + THIS->handles_used - 1))    {    /* don't think this applies to us, so let's flag an exception. */    Pike_error("poll: unexpected result (WAIT_ABANDONED)\n");    }    else if(res == WAIT_TIMEOUT)