functionSource
stringlengths
20
97.4k
CWE-119
bool
2 classes
CWE-120
bool
2 classes
CWE-469
bool
2 classes
CWE-476
bool
2 classes
CWE-other
bool
2 classes
combine
int64
0
1
DoIconize(bool iconize) { if (m_wndTaskbarNotifier && thePrefs::DoMinToTray()) { if (iconize) { // Skip() will do it. //Iconize(true); if (SafeState()) { Show(false); } } else { Show(true); Raise(); } } else { // Will be done by Skip(); //Iconize(iconize); } }
false
false
false
false
false
0
sort_shell(int *data, int len) { int gap; int i; int j; int k; int tmp; gap = len / 2; while (gap) { for (i = gap; i < len; i++) { tmp = data[i]; for (j = i - gap; j >=0; j -= gap) { if (data[j] > tmp) { data[j + gap] = data[j]; } else { break; } } data[j + gap] = tmp; } gap /= 2; } return; }
false
false
false
false
false
0
createNode(Interval *itemInterval) { Key *key=new Key(itemInterval); //System.out.println("input: " + env + " binaryEnv: " + key.getEnvelope()); Node* node=new Node(new Interval(key->getInterval()),key->getLevel()); delete key; return node; }
false
false
false
false
false
0
read_float4(int f, float *x) { #ifdef _CRAY long buffer = 0; if (read(f, &buffer, 4) == 4) { /* convert IEEE float (buffer) to Cray float (x) */ if_to_c((long *)x, &buffer); return 1; } return 0; #else # ifdef LITTLE unsigned int n, *iptr; if (read(f, &n, 4) == 4) { iptr = (unsigned int *)x; *iptr = FLIP4(n); return 1; } else { return 0; } # else if (read(f, x, 4) == 4) { return 1; } else { return 0; } # endif #endif }
false
true
false
false
true
1
tcp_close ( struct tcp_connection *tcp, int rc ) { struct io_buffer *iobuf; struct io_buffer *tmp; /* Close data transfer interface */ intf_shutdown ( &tcp->xfer, rc ); tcp->flags |= TCP_XFER_CLOSED; /* If we are in CLOSED, or have otherwise not yet received a * SYN (i.e. we are in LISTEN or SYN_SENT), just delete the * connection. */ if ( ! ( tcp->tcp_state & TCP_STATE_RCVD ( TCP_SYN ) ) ) { /* Transition to CLOSED for the sake of debugging messages */ tcp->tcp_state = TCP_CLOSED; tcp_dump_state ( tcp ); /* Free any unprocessed I/O buffers */ list_for_each_entry_safe ( iobuf, tmp, &tcp->rx_queue, list ) { list_del ( &iobuf->list ); free_iob ( iobuf ); } /* Free any unsent I/O buffers */ list_for_each_entry_safe ( iobuf, tmp, &tcp->tx_queue, list ) { list_del ( &iobuf->list ); free_iob ( iobuf ); } /* Remove from list and drop reference */ stop_timer ( &tcp->timer ); list_del ( &tcp->list ); ref_put ( &tcp->refcnt ); DBGC ( tcp, "TCP %p connection deleted\n", tcp ); return; } /* If we have not had our SYN acknowledged (i.e. we are in * SYN_RCVD), pretend that it has been acknowledged so that we * can send a FIN without breaking things. */ if ( ! ( tcp->tcp_state & TCP_STATE_ACKED ( TCP_SYN ) ) ) tcp_rx_ack ( tcp, ( tcp->snd_seq + 1 ), 0 ); /* If we have no data remaining to send, start sending FIN */ if ( list_empty ( &tcp->tx_queue ) ) { tcp->tcp_state |= TCP_STATE_SENT ( TCP_FIN ); tcp_dump_state ( tcp ); } }
false
false
false
false
false
0
flickcurl_user_icon_uri(int farm, int server, char *nsid) { char buf[1024]; char *result; if(server && farm && nsid) { size_t len; /* http://farm{icon-farm}.static.flickr.com/{icon-server}/buddyicons/{nsid}.jpg */ sprintf(buf, "http://farm%d.static.flickr.com/%d/buddicons/%s.jpg", farm, server, nsid); len = strlen(buf); result = (char*)malloc(len + 1); memcpy(result, buf, len + 1); } else { #define MAGIC_LEN 42 result = (char*)malloc(MAGIC_LEN + 1); memcpy(result, "http://www.flickr.com/images/buddyicon.jpg", MAGIC_LEN + 1); } return result; }
true
true
false
false
false
1
get_bookmarks (TrackerSparqlConnection *connection, GStrv search_terms, gint search_offset, gint search_limit, gboolean use_or_operator) { GError *error = NULL; TrackerSparqlCursor *cursor; gchar *fts; gchar *query; fts = get_fts_string (search_terms, use_or_operator); if (fts) { query = g_strdup_printf ("SELECT nie:title(?urn) nie:url(?bookmark) " "WHERE {" " ?urn a nfo:Bookmark ;" " nfo:bookmarks ?bookmark ." " ?urn fts:match \"%s\" . " "} " "ORDER BY ASC(nie:title(?urn)) " "OFFSET %d " "LIMIT %d", fts, search_offset, search_limit); } else { query = g_strdup_printf ("SELECT nie:title(?urn) nie:url(?bookmark) " "WHERE {" " ?urn a nfo:Bookmark ;" " nfo:bookmarks ?bookmark ." "} " "ORDER BY ASC(nie:title(?urn)) " "OFFSET %d " "LIMIT %d", search_offset, search_limit); } g_free (fts); cursor = tracker_sparql_connection_query (connection, query, NULL, &error); g_free (query); if (error) { g_printerr ("%s, %s\n", _("Could not get search results"), error->message); g_error_free (error); return FALSE; } if (!cursor) { g_print ("%s\n", _("No bookmarks were found")); } else { gint count = 0; g_print ("%s:\n", _("Bookmarks")); while (tracker_sparql_cursor_next (cursor, NULL, NULL)) { g_print (" %s%s%s (%s)\n", disable_color ? "" : TITLE_BEGIN, tracker_sparql_cursor_get_string (cursor, 0, NULL), disable_color ? "" : TITLE_END, tracker_sparql_cursor_get_string (cursor, 1, NULL)); count++; } g_print ("\n"); if (count >= search_limit) { show_limit_warning (); } g_object_unref (cursor); } return TRUE; }
false
false
false
false
false
0
OpenUri( QString Uri ) const { KUrl url( Uri ); The::playlistController()->insertOptioned( url, Playlist::OnPlayMediaAction ); }
false
false
false
false
false
0
is_deleted(int recNo) { Town *townPtr = (Town*) get_ptr(recNo); if( !townPtr ) return 1; if( townPtr->population==0 ) return 1; return 0; }
false
false
false
false
false
0
ConnectCB(int status) { ostringstream osstr; // fprintf(stderr, "debug - dcf connectcb %u\n", status); if (status != 0) { if (reconnect == 0) { osstr << "Kismet drone connection to " << cli_host << ":" << cli_port << " failed (" << strerror(errno) << ") and reconnection " "not enabled"; _MSG(osstr.str(), MSGFLAG_PRINTERROR); return; } else { osstr << "Could not create connection to the Kismet drone " "server at " << cli_host << ":" << cli_port << " (" << strerror(errno) << "), will attempt to reconnect in 5 seconds"; _MSG(osstr.str(), MSGFLAG_PRINTERROR); } last_disconnect = globalreg->timestamp.tv_sec; last_frame = globalreg->timestamp.tv_sec; return; } last_disconnect = 0; last_frame = globalreg->timestamp.tv_sec; return; }
false
false
false
false
false
0
qla2x00_read_optrom_data(struct scsi_qla_host *vha, uint8_t *buf, uint32_t offset, uint32_t length) { uint32_t addr, midpoint; uint8_t *data; struct qla_hw_data *ha = vha->hw; struct device_reg_2xxx __iomem *reg = &ha->iobase->isp; /* Suspend HBA. */ qla2x00_suspend_hba(vha); /* Go with read. */ midpoint = ha->optrom_size / 2; qla2x00_flash_enable(ha); WRT_REG_WORD(&reg->nvram, 0); RD_REG_WORD(&reg->nvram); /* PCI Posting. */ for (addr = offset, data = buf; addr < length; addr++, data++) { if (addr == midpoint) { WRT_REG_WORD(&reg->nvram, NVR_SELECT); RD_REG_WORD(&reg->nvram); /* PCI Posting. */ } *data = qla2x00_read_flash_byte(ha, addr); } qla2x00_flash_disable(ha); /* Resume HBA. */ qla2x00_resume_hba(vha); return buf; }
false
false
false
false
false
0
H5Pget_est_link_info(hid_t plist_id, unsigned *est_num_entries /*out*/, unsigned *est_name_len /*out*/) { herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) H5TRACE3("e", "ixx", plist_id, est_num_entries, est_name_len); /* Get values */ if(est_num_entries || est_name_len) { H5P_genplist_t *plist; /* Property list pointer */ H5O_ginfo_t ginfo; /* Group information structure */ /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get group info */ if(H5P_get(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info") if(est_num_entries) *est_num_entries = ginfo.est_num_entries; if(est_name_len) *est_name_len = ginfo.est_name_len; } /* end if */ done: FUNC_LEAVE_API(ret_value) }
false
false
false
false
false
0
copy_gfile(MainInfo *min, DirPane *src, DirPane *dst, GFile *from, GFile *to, GError **err) { GFileInfo *fi; gboolean ok; if(min == NULL || from == NULL || to == NULL) return FALSE; switch(ovw_overwrite_unary_file(dst, to)) { case OVW_SKIP: return TRUE; case OVW_CANCEL: return FALSE; case OVW_PROCEED: break; case OVW_PROCEED_FILE: case OVW_PROCEED_DIR: if(!del_delete_gfile(min, to, FALSE, err)) return FALSE; } if((fi = g_file_query_info(from, "standard::*", G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS, NULL, err)) == NULL) return FALSE; switch(g_file_info_get_file_type(fi)) { case G_FILE_TYPE_REGULAR: pgs_progress_item_begin(min, g_file_info_get_display_name(fi), g_file_info_get_size(fi)); ok = copy_gfile_regular(min, src, dst, from, to, err); pgs_progress_item_end(min); break; case G_FILE_TYPE_DIRECTORY: pgs_progress_item_begin(min, g_file_info_get_display_name(fi), g_file_info_get_size(fi)); ok = copy_gfile_directory(min, src, dst, from, to, err); pgs_progress_item_end(min); break; case G_FILE_TYPE_SYMBOLIC_LINK: pgs_progress_item_begin(min, g_file_info_get_display_name(fi), g_file_info_get_size(fi)); ok = copy_gfile_symlink(min, src, dst, from, to, err); pgs_progress_item_end(min); break; case G_FILE_TYPE_SPECIAL: pgs_progress_item_begin(min, g_file_info_get_display_name(fi), 0); ok = copy_gfile_special(min, src, dst, from, to, err); pgs_progress_item_end(min); break; default: g_error("Not copying '%s', type is %d which is unsupported", g_file_info_get_name(fi), g_file_info_get_file_type(fi)); ok = FALSE; } g_object_unref(fi); return ok; }
false
false
false
false
false
0
edupd(int flg) { W *w; int wid, hei; if (dostaupd) { staupd = 1; dostaupd = 0; } ttgtsz(&wid, &hei); if ((wid >= 2 && wid != maint->w) || (hei >= 1 && hei != maint->h)) { nresize(maint->t, wid, hei); sresize(maint); } dofollows(); ttflsh(); nscroll(maint->t); help_display(maint); w = maint->curwin; do { if (w->y != -1) { if (w->object && w->watom->disp) w->watom->disp(w->object, flg); msgout(w); } w = (W *) (w->link.next); } while (w != maint->curwin); cpos(maint->t, maint->curwin->x + maint->curwin->curx, maint->curwin->y + maint->curwin->cury); staupd = 0; }
false
false
false
false
false
0
add(const string& name, awt_mask_item *item) { awt_mask_item *existing = lookup(name); if (existing) return GB_export_errorf("ID '%s' already exists", name.c_str()); id[name] = item; return 0; }
false
false
false
false
false
0
mmc_add_disk(struct mmc_blk_data *md) { int ret; struct mmc_card *card = md->queue.card; add_disk(md->disk); md->force_ro.show = force_ro_show; md->force_ro.store = force_ro_store; sysfs_attr_init(&md->force_ro.attr); md->force_ro.attr.name = "force_ro"; md->force_ro.attr.mode = S_IRUGO | S_IWUSR; ret = device_create_file(disk_to_dev(md->disk), &md->force_ro); if (ret) goto force_ro_fail; if ((md->area_type & MMC_BLK_DATA_AREA_BOOT) && card->ext_csd.boot_ro_lockable) { umode_t mode; if (card->ext_csd.boot_ro_lock & EXT_CSD_BOOT_WP_B_PWR_WP_DIS) mode = S_IRUGO; else mode = S_IRUGO | S_IWUSR; md->power_ro_lock.show = power_ro_lock_show; md->power_ro_lock.store = power_ro_lock_store; sysfs_attr_init(&md->power_ro_lock.attr); md->power_ro_lock.attr.mode = mode; md->power_ro_lock.attr.name = "ro_lock_until_next_power_on"; ret = device_create_file(disk_to_dev(md->disk), &md->power_ro_lock); if (ret) goto power_ro_lock_fail; } return ret; power_ro_lock_fail: device_remove_file(disk_to_dev(md->disk), &md->force_ro); force_ro_fail: del_gendisk(md->disk); return ret; }
false
false
false
false
false
0
free_this_dosum_info(Block *dosum_block, Dosum_info *dosum_info){ Dosum_info *temp; if (dosum_info != NULL){ if (dosum_info == dosum_block->dosum_info){ dosum_block->dosum_info = dosum_info->next; temp = dosum_info; } else { temp = dosum_block->dosum_info; while(temp->next != dosum_info && temp != NULL) temp = temp->next; if (temp == NULL){ fputs("ERROR: listing mismatch.\n", stderr); exit(1); } temp->next = dosum_info->next; temp = dosum_info; } free(temp); } }
false
false
false
false
false
0
_pager_cb_event_border_remove(void *data __UNUSED__, int type __UNUSED__, void *event) { E_Event_Border_Remove *ev = event; Eina_List *l; Pager *p; EINA_LIST_FOREACH(pagers, l, p) { Eina_List *l2; Pager_Desk *pd; if (p->zone != ev->border->zone) continue; EINA_LIST_FOREACH(p->desks, l2, pd) { Pager_Win *pw; pw = _pager_desk_window_find(pd, ev->border); if (!pw) continue; pd->wins = eina_list_remove(pd->wins, pw); _pager_window_free(pw); } } return ECORE_CALLBACK_PASS_ON; }
false
false
false
false
false
0
me_chghost(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { struct Client *target_p; if (!(target_p = find_person(parv[1]))) return -1; do_chghost(source_p, target_p, parv[2], 1); return 0; }
false
false
false
false
false
0
ItemDone() { CurrentItem = 0; CurrentSize = 0; TotalSize = 0; Status = string(); }
false
false
false
false
false
0
intel_i915_setup_chipset_flush(void) { int ret; u32 temp; pci_read_config_dword(intel_private.bridge_dev, I915_IFPADDR, &temp); if (!(temp & 0x1)) { intel_alloc_chipset_flush_resource(); intel_private.resource_valid = 1; pci_write_config_dword(intel_private.bridge_dev, I915_IFPADDR, (intel_private.ifp_resource.start & 0xffffffff) | 0x1); } else { temp &= ~1; intel_private.resource_valid = 1; intel_private.ifp_resource.start = temp; intel_private.ifp_resource.end = temp + PAGE_SIZE; ret = request_resource(&iomem_resource, &intel_private.ifp_resource); /* some BIOSes reserve this area in a pnp some don't */ if (ret) intel_private.resource_valid = 0; } }
false
false
false
false
false
0
_mpd_fix_sqrt(mpd_t *result, const mpd_t *a, mpd_t *tmp, const mpd_context_t *ctx, uint32_t *status) { mpd_context_t maxctx; MPD_NEW_CONST(u,0,0,1,1,1,5); mpd_maxcontext(&maxctx); u.exp = u.digits - ctx->prec + result->exp - 1; _mpd_qsub(tmp, result, &u, &maxctx, status); if (*status&MPD_Errors) goto nanresult; _mpd_qmul(tmp, tmp, tmp, &maxctx, status); if (*status&MPD_Errors) goto nanresult; if (_mpd_cmp(tmp, a) == 1) { u.exp += 1; u.data[0] = 1; _mpd_qsub(result, result, &u, &maxctx, status); } else { _mpd_qadd(tmp, result, &u, &maxctx, status); if (*status&MPD_Errors) goto nanresult; _mpd_qmul(tmp, tmp, tmp, &maxctx, status); if (*status&MPD_Errors) goto nanresult; if (_mpd_cmp(tmp, a) == -1) { u.exp += 1; u.data[0] = 1; _mpd_qadd(result, result, &u, &maxctx, status); } } return; nanresult: mpd_setspecial(result, MPD_POS, MPD_NAN); }
false
false
false
false
false
0
_builtin_abs (CSPARSE *parse, CS_FUNCTION *csf, CSARG *args, CSARG *result) { NEOERR *err; int n1 = 0; CSARG val; memset(&val, 0, sizeof(val)); err = eval_expr(parse, args, &val); if (err) return nerr_pass(err); result->op_type = CS_TYPE_NUM; n1 = arg_eval_num(parse, &val); result->n = abs(n1); if (val.alloc) free(val.s); return STATUS_OK; }
false
false
false
false
false
0
adjustSeparatorVisibility() { bool visibleNonSeparator = false; int separatorToShow = -1; for (int index = 0; index < q->actions().count(); ++index) { QAction* action = q->actions()[ index ]; if (action->isSeparator()) { if (visibleNonSeparator) { separatorToShow = index; visibleNonSeparator = false; } else { action->setVisible(false); } } else if (!visibleNonSeparator) { if (action->isVisible()) { visibleNonSeparator = true; if (separatorToShow != -1) { q->actions()[ separatorToShow ]->setVisible(true); separatorToShow = -1; } } } } if (separatorToShow != -1) q->actions()[ separatorToShow ]->setVisible(false); }
false
false
false
false
false
0
fireResourceGroupScriptingEnded(const String& groupName) { OGRE_LOCK_AUTO_MUTEX; for (ResourceGroupListenerList::iterator l = mResourceGroupListenerList.begin(); l != mResourceGroupListenerList.end(); ++l) { (*l)->resourceGroupScriptingEnded(groupName); } }
false
false
false
false
false
0
Iconcat (int argc, lvar_t *argv) { Tobj ao; char buf2[50]; char *s; int i, n, bufi; for (bufi = 0, i = 0; i < argc; i++) { ao = argv[i].o; switch (Tgettype (argv[i].o)) { case T_STRING: if (bufi + (n = strlen (Tgetstring (ao)) + 1) > bufn) growbufp (bufi + n); for (s = Tgetstring (ao); *s; s++) bufp[bufi++] = *s; break; case T_INTEGER: if (bufi + 50 > bufn) growbufp (bufi + 50); sprintf (buf2, "%ld", Tgetinteger (ao)); for (s = buf2; *s; s++) bufp[bufi++] = *s; break; case T_REAL: if (bufi + 50 > bufn) growbufp (bufi + 50); sprintf (buf2, "%f", Tgetreal (ao)); for (s = buf2; *s; s++) bufp[bufi++] = *s; break; } } bufp[bufi] = '\000'; rtno = Tstring (bufp); return L_SUCCESS; }
false
false
false
false
true
1
CMMF_POPODecKeyChallContentSetNextChallenge (CMMFPOPODecKeyChallContent *inDecKeyChall, long inRandom, CERTGeneralName *inSender, SECKEYPublicKey *inPubKey, void *passwdArg) { CMMFChallenge *curChallenge; PLArenaPool *genNamePool = NULL, *poolp; SECStatus rv; SECItem *genNameDER; void *mark; PORT_Assert (inDecKeyChall != NULL && inSender != NULL && inPubKey != NULL); if (inDecKeyChall == NULL || inSender == NULL || inPubKey == NULL) { return SECFailure; } poolp = inDecKeyChall->poolp; mark = PORT_ArenaMark(poolp); genNamePool = PORT_NewArena(CRMF_DEFAULT_ARENA_SIZE); genNameDER = CERT_EncodeGeneralName(inSender, NULL, genNamePool); if (genNameDER == NULL) { rv = SECFailure; goto loser; } if (inDecKeyChall->challenges == NULL) { inDecKeyChall->challenges = PORT_ArenaZNewArray(poolp, CMMFChallenge*,(CMMF_MAX_CHALLENGES+1)); inDecKeyChall->numAllocated = CMMF_MAX_CHALLENGES; } if (inDecKeyChall->numChallenges >= inDecKeyChall->numAllocated) { rv = SECFailure; goto loser; } if (inDecKeyChall->numChallenges == 0) { rv = cmmf_create_first_challenge(inDecKeyChall, inRandom, genNameDER, inPubKey, passwdArg); } else { curChallenge = PORT_ArenaZNew(poolp, CMMFChallenge); if (curChallenge == NULL) { rv = SECFailure; goto loser; } rv = cmmf_create_witness_and_challenge(poolp, curChallenge, inRandom, genNameDER, inPubKey, passwdArg); if (rv == SECSuccess) { inDecKeyChall->challenges[inDecKeyChall->numChallenges] = curChallenge; inDecKeyChall->numChallenges++; } } if (rv != SECSuccess) { goto loser; } PORT_ArenaUnmark(poolp, mark); PORT_FreeArena(genNamePool, PR_FALSE); return SECSuccess; loser: PORT_ArenaRelease(poolp, mark); if (genNamePool != NULL) { PORT_FreeArena(genNamePool, PR_FALSE); } PORT_Assert(rv != SECSuccess); return rv; }
false
false
false
false
false
0
match(int *addr) { if(!pattern) return 0; if(addr){ if(addr == zero) return 0; subexp[0].s.rsp = getline(*addr); } else subexp[0].s.rsp = loc2; subexp[0].e.rep = 0; if(rregexec(pattern, linebuf, subexp, MAXSUB)) { loc1 = subexp[0].s.rsp; loc2 = subexp[0].e.rep; return 1; } loc1 = loc2 = 0; return 0; }
false
false
false
false
false
0
do_move(line1, line2, n) linenr_t line1; linenr_t line2; linenr_t n; { char_u *q; int has_mark; if (n >= line1 && n < line2 && line2 > line1) { EMSG("Move lines into themselves"); return FAIL; } /* * adjust line marks (global marks done below) * if the lines are moved down, the marks in the moved lines * move down and the marks in the lines between the old and * new position move up. * If the lines are moved up it is just the other way round */ if (n >= line2) /* move down */ { mark_adjust(line1, line2, n - line2); mark_adjust(line2 + 1, n, -(line2 - line1 + 1)); } else /* move up */ { mark_adjust(line1, line2, -(line1 - n - 1)); mark_adjust(n + 1, line1 - 1, line2 - line1 + 1); } if (n >= line1) { --n; curwin->w_cursor.lnum = n - (line2 - line1) + 1; } else curwin->w_cursor.lnum = n + 1; while (line1 <= line2) { /* this undo is not efficient, but it works */ u_save(line1 - 1, line1 + 1); q = strsave(ml_get(line1)); if (q != NULL) { /* * marks from global command go with the line */ has_mark = ml_has_mark(line1); ml_delete(line1); u_save(n, n + 1); ml_append(n, q, (colnr_t)0, FALSE); free(q); if (has_mark) ml_setmarked(n + 1); } if (n < line1) { ++n; ++line1; } else --line2; } CHANGED; return OK; }
false
false
false
false
false
0
process_shutdown(auparse_state_t *au) { uid_t uid = -1; time_t time = 0; struct event *down; list_node_t *it; int success = 0; if (extract_virt_fields(au, NULL, &uid, &time, NULL, &success)) return 0; for (it = events->tail; it; it = it->prev) { struct event *event = it->data; if (event->success) { if (event->type == ET_START || event->type == ET_RES) { if (event->end == 0) { event->end = time; add_proof(event, au); } } else if (event->type == ET_DOWN) { break; } } } down = event_alloc(); if (down == NULL) return 1; down->type = ET_DOWN; down->uid = uid; down->start = time; down->success = success; add_proof(down, au); if (list_append(events, down) == NULL) { event_free(down); return 1; } return 0; }
false
false
false
false
false
0
generic_update(Scanline *scanline, MemAccess *memaccess, bool clear_cache) { static byte_t old_flash = 0xff; static byte_t old_lmode = 0xff; static byte_t old_border = 0xff; static byte_t old_color_expansion = 0xff; int fchg = 0; int width = get_real_width(); int height = get_real_height(); int flash = ((Timer1 *)timer)->get_flash(); if (old_flash != flash) { fchg = 1; old_flash = flash; } byte_t lmode = ((PIO1_1 *)pio)->get_line_mode(); if (old_lmode != lmode) { old_lmode = lmode; clear_cache = true; } bool color_expansion_installed = !module->is_empty(61); if (old_color_expansion != color_expansion_installed) { old_color_expansion = color_expansion_installed; clear_cache = true; } if (clear_cache) old_border = 0xff; // force drawing of screen border if (color_expansion_installed || clear_cache) { byte_t border = color_expansion_installed ? ((PIO1_1 *)pio)->get_border_color() : 0; if (old_border != border) { old_border = border; generic_set_border_24(width, height, border); if (lmode) generic_set_border_20(width, height, border); } } if (lmode) generic_update_20(width, height, fchg, flash, clear_cache); else generic_update_24(width, height, fchg, flash, clear_cache); }
false
false
false
false
false
0
read_netdump(int fd, void *bufptr, int cnt, ulong addr, physaddr_t paddr) { off_t offset; struct pt_load_segment *pls; int i; offset = 0; /* * The Elf32_Phdr has 32-bit fields for p_paddr, p_filesz and * p_memsz, so for now, multiple PT_LOAD segment support is * restricted to 64-bit machines for netdump/diskdump vmcores. * However, kexec/kdump has introduced the optional use of a * 64-bit ELF header for 32-bit processors. */ switch (DUMPFILE_FORMAT(nd->flags)) { case NETDUMP_ELF32: offset = (off_t)paddr + (off_t)nd->header_size; break; case NETDUMP_ELF64: case KDUMP_ELF32: case KDUMP_ELF64: if (nd->num_pt_load_segments == 1) { offset = (off_t)paddr + (off_t)nd->header_size - (off_t)nd->pt_load_segments[0].phys_start; break; } for (i = offset = 0; i < nd->num_pt_load_segments; i++) { pls = &nd->pt_load_segments[i]; if ((paddr >= pls->phys_start) && (paddr < pls->phys_end)) { offset = (off_t)(paddr - pls->phys_start) + pls->file_offset; break; } if (pls->zero_fill && (paddr >= pls->phys_end) && (paddr < pls->zero_fill)) { memset(bufptr, 0, cnt); if (CRASHDEBUG(8)) fprintf(fp, "read_netdump: zero-fill: " "addr: %lx paddr: %llx cnt: %d\n", addr, (ulonglong)paddr, cnt); return cnt; } } if (!offset) { if (CRASHDEBUG(8)) fprintf(fp, "read_netdump: READ_ERROR: " "offset not found for paddr: %llx\n", (ulonglong)paddr); return READ_ERROR; } break; } if (CRASHDEBUG(8)) fprintf(fp, "read_netdump: addr: %lx paddr: %llx cnt: %d offset: %llx\n", addr, (ulonglong)paddr, cnt, (ulonglong)offset); if (FLAT_FORMAT()) { if (!read_flattened_format(nd->ndfd, offset, bufptr, cnt)) { if (CRASHDEBUG(8)) fprintf(fp, "read_netdump: READ_ERROR: " "read_flattened_format failed for offset:" " %llx\n", (ulonglong)offset); return READ_ERROR; } } else { if (lseek(nd->ndfd, offset, SEEK_SET) == -1) { if (CRASHDEBUG(8)) fprintf(fp, "read_netdump: SEEK_ERROR: " "offset: %llx\n", (ulonglong)offset); return SEEK_ERROR; } if (read(nd->ndfd, bufptr, cnt) != cnt) { if (CRASHDEBUG(8)) fprintf(fp, "read_netdump: READ_ERROR: " "offset: %llx\n", (ulonglong)offset); return READ_ERROR; } } return cnt; }
false
true
false
false
true
1
pump_execute_abort (call_frame_t *frame, xlator_t *this) { afr_private_t *priv = NULL; pump_private_t *pump_priv = NULL; afr_local_t *local = NULL; call_frame_t *sync_frame = NULL; int ret = 0; priv = this->private; pump_priv = priv->pump_private; local = frame->local; pump_change_state (this, PUMP_STATE_ABORT); LOCK (&pump_priv->resume_path_lock); { pump_priv->number_files_pumped = 0; pump_priv->current_file[0] = '\0'; } UNLOCK (&pump_priv->resume_path_lock); local->op_ret = 0; if (pump_priv->pump_finished) { sync_frame = create_frame (this, this->ctx->pool); ret = synctask_new (pump_priv->env, pump_cleanup_helper, pump_cleanup_done, sync_frame, frame); if (ret) { gf_log (this->name, GF_LOG_DEBUG, "Couldn't create " "synctask for cleaning up xattrs."); } } else { pump_priv->cleaner = fop_setxattr_cbk_stub (frame, pump_xattr_cleaner, 0, 0, NULL); } return 0; }
false
false
false
false
false
0
CheckPath(const wxString &name, const std::string &path) const { if( path.size() > 7 && path.substr(0, 7) == "file://" ) { std::string p = path.substr(7); if( !EvoSources::PathExists(p) ) { wxString msg = wxString::Format(_W("File '%s' does not exist."), name.c_str()); return msg; } } return _T(""); }
false
false
false
false
false
0
lpfc_hba_clean_txcmplq(struct lpfc_hba *phba) { struct lpfc_sli *psli = &phba->sli; struct lpfc_sli_ring *pring; LIST_HEAD(completions); int i; for (i = 0; i < psli->num_rings; i++) { pring = &psli->ring[i]; if (phba->sli_rev >= LPFC_SLI_REV4) spin_lock_irq(&pring->ring_lock); else spin_lock_irq(&phba->hbalock); /* At this point in time the HBA is either reset or DOA. Either * way, nothing should be on txcmplq as it will NEVER complete. */ list_splice_init(&pring->txcmplq, &completions); pring->txcmplq_cnt = 0; if (phba->sli_rev >= LPFC_SLI_REV4) spin_unlock_irq(&pring->ring_lock); else spin_unlock_irq(&phba->hbalock); /* Cancel all the IOCBs from the completions list */ lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT, IOERR_SLI_ABORTED); lpfc_sli_abort_iocb_ring(phba, pring); } }
false
false
false
false
false
0
save_program_settings(void) { const gchar *program_name = *program_executable ? program_executable : program_load_script; if (*program_name) { RecentProgram *recent = (RecentProgram *) array_find(recent_programs, program_name, TRUE); GKeyFile *config = g_key_file_new(); char *configfile; if (!recent) { recent = (RecentProgram *) array_append(recent_programs); recent->name = g_strdup(program_name); for (recent->id = 1; recent->id < RECENT_COUNT; recent->id++) if ((recent_bitmap & (1 << recent->id)) == 0) break; recent_bitmap |= 1 << recent->id; } configfile = recent_file_name(recent->id); stash_foreach((GFunc) stash_group_save_to_key_file, config); breaks_save(config); watches_save(config); inspects_save(config); parse_save(config); utils_key_file_write_to_file(config, configfile); g_free(configfile); g_key_file_free(config); g_array_insert_vals(recent_programs, 0, ++recent, 1); array_remove(recent_programs, recent); recent_menu_create(); if (recent_programs->len > RECENT_COUNT) { recent_bitmap &= ~(1 << recent->id); array_remove(recent_programs, recent); } } }
false
false
false
false
false
0
shallow_copy (struct Node* node) { struct Node* root = (struct Node *) create_tree (node->data); struct Node *start, *next; start = next = node->firstchild; if (start) { insert_node_under (shallow_copy (start), root); while ((next = next->nextsibling) != start) { insert_node_under (shallow_copy (next), root); } } return root; }
false
false
false
false
false
0
cpyFAlist( FALIST *dst, FALIST *src ) { if( dst != NULL ) dst = freeFAlist( dst ); while( src != NULL ){ dst = appendFAlist( dst, src->fa ); src = src->next; } return( dst ); }
false
false
false
false
false
0
e_destination_is_evolution_list (const EDestination *dest) { g_return_val_if_fail (dest && E_IS_DESTINATION (dest), FALSE); return dest->priv->list_dests != NULL; }
false
false
false
false
false
0
vxp_resume(struct pcmcia_device *link) { struct vx_core *chip = link->priv; snd_printdd(KERN_DEBUG "RESUME\n"); if (pcmcia_dev_present(link)) { //struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip; if (chip) { snd_printdd(KERN_DEBUG "calling snd_vx_resume\n"); snd_vx_resume(chip); } } snd_printdd(KERN_DEBUG "resume done!\n"); return 0; }
false
false
false
false
false
0
NET_SV_NumClients(void) { int count; int i; count = 0; for (i=0; i<MAXNETNODES; ++i) { if (ClientConnected(&clients[i])) { ++count; } } return count; }
false
false
false
false
false
0
calc_capacity(struct pm860x_battery_info *info, int *cap) { int ret; int data; int ibat; int cap_ocv = 0; int cap_cc = 0; ret = calc_ccnt(info, &ccnt_data); if (ret) goto out; soc: data = info->max_capacity * info->start_soc / 100; if (ccnt_data.total_dischg - ccnt_data.total_chg <= data) { cap_cc = data + ccnt_data.total_chg - ccnt_data.total_dischg; } else { clear_ccnt(info, &ccnt_data); calc_soc(info, OCV_MODE_ACTIVE, &info->start_soc); dev_dbg(info->dev, "restart soc = %d !\n", info->start_soc); goto soc; } cap_cc = cap_cc * 100 / info->max_capacity; if (cap_cc < 0) cap_cc = 0; else if (cap_cc > 100) cap_cc = 100; dev_dbg(info->dev, "%s, last cap : %d", __func__, info->last_capacity); ret = measure_current(info, &ibat); if (ret) goto out; /* Calculate the capacity when discharging(ibat < 0) */ if (ibat < 0) { ret = calc_soc(info, OCV_MODE_ACTIVE, &cap_ocv); if (ret) cap_ocv = info->last_capacity; ret = measure_vbatt(info, OCV_MODE_ACTIVE, &data); if (ret) goto out; if (data <= LOW_BAT_THRESHOLD) { /* choose the lower capacity value to report * between vbat and CC when vbat < 3.6v; * than 3.6v; */ *cap = min(cap_ocv, cap_cc); } else { /* when detect vbat > 3.6v, but cap_cc < 15,and * cap_ocv is 10% larger than cap_cc, we can think * CC have some accumulation error, switch to OCV * to estimate capacity; * */ if (cap_cc < 15 && cap_ocv - cap_cc > 10) *cap = cap_ocv; else *cap = cap_cc; } /* when discharging, make sure current capacity * is lower than last*/ if (*cap > info->last_capacity) *cap = info->last_capacity; } else { *cap = cap_cc; } info->last_capacity = *cap; dev_dbg(info->dev, "%s, cap_ocv:%d cap_cc:%d, cap:%d\n", (ibat < 0) ? "discharging" : "charging", cap_ocv, cap_cc, *cap); /* * store the current capacity to RTC domain register, * after next power up , it will be restored. */ pm860x_set_bits(info->i2c, PM8607_RTC_MISC2, RTC_SOC_5LSB, (*cap & 0x1F) << 3); pm860x_set_bits(info->i2c, PM8607_RTC1, RTC_SOC_3MSB, ((*cap >> 5) & 0x3)); return 0; out: return ret; }
false
false
false
false
false
0
EnvisatFile_GetKeyByIndex( EnvisatFile *self, EnvisatFile_HeaderFlag mph_or_sph, int key_index ) { int entry_count; EnvisatNameValue **entries; /* * Select source list. */ if( mph_or_sph == MPH ) { entry_count = self->mph_count; entries = self->mph_entries; } else { entry_count = self->sph_count; entries = self->sph_entries; } if( key_index < 0 || key_index >= entry_count ) return NULL; else return entries[key_index]->key; }
false
false
false
false
false
0
log_reset_stub (const char *filename,int line,const char *function) { if (!initialized || filename == NULL || function == NULL) { errno = EINVAL; return (-1); } if ((log_private.flags & LOG_HAVE_LOGFILE)) { print_one_line (&log_private,filename,line,function,_LOG_VERBOSE,"Attempting to reload log file."); print_one_line (&log_private,filename,line,function,_LOG_VERBOSE,"Stopped logging output."); close (log_private.fd); if ((log_private.fd = open (log_private.filename,O_CREAT | O_APPEND | O_WRONLY,S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) < 0) { int saved = errno; mem_free (log_private.filename); errno = saved; return (-1); } print_one_line (&log_private,filename,line,function,_LOG_VERBOSE,"Starting to log output again."); print_one_line (&log_private,filename,line,function,_LOG_VERBOSE,"Reload succeeded."); } return (0); }
false
false
false
false
false
0
parse_xml_scredentials_element_end(void *data, const char *element) { char *el, *err; Scredentials *sc; Parse_xml_scredentials_state *state; if (parse_xmlns_name(element, NULL, &el) == -1) { parse_xml_set_error(ds_xprintf("Invalid namespace: %s", element)); return; } sc = *(Scredentials **) data; if (parse_xml_is_error(NULL)) return; err = ""; if (streq(el, "selected_credentials")) { if (parse_xml_pop((void **) &state) == PARSE_XML_ERROR) goto err; if (state->code != SCREDENTIALS_PARSE_SCREDENTIALS) goto err; sc = state->object.scredentials; if (sc->unauth == NULL && sc->selected == NULL) goto err; if (sc->unauth != NULL && sc->selected != NULL) goto err; } else if (streq(el, "unauth")) { /* Do nothing */ } else if (streq(el, "selected")) { /* Do nothing */ } else { err = ds_xprintf("Unknown element: %s", el); goto err; } return; err: parse_xml_set_error(err); }
false
false
false
false
false
0
do_root_summary( datum_t *key, datum_t *val, void *arg ) { Source_t *source = (Source_t*) val->data; int rc; llist_entry *le; /* We skip dead sources. */ if (source->ds->dead) return 0; /* We skip metrics not to be summarized. */ if (llist_search(&(gmetad_config.unsummarized_metrics), (void *)key->data, llist_strncmp, &le) == 0) return 0; /* Need to be sure the source has a complete sum for its metrics. */ pthread_mutex_lock(source->sum_finished); /* We know that all these metrics are numeric. */ rc = hash_foreach(source->metric_summary, sum_metrics, arg); /* Update the top level root source */ root.hosts_up += source->hosts_up; root.hosts_down += source->hosts_down; /* summary completed for source */ pthread_mutex_unlock(source->sum_finished); return rc; }
false
false
false
false
false
0
nilfs_mdt_find_block(struct inode *inode, unsigned long start, unsigned long end, unsigned long *blkoff, struct buffer_head **out_bh) { __u64 next; int ret; if (unlikely(start > end)) return -ENOENT; ret = nilfs_mdt_read_block(inode, start, true, out_bh); if (!ret) { *blkoff = start; goto out; } if (unlikely(ret != -ENOENT || start == ULONG_MAX)) goto out; ret = nilfs_bmap_seek_key(NILFS_I(inode)->i_bmap, start + 1, &next); if (!ret) { if (next <= end) { ret = nilfs_mdt_read_block(inode, next, true, out_bh); if (!ret) *blkoff = next; } else { ret = -ENOENT; } } out: return ret; }
false
false
false
false
false
0
nfanode(struct vars * v, struct subre * t, FILE *f) /* for debug output */ { struct nfa *nfa; long ret = 0; assert(t->begin != NULL); #ifdef REG_DEBUG if (f != NULL) { char idbuf[50]; fprintf(f, "\n\n\n========= TREE NODE %s ==========\n", stid(t, idbuf, sizeof(idbuf))); } #endif nfa = newnfa(v, v->cm, v->nfa); NOERRZ(); dupnfa(nfa, t->begin, t->end, nfa->init, nfa->final); if (!ISERR()) { specialcolors(nfa); ret = optimize(nfa, f); } if (!ISERR()) compact(nfa, &t->cnfa); freenfa(nfa); return ret; }
false
false
false
false
false
0
parse_string(char *opt, const char *arg, size_t optsize) { int arglen = strlen(arg); switch (arg[0]) { case '\"': case '\'': if (arglen == 1 || arg[arglen - 1] != arg[0]) return OPT_ERR_UNMATCHED_QUOTATION; arg += 1; arglen -= 2; default: string_ncopy_do(opt, optsize, arg, arglen); return OPT_OK; } }
false
false
false
false
false
0
createTemplatesActions(int actions) { if (!actions) return; QAction *a = 0; Command *cmd = 0; // QList<int> ctx = QList<int>() << Constants::C_GLOBAL; Core::Context ctx(Constants::C_GLOBAL); ActionContainer *menu = actionManager()->actionContainer(Constants::M_TEMPLATES); Q_ASSERT(menu); if (!menu) return; if (actions & Core::MainWindowActions::A_Templates_New) { a = new QAction(this); a->setIcon(theme()->icon(Core::Constants::ICONTEMPLATES)); cmd = actionManager()->registerAction(a, Id(Constants::A_TEMPLATE_CREATE), ctx); cmd->setTranslations(Trans::Constants::CREATETEMPLATE_TEXT); menu->addAction(cmd, Id(Constants::G_TEMPLATES_NEW)); } if (actions & Core::MainWindowActions::A_Templates_Manager) { // a = new QAction(this); // a->setIcon(theme()->icon(Constants::ICONABOUT)); // a->setMenuRole(QAction::AboutRole); // cmd = actionManager()->registerAction(a, Id(Constants::A_ABOUT), ctx); // cmd->setTranslations(Trans::Constants::ABOUT_TEXT); // menu->addAction(cmd, Constants::G_HELP_ABOUT); } if (actions & Core::MainWindowActions::A_Templates_ToogleViewer) { a = new QAction(this); a->setIcon(theme()->icon(Constants::ICONTEMPLATES)); cmd = actionManager()->registerAction(a, Id(Constants::A_TEMPLATE_TOGGLEVIEW), ctx); cmd->setTranslations(Trans::Constants::TEMPLATES_TOGGLEVIEW_TEXT); menu->addAction(cmd, Id(Constants::G_TEMPLATES_EXTRAS)); } }
false
false
false
false
false
0
check_path(struct request *r) { char *p; char c; enum { s_normal, s_slash, s_slashdot, s_slashdotdot, s_forbidden } s; p = r->path; s = s_normal; do { c = *p++; switch (s) { case s_normal: if (c == '/') s = s_slash; break; case s_slash: if (c == '/') s = s_forbidden; else if (c == '.') s = r->c->allow_dotfiles ? s_slashdot : s_forbidden; else s = s_normal; break; case s_slashdot: if (c == 0 || c == '/') s = s_forbidden; else if (c == '.') s = s_slashdotdot; else s = s_normal; break; case s_slashdotdot: if (c == 0 || c == '/') s = s_forbidden; else s = s_normal; break; case s_forbidden: c = 0; break; } } while (c); return s == s_forbidden ? -1 : 0; }
false
false
false
false
false
0
main_window_edit_on_undo (MainWindowEdit* self) { MainWindow* _tmp0_ = NULL; DocumentTab* _tmp1_ = NULL; DocumentTab* _tmp2_ = NULL; MainWindow* _tmp3_ = NULL; Document* _tmp4_ = NULL; Document* _tmp5_ = NULL; gboolean _tmp6_ = FALSE; gboolean _tmp7_ = FALSE; g_return_if_fail (self != NULL); _tmp0_ = self->priv->_main_window; _tmp1_ = main_window_get_active_tab (_tmp0_); _tmp2_ = _tmp1_; g_return_if_fail (_tmp2_ != NULL); _tmp3_ = self->priv->_main_window; _tmp4_ = main_window_get_active_document (_tmp3_); _tmp5_ = _tmp4_; g_object_get ((GtkSourceBuffer*) _tmp5_, "can-undo", &_tmp6_, NULL); _tmp7_ = _tmp6_; if (_tmp7_) { MainWindow* _tmp8_ = NULL; Document* _tmp9_ = NULL; Document* _tmp10_ = NULL; MainWindow* _tmp11_ = NULL; DocumentView* _tmp12_ = NULL; DocumentView* _tmp13_ = NULL; MainWindow* _tmp14_ = NULL; DocumentView* _tmp15_ = NULL; DocumentView* _tmp16_ = NULL; _tmp8_ = self->priv->_main_window; _tmp9_ = main_window_get_active_document (_tmp8_); _tmp10_ = _tmp9_; gtk_source_buffer_undo ((GtkSourceBuffer*) _tmp10_); _tmp11_ = self->priv->_main_window; _tmp12_ = main_window_get_active_view (_tmp11_); _tmp13_ = _tmp12_; document_view_scroll_to_cursor (_tmp13_, 0.25); _tmp14_ = self->priv->_main_window; _tmp15_ = main_window_get_active_view (_tmp14_); _tmp16_ = _tmp15_; gtk_widget_grab_focus ((GtkWidget*) _tmp16_); } }
false
false
false
false
false
0
uvc_endpoint_max_bpi(struct usb_device *dev, struct usb_host_endpoint *ep) { u16 psize; switch (dev->speed) { case USB_SPEED_SUPER: return le16_to_cpu(ep->ss_ep_comp.wBytesPerInterval); case USB_SPEED_HIGH: psize = usb_endpoint_maxp(&ep->desc); return (psize & 0x07ff) * (1 + ((psize >> 11) & 3)); case USB_SPEED_WIRELESS: psize = usb_endpoint_maxp(&ep->desc); return psize; default: psize = usb_endpoint_maxp(&ep->desc); return psize & 0x07ff; } }
false
false
false
false
false
0
pm_gui_load_directories (PluginManagerGUI *pm_gui, GSList const *plugin_dirs, gboolean is_conf) { for (; plugin_dirs; plugin_dirs = plugin_dirs->next) { GtkTreeIter iter; gtk_list_store_append (pm_gui->model_directories, &iter); gtk_list_store_set (pm_gui->model_directories, &iter, DIR_NAME, (char *) plugin_dirs->data, DIR_IS_SYSTEM, !is_conf, -1); } }
false
false
false
false
false
0
NVSetPattern(struct fb_info *info, u32 clr0, u32 clr1, u32 pat0, u32 pat1) { struct nvidia_par *par = info->par; NVDmaStart(info, par, PATTERN_COLOR_0, 4); NVDmaNext(par, clr0); NVDmaNext(par, clr1); NVDmaNext(par, pat0); NVDmaNext(par, pat1); }
false
false
false
false
false
0
__nfit_spa_map(struct acpi_nfit_desc *acpi_desc, struct acpi_nfit_system_address *spa, enum spa_map_type type) { resource_size_t start = spa->address; resource_size_t n = spa->length; struct nfit_spa_mapping *spa_map; struct resource *res; WARN_ON(!mutex_is_locked(&acpi_desc->spa_map_mutex)); spa_map = find_spa_mapping(acpi_desc, spa); if (spa_map) { kref_get(&spa_map->kref); return spa_map->addr.base; } spa_map = kzalloc(sizeof(*spa_map), GFP_KERNEL); if (!spa_map) return NULL; INIT_LIST_HEAD(&spa_map->list); spa_map->spa = spa; kref_init(&spa_map->kref); spa_map->acpi_desc = acpi_desc; res = request_mem_region(start, n, dev_name(acpi_desc->dev)); if (!res) goto err_mem; spa_map->type = type; if (type == SPA_MAP_APERTURE) spa_map->addr.aperture = (void __pmem *)memremap(start, n, ARCH_MEMREMAP_PMEM); else spa_map->addr.base = ioremap_nocache(start, n); if (!spa_map->addr.base) goto err_map; list_add_tail(&spa_map->list, &acpi_desc->spa_maps); return spa_map->addr.base; err_map: release_mem_region(start, n); err_mem: kfree(spa_map); return NULL; }
false
false
false
false
false
0
extract_my_addr(header_t *header) { const char *field; host_addr_t addr; field = header_get(header, "Remote-Ip"); if (!field) field = header_get(header, "X-Remote-Ip"); if (field) { if (!string_to_host_addr(field, NULL, &addr)) { if (extract_addr_debugging(0)) { g_debug("cannot parse Remote-IP header \"%s\"", field); if (extract_addr_debugging(1)) { g_debug("full header dump:"); header_dump(stderr, header, "----"); } } } } else { addr = zero_host_addr; } return addr; }
false
false
false
false
false
0
thread_search(gboolean cancelable, gchar *text, void *(*func)(void *), void *arg) { gint rc; pthread_attr_t thread_attr; void *p; LOG(LOG_DEBUG, "IN : thread_search(%s)", arg); thread_running = 1; hit_count = 0; pthread_attr_init (&thread_attr) ; pthread_attr_setstacksize (&thread_attr, 512*1024) ; pthread_mutex_init(&mutex, NULL); if(cancelable == TRUE) { show_cancel_dialog(text); } LOG(LOG_DEBUG, "thread_create"); rc = pthread_create(&tid, &thread_attr, func, (void *)arg); if(rc != 0){ LOG(LOG_CRITICAL, "pthread_create: %s", strerror(errno)); LOG(LOG_DEBUG, "OUT : thread_search()"); exit(1); } LOG(LOG_DEBUG, "thread_created"); pthread_attr_destroy(&thread_attr); if(cancelable == TRUE) { tag_timeout = gtk_timeout_add(WATCH_INTERVAL, watch_thread, NULL); // pthread_join(tid, &p); } else { pthread_join(tid, &p); thread_running = 0; show_result_tree(); select_first_item(); } LOG(LOG_DEBUG, "OUT : thread_search()"); }
false
false
false
false
false
0
mx_label_set_property (GObject *gobject, guint prop_id, const GValue *value, GParamSpec *pspec) { MxLabel *label = MX_LABEL (gobject); switch (prop_id) { case PROP_TEXT: mx_label_set_text (label, g_value_get_string (value)); break; case PROP_USE_MARKUP: mx_label_set_use_markup (label, g_value_get_boolean (value)); break; case PROP_Y_ALIGN: mx_label_set_y_align (label, g_value_get_enum (value)); break; case PROP_X_ALIGN: mx_label_set_x_align (label, g_value_get_enum (value)); break; case PROP_LINE_WRAP: mx_label_set_line_wrap (label, g_value_get_boolean (value)); break; case PROP_FADE_OUT: mx_label_set_fade_out (label, g_value_get_boolean (value)); break; case PROP_SHOW_TOOLTIP: mx_label_set_show_tooltip (label, g_value_get_boolean (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); break; } }
false
false
false
false
false
0
snprint_objid(char *buf, size_t buf_len, const oid * objid, size_t objidlen) { size_t out_len = 0; if (sprint_realloc_objid((u_char **) & buf, &buf_len, &out_len, 0, objid, objidlen)) { return (int) out_len; } else { return -1; } }
false
false
false
false
false
0
mojo_list_remove(struct mojo_list* list) { struct mojo_list_elem *e = TAILQ_LAST(&list->mojo_list_head, Lists_head); TAILQ_REMOVE(&list->mojo_list_head, e, mojo_lists); /* Also free the associated object : */ free_object(e->obj); free(e); }
false
false
false
false
false
0
ai_good_time_to_rearm(object *objp) { int team; Assert(objp->type == OBJ_SHIP); team = Ships[objp->instance].team; return timestamp_valid(Iff_info[team].ai_rearm_timestamp); }
false
false
false
false
false
0
hx509_request_get_name(hx509_context context, hx509_request req, hx509_name *name) { if (req->name == NULL) { hx509_set_error_string(context, 0, EINVAL, "Request have no name"); return EINVAL; } return hx509_name_copy(context, req->name, name); }
false
false
false
false
false
0
plpgsql_compile_inline(char *proc_source) { char *func_name = "inline_code_block"; PLpgSQL_function *function; ErrorContextCallback plerrcontext; Oid typinput; PLpgSQL_variable *var; int parse_rc; MemoryContext func_cxt; int i; /* * Setup the scanner input and error info. We assume that this function * cannot be invoked recursively, so there's no need to save and restore * the static variables used here. */ plpgsql_scanner_init(proc_source); plpgsql_error_funcname = func_name; /* * Setup error traceback support for ereport() */ plerrcontext.callback = plpgsql_compile_error_callback; plerrcontext.arg = proc_source; plerrcontext.previous = error_context_stack; error_context_stack = &plerrcontext; /* Do extra syntax checking if check_function_bodies is on */ plpgsql_check_syntax = check_function_bodies; /* Function struct does not live past current statement */ function = (PLpgSQL_function *) palloc0(sizeof(PLpgSQL_function)); plpgsql_curr_compile = function; /* * All the rest of the compile-time storage (e.g. parse tree) is kept in * its own memory context, so it can be reclaimed easily. */ func_cxt = AllocSetContextCreate(CurrentMemoryContext, "PL/pgSQL function context", ALLOCSET_DEFAULT_MINSIZE, ALLOCSET_DEFAULT_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE); compile_tmp_cxt = MemoryContextSwitchTo(func_cxt); function->fn_name = pstrdup(func_name); function->fn_is_trigger = false; function->fn_cxt = func_cxt; function->out_param_varno = -1; /* set up for no OUT param */ function->resolve_option = plpgsql_variable_conflict; plpgsql_ns_init(); plpgsql_ns_push(func_name); plpgsql_DumpExecTree = false; datums_alloc = 128; plpgsql_nDatums = 0; plpgsql_Datums = palloc(sizeof(PLpgSQL_datum *) * datums_alloc); datums_last = 0; /* Set up as though in a function returning VOID */ function->fn_rettype = VOIDOID; function->fn_retset = false; function->fn_retistuple = false; /* a bit of hardwired knowledge about type VOID here */ function->fn_retbyval = true; function->fn_rettyplen = sizeof(int32); getTypeInputInfo(VOIDOID, &typinput, &function->fn_rettypioparam); fmgr_info(typinput, &(function->fn_retinput)); /* * Remember if function is STABLE/IMMUTABLE. XXX would it be better to * set this TRUE inside a read-only transaction? Not clear. */ function->fn_readonly = false; /* * Create the magic FOUND variable. */ var = plpgsql_build_variable("found", 0, plpgsql_build_datatype(BOOLOID, -1), true); function->found_varno = var->dno; /* * Now parse the function's text */ parse_rc = plpgsql_yyparse(); if (parse_rc != 0) elog(ERROR, "plpgsql parser returned %d", parse_rc); function->action = plpgsql_parse_result; plpgsql_scanner_finish(); /* * If it returns VOID (always true at the moment), we allow control to * fall off the end without an explicit RETURN statement. */ if (function->fn_rettype == VOIDOID) add_dummy_return(function); /* * Complete the function's info */ function->fn_nargs = 0; function->ndatums = plpgsql_nDatums; function->datums = palloc(sizeof(PLpgSQL_datum *) * plpgsql_nDatums); for (i = 0; i < plpgsql_nDatums; i++) function->datums[i] = plpgsql_Datums[i]; /* * Pop the error context stack */ error_context_stack = plerrcontext.previous; plpgsql_error_funcname = NULL; plpgsql_check_syntax = false; MemoryContextSwitchTo(compile_tmp_cxt); compile_tmp_cxt = NULL; return function; }
false
false
false
false
false
0
map_v4v6_hostent(hp, bpp, lenp) struct hostent *hp; char **bpp; int *lenp; { char **ap; if (hp->h_addrtype != AF_INET || hp->h_length != INADDRSZ) return; hp->h_addrtype = AF_INET6; hp->h_length = IN6ADDRSZ; for (ap = hp->h_addr_list; *ap; ap++) { int i = sizeof(align) - ((u_long)*bpp % sizeof(align)); if (*lenp < (i + IN6ADDRSZ)) { /* Out of memory. Truncate address list here. XXX */ *ap = NULL; return; } *bpp += i; *lenp -= i; map_v4v6_address(*ap, *bpp); *ap = *bpp; *bpp += IN6ADDRSZ; *lenp -= IN6ADDRSZ; } }
false
false
false
false
false
0
UnionWiggleIteratorPop(WiggleIterator * wi) { UnaryWiggleIteratorData * data = (UnaryWiggleIteratorData *) wi->data; WiggleIterator * iter = data->iter; int count = 0; if (iter->done) { wi->done = true; return; } while (!iter->done) { if (!count) { wi->chrom = iter->chrom; wi->start = iter->start; wi->finish = iter->finish; } else if (wi->chrom == iter->chrom && wi->finish >= iter->start) { if (iter->finish > wi->finish) wi->finish = iter->finish; } else break; count++; pop(iter); } wi->done = (count == 0); }
false
false
false
false
false
0
gdict_strategy_chooser_has_strategy (GdictStrategyChooser *chooser, const gchar *strategy) { GdictStrategyChooserPrivate *priv; GtkTreeIter iter; gboolean retval; g_return_val_if_fail (GDICT_IS_STRATEGY_CHOOSER (chooser), FALSE); g_return_val_if_fail (strategy != NULL, FALSE); priv = chooser->priv; if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (priv->store), &iter)) return FALSE; retval = FALSE; do { gchar *strat_name; gtk_tree_model_get (GTK_TREE_MODEL (priv->store), &iter, STRAT_COLUMN_NAME, &strat_name, -1); if (strcmp (strat_name, strategy) == 0) { retval = TRUE; g_free (strat_name); break; } g_free (strat_name); } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (priv->store), &iter)); return retval; }
false
false
false
false
false
0
EatBlockComment() { if (c == '{') { do { ExtractChar(); if (c == '\n') { ++line; pos = 0; } if (in.eof()) Error("end of file in comment"); } while (c != '}'); ExtractChar(); } }
false
false
false
false
false
0
mono_debug_lookup_method_addresses (MonoMethod *method) { MonoDebugMethodAddressList *info; MonoDebugMethodHeader *header = NULL; struct LookupMethodAddressData data; MonoMethod *declaring; int count, size; GSList *list; guint8 *ptr; g_assert ((mono_debug_debugger_version == 4) || (mono_debug_debugger_version == 5)); mono_debugger_lock (); declaring = method->is_inflated ? ((MonoMethodInflated *) method)->declaring : method; data.method = declaring; data.result = NULL; g_hash_table_foreach (data_table_hash, lookup_method_address_func, &data); header = data.result; if (!header) { mono_debugger_unlock (); return NULL; } count = g_slist_length (header->address_list) + 1; size = sizeof (MonoDebugMethodAddressList) + count * sizeof (gpointer); info = g_malloc0 (size); info->size = size; info->count = count; ptr = info->data; WRITE_UNALIGNED (gpointer, ptr, header); ptr += sizeof (gpointer); for (list = header->address_list; list; list = list->next) { WRITE_UNALIGNED (gpointer, ptr, list->data); ptr += sizeof (gpointer); } mono_debugger_unlock (); return info; }
false
false
false
false
false
0
aclMatchUser(void *proxyauth_acl, char *user) { acl_user_data *data = (acl_user_data *) proxyauth_acl; splayNode *Top = data->names; debug(28, 7) ("aclMatchUser: user is %s, case_insensitive is %d\n", user, data->flags.case_insensitive); debug(28, 8) ("Top is %p, Top->data is %s\n", Top, (char *) (Top != NULL ? (Top)->data : "Unavailable")); if (user == NULL || strcmp(user, "-") == 0) return 0; if (data->flags.required) { debug(28, 7) ("aclMatchUser: user REQUIRED and auth-info present.\n"); return 1; } if (data->flags.case_insensitive) Top = splay_splay(user, Top, (SPLAYCMP *) strcasecmp); else Top = splay_splay(user, Top, (SPLAYCMP *) strcmp); /* Top=splay_splay(user,Top,(SPLAYCMP *)dumping_strcmp); */ debug(28, 7) ("aclMatchUser: returning %d,Top is %p, Top->data is %s\n", !splayLastResult, Top, (char *) (Top ? Top->data : "Unavailable")); data->names = Top; return !splayLastResult; }
false
false
false
false
false
0
dev_frameset_master(const char *p1) { cpl_frameset *frset = NULL; cpl_frame *fr = NULL; int i = 0; KMO_TRY { KMO_TRY_EXIT_IF_NULL( frset = cpl_frameset_new()); for (i = 0; i < 3; i++) { KMO_TRY_EXIT_IF_NULL( fr = cpl_frame_new()); KMO_TRY_EXIT_IF_ERROR( cpl_frame_set_filename(fr, p1)); KMO_TRY_EXIT_IF_ERROR( cpl_frame_set_tag(fr, FS_DATA)); KMO_TRY_EXIT_IF_ERROR( cpl_frame_set_type(fr, CPL_FRAME_TYPE_NONE)); KMO_TRY_EXIT_IF_ERROR( cpl_frame_set_group(fr, CPL_FRAME_GROUP_NONE)); KMO_TRY_EXIT_IF_ERROR( cpl_frame_set_level(fr, CPL_FRAME_LEVEL_NONE)); KMO_TRY_EXIT_IF_ERROR( cpl_frameset_insert(frset, fr)); KMO_TRY_EXIT_IF_NULL( fr = cpl_frame_new()); KMO_TRY_EXIT_IF_ERROR( cpl_frame_set_filename(fr, p1)); KMO_TRY_EXIT_IF_ERROR( cpl_frame_set_tag(fr, FS_NOISE)); KMO_TRY_EXIT_IF_ERROR( cpl_frame_set_type(fr, CPL_FRAME_TYPE_NONE)); KMO_TRY_EXIT_IF_ERROR( cpl_frame_set_group(fr, CPL_FRAME_GROUP_NONE)); KMO_TRY_EXIT_IF_ERROR( cpl_frame_set_level(fr, CPL_FRAME_LEVEL_NONE)); KMO_TRY_EXIT_IF_ERROR( cpl_frameset_insert(frset, fr)); } } KMO_CATCH { cpl_frameset_delete(frset); frset = NULL; } return frset; }
false
false
false
false
false
0
_secret_util_get_properties_finish (GDBusProxy *proxy, gpointer result_tag, GAsyncResult *result, GError **error) { GSimpleAsyncResult *res; g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (proxy), result_tag), FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE); res = G_SIMPLE_ASYNC_RESULT (result); if (_secret_util_propagate_error (res, error)) return FALSE; return TRUE; }
false
false
false
false
false
0
BsaveFind( void *theEnv) { struct defglobal *defglobalPtr; struct defmodule *theModule; /*=======================================================*/ /* If a binary image is already loaded, then temporarily */ /* save the count values since these will be overwritten */ /* in the process of saving the binary image. */ /*=======================================================*/ SaveBloadCount(theEnv,DefglobalBinaryData(theEnv)->NumberOfDefglobalModules); SaveBloadCount(theEnv,DefglobalBinaryData(theEnv)->NumberOfDefglobals); /*============================================*/ /* Set the count of defglobals and defglobals */ /* module data structures to zero. */ /*============================================*/ DefglobalBinaryData(theEnv)->NumberOfDefglobals = 0; DefglobalBinaryData(theEnv)->NumberOfDefglobalModules = 0; for (theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,NULL); theModule != NULL; theModule = (struct defmodule *) EnvGetNextDefmodule(theEnv,theModule)) { /*================================================*/ /* Set the current module to the module being */ /* examined and increment the number of defglobal */ /* modules encountered. */ /*================================================*/ EnvSetCurrentModule(theEnv,(void *) theModule); DefglobalBinaryData(theEnv)->NumberOfDefglobalModules++; /*====================================================*/ /* Loop through each defglobal in the current module. */ /*====================================================*/ for (defglobalPtr = (struct defglobal *) EnvGetNextDefglobal(theEnv,NULL); defglobalPtr != NULL; defglobalPtr = (struct defglobal *) EnvGetNextDefglobal(theEnv,defglobalPtr)) { /*======================================================*/ /* Initialize the construct header for the binary save. */ /*======================================================*/ MarkConstructHeaderNeededItems(&defglobalPtr->header,DefglobalBinaryData(theEnv)->NumberOfDefglobals++); } } }
false
false
false
false
false
0
listen(struct sockaddr *sa, int len) { if(::bind(nSocket, sa, len) == -1) { return SOCKET_ERR; } if(::listen(nSocket, 511) == -1) { return SOCKET_ERR; } return SOCKET_OK; }
false
false
false
false
false
0
read_line (FILE *file) { static char *string; static size_t string_len; size_t pos = 0; char *ptr; if (!string_len) { string_len = 200; string = XNEWVEC (char, string_len); } while ((ptr = fgets (string + pos, string_len - pos, file))) { size_t len = strlen (string + pos); if (string[pos + len - 1] == '\n') { string[pos + len - 1] = 0; return string; } pos += len; ptr = XNEWVEC (char, string_len * 2); if (ptr) { memcpy (ptr, string, pos); string = ptr; string_len += 2; } else pos = 0; } return pos ? string : NULL; }
false
false
false
false
false
0
swap(chain_list* head, chain_list* elemchain) { chain_list *chain, *list_elem, *swap_elem; if (!elemchain) { if (!head) return addchain(NULL,NULL); return head; } /*return a list of all possibilities with the rest of elemchain*/ swap_elem=swap(NULL,elemchain->NEXT); list_elem=head; for (chain=swap_elem; chain; chain=chain->NEXT) { /*insert new element in all positions*/ /*add it to final result*/ list_elem=all_positions(list_elem,chain->DATA,elemchain->DATA); } /*free mem*/ freechainchain(swap_elem); return list_elem; }
false
false
false
false
false
0
imap_open_store_authenticate_p3( imap_store_t *ctx, struct imap_cmd *cmd ATTR_UNUSED, int response ) { if (response == RESP_NO) imap_open_store_bail( ctx ); else if (response == RESP_OK) imap_open_store_authenticate2( ctx ); }
false
false
false
false
false
0
cyttsp4_si_get_test_data(struct cyttsp4 *cd) { struct cyttsp4_sysinfo *si = &cd->sysinfo; void *p; int rc; si->si_ofs.test_size = si->si_ofs.pcfg_ofs - si->si_ofs.test_ofs; p = krealloc(si->si_ptrs.test, si->si_ofs.test_size, GFP_KERNEL); if (p == NULL) { dev_err(cd->dev, "%s: fail alloc test memory\n", __func__); return -ENOMEM; } si->si_ptrs.test = p; rc = cyttsp4_adap_read(cd, si->si_ofs.test_ofs, si->si_ofs.test_size, si->si_ptrs.test); if (rc < 0) { dev_err(cd->dev, "%s: fail read test data r=%d\n", __func__, rc); return rc; } cyttsp4_pr_buf(cd->dev, cd->pr_buf, (u8 *)si->si_ptrs.test, si->si_ofs.test_size, "sysinfo_test_data"); if (si->si_ptrs.test->post_codel & CY_POST_CODEL_WDG_RST) dev_info(cd->dev, "%s: %s codel=%02X\n", __func__, "Reset was a WATCHDOG RESET", si->si_ptrs.test->post_codel); if (!(si->si_ptrs.test->post_codel & CY_POST_CODEL_CFG_DATA_CRC_FAIL)) dev_info(cd->dev, "%s: %s codel=%02X\n", __func__, "Config Data CRC FAIL", si->si_ptrs.test->post_codel); if (!(si->si_ptrs.test->post_codel & CY_POST_CODEL_PANEL_TEST_FAIL)) dev_info(cd->dev, "%s: %s codel=%02X\n", __func__, "PANEL TEST FAIL", si->si_ptrs.test->post_codel); dev_info(cd->dev, "%s: SCANNING is %s codel=%02X\n", __func__, si->si_ptrs.test->post_codel & 0x08 ? "ENABLED" : "DISABLED", si->si_ptrs.test->post_codel); return rc; }
false
false
false
false
false
0
gain_moves (int mp) { moves += mp; // cruise control TODO: enable for NPC? if (player_in_control(&g->u)) { if (cruise_on) if (abs(cruise_velocity - velocity) >= acceleration()/2 || (cruise_velocity != 0 && velocity == 0) || (cruise_velocity == 0 && velocity != 0)) thrust (cruise_velocity > velocity? 1 : -1); } if (g->is_in_sunlight(global_x(), global_y())) { int spw = solar_power (); if (spw) { int fl = spw / 100; int prob = spw % 100; if (rng (0, 100) <= prob) fl++; if (fl) refill (AT_BATT, fl); } } // check for smoking parts for (int ep = 0; ep < external_parts.size(); ep++) { int p = external_parts[ep]; if (parts[p].blood > 0) parts[p].blood--; int p_eng = part_with_feature (p, vpf_engine, false); if (p_eng < 0 || parts[p_eng].hp > 0 || parts[p_eng].amount < 1) continue; parts[p_eng].amount--; int x = global_x() + parts[p_eng].precalc_dx[0]; int y = global_y() + parts[p_eng].precalc_dy[0]; for (int ix = -1; ix <= 1; ix++) for (int iy = -1; iy <= 1; iy++) if (!rng(0, 2)) g->m.add_field(g, x + ix, y + iy, fd_smoke, rng(2, 4)); } if (turret_mode) // handle turrets for (int p = 0; p < parts.size(); p++) fire_turret (p); }
false
false
false
false
false
0
output_alias_pair_p (alias_pair *p, symbol_alias_set_t *defined, cgraph_node_set set, varpool_node_set vset) { struct cgraph_node *node; struct varpool_node *vnode; if (lookup_attribute ("weakref", DECL_ATTRIBUTES (p->decl))) { if (TREE_CODE (p->decl) == VAR_DECL) { vnode = varpool_get_node (p->decl); return (vnode && referenced_from_this_partition_p (&vnode->ref_list, set, vset)); } node = cgraph_get_node (p->decl); return (node && (referenced_from_this_partition_p (&node->ref_list, set, vset) || reachable_from_this_partition_p (node, set))); } else return symbol_alias_set_contains (defined, p->decl); }
false
false
false
false
false
0
add_to_dst_predicate_list (struct loop *loop, edge e, tree prev_cond, tree cond) { if (!flow_bb_inside_loop_p (loop, e->dest)) return; if (!is_true_predicate (prev_cond)) cond = fold_build2 (TRUTH_AND_EXPR, boolean_type_node, prev_cond, cond); add_to_predicate_list (e->dest, cond); }
false
false
false
false
false
0
SetCollection(vtkCollection* c) { if(c) { this->Superclass::SetCollection(vtkDataArrayCollection::SafeDownCast(c)); if(!this->Collection) { vtkErrorMacro("vtkDataArrayCollectionIterator cannot traverse a " << c->GetClassName()); } } else { this->Superclass::SetCollection(0); } }
false
false
false
false
false
0
__ecereNameSpace__ecere__com___free(void * pointer) { if(pointer) { if(__ecereNameSpace__ecere__com__memMutex != pointer) __ecereMethod___ecereNameSpace__ecere__sys__Mutex_Wait(__ecereNameSpace__ecere__com__memMutex); __ecereNameSpace__ecere__com___myfree(pointer); if(__ecereNameSpace__ecere__com__memMutex != pointer) __ecereMethod___ecereNameSpace__ecere__sys__Mutex_Release(__ecereNameSpace__ecere__com__memMutex); } }
false
false
false
false
false
0
Perl_newSTUB(pTHX_ GV *gv, bool fake) { CV *cv = MUTABLE_CV(newSV_type(SVt_PVCV)); PERL_ARGS_ASSERT_NEWSTUB; assert(!GvCVu(gv)); GvCV_set(gv, cv); GvCVGEN(gv) = 0; if (!fake && HvENAME_HEK(GvSTASH(gv))) gv_method_changed(gv); CvGV_set(cv, gv); CvFILE_set_from_cop(cv, PL_curcop); CvSTASH_set(cv, PL_curstash); GvMULTI_on(gv); return cv; }
false
false
false
false
false
0
udp_receiver(void *arg) { Octstr *datagram, *cliaddr; int ret; Msg *msg; Udpc *conn = arg; Octstr *ip; gwlist_add_producer(incoming_wdp); gwlist_add_producer(flow_threads); gwthread_wakeup(MAIN_THREAD_ID); /* remove messages from socket until it is closed */ while (bb_status != BB_DEAD && bb_status != BB_SHUTDOWN) { gwlist_consume(isolated); /* block here if suspended/isolated */ if (read_available(conn->fd, 100000) < 1) continue; ret = udp_recvfrom(conn->fd, &datagram, &cliaddr); if (ret == -1) { if (errno == EAGAIN) /* No datagram available, don't block. */ continue; error(errno, "Failed to receive an UDP"); /* * just continue, or is there ANY error that would result * in situation where it would be better to break; or even * die off? - Kalle 28.2 */ continue; } /* discard the message if the client is not allowed */ ip = udp_get_ip(cliaddr); if (!is_allowed_ip(allow_ip, deny_ip, ip)) { warning(0, "UDP: Discarding packet from %s, IP is denied.", octstr_get_cstr(ip)); octstr_destroy(datagram); } else { debug("bb.udp", 0, "datagram received"); msg = msg_create(wdp_datagram); msg->wdp_datagram.source_address = udp_get_ip(cliaddr); msg->wdp_datagram.source_port = udp_get_port(cliaddr); msg->wdp_datagram.destination_address = udp_get_ip(conn->addr); msg->wdp_datagram.destination_port = udp_get_port(conn->addr); msg->wdp_datagram.user_data = datagram; gwlist_produce(incoming_wdp, msg); counter_increase(incoming_wdp_counter); } octstr_destroy(cliaddr); octstr_destroy(ip); } gwlist_remove_producer(incoming_wdp); gwlist_remove_producer(flow_threads); }
false
false
false
false
false
0
display_application (SCM frame, int indentation, SCM sport, SCM port, scm_print_state *pstate) { SCM proc = SCM_FRAME_PROC (frame); SCM name = (scm_is_true (scm_procedure_p (proc)) ? scm_procedure_name (proc) : SCM_BOOL_F); display_frame_expr ("[", scm_cons (scm_is_true (name) ? name : proc, SCM_FRAME_ARGS (frame)), SCM_FRAME_EVAL_ARGS_P (frame) ? " ..." : "]", indentation, sport, port, pstate); }
false
false
false
false
false
0
is_visible_from_outside (struct ld_plugin_symbol *lsym, struct bfd_link_hash_entry *blhe) { struct bfd_sym_chain *sym; if (link_info.relocatable) return TRUE; if (link_info.export_dynamic || !link_info.executable) { /* Check if symbol is hidden by version script. */ if (bfd_hide_sym_by_version (link_info.version_info, blhe->root.string)) return FALSE; /* Only ELF symbols really have visibility. */ if (bfd_get_flavour (link_info.output_bfd) == bfd_target_elf_flavour) { struct elf_link_hash_entry *el = (struct elf_link_hash_entry *)blhe; int vis = ELF_ST_VISIBILITY (el->other); return vis == STV_DEFAULT || vis == STV_PROTECTED; } /* On non-ELF targets, we can safely make inferences by considering what visibility the plugin would have liked to apply when it first sent us the symbol. During ELF symbol processing, visibility only ever becomes more restrictive, not less, when symbols are merged, so this is a conservative estimate; it may give false positives, declaring something visible from outside when it in fact would not have been, but this will only lead to missed optimisation opportunities during LTRANS at worst; it will not give false negatives, which can lead to the disastrous conclusion that the related symbol is IRONLY. (See GCC PR46319 for an example.) */ return (lsym->visibility == LDPV_DEFAULT || lsym->visibility == LDPV_PROTECTED); } for (sym = &entry_symbol; sym != NULL; sym = sym->next) if (sym->name && strcmp (sym->name, blhe->root.string) == 0) return TRUE; return FALSE; }
false
false
false
false
false
0
bubble(game *g, int x, int y) { g->add_msg("You step on some bubblewrap!"); g->sound(x, y, 18, "Pop!"); g->m.tr_at(x, y) = tr_null; }
false
false
false
false
false
0
check_usermap(const char *usermap_name, const char *pg_role, const char *auth_user, bool case_insensitive) { bool found_entry = false, error = false; if (usermap_name == NULL || usermap_name[0] == '\0') { if (case_insensitive) { if (pg_strcasecmp(pg_role, auth_user) == 0) return STATUS_OK; } else { if (strcmp(pg_role, auth_user) == 0) return STATUS_OK; } ereport(LOG, (errmsg("provided user name (%s) and authenticated user name (%s) do not match", pg_role, auth_user))); return STATUS_ERROR; } else { ListCell *line_cell, *num_cell; forboth(line_cell, ident_lines, num_cell, ident_line_nums) { parse_ident_usermap(lfirst(line_cell), lfirst_int(num_cell), usermap_name, pg_role, auth_user, case_insensitive, &found_entry, &error); if (found_entry || error) break; } } if (!found_entry && !error) { ereport(LOG, (errmsg("no match in usermap \"%s\" for user \"%s\" authenticated as \"%s\"", usermap_name, pg_role, auth_user))); } return found_entry ? STATUS_OK : STATUS_ERROR; }
false
false
false
false
false
0
freerdp_event_new(uint32 event_type, FRDP_EVENT_CALLBACK on_event_free_callback, void* user_data) { FRDP_EVENT* event = NULL; switch (event_type) { case FRDP_EVENT_TYPE_DEBUG: event = xnew(FRDP_EVENT); break; case FRDP_EVENT_TYPE_VIDEO_FRAME: event = (FRDP_EVENT*)xnew(FRDP_VIDEO_FRAME_EVENT); break; case FRDP_EVENT_TYPE_REDRAW: event = (FRDP_EVENT*)xnew(FRDP_REDRAW_EVENT); break; case FRDP_EVENT_TYPE_CB_SYNC: event = (FRDP_EVENT*)xnew(FRDP_CB_SYNC_EVENT); break; case FRDP_EVENT_TYPE_CB_FORMAT_LIST: event = (FRDP_EVENT*)xnew(FRDP_CB_FORMAT_LIST_EVENT); break; case FRDP_EVENT_TYPE_CB_DATA_REQUEST: event = (FRDP_EVENT*)xnew(FRDP_CB_DATA_REQUEST_EVENT); break; case FRDP_EVENT_TYPE_CB_DATA_RESPONSE: event = (FRDP_EVENT*)xnew(FRDP_CB_DATA_RESPONSE_EVENT); break; case FRDP_EVENT_TYPE_RAIL_UI_2_VCHANNEL: case FRDP_EVENT_TYPE_RAIL_VCHANNEL_2_UI: event = xnew(FRDP_EVENT); break; } if (event != NULL) { event->event_type = event_type; event->on_event_free_callback = on_event_free_callback; event->user_data = user_data; } return event; }
false
false
false
false
false
0
AvanceEdge(int no, float to, AlphaLigne *line, bool exact, float step) { AvanceEdge(no,to,exact,step); if ( swrData[no].sens ) { if ( swrData[no].curX <= swrData[no].lastX ) { line->AddBord(swrData[no].curX, 0, swrData[no].lastX, swrData[no].curY - swrData[no].lastY, -swrData[no].dydx); } else if ( swrData[no].curX > swrData[no].lastX ) { line->AddBord(swrData[no].lastX, 0, swrData[no].curX, swrData[no].curY - swrData[no].lastY, swrData[no].dydx); } } else { if ( swrData[no].curX <= swrData[no].lastX ) { line->AddBord(swrData[no].curX, 0, swrData[no].lastX, swrData[no].lastY - swrData[no].curY, swrData[no].dydx); } else if ( swrData[no].curX > swrData[no].lastX ) { line->AddBord(swrData[no].lastX, 0, swrData[no].curX, swrData[no].lastY - swrData[no].curY, -swrData[no].dydx); } } }
false
false
false
false
false
0
sge_deliver_events_immediately(u_long32 event_client_id) { lListElem *client = NULL; DENTER(TOP_LAYER, "sge_event_immediate_delivery"); sge_mutex_lock("event_master_mutex", SGE_FUNC, __LINE__, &Event_Master_Control.mutex); if ((client = get_event_client(event_client_id)) == NULL) { ERROR((SGE_EVENT, MSG_EVE_UNKNOWNEVCLIENT_US, sge_u32c(event_client_id), "deliver events immediately")); } else { flush_events(client, 0); sge_mutex_lock("event_master_cond_mutex", SGE_FUNC, __LINE__, &Event_Master_Control.cond_mutex); Event_Master_Control.delivery_signaled = true; pthread_cond_signal(&Event_Master_Control.cond_var); sge_mutex_unlock("event_master_cond_mutex", SGE_FUNC, __LINE__, &Event_Master_Control.cond_mutex); } sge_mutex_unlock("event_master_mutex", SGE_FUNC, __LINE__, &Event_Master_Control.mutex); DRETURN_VOID; }
false
false
false
false
false
0
isTrue(std::string s) { if(s.empty() || s=="false" || s=="0") return false; return true; }
false
false
false
false
false
0
formatTimeStamp(const QDateTime &time) { // TODO: provide an option for user to customize // time stamp format return QString().sprintf("%02d:%02d:%02d", time.time().hour(), time.time().minute(), time.time().second());; }
false
false
false
false
false
0
fsl_edma_fill_tcd(struct fsl_edma_hw_tcd *tcd, u32 src, u32 dst, u16 attr, u16 soff, u32 nbytes, u32 slast, u16 citer, u16 biter, u16 doff, u32 dlast_sga, bool major_int, bool disable_req, bool enable_sg) { u16 csr = 0; /* * eDMA hardware SGs require the TCDs to be stored in little * endian format irrespective of the register endian model. * So we put the value in little endian in memory, waiting * for fsl_edma_set_tcd_regs doing the swap. */ tcd->saddr = cpu_to_le32(src); tcd->daddr = cpu_to_le32(dst); tcd->attr = cpu_to_le16(attr); tcd->soff = cpu_to_le16(EDMA_TCD_SOFF_SOFF(soff)); tcd->nbytes = cpu_to_le32(EDMA_TCD_NBYTES_NBYTES(nbytes)); tcd->slast = cpu_to_le32(EDMA_TCD_SLAST_SLAST(slast)); tcd->citer = cpu_to_le16(EDMA_TCD_CITER_CITER(citer)); tcd->doff = cpu_to_le16(EDMA_TCD_DOFF_DOFF(doff)); tcd->dlast_sga = cpu_to_le32(EDMA_TCD_DLAST_SGA_DLAST_SGA(dlast_sga)); tcd->biter = cpu_to_le16(EDMA_TCD_BITER_BITER(biter)); if (major_int) csr |= EDMA_TCD_CSR_INT_MAJOR; if (disable_req) csr |= EDMA_TCD_CSR_D_REQ; if (enable_sg) csr |= EDMA_TCD_CSR_E_SG; tcd->csr = cpu_to_le16(csr); }
false
false
false
false
false
0
try_apache_listing_unusual(file_info &info,const char *str) { info.clear(); // unusual apache listing: size DD-Mon-YYYY int n=sscanf(str,"%30s %2d-%3s-%d", info.size_str,&info.day,info.month_name,&info.year); if(n==4 && (info.size_str[0]=='-' || is_ascii_digit(info.size_str[0]))) { debug("unusual apache listing matched"); return true; } return false; }
false
false
false
false
false
0
rl_history_search_internal (count, dir) int count, dir; { HIST_ENTRY *temp; int ret, oldpos; rl_maybe_save_line (); temp = (HIST_ENTRY *)NULL; /* Search COUNT times through the history for a line whose prefix matches history_search_string. When this loop finishes, TEMP, if non-null, is the history line to copy into the line buffer. */ while (count) { ret = noninc_search_from_pos (history_search_string, rl_history_search_pos + dir, dir); if (ret == -1) break; /* Get the history entry we found. */ rl_history_search_pos = ret; oldpos = where_history (); history_set_pos (rl_history_search_pos); temp = current_history (); history_set_pos (oldpos); /* Don't find multiple instances of the same line. */ if (prev_line_found && STREQ (prev_line_found, temp->line)) continue; prev_line_found = temp->line; count--; } /* If we didn't find anything at all, return. */ if (temp == 0) { rl_maybe_unsave_line (); rl_ding (); /* If you don't want the saved history line (last match) to show up in the line buffer after the search fails, change the #if 0 to #if 1 */ #if 0 if (rl_point > rl_history_search_len) { rl_point = rl_end = rl_history_search_len; rl_line_buffer[rl_end] = '\0'; rl_mark = 0; } #else rl_point = rl_history_search_len; /* rl_maybe_unsave_line changes it */ rl_mark = rl_end; #endif return 1; } /* Copy the line we found into the current line buffer. */ make_history_line_current (temp); rl_point = rl_history_search_len; rl_mark = rl_end; return 0; }
false
false
false
false
false
0
findRowSection(long index, HTMLTableSectionElementImpl*& outSection, long& outIndex) const { HTMLTableSectionElementImpl* foot = tFoot(); HTMLTableSectionElementImpl* head = tHead(); HTMLTableSectionElementImpl* section = 0L; HTMLTableSectionElementImpl* lastSection = 0L; if ( head ) section = processSection( head, lastSection, index ); if ( !section ) { for ( NodeImpl *node = firstChild(); node; node = node->nextSibling() ) { if ( ( node->id() == ID_THEAD || node->id() == ID_TFOOT || node->id() == ID_TBODY ) && node != foot && node != head ) { section = processSection( static_cast<HTMLTableSectionElementImpl *>(node), lastSection, index ); if ( section ) break; } } } if ( !section && foot ) section = processSection( foot, lastSection, index ); outIndex = index; if ( section ) { outSection = section; return true; } else { outSection = lastSection; return false; } }
false
false
false
false
false
0
gfs1_rgrp_print(struct gfs1_rgrp *rg) { gfs2_meta_header_print(&rg->rg_header); pv(rg, rg_flags, "%u", "0x%x"); pv(rg, rg_free, "%u", "0x%x"); pv(rg, rg_useddi, "%u", "0x%x"); pv(rg, rg_freedi, "%u", "0x%x"); gfs2_inum_print(&rg->rg_freedi_list); pv(rg, rg_usedmeta, "%u", "0x%x"); pv(rg, rg_freemeta, "%u", "0x%x"); }
false
false
false
false
false
0
ucm_mergeTables(UCMTable *fromUTable, UCMTable *toUTable, const uint8_t *subchar, int32_t subcharLength, uint8_t subchar1) { UCMapping *fromUMapping, *toUMapping; int32_t fromUIndex, toUIndex, fromUTop, toUTop, cmp; ucm_sortTable(fromUTable); ucm_sortTable(toUTable); fromUMapping=fromUTable->mappings; toUMapping=toUTable->mappings; fromUTop=fromUTable->mappingsLength; toUTop=toUTable->mappingsLength; fromUIndex=toUIndex=0; while(fromUIndex<fromUTop && toUIndex<toUTop) { cmp=compareMappings(fromUTable, fromUMapping, toUTable, toUMapping, TRUE); if(cmp==0) { /* equal: roundtrip, nothing to do (flags are initially 0) */ ++fromUMapping; ++toUMapping; ++fromUIndex; ++toUIndex; } else if(cmp<0) { /* * the fromU mapping does not have a toU counterpart: * fallback Unicode->codepage */ if( (fromUMapping->bLen==subcharLength && 0==uprv_memcmp(UCM_GET_BYTES(fromUTable, fromUMapping), subchar, subcharLength)) || (subchar1!=0 && fromUMapping->bLen==1 && fromUMapping->b.bytes[0]==subchar1) ) { fromUMapping->f=2; /* SUB mapping */ } else { fromUMapping->f=1; /* normal fallback */ } ++fromUMapping; ++fromUIndex; } else { /* * the toU mapping does not have a fromU counterpart: * (reverse) fallback codepage->Unicode, copy it to the fromU table */ /* ignore reverse fallbacks to Unicode SUB */ if(!(toUMapping->uLen==1 && (toUMapping->u==0xfffd || toUMapping->u==0x1a))) { toUMapping->f=3; /* reverse fallback */ ucm_addMapping(fromUTable, toUMapping, UCM_GET_CODE_POINTS(toUTable, toUMapping), UCM_GET_BYTES(toUTable, toUMapping)); /* the table may have been reallocated */ fromUMapping=fromUTable->mappings+fromUIndex; } ++toUMapping; ++toUIndex; } } /* either one or both tables are exhausted */ while(fromUIndex<fromUTop) { /* leftover fromU mappings are fallbacks */ if( (fromUMapping->bLen==subcharLength && 0==uprv_memcmp(UCM_GET_BYTES(fromUTable, fromUMapping), subchar, subcharLength)) || (subchar1!=0 && fromUMapping->bLen==1 && fromUMapping->b.bytes[0]==subchar1) ) { fromUMapping->f=2; /* SUB mapping */ } else { fromUMapping->f=1; /* normal fallback */ } ++fromUMapping; ++fromUIndex; } while(toUIndex<toUTop) { /* leftover toU mappings are reverse fallbacks */ /* ignore reverse fallbacks to Unicode SUB */ if(!(toUMapping->uLen==1 && (toUMapping->u==0xfffd || toUMapping->u==0x1a))) { toUMapping->f=3; /* reverse fallback */ ucm_addMapping(fromUTable, toUMapping, UCM_GET_CODE_POINTS(toUTable, toUMapping), UCM_GET_BYTES(toUTable, toUMapping)); } ++toUMapping; ++toUIndex; } fromUTable->isSorted=FALSE; }
false
false
false
false
false
0