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
cmor_get_variable_time_length(int *var_id, int *length) { cmor_var_t avar; int i; *length=0; avar = cmor_vars[*var_id]; for (i=0;i<avar.ndims;i++) { if (cmor_axes[avar.original_order[i]].axis=='T') *length=cmor_axes[avar.original_order[i]].length; } /* if (*length == -1) { */ /* snprintf(msg,CMOR_MAX_STRING,"trying to retrieve length of time axis for variable %s but this variable does not have a time axis",avar.id); */ /* cmor_handle_error(msg,CMOR_CRITICAL); */ /* } */ return 0; }
false
false
false
false
false
0
H5E_get_auto(const H5E_t *estack, H5E_auto_op_t *op, void **client_data) { FUNC_ENTER_NOAPI_NOINIT_NOERR HDassert(estack); /* Retrieve the requested information */ if(op) *op = estack->auto_op; if(client_data) *client_data = estack->auto_data; FUNC_LEAVE_NOAPI(SUCCEED) }
false
false
false
false
false
0
chkNoInstantClass( void ) { CLASS *class = ClassList; while( class != NULL ){ if( !class->branch ) return( class->name ); class = class->next; } return( NULL ); }
false
false
false
false
false
0
voice_dial(struct audio_device *device, const char *buf) { gboolean enable; if (strlen(buf) < 9) return -EINVAL; if (buf[8] == '0') enable = FALSE; else enable = TRUE; telephony_voice_dial_req(device, enable); return 0; }
false
false
false
false
false
0
print_express(node,c) struct expnode *node; /* expression tree */ int c; /* character for parameters */ { if ( !strstart ) /* for first time thru */ { strsize = 200; strstart = my_list_calloc(1,strsize,ETERNAL_BLOCK); } else strstart[0] = '\0'; linestart = pos = strstart; vch = (char)c; if ( !node || !node->root ) { strcpy(strstart,"{}"); return strstart;} bracket_depth = 0; current_proc_locals[0] = node->locals; current_proc_depth = 0; exprint_recur(node->root,0); return strstart; }
false
false
false
false
false
0
delim_from_arg (const char *s) { int i; for (i=0; csv_delim_args[i] != NULL; i++) { if (!strcmp(s, csv_delim_args[i])) { return csv_delims[i]; } } return 0; }
false
false
false
false
false
0
scc_maybe_rx_int(int port, double dcycs) { Scc *scc_ptr; int depth; int rx_int_mode; scc_ptr = &(scc_stat[port]); depth = scc_ptr->rx_queue_depth; if(depth <= 0) { /* no more chars, just get out */ scc_clr_rx_int(port); return; } rx_int_mode = (scc_ptr->reg[1] >> 3) & 0x3; if(rx_int_mode == 1 || rx_int_mode == 2) { scc_ptr->wantint_rx = 1; } scc_evaluate_ints(port); }
false
false
false
false
false
0
dowrite(unsigned offset, unsigned size) { ssize_t ret; off_t newsize; offset -= offset % writebdy; if (o_direct) size -= size % writebdy; if (size == 0) { if (!quiet && testcalls > simulatedopcount && !o_direct) prt("skipping zero size write\n"); log4(OP_SKIPPED, OP_WRITE, offset, size); return; } log4(OP_WRITE, offset, size, file_size); gendata(original_buf, good_buf, offset, size); if (file_size < offset + size) { newsize = ceil(((double)offset + size) / truncbdy) * truncbdy; if (file_size < newsize) memset(good_buf + file_size, '\0', newsize - file_size); file_size = newsize; if (lite) { warn("Lite file size bug in fsx!"); report_failure(149); } ret = rbd_resize(image, newsize); if (ret < 0) { prterrcode("dowrite: resize", ret); report_failure(150); } } if (testcalls <= simulatedopcount) return; if (!quiet && ((progressinterval && testcalls % progressinterval == 0) || (debug && (monitorstart == -1 || (offset + size > monitorstart && (monitorend == -1 || offset <= monitorend)))))) prt("%lu write\t0x%x thru\t0x%x\t(0x%x bytes)\n", testcalls, offset, offset + size - 1, size); ret = rbd_write(image, offset, size, good_buf + offset); if (ret != size) { if (ret < 0) prterrcode("dowrite: rbd_write", ret); else prt("short write: 0x%x bytes instead of 0x%x\n", ret, size); report_failure(151); } if (flush) { doflush(offset, size); } }
false
false
false
false
false
0
nand_bch_free(struct nand_bch_control *nbc) { if (nbc) { free_bch(nbc->bch); kfree(nbc->errloc); kfree(nbc->eccmask); kfree(nbc); } }
false
false
false
false
false
0
unpark_waiters_on(Capability *cap, StgTVar *s) { StgTVarWatchQueue *q; StgTVarWatchQueue *trail; TRACE("unpark_waiters_on tvar=%p", s); // unblock TSOs in reverse order, to be a bit fairer (#2319) for (q = s -> first_watch_queue_entry, trail = q; q != END_STM_WATCH_QUEUE; q = q -> next_queue_entry) { trail = q; } q = trail; for (; q != END_STM_WATCH_QUEUE; q = q -> prev_queue_entry) { if (watcher_is_tso(q)) { unpark_tso(cap, (StgTSO *)(q -> closure)); } } }
false
false
false
false
false
0
find_std_name(const struct std_name *arrPtr, unsigned int arrSize, const char *bufPtr, unsigned int bufSize) { unsigned int idx; const struct std_name *p; for (idx = 0; idx < arrSize; idx++) { p = arrPtr + idx; if (strlen(p->name) != bufSize) continue; if (!memcmp(bufPtr,p->name,bufSize)) return p; } return NULL; }
false
false
false
false
false
0
Gen_to_Dmatrix(Gen_node g){ Dmatrix Res; Gmatrix M; int i,j; M=Gen_Mtx(g); Res=Dmatrix_new(GMrows(M),GMcols(M)); for(i=1;i<=GMrows(M);i++) for(j=1;j<=GMcols(M);j++) DMref(Res,i,j)=Gen_To_Dbl(*GMref(M,i,j)); return Res; }
false
false
false
false
false
0
insert FUNCTION((s, x, start, length), char *s AND int x AND int start AND int length) { unsigned char cl; unsigned char cc; unsigned char cr; UINT4 y; int shift; shift = ((8 - ((start + length) % 8)) % 8); y = (long) x << shift; cl = (y >> 16) & 0xff; cc = (y >> 8) & 0xff; cr = y & 0xff; if (shift + length > 16) { s[start / 8] |= cl; s[start / 8 + 1] |= cc; s[start / 8 + 2] |= cr; } else if (shift + length > 8) { s[start / 8] |= cc; s[start / 8 + 1] |= cr; } else { s[start / 8] |= cr; } }
false
false
false
false
false
0
new_frame(Fm_mem_src *src, char *name, unsigned int flags) { Frame *f; f = (Frame *) MALLOC(sizeof(Frame)); if (f == NULL) { frame_errmsg = "malloc failed"; return(NULL); } if (name == NULL || *name == '\0') f->name = NULL; else f->name = xstrdup(name); if (src == NULL) { static Fm_mem_src default_mem_src; static Fm_mem_funcs_standard default_mem_funcs = { MALLOC, FREE }; default_mem_src.type = MEM_SRC_DEFAULT; default_mem_src.u.mem_funcs_standard = &default_mem_funcs; f->src = &default_mem_src; } else f->src = src; f->popped = 1; f->src->flags = flags & FM_FRAME_FLAG_MASK; f->chunks = NULL; f->next = popped_frames; popped_frames = f; return(f); }
false
false
false
false
false
0
wi_mutable_string_expand_tilde_in_path(wi_mutable_string_t *path) { wi_array_t *array; wi_string_t *component, *string; struct passwd *user; wi_uinteger_t length; WI_RUNTIME_ASSERT_MUTABLE(path); if(!wi_string_has_prefix(path, WI_STR("~"))) return; array = wi_string_path_components(path); component = WI_ARRAY(array, 0); length = wi_string_length(component); if(length == 1) { user = getpwuid(getuid()); } else { wi_mutable_string_delete_characters_to_index(component, 1); user = getpwnam(wi_string_cstring(component)); } if(user) { wi_mutable_string_delete_characters_to_index(path, length); string = wi_string_init_with_cstring(wi_string_alloc(), user->pw_dir); wi_mutable_string_insert_string_at_index(path, string, 0); wi_release(string); } }
false
false
false
false
false
0
widget_text_update(void *Self) { WIDGET *W = (WIDGET *) Self; WIDGET_TEXT *T = W->data; char *string; int update = 0; /* evaluate properties */ update += property_eval(&T->prefix); update += property_eval(&T->postfix); update += property_eval(&T->style); /* evaluate value */ property_eval(&T->value); /* string or number? */ if (T->precision == 0xDEAD) { string = strdup(P2S(&T->value)); } else { double number = P2N(&T->value); int width = T->width - strlen(P2S(&T->prefix)) - strlen(P2S(&T->postfix)); int precision = T->precision; /* print zero bytes so we can specify NULL as target */ /* and get the length of the resulting string */ int size = snprintf(NULL, 0, "%.*f", precision, number); /* number does not fit into field width: try to reduce precision */ if (width < 0) width = 0; if (size > width && precision > 0) { int delta = size - width; if (delta > precision) delta = precision; precision -= delta; size -= delta; /* zero precision: omit decimal point, too */ if (precision == 0) size--; } /* number still doesn't fit: display '*****' */ if (size > width) { string = malloc(width + 1); memset(string, '*', width); *(string + width) = '\0'; } else { string = malloc(size + 1); snprintf(string, size + 1, "%.*f", precision, number); } } /* did the formatted string change? */ if (T->string == NULL || strcmp(T->string, string) != 0) { update++; free(T->string); T->string = string; } else { free(string); } /* something has changed and should be updated */ if (update) { /* reset marquee counter if content has changed */ T->scroll = 0; /* Init pingpong scroller. start scrolling left (wrong way) to get a delay */ if (T->align == ALIGN_PINGPONG_LEFT || T->align == ALIGN_PINGPONG_CENTER || T->align == ALIGN_PINGPONG_RIGHT) { T->direction = 0; T->delay = PINGPONGWAIT; } /* if there's a marquee scroller active, it has its own */ /* update callback timer, so we do nothing here; otherwise */ /* we simply call this scroll callback directly */ if (T->align != ALIGN_MARQUEE || T->align != ALIGN_AUTOMATIC || T->align != ALIGN_PINGPONG_LEFT || T->align != ALIGN_PINGPONG_CENTER || T->align != ALIGN_PINGPONG_RIGHT) { widget_text_scroll(Self); } } }
false
false
false
false
true
1
get_record_instance(const glsl_struct_field *fields, unsigned num_fields, const char *name) { const glsl_type key(fields, num_fields, name); if (record_types == NULL) { record_types = hash_table_ctor(64, record_key_hash, record_key_compare); } const glsl_type *t = (glsl_type *) hash_table_find(record_types, & key); if (t == NULL) { t = new glsl_type(fields, num_fields, name); hash_table_insert(record_types, (void *) t, t); } assert(t->base_type == GLSL_TYPE_STRUCT); assert(t->length == num_fields); assert(strcmp(t->name, name) == 0); return t; }
false
false
false
false
false
0
i2c_dw_isr(int this_irq, void *dev_id) { struct dw_i2c_dev *dev = dev_id; u32 stat, enabled; enabled = dw_readl(dev, DW_IC_ENABLE); stat = dw_readl(dev, DW_IC_RAW_INTR_STAT); dev_dbg(dev->dev, "%s: enabled=%#x stat=%#x\n", __func__, enabled, stat); if (!enabled || !(stat & ~DW_IC_INTR_ACTIVITY)) return IRQ_NONE; stat = i2c_dw_read_clear_intrbits(dev); if (stat & DW_IC_INTR_TX_ABRT) { dev->cmd_err |= DW_IC_ERR_TX_ABRT; dev->status = STATUS_IDLE; /* * Anytime TX_ABRT is set, the contents of the tx/rx * buffers are flushed. Make sure to skip them. */ dw_writel(dev, 0, DW_IC_INTR_MASK); goto tx_aborted; } if (stat & DW_IC_INTR_RX_FULL) i2c_dw_read(dev); if (stat & DW_IC_INTR_TX_EMPTY) i2c_dw_xfer_msg(dev); /* * No need to modify or disable the interrupt mask here. * i2c_dw_xfer_msg() will take care of it according to * the current transmit status. */ tx_aborted: if ((stat & (DW_IC_INTR_TX_ABRT | DW_IC_INTR_STOP_DET)) || dev->msg_err) complete(&dev->cmd_complete); else if (unlikely(dev->accessor_flags & ACCESS_INTR_MASK)) { /* workaround to trigger pending interrupt */ stat = dw_readl(dev, DW_IC_INTR_MASK); i2c_dw_disable_int(dev); dw_writel(dev, stat, DW_IC_INTR_MASK); } return IRQ_HANDLED; }
false
false
false
false
false
0
reallocate() { Canvas* c = canvas_; if (c != nil) { /* remove these two lines when doc otherwise works */ Requisition s; request(s); c->push_transform(); c->transformer(transformer_); extension_.clear(); allocate(c, allocation_, extension_); c->pop_transform(); } }
false
false
false
false
false
0
ManagerCallback() { m_Mutex.Lock(); if ( CConfig::Instance() ) { if ( m_pListen ) { if ( CConfig::Instance()->GetMode(true) == ecmACTIVE ) { if ( m_pListen->IsConnect() == -1 ) { StartListen(); } if ( m_bCrypto ) { if ( CConfig::Instance()->GetCryptoListenPort() != m_nListenPort ) { StartListen(); } } else { if ( CConfig::Instance()->GetTCPListenPort() != m_nListenPort ) { StartListen(); } } } else { StartListen(); } } else { if ( CConfig::Instance()->GetMode(true) == ecmACTIVE ) { StartListen(); } } } m_Mutex.UnLock(); return 0; }
false
false
false
false
false
0
pkix_pl_LdapDefaultClient_RecvNonInitial( PKIX_PL_LdapDefaultClient *client, PKIX_Boolean *pKeepGoing, void *plContext) { PKIX_UInt32 bytesProcessed = 0; PKIX_ENTER (LDAPDEFAULTCLIENT, "pkix_pl_LdapDefaultClient_RecvNonInitial"); PKIX_NULLCHECK_TWO(client, pKeepGoing); PKIX_CHECK(pkix_pl_LdapResponse_Append (client->currentResponse, client->currentBytesAvailable, client->currentInPtr, &bytesProcessed, plContext), PKIX_LDAPRESPONSEAPPENDFAILED); client->currentBytesAvailable -= bytesProcessed; PKIX_CHECK(pkix_pl_LdapDefaultClient_RecvCheckComplete (client, bytesProcessed, pKeepGoing, plContext), PKIX_LDAPDEFAULTCLIENTRECVCHECKCOMPLETEFAILED); cleanup: PKIX_RETURN(LDAPDEFAULTCLIENT); }
false
false
false
false
false
0
fbcon_softback_note(struct vc_data *vc, int t, int count) { unsigned short *p; if (vc->vc_num != fg_console) return; p = (unsigned short *) (vc->vc_origin + t * vc->vc_size_row); while (count) { scr_memcpyw((u16 *) softback_in, p, vc->vc_size_row); count--; p = advance_row(p, 1); softback_in += vc->vc_size_row; if (softback_in == softback_end) softback_in = softback_buf; if (softback_in == softback_top) { softback_top += vc->vc_size_row; if (softback_top == softback_end) softback_top = softback_buf; } } softback_curr = softback_in; }
false
false
false
false
false
0
lua_setuservalue (lua_State *L, int idx) { StkId o; lua_lock(L); api_checknelems(L, 1); o = index2addr(L, idx); api_check(ttisfulluserdata(o), "full userdata expected"); setuservalue(L, uvalue(o), L->top - 1); luaC_barrier(L, gcvalue(o), L->top - 1); L->top--; lua_unlock(L); }
false
false
false
false
false
0
setProfile(xmlNode *profile) { this->unsetProfile(); if(profile != NULL) { /* xmlNodePtr node; node = xmlNewNode(NULL, (xmlChar*)"profile"); node = xmlDocCopyNode(node, doc, 1); xmlAddChild(doc->children, node); xmlNodeSetContent(node, (xmlChar*)get_content(profile)); cout << "profile " << ( get_content(profile) ? get_content(profile) : "" ) << " added" << endl; */ profile = xmlDocCopyNode(profile, doc, 1); //1 means recursively (with all children) xmlAddChild(doc->children, profile); //cout << "profile " << getProfileName() << " added" << endl; } }
false
false
false
false
false
0
dsvec_init_size(Dsvec *odsv, size_t size, int n) { Dsvec *dsv; dsvec_errmsg = NULL; if (odsv == NULL) { if ((dsv = new_dsvec(size)) == NULL) return(NULL); } else { dsv = odsv; dsv->alloc_flag = 0; set_default_dsvec(dsv, size); } if ((dsv->ptr = (void **) dsv->malloc(n * size)) == NULL) { dsvec_errmsg = "malloc failed"; return(NULL); } dsv->nalloc = n; return(dsv); }
false
false
false
false
false
0
load_dict(const char* path, struct stat* oldstat, dict* dictp, void (*free_fn)(void*), int (*load_fn)(void)) { struct stat s; switch (stat_changed(path, oldstat, &s)) { case -1: if (errno != ENOENT) return 0; oldstat->st_mtime = 0; oldstat->st_ino = 0; oldstat->st_size = 0; dict_free(dictp, free_fn); return 1; case 0: return 1; } // FIXME: obuf_putsflush(&errbuf, "Reloading *path*\n"); *oldstat = s; dict_free(dictp, free_fn); return load_fn(); }
false
false
false
false
false
0
_extract_parameter(char *param, char *buffer, int buffer_size) { /* * if we start with a quote then we must end with a quote * otherwise we end with a space */ if (*param == '\"') { int cnt = 0; param += 1; for (cnt = 0; *param && *param != '\"' && cnt < buffer_size - 1; cnt++, param++) { buffer[cnt] = *param; } buffer[cnt] = '\0'; } else { int cnt = 0; for (cnt = 0; *param && !isspace(*param) && *param != '>' && cnt < buffer_size - 1; cnt++, param++) { buffer[cnt] = *param; } buffer[cnt] = '\0'; } }
false
false
false
false
false
0
egg_list_box_update_active (EggListBox *list_box, EggListBoxChildInfo *child) { EggListBoxPrivate *priv = list_box->priv; gboolean val; val = priv->active_child == child; if (priv->active_child != NULL && val != priv->active_child_active) { priv->active_child_active = val; gtk_widget_queue_draw (GTK_WIDGET (list_box)); } }
false
false
false
false
false
0
set_ftp_options_unlocked (GstCurlBaseSink * basesink) { GstCurlFtpSink *sink = GST_CURL_FTP_SINK (basesink); curl_easy_setopt (basesink->curl, CURLOPT_UPLOAD, 1L); if (sink->ftp_port_arg != NULL && (strlen (sink->ftp_port_arg) > 0)) { /* Connect data stream actively. */ CURLcode res = curl_easy_setopt (basesink->curl, CURLOPT_FTPPORT, sink->ftp_port_arg); if (res != CURLE_OK) { GST_DEBUG_OBJECT (sink, "Failed to set up active mode: %s", curl_easy_strerror (res)); GST_ELEMENT_ERROR (sink, RESOURCE, WRITE, ("Failed to set up active mode: %s", curl_easy_strerror (res)), (NULL)); return FALSE; } goto end; } /* Connect data stream passively. * libcurl will always attempt to use EPSV before PASV. */ if (!sink->epsv_mode) { /* send only plain PASV command */ curl_easy_setopt (basesink->curl, CURLOPT_FTP_USE_EPSV, 0); } end: if (sink->create_dirs) { curl_easy_setopt (basesink->curl, CURLOPT_FTP_CREATE_MISSING_DIRS, 1L); } return TRUE; }
false
false
false
false
false
0
botaddr_tcl_set(Tcl_Interp * irp, struct userrec *u, struct user_entry *e, int argc, char **argv) { register struct bot_addr *bi = (struct bot_addr *) e->u.extra; BADARGS(4, 6, " handle type address ?telnetport ?relayport??"); if (u->flags & USER_BOT) { /* Silently ignore for users */ if (!bi) { bi = user_malloc(sizeof(struct bot_addr)); egg_bzero(bi, sizeof(struct bot_addr)); } else nfree(bi->address); bi->address = user_malloc(strlen(argv[3]) + 1); strcpy(bi->address, argv[3]); if (argc > 4) bi->telnet_port = atoi(argv[4]); if (argc > 5) bi->relay_port = atoi(argv[5]); if (!bi->telnet_port) bi->telnet_port = 3333; if (!bi->relay_port) bi->relay_port = bi->telnet_port; botaddr_set(u, e, bi); } return TCL_OK; }
false
false
false
false
false
0
G_get_default_window(struct Cell_head *window) { char *err; if ((err = G__get_window(window, "", "DEFAULT_WIND", "PERMANENT"))) { G_fatal_error(_("default region %s"), err); G_free(err); } return 1; }
true
true
false
false
false
1
_backup_adder_orc_volume_s32 (OrcExecutor * ORC_RESTRICT ex) { int i; int n = ex->n; orc_union32 * ORC_RESTRICT ptr0; orc_union32 var33; orc_union32 var34; orc_union32 var35; orc_union64 var36; orc_union64 var37; ptr0 = (orc_union32 *)ex->arrays[0]; /* 1: loadpl */ var34.i = ex->params[24]; for (i = 0; i < n; i++) { /* 0: loadl */ var33 = ptr0[i]; /* 2: mulslq */ var36.i = ((orc_int64)var33.i) * ((orc_int64)var34.i); /* 3: shrsq */ var37.i = var36.i >> 27; /* 4: convsssql */ var35.i = ORC_CLAMP_SL(var37.i); /* 5: storel */ ptr0[i] = var35; } }
false
false
false
false
false
0
json_parse_string_with_comments(const char *string) { JSON_Value *result = NULL; char *string_mutable_copy = NULL, *string_mutable_copy_ptr = NULL; string_mutable_copy = parson_strdup(string); if (!string_mutable_copy) return NULL; remove_comments(string_mutable_copy, "/*", "*/"); remove_comments(string_mutable_copy, "//", "\n"); string_mutable_copy_ptr = string_mutable_copy; SKIP_WHITESPACES(&string_mutable_copy_ptr); if (*string_mutable_copy_ptr != '{' && *string_mutable_copy_ptr != '[') { PARSON_FREE(string_mutable_copy); return NULL; } result = parse_value((const char**)&string_mutable_copy_ptr, 0); PARSON_FREE(string_mutable_copy); return result; }
false
false
false
false
false
0
ecpg_dynamic_type(Oid type) { switch (type) { case BOOLOID: return SQL3_BOOLEAN; /* bool */ case INT2OID: return SQL3_SMALLINT; /* int2 */ case INT4OID: return SQL3_INTEGER; /* int4 */ case TEXTOID: return SQL3_CHARACTER; /* text */ case FLOAT4OID: return SQL3_REAL; /* float4 */ case FLOAT8OID: return SQL3_DOUBLE_PRECISION; /* float8 */ case BPCHAROID: return SQL3_CHARACTER; /* bpchar */ case VARCHAROID: return SQL3_CHARACTER_VARYING; /* varchar */ case DATEOID: return SQL3_DATE_TIME_TIMESTAMP; /* date */ case TIMEOID: return SQL3_DATE_TIME_TIMESTAMP; /* time */ case TIMESTAMPOID: return SQL3_DATE_TIME_TIMESTAMP; /* datetime */ case NUMERICOID: return SQL3_NUMERIC; /* numeric */ default: return -(int) type; } }
false
false
false
false
false
0
create_new_item(item *env, sint32 tag) { item *op; if (!free_items) { free_items = alloc_items(NROF_ITEMS); } op = free_items; free_items = free_items->next; if (free_items) { free_items->prev = NULL; } op->tag = tag; op->locked = 0; if (env) { add_item(env, op); } return op; }
false
false
false
false
false
0
delay_ok(int i, unsigned char alarm_result, char mors) { int bit_position = 128; int j = 7; int ret = 0; sprintf(temp_message_space, "delay_ok(): i: %d\talarm_result: %.2x\tmors: %c", i, alarm_result, mors); log_message(4, temp_message_space); if ((int)mors == 'm') { while ( bit_position >= 1 ) { if ( alarm_result >= bit_position ) { /* We have found a high bit, so a timeout increment is in order */ alarm_result = alarm_result - bit_position; mono_delay_counter[i][j]++; } else { /* We will want to check if [i][j] was above the notify threshold If it was we need to notify that the condition has returned to normal */ if ( mono_delay_counter[i][j] >= ( Delay * DataRate ) ) notify(i, j, 'm'); mono_delay_counter[i][j] = 0; } /* Have we reached the notify threshold */ if ( mono_delay_counter[i][j] == ( Delay * DataRate ) ) ret = 1; --j; bit_position = bit_position >> 1; } } if ((int)mors == 's') { while ( bit_position >= 1 ) { if ( alarm_result >= bit_position ) { /* We have found a high bit, so a timeout increment is in order */ alarm_result = alarm_result - bit_position; stereo_delay_counter[i][j]++; } else { /* We will want to check if [i][j] was above the notify threshold If it was we need to notify that the condition has returned to normal */ if ( stereo_delay_counter[i][j] >= ( Delay * DataRate ) ) notify(i, j, 's'); stereo_delay_counter[i][j] = 0; } /* Have we reached the notify threshold */ if ( stereo_delay_counter[i][j] == ( Delay * DataRate ) ) ret = 1; --j; bit_position = bit_position >> 1; } } /* A silence has been present for the required period */ if ( ret == 1 ) return 0; /* Otherwise return 1 */ return 1; }
false
false
false
false
false
0
itracku_device_dump_waypts(void* fd, void (*waypt_add)(waypoint* wpt)) { itracku_data_record d; dbg(1, "reading memory"); gbser_write(fd, read_update_data_command, sizeof(read_update_data_command)); itracku_device_update_data_init(); while (itracku_device_update_data_read(&d, sizeof(d))) { if (itracku_is_valid_data_record(&d)) { if (import_data_record(&d)) { waypt_add(to_waypoint(&d)); } } } }
false
false
false
false
false
0
run() { #ifdef SIGPIPE /* Don't die with SIGPIPE on remote read shutdown. That's dumb. */ signal( SIGPIPE, SIG_IGN ); #endif int ret = 0; int listenFD = -1; ret = SP_IOUtils::tcpListen( mBindIP, mPort, &listenFD, 0 ); if( 0 == ret ) { // Clean close on SIGINT or SIGTERM. mEvSigInt = (struct event*)malloc( sizeof( struct event ) ); signal_set( mEvSigInt, SIGINT, sigHandler, this ); event_base_set( mEventArg->getEventBase(), mEvSigInt ); signal_add( mEvSigInt, NULL); mEvSigTerm = (struct event*)malloc( sizeof( struct event ) ); signal_set( mEvSigTerm, SIGTERM, sigHandler, this ); event_base_set( mEventArg->getEventBase(), mEvSigTerm ); signal_add( mEvSigTerm, NULL); mEvAccept = (struct event*)malloc( sizeof( struct event ) ); event_set( mEvAccept, listenFD, EV_READ|EV_PERSIST, SP_EventCallback::onAccept, mAcceptArg ); event_base_set( mEventArg->getEventBase(), mEvAccept ); event_add( mEvAccept, NULL ); mCompletionHandler = mAcceptArg->mHandlerFactory->createCompletionHandler(); if( NULL == mAcceptArg->mIOChannelFactory ) { mAcceptArg->mIOChannelFactory = new SP_DefaultIOChannelFactory(); } mThreadPool = new SP_ThreadPool( mMaxThreads ); for( int i = 0; i < mMaxThreads; i++ ) { mThreadPool->dispatch( lfHandler, this ); } } return ret; }
false
false
false
false
false
0
mono_test_marshal_ansi_char_array (char *s) { const char m[] = "abcdef"; if (strncmp ("qwer", s, 4)) return 1; memcpy (s, m, sizeof (m)); return 0; }
false
false
false
false
false
0
get_cairo_pattern(const FillStyle& style, const SWFCxForm& cx) { StyleHandler st(cx); cairo_pattern_t* pattern = boost::apply_visitor(st, style.fill); return pattern; }
false
false
false
false
false
0
RomByte(b) { rom[Dot.value] = b; if (Dot.value > MaxDotValue) MaxDotValue = Dot.value; if ((Dot.value += 1) >= romsize) { RomGrow(); } }
false
false
false
false
false
0
Open(LoaderBase* fileLdr, const wxString& filename, int pos,ProjectFile* data) { bool can_updateui = !GetActiveEditor() || !Manager::Get()->GetProjectManager()->IsLoading(); wxFileName fn(realpath(filename)); NormalizePath(fn, wxEmptyString); wxString fname = UnixFilename(fn.GetFullPath()); // Manager::Get()->GetLogManager()->DebugLog("Trying to open '%s'", fname.c_str()); if (!wxFileExists(fname)) return NULL; // Manager::Get()->GetLogManager()->DebugLog("File exists '%s'", fname.c_str()); // disallow application shutdown while opening files // WARNING: remember to set it to true, when exiting this function!!! s_CanShutdown = false; SEditorBase* eb = IsOpen(fname); ScbEditor* ed = 0; if (eb) { if (eb->IsBuiltinEditor()) ed = (ScbEditor*)eb; else return 0; // is open but not a builtin editor } if (!ed) { ed = new ScbEditor(m_pNotebook, fileLdr, fname, m_Theme); if (ed->IsOK()) AddEditorBase(ed); else { ed->Destroy(); ed = NULL; } } if(can_updateui) { if (ed) { SetActiveEditor(ed); ed->GetControl()->SetFocus(); } } // check for ProjectFile if (ed && !ed->GetProjectFile()) { // First checks if we're already being passed a ProjectFile // as a parameter if(data) { Manager::Get()->GetLogManager()->DebugLog(_T("project data set for ") + data->file.GetFullPath()); } else { ProjectsArray* projects = Manager::Get()->GetProjectManager()->GetProjects(); for (unsigned int i = 0; i < projects->GetCount(); ++i) { cbProject* prj = projects->Item(i); ProjectFile* pf = prj->GetFileByFilename(ed->GetFilename(), false); if (pf) { Manager::Get()->GetLogManager()->DebugLog(_T("found ") + pf->file.GetFullPath()); data = pf; break; } } } if(data) ed->SetProjectFile(data,true); } // we 're done s_CanShutdown = true; return ed; }
false
false
false
false
false
0
spl_ptr_llist_push(spl_ptr_llist *llist, void *data TSRMLS_DC) /* {{{ */ { spl_ptr_llist_element *elem = emalloc(sizeof(spl_ptr_llist_element)); elem->data = data; elem->rc = 1; elem->prev = llist->tail; elem->next = NULL; if (llist->tail) { llist->tail->next = elem; } else { llist->head = elem; } llist->tail = elem; llist->count++; if (llist->ctor) { llist->ctor(elem TSRMLS_CC); } }
false
false
false
false
false
0
multiplexer_repr (Multiplexer* self) { gchar* result = NULL; gchar _tmp0_ = '\0'; struct gsm0710_context* _tmp1_ = NULL; gint _tmp2_ = 0; gchar _tmp3_ = '\0'; struct gsm0710_context* _tmp4_ = NULL; gint _tmp5_ = 0; const gchar* _tmp6_ = NULL; struct gsm0710_context* _tmp7_ = NULL; gint _tmp8_ = 0; gchar* _tmp9_ = NULL; g_return_val_if_fail (self != NULL, NULL); _tmp1_ = self->priv->ctx; _tmp2_ = _tmp1_->mode; if (_tmp2_ == 1) { _tmp0_ = 'A'; } else { _tmp0_ = 'B'; } _tmp3_ = _tmp0_; _tmp4_ = self->priv->ctx; _tmp5_ = _tmp4_->frame_size; _tmp6_ = self->priv->portname; _tmp7_ = self->priv->ctx; _tmp8_ = _tmp7_->port_speed; _tmp9_ = g_strdup_printf ("<%c%d %s@%d>", (gint) _tmp3_, _tmp5_, _tmp6_, _tmp8_); result = _tmp9_; return result; }
false
false
false
false
false
0
stk1160_reg_reset(struct stk1160 *dev) { int i; static const struct regval ctl[] = { {STK1160_GCTRL+2, 0x0078}, {STK1160_RMCTL+1, 0x0000}, {STK1160_RMCTL+3, 0x0002}, {STK1160_PLLSO, 0x0010}, {STK1160_PLLSO+1, 0x0000}, {STK1160_PLLSO+2, 0x0014}, {STK1160_PLLSO+3, 0x000E}, {STK1160_PLLFD, 0x0046}, /* Timing generator setup */ {STK1160_TIGEN, 0x0012}, {STK1160_TICTL, 0x002D}, {STK1160_TICTL+1, 0x0001}, {STK1160_TICTL+2, 0x0000}, {STK1160_TICTL+3, 0x0000}, {STK1160_TIGEN, 0x0080}, {0xffff, 0xffff} }; for (i = 0; ctl[i].reg != 0xffff; i++) stk1160_write_reg(dev, ctl[i].reg, ctl[i].val); }
false
false
false
false
false
0
reduce_tertiaries (NODE_T * p) { NODE_T *q; BOOL_T siga; for (q = p; q != NO_NODE; FORWARD (q)) { reduce (q, NO_NOTE, NO_TICK, TERTIARY, NIHIL, STOP); reduce (q, NO_NOTE, NO_TICK, FORMULA, MONADIC_FORMULA, STOP); reduce (q, NO_NOTE, NO_TICK, TERTIARY, FORMULA, STOP); reduce (q, NO_NOTE, NO_TICK, TERTIARY, SECONDARY, STOP); } siga = A68_TRUE; while (siga) { siga = A68_FALSE; for (q = p; q != NO_NODE; FORWARD (q)) { reduce (q, NO_NOTE, &siga, TRANSPOSE_FUNCTION, TRANSPOSE_SYMBOL, TERTIARY, STOP); reduce (q, NO_NOTE, &siga, DIAGONAL_FUNCTION, TERTIARY, DIAGONAL_SYMBOL, TERTIARY, STOP); reduce (q, NO_NOTE, &siga, DIAGONAL_FUNCTION, DIAGONAL_SYMBOL, TERTIARY, STOP); reduce (q, NO_NOTE, &siga, COLUMN_FUNCTION, TERTIARY, COLUMN_SYMBOL, TERTIARY, STOP); reduce (q, NO_NOTE, &siga, COLUMN_FUNCTION, COLUMN_SYMBOL, TERTIARY, STOP); reduce (q, NO_NOTE, &siga, ROW_FUNCTION, TERTIARY, ROW_SYMBOL, TERTIARY, STOP); reduce (q, NO_NOTE, &siga, ROW_FUNCTION, ROW_SYMBOL, TERTIARY, STOP); } for (q = p; q != NO_NODE; FORWARD (q)) { reduce (q, a68_extension, &siga, TERTIARY, TRANSPOSE_FUNCTION, STOP); reduce (q, a68_extension, &siga, TERTIARY, DIAGONAL_FUNCTION, STOP); reduce (q, a68_extension, &siga, TERTIARY, COLUMN_FUNCTION, STOP); reduce (q, a68_extension, &siga, TERTIARY, ROW_FUNCTION, STOP); } } for (q = p; q != NO_NODE; FORWARD (q)) { reduce (q, NO_NOTE, NO_TICK, IDENTITY_RELATION, TERTIARY, IS_SYMBOL, TERTIARY, STOP); reduce (q, NO_NOTE, NO_TICK, IDENTITY_RELATION, TERTIARY, ISNT_SYMBOL, TERTIARY, STOP); } for (q = p; q != NO_NODE; FORWARD (q)) { reduce (q, NO_NOTE, NO_TICK, AND_FUNCTION, TERTIARY, ANDF_SYMBOL, TERTIARY, STOP); reduce (q, NO_NOTE, NO_TICK, OR_FUNCTION, TERTIARY, ORF_SYMBOL, TERTIARY, STOP); } }
false
false
false
false
false
0
is_shadow(struct dm_transaction_manager *tm, dm_block_t b) { int r = 0; unsigned bucket = dm_hash_block(b, DM_HASH_MASK); struct shadow_info *si; spin_lock(&tm->lock); hlist_for_each_entry(si, tm->buckets + bucket, hlist) if (si->where == b) { r = 1; break; } spin_unlock(&tm->lock); return r; }
false
false
false
false
false
0
output (int unit, unsigned char *p, int len) { if (debug) { log_packet(p, len, "sent ", LOG_DEBUG); } if (write(ppp_fd, p, len) < 0) { if (errno == EWOULDBLOCK || errno == ENOBUFS || errno == ENXIO || errno == EIO || errno == EINTR) { syslog(LOG_WARNING, "write: warning: %m (%d)", errno); } else { syslog(LOG_ERR, "write: %m (%d)", errno); } } }
false
false
false
false
false
0
leavesAreNumConst(const Expr& e) { DebugAssert(e.isTerm() || (e.isPropAtom() && theoryOf(e) == this), "Expected term or arith prop atom"); if (e.validTerminalsConstFlag()) { return e.getTerminalsConstFlag(); } if (e.isRational()) { e.setTerminalsConstFlag(true); return true; } if (e.isAtomic() && isLeaf(e)) { e.setTerminalsConstFlag(false); return false; } DebugAssert(e.arity() > 0, "Expected non-zero arity"); int k = 0; if (e.isITE()) { k = 1; } for (; k < e.arity(); ++k) { if (!leavesAreNumConst(e[k])) { e.setTerminalsConstFlag(false); return false; } } e.setTerminalsConstFlag(true); return true; }
false
false
false
false
false
0
radeon_irq_kms_pflip_irq_put(struct radeon_device *rdev, int crtc) { unsigned long irqflags; if (crtc < 0 || crtc >= rdev->num_crtc) return; if (!rdev->ddev->irq_enabled) return; if (atomic_dec_and_test(&rdev->irq.pflip[crtc])) { spin_lock_irqsave(&rdev->irq.lock, irqflags); radeon_irq_set(rdev); spin_unlock_irqrestore(&rdev->irq.lock, irqflags); } }
false
false
false
false
false
0
open_route_table (void) { char *path; close_route_table(); path = path_to_procfs("/net/route"); route_fd = fopen (path, "r"); if (route_fd == NULL) { error("can't open routing table %s: %m", path); return 0; } route_dev_col = 0; /* default to usual columns */ route_dest_col = 1; route_gw_col = 2; route_flags_col = 3; route_mask_col = 7; route_num_cols = 8; /* parse header line */ if (fgets(route_buffer, sizeof(route_buffer), route_fd) != 0) { char *p = route_buffer, *q; int col; for (col = 0; col < ROUTE_MAX_COLS; ++col) { int used = 1; if ((q = strtok(p, route_delims)) == 0) break; if (strcasecmp(q, "iface") == 0) route_dev_col = col; else if (strcasecmp(q, "destination") == 0) route_dest_col = col; else if (strcasecmp(q, "gateway") == 0) route_gw_col = col; else if (strcasecmp(q, "flags") == 0) route_flags_col = col; else if (strcasecmp(q, "mask") == 0) route_mask_col = col; else used = 0; if (used && col >= route_num_cols) route_num_cols = col + 1; p = NULL; } } return 1; }
false
false
false
false
true
1
sheet_find_boundary_horizontal (Sheet *sheet, int start_col, int move_row, int base_row, int count, gboolean jump_to_boundaries) { gboolean find_nonblank = sheet_is_cell_empty (sheet, start_col, move_row); gboolean keep_looking = FALSE; int new_col, prev_col, lagged_start_col, max_col = gnm_sheet_get_last_col (sheet); int iterations = 0; GnmRange check_merge; GnmRange const * const bound = &sheet->priv->unhidden_region; /* Jumping to bounds requires steping cell by cell */ g_return_val_if_fail (count == 1 || count == -1 || !jump_to_boundaries, start_col); g_return_val_if_fail (IS_SHEET (sheet), start_col); if (move_row < base_row) { check_merge.start.row = move_row; check_merge.end.row = base_row; } else { check_merge.end.row = move_row; check_merge.start.row = base_row; } do { GSList *merged, *ptr; lagged_start_col = check_merge.start.col = check_merge.end.col = start_col; merged = gnm_sheet_merge_get_overlap (sheet, &check_merge); for (ptr = merged ; ptr != NULL ; ptr = ptr->next) { GnmRange const * const r = ptr->data; if (count > 0) { if (start_col < r->end.col) start_col = r->end.col; } else { if (start_col > r->start.col) start_col = r->start.col; } } g_slist_free (merged); } while (start_col != lagged_start_col); new_col = prev_col = start_col; do { new_col += count; ++iterations; if (new_col < bound->start.col) return MIN (bound->start.col, max_col); if (new_col > bound->end.col) return MIN (bound->end.col, max_col); keep_looking = sheet_col_is_hidden (sheet, new_col); if (jump_to_boundaries) { if (new_col > sheet->cols.max_used) { if (count > 0) return (find_nonblank || iterations == 1)? MIN (bound->end.col, max_col): MIN (prev_col, max_col); new_col = sheet->cols.max_used; } keep_looking |= (sheet_is_cell_empty (sheet, new_col, move_row) == find_nonblank); if (keep_looking) prev_col = new_col; else if (!find_nonblank) { /* * Handle special case where we are on the last * non-null cell */ if (iterations == 1) keep_looking = find_nonblank = TRUE; else new_col = prev_col; } } } while (keep_looking); return MIN (new_col, max_col); }
false
false
false
false
false
0
metadata_value_free(gpointer data) { struct metadata_value *value = data; switch (value->type) { case DBUS_TYPE_STRING: g_free(value->value.str); break; } g_free(value); }
false
false
false
false
false
0
of_pwm_xlate_with_flags(struct pwm_chip *pc, const struct of_phandle_args *args) { struct pwm_device *pwm; if (pc->of_pwm_n_cells < 3) return ERR_PTR(-EINVAL); if (args->args[0] >= pc->npwm) return ERR_PTR(-EINVAL); pwm = pwm_request_from_chip(pc, args->args[0], NULL); if (IS_ERR(pwm)) return pwm; pwm_set_period(pwm, args->args[1]); if (args->args[2] & PWM_POLARITY_INVERTED) pwm_set_polarity(pwm, PWM_POLARITY_INVERSED); else pwm_set_polarity(pwm, PWM_POLARITY_NORMAL); return pwm; }
false
false
false
false
false
0
eel_accessibility_set_atk_object_return (gpointer object, AtkObject *atk_object) { atk_object_initialize (atk_object, object); if (!ATK_IS_GOBJECT_ACCESSIBLE (atk_object)) { g_object_set_qdata_full (object, get_quark_accessible (), atk_object, (GDestroyNotify)eel_accessibility_destroy); g_object_set_qdata (G_OBJECT (atk_object), get_quark_gobject (), object); } return atk_object; }
false
false
false
false
false
0
journal_init_revoke(journal_t *journal, int hash_size) { int shift, tmp; J_ASSERT (journal->j_revoke == NULL); journal->j_revoke = kmem_cache_alloc(revoke_table_cache, GFP_KERNEL); if (!journal->j_revoke) return -ENOMEM; /* Check that the hash_size is a power of two */ J_ASSERT ((hash_size & (hash_size-1)) == 0); journal->j_revoke->hash_size = hash_size; shift = 0; tmp = hash_size; while((tmp >>= 1UL) != 0UL) shift++; journal->j_revoke->hash_shift = shift; journal->j_revoke->hash_table = kmalloc(hash_size * sizeof(struct list_head), GFP_KERNEL); if (!journal->j_revoke->hash_table) { kmem_cache_free(revoke_table_cache, journal->j_revoke); journal->j_revoke = NULL; return -ENOMEM; } for (tmp = 0; tmp < hash_size; tmp++) INIT_LIST_HEAD(&journal->j_revoke->hash_table[tmp]); return 0; }
false
true
false
false
false
1
utilization_print(const lListElem *cr, const char *object_name) { lListElem *rde; DENTER(TOP_LAYER, "utilization_print"); DPRINTF(("resource utilization: %s \"%s\" %f utilized now\n", object_name?object_name:"<unknown_object>", lGetString(cr, RUE_name), lGetDouble(cr, RUE_utilized_now))); for_each (rde, lGetList(cr, RUE_utilized)) { DPRINTF(("\t"sge_U32CFormat" %f\n", lGetUlong(rde, RDE_time), lGetDouble(rde, RDE_amount))); } DPRINTF(("resource utilization: %s \"%s\" %f utilized now non-exclusive\n", object_name?object_name:"<unknown_object>", lGetString(cr, RUE_name), lGetDouble(cr, RUE_utilized_now_nonexclusive))); for_each (rde, lGetList(cr, RUE_utilized_nonexclusive)) { DPRINTF(("\t"sge_U32CFormat" %f\n", lGetUlong(rde, RDE_time), lGetDouble(rde, RDE_amount))); } DRETURN_VOID; }
false
false
false
false
false
0
sci_controller_isr(struct isci_host *ihost) { if (sci_controller_completion_queue_has_entries(ihost)) return true; /* we have a spurious interrupt it could be that we have already * emptied the completion queue from a previous interrupt * FIXME: really!? */ writel(SMU_ISR_COMPLETION, &ihost->smu_registers->interrupt_status); /* There is a race in the hardware that could cause us not to be * notified of an interrupt completion if we do not take this * step. We will mask then unmask the interrupts so if there is * another interrupt pending the clearing of the interrupt * source we get the next interrupt message. */ spin_lock(&ihost->scic_lock); if (test_bit(IHOST_IRQ_ENABLED, &ihost->flags)) { writel(0xFF000000, &ihost->smu_registers->interrupt_mask); writel(0, &ihost->smu_registers->interrupt_mask); } spin_unlock(&ihost->scic_lock); return false; }
false
false
false
false
false
0
pcifront_bus_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val) { int err = 0; struct xen_pci_op op = { .cmd = XEN_PCI_OP_conf_read, .domain = pci_domain_nr(bus), .bus = bus->number, .devfn = devfn, .offset = where, .size = size, }; struct pcifront_sd *sd = bus->sysdata; struct pcifront_device *pdev = pcifront_get_pdev(sd); if (verbose_request) dev_info(&pdev->xdev->dev, "read dev=%04x:%02x:%02x.%d - offset %x size %d\n", pci_domain_nr(bus), bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn), where, size); err = do_pci_op(pdev, &op); if (likely(!err)) { if (verbose_request) dev_info(&pdev->xdev->dev, "read got back value %x\n", op.value); *val = op.value; } else if (err == -ENODEV) { /* No device here, pretend that it just returned 0 */ err = 0; *val = 0; } return errno_to_pcibios_err(err); }
false
false
false
false
false
0
pack_restart(int i, double *buf) { int m = 1; buf[m++] = x[i][0]; buf[m++] = x[i][1]; buf[m++] = x[i][2]; buf[m++] = tag[i]; buf[m++] = type[i]; buf[m++] = mask[i]; buf[m] = 0.0; // for valgrind *((tagint *) &buf[m++]) = image[i]; buf[m++] = v[i][0]; buf[m++] = v[i][1]; buf[m++] = v[i][2]; buf[m++] = rmass[i]; buf[m++] = angmom[i][0]; buf[m++] = angmom[i][1]; buf[m++] = angmom[i][2]; if (ellipsoid[i] < 0) buf[m++] = 0; else { buf[m++] = 1; int j = ellipsoid[i]; buf[m++] = bonus[j].shape[0]; buf[m++] = bonus[j].shape[1]; buf[m++] = bonus[j].shape[2]; buf[m++] = bonus[j].quat[0]; buf[m++] = bonus[j].quat[1]; buf[m++] = bonus[j].quat[2]; buf[m++] = bonus[j].quat[3]; } if (atom->nextra_restart) for (int iextra = 0; iextra < atom->nextra_restart; iextra++) m += modify->fix[atom->extra_restart[iextra]]->pack_restart(i,&buf[m]); buf[0] = m; return m; }
false
false
false
false
false
0
paramGetPropertySet(OfxParamHandle param, OfxPropertySetHandle *propHandle) { # ifdef OFX_DEBUG_PARAMETERS std::cout << "OFX: paramGetPropertySet - " << param << ' ' << propHandle << " ..."; # endif Param::Instance *paramInstance = reinterpret_cast<Param::Instance*>(param); if(paramInstance && paramInstance->verifyMagic()){ // get the param property set if (propHandle) { *propHandle = paramInstance->getPropHandle(); # ifdef OFX_DEBUG_PARAMETERS std::cout << ' ' << *propHandle; # endif } # ifdef OFX_DEBUG_PARAMETERS std::cout << ' ' << StatStr(kOfxStatOK) << std::endl; # endif return kOfxStatOK; } else { # ifdef OFX_DEBUG_PARAMETERS std::cout << ' ' << StatStr(kOfxStatErrBadHandle) << std::endl; # endif return kOfxStatErrBadHandle; } }
false
false
false
false
false
0
PyFF_LayerArray_dealloc(PyFF_LayerArray *self) { if ( self->sc!=NULL ) self->sc = NULL; ((PyObject *)self)->ob_type->tp_free((PyObject *) self); }
false
false
false
false
false
0
pi__dlg_preferences_construct_cb (GtkWidget *dialog, GthBrowser *browser, GtkBuilder *dialog_builder) { PreferencesData *data; GtkWidget *general_vbox; GtkWidget *importer_options; GtkWidget *widget; data = g_new0 (PreferencesData, 1); data->builder = _gtk_builder_new_from_file("photo-importer-options.ui", "photo_importer"); data->settings = g_settings_new (GTHUMB_PHOTO_IMPORTER_SCHEMA); general_vbox = _gtk_builder_get_widget (dialog_builder, "general_vbox"); importer_options = _gtk_builder_get_widget (data->builder, "importer_options"); gtk_box_pack_start (GTK_BOX (general_vbox), importer_options, FALSE, FALSE, 0); /* move the options before the 'other' options */ gtk_box_reorder_child (GTK_BOX (general_vbox), importer_options, _gtk_container_get_n_children (GTK_CONTAINER (general_vbox)) - 2); widget = _gtk_builder_get_widget (data->builder, "adjust_orientation_checkbutton"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), g_settings_get_boolean (data->settings, PREF_PHOTO_IMPORTER_ADJUST_ORIENTATION)); g_signal_connect (widget, "toggled", G_CALLBACK (adjust_orientation_checkbutton_toggled_cb), data); g_object_set_data_full (G_OBJECT (dialog), PREFERENCES_DATA_KEY, data, (GDestroyNotify) preferences_data_free); }
false
false
false
false
false
0
atk_object_real_set_parent (AtkObject *object, AtkObject *parent) { if (object->accessible_parent) g_object_unref (object->accessible_parent); object->accessible_parent = parent; if (object->accessible_parent) g_object_ref (object->accessible_parent); }
false
false
false
false
false
0
gregoriotex_fix_style(gregorio_character *first_character) { unsigned char possible_fixed_style= 0; unsigned char state = 0; /* states are: - 0: we didn't meet any style yet, which means that if we encounter: * a character -> we can return, nothing to do * a style -> we go in state 1 * center or initial: stay in state 0 - 1: we encountered a style, if we encounter * another style : we can return * something that makes us change syllable part (like center or initial) -> go in state 2 * a character : stay in state 1 - 2: if we encounter: * another style, then return * a character, then return * the same style: go in state 1 */ gregorio_character *current_char = first_character; while(current_char) { switch (state) { case 0: if (current_char->is_character) return 0; if (current_char->cos.s.style != ST_CENTER && current_char->cos.s.style != ST_FORCED_CENTER && current_char->cos.s.style != ST_SPECIAL_CHAR && current_char->cos.s.style != ST_VERBATIM && current_char->cos.s.style != ST_INITIAL) { possible_fixed_style=current_char->cos.s.style; state = 1; } break; case 1: if (!current_char->is_character) { if (!current_char->is_character && current_char->cos.s.style != ST_CENTER && current_char->cos.s.style != ST_FORCED_CENTER && current_char->cos.s.style != ST_INITIAL) { state = 2; } else if (current_char->cos.s.style != possible_fixed_style && current_char->cos.s.style != ST_SPECIAL_CHAR && current_char->cos.s.style != ST_VERBATIM) return 0; } break; case 2: if (current_char->is_character) return 0; if (current_char->cos.s.style != ST_CENTER && current_char->cos.s.style != ST_FORCED_CENTER && current_char->cos.s.style != ST_SPECIAL_CHAR && current_char->cos.s.style != ST_VERBATIM && current_char->cos.s.style != ST_INITIAL) { if (current_char->cos.s.style != possible_fixed_style) { return 0; } else { state = 1; } } break; default: break; } current_char = current_char->next_character; } // if we reached here, this means that we there is only one style applied // to all the syllables return possible_fixed_style; }
false
false
false
false
false
0
l2tp_packet_add_int64(struct l2tp_packet_t *pack, int id, int64_t val, int M) { struct l2tp_attr_t *attr = attr_alloc(id, M, pack->hide_avps); if (!attr) return -1; if (attr->H) { if (pack->last_RV == NULL) if (l2tp_packet_add_random_vector(pack) < 0) goto err; val = htobe64(val); if (encode_attr(pack, attr, &val, sizeof(val)) < 0) goto err; } else { attr->length = sizeof(val); attr->val.uint64 = val; } list_add_tail(&attr->entry, &pack->attrs); return 0; err: mempool_free(attr); return -1; }
false
false
false
false
false
0
host_ip(char *str, unsigned char ip[4]) { unsigned int in[4]; int i; if (sscanf(str,"%u.%u.%u.%u",&(in[0]),&(in[1]),&(in[2]),&(in[3])) == 4) { for (i=0; i<4; i++) if (in[i] > 255) { BIO_printf(bio_err,"invalid IP address\n"); goto err; } ip[0]=in[0]; ip[1]=in[1]; ip[2]=in[2]; ip[3]=in[3]; } else { /* do a gethostbyname */ struct hostent *he; if (!ssl_sock_init()) return(0); he=GetHostByName(str); if (he == NULL) { BIO_printf(bio_err,"gethostbyname failure\n"); goto err; } /* cast to short because of win16 winsock definition */ if ((short)he->h_addrtype != AF_INET) { BIO_printf(bio_err,"gethostbyname addr is not AF_INET\n"); return(0); } ip[0]=he->h_addr_list[0][0]; ip[1]=he->h_addr_list[0][1]; ip[2]=he->h_addr_list[0][2]; ip[3]=he->h_addr_list[0][3]; } return(1); err: return(0); }
true
true
false
false
false
1
rd_ghost(u32b version) { char buf[64]; /* Only if the player's alive */ if (p_ptr->is_dead) return 0; /* XXX */ /* Strip name */ rd_string(buf, 64); /* Strip old data */ strip_bytes(60); return 0; }
true
true
false
false
false
1
qmonQCUReadPreferences(void) { static bool preferences_set = false; DENTER(GUI_LAYER, "qmonQCUReadPreferences"); if (!preferences_set) { const char *qfs; queue_filter_resources = lCopyList("", lGetList(qmonGetPreferences(), PREF_queue_filter_resources)); queue_filter_pe = lCopyList("", lGetList(qmonGetPreferences(), PREF_queue_filter_pe)); queue_filter_user = lCopyList("", lGetList(qmonGetPreferences(), PREF_queue_filter_user)); queue_filter_q = lCopyList("", lGetList(qmonGetPreferences(), PREF_queue_filter_q)); qfs = lGetString(qmonGetPreferences(), PREF_queue_filter_state); strcpy(queue_filter_state, qfs ? qfs: ""); preferences_set = true; } DEXIT; }
false
true
false
false
false
1
gda_tree_mgr_select_new (GdaConnection *cnc, GdaStatement *stmt, GdaSet *params) { g_return_val_if_fail (GDA_IS_CONNECTION (cnc), NULL); g_return_val_if_fail (GDA_IS_STATEMENT (stmt), NULL); g_return_val_if_fail (gda_statement_get_statement_type (stmt) == GDA_SQL_STATEMENT_SELECT, NULL); g_return_val_if_fail (!params || GDA_IS_SET (params), NULL); return (GdaTreeManager*) g_object_new (GDA_TYPE_TREE_MGR_SELECT, "connection", cnc, "statement", stmt, "params", params, NULL); }
false
false
false
false
false
0
print(std::ostream &os) const { IOInterface::print(os); std::list<num_addr_pair_t>::const_iterator gmember_iter; os << "* Group members:" << std::endl; for(gmember_iter = groupmember_list.begin(); gmember_iter != groupmember_list.end(); ++gmember_iter) { os << "\t" << inet_ntoa(gmember_iter->first) << " " << gmember_iter->second << std::endl; } }
false
false
false
false
false
0
gen_atmtype_abbrev(type) int type; { struct block *b0, *b1; switch (type) { case A_METAC: /* Get all packets in Meta signalling Circuit */ if (!is_atm) bpf_error("'metac' supported only on raw ATM"); b0 = gen_atmfield_code(A_VPI, 0, BPF_JEQ, 0); b1 = gen_atmfield_code(A_VCI, 1, BPF_JEQ, 0); gen_and(b0, b1); break; case A_BCC: /* Get all packets in Broadcast Circuit*/ if (!is_atm) bpf_error("'bcc' supported only on raw ATM"); b0 = gen_atmfield_code(A_VPI, 0, BPF_JEQ, 0); b1 = gen_atmfield_code(A_VCI, 2, BPF_JEQ, 0); gen_and(b0, b1); break; case A_OAMF4SC: /* Get all cells in Segment OAM F4 circuit*/ if (!is_atm) bpf_error("'oam4sc' supported only on raw ATM"); b0 = gen_atmfield_code(A_VPI, 0, BPF_JEQ, 0); b1 = gen_atmfield_code(A_VCI, 3, BPF_JEQ, 0); gen_and(b0, b1); break; case A_OAMF4EC: /* Get all cells in End-to-End OAM F4 Circuit*/ if (!is_atm) bpf_error("'oam4ec' supported only on raw ATM"); b0 = gen_atmfield_code(A_VPI, 0, BPF_JEQ, 0); b1 = gen_atmfield_code(A_VCI, 4, BPF_JEQ, 0); gen_and(b0, b1); break; case A_SC: /* Get all packets in connection Signalling Circuit */ if (!is_atm) bpf_error("'sc' supported only on raw ATM"); b0 = gen_atmfield_code(A_VPI, 0, BPF_JEQ, 0); b1 = gen_atmfield_code(A_VCI, 5, BPF_JEQ, 0); gen_and(b0, b1); break; case A_ILMIC: /* Get all packets in ILMI Circuit */ if (!is_atm) bpf_error("'ilmic' supported only on raw ATM"); b0 = gen_atmfield_code(A_VPI, 0, BPF_JEQ, 0); b1 = gen_atmfield_code(A_VCI, 16, BPF_JEQ, 0); gen_and(b0, b1); break; case A_LANE: /* Get all LANE packets */ if (!is_atm) bpf_error("'lane' supported only on raw ATM"); b1 = gen_atmfield_code(A_PROTOTYPE, PT_LANE, BPF_JEQ, 0); /* * Arrange that all subsequent tests assume LANE * rather than LLC-encapsulated packets, and set * the offsets appropriately for LANE-encapsulated * Ethernet. * * "off_mac" is the offset of the Ethernet header, * which is 2 bytes past the ATM pseudo-header * (skipping the pseudo-header and 2-byte LE Client * field). The other offsets are Ethernet offsets * relative to "off_mac". */ is_lane = 1; off_mac = off_payload + 2; /* MAC header */ off_linktype = off_mac + 12; off_macpl = off_mac + 14; /* Ethernet */ off_nl = 0; /* Ethernet II */ off_nl_nosnap = 3; /* 802.3+802.2 */ break; case A_LLC: /* Get all LLC-encapsulated packets */ if (!is_atm) bpf_error("'llc' supported only on raw ATM"); b1 = gen_atmfield_code(A_PROTOTYPE, PT_LLC, BPF_JEQ, 0); is_lane = 0; break; default: abort(); } return b1; }
false
false
false
false
false
0
_getOKButtonText() const { const XAP_StringSet * pSS = m_pApp->getStringSet(); UT_return_val_if_fail(pSS, NULL); switch(getDialogId()) { case XAP_DIALOG_ID_LISTDOCUMENTS: return pSS->getValue(XAP_STRING_ID_DLG_Select); case XAP_DIALOG_ID_COMPAREDOCUMENTS: return pSS->getValue(XAP_STRING_ID_DLG_Compare); case XAP_DIALOG_ID_MERGEDOCUMENTS: return pSS->getValue(XAP_STRING_ID_DLG_Merge); default: UT_return_val_if_fail(UT_NOT_REACHED, NULL); } return NULL; }
false
false
false
false
false
0
__vxge_hw_device_vpath_reset_in_prog_check(u64 __iomem *vpath_rst_in_prog) { enum vxge_hw_status status; vxge_trace(); status = __vxge_hw_device_register_poll(vpath_rst_in_prog, VXGE_HW_VPATH_RST_IN_PROG_VPATH_RST_IN_PROG(0x1ffff), VXGE_HW_DEF_DEVICE_POLL_MILLIS); return status; }
false
false
false
false
false
0
squat_scan(SquatSearchIndex* index, char first_char, SquatScanCallback handler, void* closure) { char buf[SQUAT_WORD_SIZE+1]; const char *s; int r = squat_find_branch(&s, NULL, index->word_list, index->data_end, first_char); if (r != SQUAT_OK) return(r); if (!s) return SQUAT_OK; memset(buf, 0, sizeof(buf)); buf[0] = first_char; return(squat_scan_recurse(s, index->data_end, buf, 1, handler, closure)); return SQUAT_OK; }
true
true
false
false
false
1
CopyDesiredColours() { if (!data || !codes || !colours || !lines) { return; } for (int i=0; i<nColours; i++) { colours[i].Copy(); } }
false
false
false
false
false
0
FromTree(const TreeValue* v) { const TreeCompound* src = TreeValueCast<TreeCompound> (v); if (src) { // copy all items named in our current map for (std::vector<MapCompoundElement*>::iterator i( refmap.begin() ); i != refmap.end(); i++) { const TreeValue* srcvalue = src->Get((*i)->Name()); if (srcvalue != NULL) { (*i)->FromTree(srcvalue); } } } }
false
false
false
false
false
0
isNonConstantNegative(const SCEV *F) { const SCEVMulExpr *Mul = dyn_cast<SCEVMulExpr>(F); if (!Mul) return false; // If there is a constant factor, it will be first. const SCEVConstant *SC = dyn_cast<SCEVConstant>(Mul->getOperand(0)); if (!SC) return false; // Return true if the value is negative, this matches things like (-42 * V). return SC->getValue()->getValue().isNegative(); }
false
false
false
false
false
0
efx_rx_config_page_split(struct efx_nic *efx) { efx->rx_page_buf_step = ALIGN(efx->rx_dma_len + efx->rx_ip_align, EFX_RX_BUF_ALIGNMENT); efx->rx_bufs_per_page = efx->rx_buffer_order ? 1 : ((PAGE_SIZE - sizeof(struct efx_rx_page_state)) / efx->rx_page_buf_step); efx->rx_buffer_truesize = (PAGE_SIZE << efx->rx_buffer_order) / efx->rx_bufs_per_page; efx->rx_pages_per_batch = DIV_ROUND_UP(EFX_RX_PREFERRED_BATCH, efx->rx_bufs_per_page); }
false
false
false
false
false
0
square_expose(XEvent *event) /* handle an expose event in a square */ { int rv = 0; struct jester_data *jd = NULL; XFindContext(display, event->xexpose.window, jester_context, (XPointer *)&jd); if(pieces[jd->coords.x][jd->coords.y] == EMPTY) goto DONE; draw_piece(pieces[jd->coords.x][jd->coords.y], event->xexpose.window); DONE: return(rv); }
false
false
false
false
false
0
cwd(std::string& name) { std::string new_dir; if(name[0] != '/') { new_dir=cur_dir+'/'+name; } else { new_dir=name; }; error=FileNode::no_error; if(Arc::CanonicalDir(new_dir,false)) { if(new_dir.length() == 0) { /* always can go to root ? */ cur_dir=new_dir; name=cur_dir; return 0; }; /* check if can cd */ for(std::list<FileNode>::iterator i=nodes.begin();i!=nodes.end();++i) { if((*i) == new_dir) { cur_dir=new_dir; name=cur_dir; return 0; }; if((*i).belongs(new_dir.c_str())) { if((*i).checkdir(new_dir) == 0) { cur_dir=new_dir; name=cur_dir; return 0; }; error=i->error(); name=cur_dir; return 1; }; }; NO_PLUGIN(name); }; name="/"+cur_dir; return 1; }
false
false
false
false
false
0
compute_virtual_size_for_configuration (GnomeRRConfig *config, int *ret_width, int *ret_height) { int i; int width, height; int output_x, output_y, output_width, output_height; GnomeRROutputInfo **outputs; width = height = 0; outputs = gnome_rr_config_get_outputs (config); for (i = 0; outputs[i] != NULL; i++) { if (gnome_rr_output_info_is_active (outputs[i])) { gnome_rr_output_info_get_geometry (outputs[i], &output_x, &output_y, &output_width, &output_height); width = MAX (width, output_x + output_width); height = MAX (height, output_y + output_height); } } *ret_width = width; *ret_height = height; }
false
false
false
false
false
0
updateConstants() { int i,ni; /* Links */ for(i=0,ni=m_links.size();i<ni;++i) { Link& l=m_links[i]; Material& m=*l.m_material; l.m_rl = (l.m_n[0]->m_x-l.m_n[1]->m_x).length(); l.m_c0 = (l.m_n[0]->m_im+l.m_n[1]->m_im)/m.m_kLST; l.m_c1 = l.m_rl*l.m_rl; } /* Faces */ for(i=0,ni=m_faces.size();i<ni;++i) { Face& f=m_faces[i]; f.m_ra = AreaOf(f.m_n[0]->m_x,f.m_n[1]->m_x,f.m_n[2]->m_x); } /* Area's */ btAlignedObjectArray<int> counts; counts.resize(m_nodes.size(),0); for(i=0,ni=m_nodes.size();i<ni;++i) { m_nodes[i].m_area = 0; } for(i=0,ni=m_faces.size();i<ni;++i) { btSoftBody::Face& f=m_faces[i]; for(int j=0;j<3;++j) { const int index=(int)(f.m_n[j]-&m_nodes[0]); counts[index]++; f.m_n[j]->m_area+=btFabs(f.m_ra); } } for(i=0,ni=m_nodes.size();i<ni;++i) { if(counts[i]>0) m_nodes[i].m_area/=(btScalar)counts[i]; else m_nodes[i].m_area=0; } }
false
false
false
false
false
0
lto_fixup_types (tree t) { switch (TREE_CODE (t)) { case IDENTIFIER_NODE: break; case TREE_LIST: LTO_FIXUP_TREE (TREE_VALUE (t)); LTO_FIXUP_TREE (TREE_PURPOSE (t)); LTO_FIXUP_TREE (TREE_CHAIN (t)); break; case FIELD_DECL: lto_ft_field_decl (t); break; case LABEL_DECL: case CONST_DECL: case PARM_DECL: case RESULT_DECL: case IMPORTED_DECL: lto_ft_decl_common (t); break; case VAR_DECL: lto_ft_decl_with_vis (t); break; case TYPE_DECL: lto_ft_decl_non_common (t); break; case FUNCTION_DECL: lto_ft_function (t); break; case TREE_BINFO: lto_ft_binfo (t); break; case PLACEHOLDER_EXPR: lto_ft_common (t); break; case BLOCK: case TRANSLATION_UNIT_DECL: case OPTIMIZATION_NODE: case TARGET_OPTION_NODE: break; default: if (TYPE_P (t)) lto_ft_type (t); else if (TREE_CODE (t) == CONSTRUCTOR) lto_ft_constructor (t); else if (CONSTANT_CLASS_P (t)) LTO_FIXUP_TREE (TREE_TYPE (t)); else if (EXPR_P (t)) { lto_ft_expr (t); } else { remember_with_vars (t); } } }
false
false
false
false
false
0
scc_maybe_rx_event(int port, double dcycs) { Scc *scc_ptr; double rx_dcycs; int in_rdptr, in_wrptr; int depth; scc_ptr = &(scc_stat[port]); if(scc_ptr->rx_event_pending) { /* one pending already, wait for the event to arrive */ return; } in_rdptr = scc_ptr->in_rdptr; in_wrptr = scc_ptr->in_wrptr; depth = scc_ptr->rx_queue_depth; if((in_rdptr == in_wrptr) || (depth >= 3)) { /* no more chars or no more space, just get out */ return; } if(depth < 0) { depth = 0; } /* pull char from in_rdptr into queue */ scc_ptr->rx_queue[depth] = scc_ptr->in_buf[in_rdptr]; scc_ptr->in_rdptr = (in_rdptr + 1) & (SCC_INBUF_SIZE - 1); scc_ptr->rx_queue_depth = depth + 1; scc_maybe_rx_int(port, dcycs); rx_dcycs = scc_ptr->rx_dcycs; scc_ptr->rx_event_pending = 1; add_event_scc(dcycs + rx_dcycs, SCC_MAKE_EVENT(port, SCC_RX_EVENT)); }
false
false
false
false
false
0
FuncADD_ROW_VECTOR_5( Obj self, Obj list1, Obj list2, Obj mult, Obj from, Obj to ) { UInt i; Obj el1,el2; while (!IS_INTOBJ(to) || INT_INTOBJ(to) > LEN_LIST(list1) || INT_INTOBJ(to) > LEN_LIST(list2)) to = ErrorReturnObj("AddRowVector: Upper limit too large", 0L, 0L, "you can replace limit by <lim> via 'return <lim>;'"); for (i = INT_INTOBJ(from); i <= INT_INTOBJ(to); i++) { el1 = ELM_LIST(list1,i); el2 = ELM_LIST(list2,i); el2 = PROD(mult, el2); el1 = SUM(el1,el2); ASS_LIST(list1,i,el1); CHANGED_BAG(list1); } return 0; }
false
false
false
false
false
0
make_radio(GtkWidget *label, gchar **items) { GtkWidget *box, *button; //GSList *group; guint i; box = gtk_vbox_new (FALSE, 0); button = gtk_radio_button_new_with_label (NULL, _(items[0])); gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0); for (i = 1; items[i] != NULL; i++) { button = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (button), _(items[i])); gtk_box_pack_start (GTK_BOX (box), button, FALSE, FALSE, 0); } return box; }
false
false
false
false
false
0
db_object_bytes(Objid oid) { Object *o = objects[oid]; int i, len, count; Verbdef *v; count = sizeof(Object) + sizeof(Object *); count += memo_strlen(o->name) + 1; for (v = o->verbdefs; v; v = v->next) { count += sizeof(Verbdef); count += memo_strlen(v->name) + 1; if (v->program) count += program_bytes(v->program); } count += sizeof(Propdef) * o->propdefs.cur_length; for (i = 0; i < o->propdefs.cur_length; i++) count += memo_strlen(o->propdefs.l[i].name) + 1; len = dbpriv_count_properties(oid); count += (sizeof(Pval) - sizeof(Var)) * len; for (i = 0; i < len; i++) count += value_bytes(o->propval[i].var); return count; }
false
false
false
false
false
0
check_duplicate_property_names(struct check *c, struct node *dt, struct node *node) { struct property *prop, *prop2; for_each_property(node, prop) { for (prop2 = prop->next; prop2; prop2 = prop2->next) { if (prop2->deleted) continue; if (streq(prop->name, prop2->name)) FAIL(c, "Duplicate property name %s in %s", prop->name, node->fullpath); } } }
false
false
false
false
false
0
replybody(struct rfc2045_mkreplyinfo *ri, struct rfc2045 *rfc) { rfc=rfc2045_searchcontenttype(rfc, "text/plain"); if (!rfc) return; reformat(ri, rfc, 1); }
false
false
false
false
false
0
_nc_Calculate_Item_Length_and_Width(MENU * menu) { int l; assert(menu); menu->height = 1 + menu->spc_rows * (menu->arows - 1); l = calculate_actual_width(menu, TRUE); l += menu->marklen; if ((menu->opt & O_SHOWDESC) && (menu->desclen > 0)) { l += calculate_actual_width(menu, FALSE); l += menu->spc_desc; } menu->itemlen = l; l *= menu->cols; l += (menu->cols - 1) * menu->spc_cols; /* for the padding between the columns */ menu->width = l; T(("_nc_CalculateItem_Length_and_Width columns %d, item %d, width %d", menu->cols, menu->itemlen, menu->width)); }
false
false
false
false
false
0
parseFile() { // // at the top level, the scene can have a camera, // background color and a group of objects // (we add lights and other things in future assignments) // char token[MAX_PARSER_TOKEN_LENGTH]; while (getToken(token)) { if (!strcmp(token, "PerspectiveCamera")) { parsePerspectiveCamera(); } else if (!strcmp(token, "Background")) { parseBackground(); } else if (!strcmp(token, "Lights")) { parseLights(); } else if (!strcmp(token, "Materials")) { parseMaterials(); } else if (!strcmp(token, "Group")) { group = parseGroup(); } else { printf ("Unknown token in parseFile: '%s'\n", token); exit(0); } } }
false
false
false
false
true
1
merge_frames(char *shapefile, char** framefiles, int numframefiles) { FILE *shpfile, *framefile; int i; bool tiles = false; int file_size, shape_size, hdr_size, frame_size; int total_size; uint8 *data; shpfile = fopen(shapefile, "wb"); total_size = 4 + 4*numframefiles; for (i=0; i<numframefiles; i++) { framefile = fopen(framefiles[i], "rb"); cout << "reading " << framefiles[i] << "..." << endl; fseek(framefile, 0, SEEK_END); file_size = ftell(framefile); fseek(framefile, 0, SEEK_SET); shape_size = read4(framefile); if (file_size != shape_size) { // 8x8 tile if (i > 0 && !tiles) { cout << "Error: can't mix 8x8 tiles and non-tile shapes!" << endl; exit(1); } tiles = true; fseek(framefile, 0, SEEK_SET); fseek(shpfile, 64*i, SEEK_SET); data = new uint8[64]; fread(data, 1, 64, framefile); fwrite(data, 1, 64, shpfile); fclose(framefile); delete [] data; } else { if (tiles) { cout << "Error: can't mix 8x8 tiles and non-tile shapes!" << endl; exit(1); } hdr_size = read4(framefile); if (hdr_size > 8) { frame_size = read4(framefile); frame_size -= hdr_size; } else { frame_size = shape_size - hdr_size; } data = new uint8[frame_size]; fseek(framefile, hdr_size, SEEK_SET); fread(data, 1, frame_size, framefile); fclose(framefile); fseek(shpfile, 4 + (i*4), SEEK_SET); write4(shpfile, total_size); fseek(shpfile, total_size, SEEK_SET); fwrite(data, 1, frame_size, shpfile); total_size += frame_size; delete [] data; } } if (!tiles) { fseek(shpfile, 0, SEEK_SET); write4(shpfile, total_size); } cout << "done" << endl; fclose(shpfile); }
false
false
false
false
true
1
functable_evaluate (Functable * t, double x) { int i; double f0, f1, w0, w1; double x2, x3; double w; if (x < t->offset || x > (t->offset + t->length * t->multiplier)) { RESAMPLE_DEBUG ("x out of range %g", x); } x -= t->offset; x *= t->inv_multiplier; i = floor (x); x -= i; x2 = x * x; x3 = x2 * x; f1 = 3 * x2 - 2 * x3; f0 = 1 - f1; w0 = (x - 2 * x2 + x3) * t->multiplier; w1 = (-x2 + x3) * t->multiplier; w = t->fx[i] * f0 + t->fx[i + 1] * f1 + t->dfx[i] * w0 + t->dfx[i + 1] * w1; /*w = t->fx[i] * (1-x) + t->fx[i+1] * x; */ return w; }
false
false
false
false
false
0
command_find(mowgli_patricia_t *commandtree, const char *command) { return_val_if_fail(commandtree != NULL, NULL); return_val_if_fail(command != NULL, NULL); return mowgli_patricia_retrieve(commandtree, command); }
false
false
false
false
false
0
clausify_formula(Formula f) { Formula g; Plist clauses, p; g = clausify_prepare(formula_copy(f)); clauses = formula_to_clauses(g); for (p = clauses; p; p = p->next) { Topform c = p->v; renumber_variables(c, MAX_VARS); } zap_formula(g); return clauses; }
false
false
false
false
false
0
check_connect_status (int f) { socklen_t len; int err; len = sizeof (err); if (getsockopt (f, SOL_SOCKET, SO_ERROR, SOCKOPTCAST & err, &len) != 0) { nlogerr ("check_connect_status", "getsockopt"); return -1; } if (err != 0) { _logerr ("check_connect_status", "connect", err); return -1; } return 0; }
false
false
false
false
false
0
expand_path_option(curdir, gap) char_u *curdir; garray_T *gap; { char_u *path_option = *curbuf->b_p_path == NUL ? p_path : curbuf->b_p_path; char_u *buf; char_u *p; int len; if ((buf = alloc((int)MAXPATHL)) == NULL) return; while (*path_option != NUL) { copy_option_part(&path_option, buf, MAXPATHL, " ,"); if (buf[0] == '.' && (buf[1] == NUL || vim_ispathsep(buf[1]))) { /* Relative to current buffer: * "/path/file" + "." -> "/path/" * "/path/file" + "./subdir" -> "/path/subdir" */ if (curbuf->b_ffname == NULL) continue; p = gettail(curbuf->b_ffname); len = (int)(p - curbuf->b_ffname); if (len + (int)STRLEN(buf) >= MAXPATHL) continue; if (buf[1] == NUL) buf[len] = NUL; else STRMOVE(buf + len, buf + 2); mch_memmove(buf, curbuf->b_ffname, len); simplify_filename(buf); } else if (buf[0] == NUL) /* relative to current directory */ STRCPY(buf, curdir); else if (path_with_url(buf)) /* URL can't be used here */ continue; else if (!mch_isFullName(buf)) { /* Expand relative path to their full path equivalent */ len = (int)STRLEN(curdir); if (len + (int)STRLEN(buf) + 3 > MAXPATHL) continue; STRMOVE(buf + len + 1, buf); STRCPY(buf, curdir); buf[len] = PATHSEP; simplify_filename(buf); } if (ga_grow(gap, 1) == FAIL) break; p = vim_strsave(buf); if (p == NULL) break; ((char_u **)gap->ga_data)[gap->ga_len++] = p; } vim_free(buf); }
false
false
false
false
false
0
dsvec_strneq(Dsvec *dsv1, Dsvec *dsv2, size_t len) { unsigned int i; if (dsvec_len(dsv1) < len || dsvec_len(dsv2) < len) return(0); for (i = 0; i < len; i++) { char *p, *q; p = (char *) dsvec_ptr_index(dsv1, i); q = (char *) dsvec_ptr_index(dsv2, i); if (!streq(p, q)) return(0); } return(1); }
false
false
false
false
false
0
file_cache_deinit(struct file_cache *cache) { if (cache == NULL) { return; } file_cache_fflush(cache); mem_cache_deinit(&cache->read_cache); mem_cache_deinit(&cache->write_cache); close(cache->fd); }
false
false
false
false
false
0