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
conf_set_general_default_umodes(void *data) { char *pm; int what = MODE_ADD, flag; ConfigFileEntry.default_umodes = 0; for (pm = (char *) data; *pm; pm++) { switch (*pm) { case '+': what = MODE_ADD; break; case '-': what = MODE_DEL; break; /* don't allow +o */ case 'o': case 'S': case 'Z': case ' ': break; default: if ((flag = user_modes[(unsigned char) *pm])) { /* Proper value has probably not yet been set * so don't check oper_only_umodes -- jilles */ if (what == MODE_ADD) ConfigFileEntry.default_umodes |= flag; else ConfigFileEntry.default_umodes &= ~flag; } break; } } }
false
false
false
false
false
0
exec_conf(void) { int pipefd[2], stat, size; sigset_t sset, osset; sigemptyset(&sset); sigaddset(&sset, SIGINT); sigprocmask(SIG_BLOCK, &sset, &osset); signal(SIGINT, SIG_DFL); #ifdef SIGWINCH { struct sigaction sa; sa.sa_handler = winch_handler; sigemptyset(&sa.sa_mask); sa.sa_flags = SA_RESTART; sigaction(SIGWINCH, &sa, NULL); } #endif *argptr++ = NULL; pipe(pipefd); pid = fork(); if (pid == 0) { sigprocmask(SIG_SETMASK, &osset, NULL); dup2(pipefd[1], 2); close(pipefd[0]); close(pipefd[1]); execv(args[0], args); _exit(EXIT_FAILURE); } close(pipefd[1]); bufptr = input_buf; while (1) { size = input_buf + sizeof(input_buf) - bufptr; size = read(pipefd[0], bufptr, size); if (size <= 0) { if (size < 0) { if (errno == EINTR || errno == EAGAIN) continue; perror("read"); } break; } bufptr += size; } *bufptr++ = 0; close(pipefd[0]); waitpid(pid, &stat, 0); if (do_resize) { init_wsize(); do_resize = 0; sigprocmask(SIG_SETMASK, &osset, NULL); return -1; } if (WIFSIGNALED(stat)) { printf("\finterrupted(%d)\n", WTERMSIG(stat)); exit(1); } #if 0 printf("\fexit state: %d\nexit data: '%s'\n", WEXITSTATUS(stat), input_buf); sleep(1); #endif sigpending(&sset); if (sigismember(&sset, SIGINT)) { printf("\finterrupted\n"); exit(1); } sigprocmask(SIG_SETMASK, &osset, NULL); return WEXITSTATUS(stat); }
false
false
false
false
false
0
Delete() { SendObjectDeSpawnAnim(GetObjectGuid()); SetGoState(GO_STATE_READY); SetUInt32Value(GAMEOBJECT_FLAGS, GetGOInfo()->flags); if (uint16 poolid = sPoolMgr.IsPartOfAPool<GameObject>(GetGUIDLow())) { sPoolMgr.UpdatePool<GameObject>(*GetMap()->GetPersistentState(), poolid, GetGUIDLow()); } else { AddObjectToRemoveList(); } }
false
false
false
false
false
0
prepare_to_space (char *to_space_bitmap, size_t space_bitmap_size) { SgenFragment **previous, *frag; memset (to_space_bitmap, 0, space_bitmap_size); memset (age_alloc_buffers, 0, sizeof (age_alloc_buffers)); previous = &collector_allocator.alloc_head; for (frag = *previous; frag; frag = *previous) { char *start = (char *)align_up (frag->fragment_next, SGEN_TO_SPACE_GRANULE_BITS); char *end = (char *)align_down (frag->fragment_end, SGEN_TO_SPACE_GRANULE_BITS); /* Fragment is too small to be usable. */ if ((end - start) < SGEN_MAX_NURSERY_WASTE) { sgen_clear_range (frag->fragment_next, frag->fragment_end); frag->fragment_next = frag->fragment_end = frag->fragment_start; *previous = frag->next; continue; } /* We need to insert 3 phony objects so the fragments build step can correctly walk the nursery. */ /* Clean the fragment range. */ sgen_clear_range (start, end); /* We need a phony object in between the original fragment start and the effective one. */ if (start != frag->fragment_next) sgen_clear_range (frag->fragment_next, start); /* We need an phony object in between the new fragment end and the original fragment end. */ if (end != frag->fragment_end) sgen_clear_range (end, frag->fragment_end); frag->fragment_start = frag->fragment_next = start; frag->fragment_end = end; mark_bits_in_range (to_space_bitmap, start, end); previous = &frag->next; } }
false
false
false
false
false
0
mergesort_lp_file(char *REL_str, char *NEW_str, char *TMP_str, FILE *COMB) { FILE *NEW = flint_fopen(NEW_str, "r"); #if defined(WINCE) || defined(macintosh) char * tmp_dir = NULL; #else char * tmp_dir = getenv("TMPDIR"); #endif if (tmp_dir == NULL) tmp_dir = "./"; char * TMP_name = get_filename(tmp_dir,unique_filename(TMP_str)); char * REL_name = get_filename(tmp_dir,unique_filename(REL_str)); FILE * TMP = fopen(TMP_name,"w"); FILE * REL = fopen(REL_name,"r"); if ((!TMP) || (!REL)) { printf("Unable to open temporary file\n"); abort(); } long tp = mergesort_lp_file_internal(REL, NEW, COMB, TMP); fclose(REL); fclose(NEW); if (rename(TMP_name,REL_name)) { printf("Cannot rename file %s to %s", TMP_str, REL_str); abort(); } return tp; }
false
false
false
false
true
1
mcb_device_register(struct mcb_bus *bus, struct mcb_device *dev) { int ret; int device_id; device_initialize(&dev->dev); dev->dev.bus = &mcb_bus_type; dev->dev.parent = bus->dev.parent; dev->dev.release = mcb_release_dev; device_id = dev->id; dev_set_name(&dev->dev, "mcb%d-16z%03d-%d:%d:%d", bus->bus_nr, device_id, dev->inst, dev->group, dev->var); ret = device_add(&dev->dev); if (ret < 0) { pr_err("Failed registering device 16z%03d on bus mcb%d (%d)\n", device_id, bus->bus_nr, ret); goto out; } return 0; out: return ret; }
false
false
false
false
false
0
Java_ncsa_hdf_hdf5lib_H5_H5Pget_1btree_1ratios (JNIEnv *env, jclass clss, jint plist_id, jdoubleArray left, jdoubleArray middle, jdoubleArray right) { herr_t status; jdouble *leftP; jdouble *middleP; jdouble *rightP; jboolean isCopy; if (left == NULL) { h5nullArgument(env, "H5Pget_btree_ratios: left input array is NULL"); return -1; } if (middle == NULL) { h5nullArgument(env, "H5Pget_btree_ratios: middle input array is NULL"); return -1; } if (right == NULL) { h5nullArgument(env, "H5Pget_btree_ratios: right input array is NULL"); return -1; } leftP = (jdouble *)ENVPTR->GetDoubleArrayElements(ENVPAR left, &isCopy); if (leftP == NULL) { h5JNIFatalError(env, "H5Pget_btree_ratios: left not pinned"); return -1; } middleP = (jdouble *)ENVPTR->GetDoubleArrayElements(ENVPAR middle, &isCopy); if (middleP == NULL) { ENVPTR->ReleaseDoubleArrayElements(ENVPAR left, leftP, JNI_ABORT); h5JNIFatalError(env, "H5Pget_btree_ratios: middle not pinned"); return -1; } rightP = (jdouble *)ENVPTR->GetDoubleArrayElements(ENVPAR right, &isCopy); if (rightP == NULL) { ENVPTR->ReleaseDoubleArrayElements(ENVPAR left, leftP, JNI_ABORT); ENVPTR->ReleaseDoubleArrayElements(ENVPAR middle, middleP, JNI_ABORT); h5JNIFatalError(env, "H5Pget_btree_ratios: middle not pinned"); return -1; } status = H5Pget_btree_ratios((hid_t)plist_id, (double *)leftP, (double *)middleP, (double *)rightP); if (status < 0) { ENVPTR->ReleaseDoubleArrayElements(ENVPAR left, leftP, JNI_ABORT); ENVPTR->ReleaseDoubleArrayElements(ENVPAR middle, middleP, JNI_ABORT); ENVPTR->ReleaseDoubleArrayElements(ENVPAR right, rightP, JNI_ABORT); h5libraryError(env); return -1; } ENVPTR->ReleaseDoubleArrayElements(ENVPAR left, leftP, 0); ENVPTR->ReleaseDoubleArrayElements(ENVPAR middle, middleP, 0); ENVPTR->ReleaseDoubleArrayElements(ENVPAR right, rightP, 0); return (jint)status; }
false
false
false
false
false
0
gen_mjpeghdr_to_package(struct go7007 *go, __le16 *code, int space) { u8 *buf; u16 mem = 0x3e00; unsigned int addr = 0x19; int size = 0, i, off = 0, chunk; buf = kzalloc(4096, GFP_KERNEL); if (buf == NULL) return -ENOMEM; for (i = 1; i < 32; ++i) { mjpeg_frame_header(go, buf + size, i); size += 80; } chunk = mjpeg_frame_header(go, buf + size, 1); memmove(buf + size, buf + size + 80, chunk - 80); size += chunk - 80; for (i = 0; i < size; i += chunk * 2) { if (space - off < 32) { off = -1; goto done; } code[off + 1] = __cpu_to_le16(0x8000 | mem); chunk = 28; if (mem + chunk > 0x4000) chunk = 0x4000 - mem; if (i + 2 * chunk > size) chunk = (size - i) / 2; if (chunk < 28) { code[off] = __cpu_to_le16(0x4000 | chunk); code[off + 31] = __cpu_to_le16(addr++); mem = 0x3e00; } else { code[off] = __cpu_to_le16(0x1000 | 28); code[off + 31] = 0; mem += 28; } memcpy(&code[off + 2], buf + i, chunk * 2); off += 32; } done: kfree(buf); return off; }
false
false
false
false
false
0
QtUtilInit (void) { CHK (TOOL_ERROR_REGISTER_CODE (ERROR_QTUTIL_DIALOG_STACK_OVERFLOW )) CHK (TOOL_ERROR_REGISTER_CODE (ERROR_QTUTIL_DIALOG_STACK_UNDERFLOW )) CHK (TOOL_ERROR_REGISTER_CODE (ERROR_QTUTIL_DIALOG_INVALID_CUSTOMEVENT)) CHK (TOOL_ERROR_REGISTER_CODE (ERROR_QTUTIL_DIALOG_UNEXPECTED_EVENT )) CHK (TOOL_ERROR_REGISTER_CODE (ERROR_QTUTIL_INVALID_MESSAGEBOX_TYPE )) CHK (TOOL_ERROR_REGISTER_CODE (ERROR_QTUTIL_UNFREED_MEMORY )) CHK (TOOL_ERROR_REGISTER_CODE (ERROR_QTUTIL_COMMAND_TIMEOUT )) return NO_ERROR; }
false
false
false
false
false
0
_setString8(const std::string& value) { if (_t != t_string8) { _releaseValue(); new (_String8Ptr()) std::string(value); _t = t_string8; } else { _String8().assign(value); } _category = Value; }
false
false
false
false
false
0
mrand48_r (buffer, result) struct drand48_data *buffer; long int *result; { /* Be generous for the arguments, detect some errors. */ if (buffer == NULL) return -1; return __jrand48_r (buffer->__x, buffer, result); }
false
false
false
false
false
0
pc87427_request_regions(struct platform_device *pdev, int count) { struct resource *res; int i; for (i = 0; i < count; i++) { res = platform_get_resource(pdev, IORESOURCE_IO, i); if (!res) { dev_err(&pdev->dev, "Missing resource #%d\n", i); return -ENOENT; } if (!devm_request_region(&pdev->dev, res->start, resource_size(res), DRVNAME)) { dev_err(&pdev->dev, "Failed to request region 0x%lx-0x%lx\n", (unsigned long)res->start, (unsigned long)res->end); return -EBUSY; } } return 0; }
false
false
false
false
false
0
cr_statement_parse_from_buf (const guchar * a_buf, enum CREncoding a_encoding) { CRStatement *result = NULL; /* *The strategy of this function is "brute force". *It tries to parse all the types of CRStatement it knows about. *I could do this a smarter way but I don't have the time now. *I think I will revisit this when time of performances and *pull based incremental parsing comes. */ result = cr_statement_ruleset_parse_from_buf (a_buf, a_encoding); if (!result) { result = cr_statement_at_charset_rule_parse_from_buf (a_buf, a_encoding); } else { goto out; } if (!result) { result = cr_statement_at_media_rule_parse_from_buf (a_buf, a_encoding); } else { goto out; } if (!result) { result = cr_statement_at_charset_rule_parse_from_buf (a_buf, a_encoding); } else { goto out; } if (!result) { result = cr_statement_font_face_rule_parse_from_buf (a_buf, a_encoding); } else { goto out; } if (!result) { result = cr_statement_at_page_rule_parse_from_buf (a_buf, a_encoding); } else { goto out; } if (!result) { result = cr_statement_at_import_rule_parse_from_buf (a_buf, a_encoding); } else { goto out; } out: return result; }
false
false
false
false
false
0
m68k_op_lsr_16_r(void) { uint* r_dst = &DY; uint shift = DX & 0x3f; uint src = MASK_OUT_ABOVE_16(*r_dst); uint res = src >> shift; if(shift != 0) { USE_CYCLES(shift<<CYC_SHIFT); if(shift <= 16) { *r_dst = MASK_OUT_BELOW_16(*r_dst) | res; FLAG_C = FLAG_X = (src >> (shift - 1))<<8; FLAG_N = NFLAG_CLEAR; FLAG_Z = res; FLAG_V = VFLAG_CLEAR; return; } *r_dst &= 0xffff0000; FLAG_X = XFLAG_CLEAR; FLAG_C = CFLAG_CLEAR; FLAG_N = NFLAG_CLEAR; FLAG_Z = ZFLAG_SET; FLAG_V = VFLAG_CLEAR; return; } FLAG_C = CFLAG_CLEAR; FLAG_N = NFLAG_16(src); FLAG_Z = src; FLAG_V = VFLAG_CLEAR; }
false
false
false
false
false
0
brasero_task_sleep (BraseroTask *self, guint sec) { BraseroTaskPrivate *priv; priv = BRASERO_TASK_PRIVATE (self); BRASERO_BURN_LOG ("wait loop"); priv->loop = g_main_loop_new (NULL, FALSE); priv->clock_id = g_timeout_add_seconds (sec, brasero_task_wakeup, self); GDK_THREADS_LEAVE (); g_main_loop_run (priv->loop); GDK_THREADS_ENTER (); g_main_loop_unref (priv->loop); priv->loop = NULL; if (priv->clock_id) { g_source_remove (priv->clock_id); priv->clock_id = 0; } return priv->retval; }
false
false
false
false
false
0
rom1394_get_bus_options(raw1394handle_t handle, nodeid_t node, rom1394_bus_options* bus_options) { quadlet_t quadlet; octlet_t offset; NODECHECK(handle, node); offset = CSR_REGISTER_BASE + CSR_CONFIG_ROM + ROM1394_BUS_OPTIONS; QUADREADERR (handle, node, offset, &quadlet); quadlet = htonl (quadlet); bus_options->irmc = quadlet >> 31; bus_options->cmc = (quadlet >> 30) & 1; bus_options->isc = (quadlet >> 29) & 1; bus_options->bmc = (quadlet >> 28) & 1; bus_options->cyc_clk_acc = (quadlet >> 16) & 0xFF; bus_options->max_rec = (quadlet >> 12) & 0xF; bus_options->max_rec = pow( 2, bus_options->max_rec+1); return 0; }
false
false
false
false
false
0
pci_dev_hp_attrs_are_visible(struct kobject *kobj, struct attribute *a, int n) { struct device *dev = container_of(kobj, struct device, kobj); struct pci_dev *pdev = to_pci_dev(dev); if (pdev->is_virtfn) return 0; return a->mode; }
false
false
false
false
false
0
name_owner_changed_cb ( TpDBusDaemon *bus, const gchar *name, const gchar *new_owner, gpointer user_data) { TpDebugClient *self = TP_DEBUG_CLIENT (user_data); if (tp_str_empty (new_owner)) { GError *error = g_error_new (TP_DBUS_ERRORS, TP_DBUS_ERROR_NAME_OWNER_LOST, "%s fell off the bus", name); DEBUG ("%s fell off the bus", name); tp_proxy_invalidate (TP_PROXY (self), error); g_error_free (error); } }
false
false
false
false
false
0
Info_RemoveKey (char *s, const char *key) { char *start; char pkey[MAX_INFO_KEY]; char value[MAX_INFO_VALUE]; char *o; if (strchr (key, '\\')) { Com_Printf ("Info_RemoveKey: Tried to remove illegal key '%s'\n", key); return; } while (1) { start = s; if (*s == '\\') s++; o = pkey; while (*s != '\\') { if (!*s) return; *o++ = *s++; } *o = 0; s++; o = value; while (*s != '\\' && *s) { *o++ = *s++; } *o = 0; if (!strcmp(key, pkey)) { strcpy(start, s); // remove this part return; } if (!*s) return; } }
false
false
false
false
false
0
SetFlags(GenericContainer *gen,unsigned newFlags) { unsigned result; if (gen == NULL) { iError.RaiseError("iGeneric.SetFlags",CONTAINER_ERROR_BADARG); return 0; } result = gen->vTable->GetFlags(gen); gen->vTable->SetFlags(gen,newFlags); return result; }
false
false
false
false
false
0
areTypesIsomorphic(Type *DstTy, Type *SrcTy) { // Two types with differing kinds are clearly not isomorphic. if (DstTy->getTypeID() != SrcTy->getTypeID()) return false; // If we have an entry in the MappedTypes table, then we have our answer. Type *&Entry = MappedTypes[SrcTy]; if (Entry) return Entry == DstTy; // Two identical types are clearly isomorphic. Remember this // non-speculatively. if (DstTy == SrcTy) { Entry = DstTy; return true; } // Okay, we have two types with identical kinds that we haven't seen before. // If this is an opaque struct type, special case it. if (StructType *SSTy = dyn_cast<StructType>(SrcTy)) { // Mapping an opaque type to any struct, just keep the dest struct. if (SSTy->isOpaque()) { Entry = DstTy; SpeculativeTypes.push_back(SrcTy); return true; } // Mapping a non-opaque source type to an opaque dest. If this is the first // type that we're mapping onto this destination type then we succeed. Keep // the dest, but fill it in later. If this is the second (different) type // that we're trying to map onto the same opaque type then we fail. if (cast<StructType>(DstTy)->isOpaque()) { // We can only map one source type onto the opaque destination type. if (!DstResolvedOpaqueTypes.insert(cast<StructType>(DstTy)).second) return false; SrcDefinitionsToResolve.push_back(SSTy); SpeculativeTypes.push_back(SrcTy); SpeculativeDstOpaqueTypes.push_back(cast<StructType>(DstTy)); Entry = DstTy; return true; } } // If the number of subtypes disagree between the two types, then we fail. if (SrcTy->getNumContainedTypes() != DstTy->getNumContainedTypes()) return false; // Fail if any of the extra properties (e.g. array size) of the type disagree. if (isa<IntegerType>(DstTy)) return false; // bitwidth disagrees. if (PointerType *PT = dyn_cast<PointerType>(DstTy)) { if (PT->getAddressSpace() != cast<PointerType>(SrcTy)->getAddressSpace()) return false; } else if (FunctionType *FT = dyn_cast<FunctionType>(DstTy)) { if (FT->isVarArg() != cast<FunctionType>(SrcTy)->isVarArg()) return false; } else if (StructType *DSTy = dyn_cast<StructType>(DstTy)) { StructType *SSTy = cast<StructType>(SrcTy); if (DSTy->isLiteral() != SSTy->isLiteral() || DSTy->isPacked() != SSTy->isPacked()) return false; } else if (ArrayType *DATy = dyn_cast<ArrayType>(DstTy)) { if (DATy->getNumElements() != cast<ArrayType>(SrcTy)->getNumElements()) return false; } else if (VectorType *DVTy = dyn_cast<VectorType>(DstTy)) { if (DVTy->getNumElements() != cast<VectorType>(SrcTy)->getNumElements()) return false; } // Otherwise, we speculate that these two types will line up and recursively // check the subelements. Entry = DstTy; SpeculativeTypes.push_back(SrcTy); for (unsigned I = 0, E = SrcTy->getNumContainedTypes(); I != E; ++I) if (!areTypesIsomorphic(DstTy->getContainedType(I), SrcTy->getContainedType(I))) return false; // If everything seems to have lined up, then everything is great. return true; }
false
false
false
false
false
0
Clear(void) { if(META_DEBUG) { METAIO_STREAM::cout << "MetaContour: Clear" << METAIO_STREAM::endl; } MetaObject::Clear(); m_InterpolationType = MET_NO_INTERPOLATION; m_NControlPoints = 0; m_NInterpolatedPoints = 0; // Delete the list of control points. ControlPointListType::iterator it = m_ControlPointsList.begin(); ControlPointListType::iterator itEnd = m_ControlPointsList.end(); while(it != itEnd) { ContourControlPnt* pnt = *it; ++it; delete pnt; } m_ControlPointsList.clear(); // Delete the list of interpolated points InterpolatedPointListType::iterator itInterpolated = m_InterpolatedPointsList.begin(); InterpolatedPointListType::iterator itInterpolatedEnd = m_InterpolatedPointsList.end(); while(itInterpolated != itInterpolatedEnd) { ContourInterpolatedPnt* pnt = *itInterpolated; ++itInterpolated; delete pnt; } m_InterpolatedPointsList.clear(); strcpy(m_ControlPointDim, "id x y z xp yp zp nx ny nz r g b a"); strcpy(m_InterpolatedPointDim, "id x y z r g b a"); m_Closed = false; m_DisplayOrientation = -1; m_AttachedToSlice = -1; }
false
false
false
false
false
0
compare_serv(struct servent *serv, char *spec) { char field[100], **aliases; spec = get_field(spec, ':', field); if (!spec || strcmp(serv->s_name, field) != 0) return -1; spec = get_field(spec, ':', field); if (!spec || strcmp(serv->s_proto, field) != 0) return -1; spec = get_field(spec, ':', field); if (serv->s_port != htons(atoi(field))) return -1; for (aliases = serv->s_aliases; *aliases; aliases++) { if (!spec) return -1; spec = get_field(spec, '\\', field); if (strcmp(*aliases, field) != 0) return -1; } return (spec) ? -1 : 0; }
false
false
false
false
false
0
waitFor( fd_set& rmaskret, fd_set& wmaskret, fd_set& emaskret, timeval* howlong ) { int nfound = 0; #if defined(SA_NOCLDSTOP) // POSIX static struct sigaction sa, osa; #elif defined(SV_INTERRUPT) // BSD-style static struct sigvec sv, osv; #else // System V-style void (*osig)(); #endif if (!_cqueue->isEmpty()) { #if defined(SA_NOCLDSTOP) // POSIX sa.sa_handler = fxSIGACTIONHANDLER(&Dispatcher::sigCLD); sa.sa_flags = SA_INTERRUPT; sigaction(SIGCHLD, &sa, &osa); #elif defined(SV_INTERRUPT) // BSD-style sv.sv_handler = fxSIGVECHANDLER(&Dispatcher::sigCLD); sv.sv_flags = SV_INTERRUPT; sigvec(SIGCHLD, &sv, &osv); #else // System V-style osig = (void (*)())signal(SIGCLD, fxSIGHANDLER(&Dispatcher::sigCLD)); #endif } /* * If SIGCLD is pending then it may be delivered on * exiting from the kernel after the above sig* call; * if so then we don't want to block in the select. */ if (!_cqueue->isReady()) { do { //note - this is an array copy, not a pointer assignment rmaskret = _rmask; wmaskret = _wmask; emaskret = _emask; howlong = calculateTimeout(howlong); #if CONFIG_BADSELECTPROTO nfound = select(_nfds, (int*) &rmaskret, (int*) &wmaskret, (int*) &emaskret, howlong); #else nfound = select(_nfds, &rmaskret, &wmaskret, &emaskret, howlong); #endif howlong = calculateTimeout(howlong); } while (nfound < 0 && !handleError()); } if (!_cqueue->isEmpty()) { #if defined(SA_NOCLDSTOP) // POSIX sigaction(SIGCHLD, &osa, (struct sigaction*) 0); #elif defined(SV_INTERRUPT) // BSD-style sigvec(SIGCHLD, &osv, (struct sigvec*) 0); #else // System V-style (void) signal(SIGCLD, fxSIGHANDLER(osig)); #endif } return nfound; // timed out or input available }
false
false
false
false
false
0
bfa_fcs_fabric_sm_deleting(struct bfa_fcs_fabric_s *fabric, enum bfa_fcs_fabric_event event) { bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn); bfa_trc(fabric->fcs, event); switch (event) { case BFA_FCS_FABRIC_SM_DELCOMP: bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_uninit); bfa_wc_down(&fabric->fcs->wc); break; case BFA_FCS_FABRIC_SM_LINK_UP: break; case BFA_FCS_FABRIC_SM_LINK_DOWN: bfa_fcs_fabric_notify_offline(fabric); break; default: bfa_sm_fault(fabric->fcs, event); } }
false
false
false
false
false
0
dsp_e_h(GWindow gw, GEvent *event) { if ( event->type==et_close ) { PD *di = GDrawGetUserData(gw); if ( di->done!=NULL ) *(di->done) = true; GDrawDestroyWindow(di->gw); } else if ( event->type==et_destroy ) { PD *di = GDrawGetUserData(gw); TextInfoDataFree(di->scriptlangs); free(di); if ( di==printwindow ) printwindow = NULL; } else if ( event->type==et_char ) { if ( event->u.chr.keysym == GK_F1 || event->u.chr.keysym == GK_Help ) { help("display.html"); return( true ); } else if ( GMenuIsCommand(event,H_("Quit|Ctl+Q") )) { MenuExit(NULL,NULL,NULL); return( false ); } else if ( GMenuIsCommand(event,H_("Close|Ctl+Shft+Q") )) { PD *di = GDrawGetUserData(gw); di->pi.done = true; } return( false ); } else if ( event->type==et_timer ) { PD *di = GDrawGetUserData(gw); if ( event->u.timer.timer==di->sizechanged ) DSP_SizeChangedTimer(di); else if ( event->u.timer.timer==di->dpichanged ) DSP_DpiChangedTimer(di); else if ( event->u.timer.timer==di->widthchanged ) DSP_WidthChangedTimer(di); else if ( event->u.timer.timer==di->resized ) DSP_JustResized(di); } else if ( event->type==et_resize ) { PD *di = GDrawGetUserData(gw); if ( di->resized!=NULL ) GDrawCancelTimer(di->resized); di->resized = GDrawRequestTimer(di->gw,300,0,NULL); } return( true ); }
false
false
false
false
false
0
pool_message(struct dm_target *ti, unsigned argc, char **argv) { int r = -EINVAL; struct pool_c *pt = ti->private; struct pool *pool = pt->pool; if (get_pool_mode(pool) >= PM_READ_ONLY) { DMERR("%s: unable to service pool target messages in READ_ONLY or FAIL mode", dm_device_name(pool->pool_md)); return -EOPNOTSUPP; } if (!strcasecmp(argv[0], "create_thin")) r = process_create_thin_mesg(argc, argv, pool); else if (!strcasecmp(argv[0], "create_snap")) r = process_create_snap_mesg(argc, argv, pool); else if (!strcasecmp(argv[0], "delete")) r = process_delete_mesg(argc, argv, pool); else if (!strcasecmp(argv[0], "set_transaction_id")) r = process_set_transaction_id_mesg(argc, argv, pool); else if (!strcasecmp(argv[0], "reserve_metadata_snap")) r = process_reserve_metadata_snap_mesg(argc, argv, pool); else if (!strcasecmp(argv[0], "release_metadata_snap")) r = process_release_metadata_snap_mesg(argc, argv, pool); else DMWARN("Unrecognised thin pool target message received: %s", argv[0]); if (!r) (void) commit(pool); return r; }
false
false
false
false
false
0
explain_buffer_errno_wait4_system_call(explain_string_buffer_t *sb, int errnum, int pid, int *status, int options, struct rusage *rusage) { (void)errnum; explain_string_buffer_puts(sb, "wait4(pid = "); explain_buffer_pid_t(sb, pid); if (pid == 0) { explain_string_buffer_puts(sb, " = process group "); explain_buffer_pid_t(sb, getpgrp()); } else if (pid < -1) { explain_string_buffer_puts(sb, " = process group "); explain_buffer_pid_t(sb, -pid); } explain_string_buffer_puts(sb, ", status = "); explain_buffer_pointer(sb, status); explain_string_buffer_puts(sb, ", options = "); explain_buffer_waitpid_options(sb, options); explain_string_buffer_puts(sb, ", rusage = "); explain_buffer_pointer(sb, rusage); explain_string_buffer_putc(sb, ')'); }
false
false
false
false
false
0
free_value (CutTestDataPrivate *priv) { if (priv->value) { if (priv->destroy_function) priv->destroy_function(priv->value); priv->value = NULL; } }
false
false
false
false
false
0
set_drag_dest_row (NautilusTreeViewDragDest *dest, GtkTreePath *path) { if (path) { set_widget_highlight (dest, FALSE); gtk_tree_view_set_drag_dest_row (dest->details->tree_view, path, GTK_TREE_VIEW_DROP_INTO_OR_BEFORE); } else { set_widget_highlight (dest, TRUE); gtk_tree_view_set_drag_dest_row (dest->details->tree_view, NULL, 0); } }
false
false
false
false
false
0
setLogpage(int32_t pno, /* page number of log */ int32_t *eor, /* log header eor to return */ int32_t *pmax, /* log header page number to return */ int32_t buf) { /* logp[] index number for page */ int rc; int32_t diff1, diff2; /* check that header and trailer are the same */ if ((diff1 = (__le32_to_cpu(logp[buf].h.page) - __le32_to_cpu(logp[buf].t.page))) != 0) { if (diff1 > 0) /* Both little-endian */ logp[buf].h.page = logp[buf].t.page; else /* Both little-endian */ logp[buf].t.page = logp[buf].h.page; logp[buf].h.eor = logp[buf].t.eor = __cpu_to_le16(LOGPHDRSIZE); /* empty page */ } if ((diff2 = (__le16_to_cpu(logp[buf].h.eor) - __le16_to_cpu(logp[buf].t.eor))) != 0) { if (diff2 > 0) /* Both little-endian */ logp[buf].h.eor = logp[buf].t.eor; else /* Both little-endian */ logp[buf].t.eor = logp[buf].h.eor; } /* if any difference write the page out */ if (diff1 || diff2) { rc = ujfs_rw_diskblocks(Log.fp, (uint64_t) (Log.xaddr + LOGPNTOB(pno)), (unsigned long) LOGPSIZE, (char *) &logp[buf], PUT); if (rc != 0) { fsck_send_msg(lrdo_SLPWRITEFAIL, pno, rc); return (JLOG_WRITEERROR1); } } /* * At this point, it is still possible that logp[buf].h.eor * is LOGPHDRSIZE, but we return it anyway. The caller will make * decision. */ *eor = __le16_to_cpu(logp[buf].h.eor); *pmax = __le32_to_cpu(logp[buf].h.page); return (0); }
false
false
false
false
false
0
teardown (Test *test, gconstpointer unused) { g_object_unref (test->store); test->store = NULL; g_object_unref (test->transaction); test->transaction = NULL; if (test->object != NULL) g_object_unref (test->object); test->object = NULL; mock_module_leave_and_finalize (); test->module = NULL; }
false
false
false
false
false
0
H5HF_man_iblock_unprotect(H5HF_indirect_t *iblock, hid_t dxpl_id, unsigned cache_flags, hbool_t did_protect) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT /* * Check arguments. */ HDassert(iblock); /* Check if we previously protected this indirect block */ /* (as opposed to using an existing pointer to a pinned child indirect block) */ if(did_protect) { /* Check for root indirect block */ if(iblock->block_off == 0) { /* Sanity check - shouldn't be recursively unprotecting root indirect block */ HDassert(iblock->hdr->root_iblock_flags & H5HF_ROOT_IBLOCK_PROTECTED); /* Check if we should reset the root iblock pointer */ if(H5HF_ROOT_IBLOCK_PROTECTED == iblock->hdr->root_iblock_flags) { HDassert(NULL != iblock->hdr->root_iblock); iblock->hdr->root_iblock = NULL; } /* end if */ /* Indicate that the root indirect block is unprotected */ iblock->hdr->root_iblock_flags &= ~(H5HF_ROOT_IBLOCK_PROTECTED); } /* end if */ /* Unprotect the indirect block */ if(H5AC_unprotect(iblock->hdr->f, dxpl_id, H5AC_FHEAP_IBLOCK, iblock->addr, iblock, cache_flags) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block") } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) }
false
false
false
false
false
0
mq_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno) { QUOTA_STACK_DESTROY (frame, this); return 0; }
false
false
false
false
false
0
fs_codec_remove_optional_parameter (FsCodec *codec, FsCodecParameter *param) { g_return_if_fail (codec); if (!param) return; fs_codec_parameter_free (param); codec->optional_params = g_list_remove (codec->optional_params, param); }
false
false
false
false
false
0
ossl_pkcs5_pbkdf2_hmac_sha1(VALUE self, VALUE pass, VALUE salt, VALUE iter, VALUE keylen) { VALUE str; int len = NUM2INT(keylen); StringValue(pass); StringValue(salt); str = rb_str_new(0, len); if (PKCS5_PBKDF2_HMAC_SHA1(RSTRING_PTR(pass), RSTRING_LENINT(pass), (const unsigned char *)RSTRING_PTR(salt), RSTRING_LENINT(salt), NUM2INT(iter), len, (unsigned char *)RSTRING_PTR(str)) != 1) ossl_raise(ePKCS5, "PKCS5_PBKDF2_HMAC_SHA1"); return str; }
false
false
false
false
false
0
load_dialog_cb(GtkDialog *dialog, gint response, gpointer user_data) { PlaylistWindow *playlist_window = (PlaylistWindow *) user_data; if ((response == GTK_RESPONSE_ACCEPT) && playlist_window) playlist_window->LoadPlaylist(); dialog_cancel_response(GTK_WIDGET(dialog), NULL); }
false
false
false
false
false
0
get_geometry_type_from_gauss_input_file(gchar *NomFichier) { gchar *t; FILE *fd; guint taille=BSIZE; gboolean OK=TRUE; gint i; FilePosTypeGeom j; gint k; gchar *t1; gchar *t2; gchar *t3 = NULL; j.geomtyp=GEOM_IS_OTHER; j.numline=0; j.units=1; t=g_malloc(taille); fd = FOpen(NomFichier, "rb"); if(fd!=NULL) { /* Commands lines */ while(!feof(fd) ) { if(!fgets(t, taille, fd)) break; j.numline++; if((int)t[0]==(int)'#' || (int)t[0]==(int)'%' ) { t1 = g_strdup(t); t2= g_strdup("Units(Au"); g_strup(t1); g_strup(t2); t3 = strstr(t1,t2); if(t3 != NULL) j.units=0; g_free(t1); g_free(t2); continue; } else break; } /* Title */ while(!feof(fd) ) { if(!fgets(t, taille, fd)) break; j.numline++; OK=TRUE; for(i=0;i<(gint)strlen(t);i++) if(t[i]!=' ' && t[i] !='\n' ) { OK=FALSE; break; } if(OK) break; } /* Charge and Spin */ if(!feof(fd) ) { if(fgets(t, taille, fd)) j.numline++; sscanf(t,"%d %d %d %d %d %d", &TotalCharges[0], &SpinMultiplicities[0], &TotalCharges[1], &SpinMultiplicities[1], &TotalCharges[2], &SpinMultiplicities[2]); } /* First line of geometry */ if(!feof(fd) ) { if(!fgets(t, taille, fd)) { j.geomtyp = GEOM_IS_OTHER; } else { gchar dump[5][BSIZE]; j.numline++; k = sscanf(t,"%s %s %s %s %s",dump[0],dump[1],dump[2],dump[3],dump[4]); if(k==5) j.geomtyp = GEOM_IS_XYZ; else if(k==4) j.geomtyp = GEOM_IS_XYZ; else if(k==1) j.geomtyp = GEOM_IS_ZMAT; else j.geomtyp = GEOM_IS_OTHER; /* k=0; for(i=strlen(t)-1;i>0;i--) if(t[i]!=' ' || t[i] !='\n' ) { k=i; break; } if(k>2) j.geomtyp = GEOM_IS_XYZ; else if(k>0 && k<=2) j.geomtyp = GEOM_IS_ZMAT; else j.geomtyp = GEOM_IS_OTHER; */ } } } fclose(fd); g_free(t); return j; }
false
true
false
false
true
1
cson_output_filename( cson_value const * src, char const * dest, cson_output_opt const * fmt ) { if( !src || !dest ) return cson_rc.ArgError; else { FILE * f = fopen(dest,"wb"); if( !f ) return cson_rc.IOError; else { int const rc = cson_output_FILE( src, f, fmt ); fclose(f); return rc; } } }
false
false
false
false
false
0
brw_draw_prims( struct gl_context *ctx, const struct _mesa_prim *prims, GLuint nr_prims, const struct _mesa_index_buffer *ib, GLboolean index_bounds_valid, GLuint min_index, GLuint max_index, struct gl_transform_feedback_object *unused_tfb_object, struct gl_buffer_object *indirect ) { struct brw_context *brw = brw_context(ctx); const struct gl_client_array **arrays = ctx->Array._DrawArrays; assert(unused_tfb_object == NULL); if (!_mesa_check_conditional_render(ctx)) return; /* Handle primitive restart if needed */ if (brw_handle_primitive_restart(ctx, prims, nr_prims, ib, indirect)) { /* The draw was handled, so we can exit now */ return; } /* If we're going to have to upload any of the user's vertex arrays, then * get the minimum and maximum of their index buffer so we know what range * to upload. */ if (!vbo_all_varyings_in_vbos(arrays) && !index_bounds_valid) { perf_debug("Scanning index buffer to compute index buffer bounds. " "Use glDrawRangeElements() to avoid this.\n"); vbo_get_minmax_indices(ctx, prims, ib, &min_index, &max_index, nr_prims); } /* Do GL_SELECT and GL_FEEDBACK rendering using swrast, even though it * won't support all the extensions we support. */ if (ctx->RenderMode != GL_RENDER) { perf_debug("%s render mode not supported in hardware\n", _mesa_lookup_enum_by_nr(ctx->RenderMode)); _swsetup_Wakeup(ctx); _tnl_wakeup(ctx); _tnl_draw_prims(ctx, arrays, prims, nr_prims, ib, min_index, max_index); return; } /* Try drawing with the hardware, but don't do anything else if we can't * manage it. swrast doesn't support our featureset, so we can't fall back * to it. */ brw_try_draw_prims(ctx, arrays, prims, nr_prims, ib, min_index, max_index, indirect); }
false
false
false
false
false
0
button_release_event(GtkWidget *widget UNUSED, GdkEventButton *event, gpointer data UNUSED) { int x, y; int_u vim_modifiers; gui.event_time = event->time; /* Remove any motion "machine gun" timers used for automatic further extension of allocation areas if outside of the applications window area .*/ if (motion_repeat_timer) { gtk_timeout_remove(motion_repeat_timer); motion_repeat_timer = 0; } x = event->x; y = event->y; vim_modifiers = modifiers_gdk2mouse(event->state); gui_send_mouse_event(MOUSE_RELEASE, x, y, FALSE, vim_modifiers); return TRUE; }
false
false
false
false
false
0
ena_disable_io_intr_sync(struct ena_adapter *adapter) { int i; if (!netif_running(adapter->netdev)) return; for (i = ENA_IO_IRQ_FIRST_IDX; i < adapter->msix_vecs; i++) synchronize_irq(adapter->irq_tbl[i].vector); }
false
false
false
false
false
0
paint_text ( Image_buffer8 *win, // Buffer to paint in. const char *text, // What to draw, 0-delimited. int xoff, int yoff // Upper-left corner of where to start. ) { int x = xoff; int chr; yoff += get_text_baseline(); if (font_shapes) while ((chr = *text++) != 0) { Shape_frame *shape = font_shapes->get_frame((unsigned char)chr); if (!shape) continue; shape->paint_rle(x, yoff); x += shape->get_width() + hor_lead; } return (x - xoff); }
false
false
false
false
false
0
setStrips(const Value* pSize, const byte* pData, uint32_t sizeData, uint32_t baseOffset) { if (!pValue() || !pSize) { #ifndef SUPPRESS_WARNINGS EXV_WARNING << "Directory " << groupName(group()) << ", entry 0x" << std::setw(4) << std::setfill('0') << std::hex << tag() << ": Size or data offset value not set, ignoring them.\n"; #endif return; } if (pValue()->count() != pSize->count()) { #ifndef SUPPRESS_WARNINGS EXV_WARNING << "Directory " << groupName(group()) << ", entry 0x" << std::setw(4) << std::setfill('0') << std::hex << tag() << ": Size and data offset entries have different" << " number of components, ignoring them.\n"; #endif return; } for (int i = 0; i < pValue()->count(); ++i) { const uint32_t offset = static_cast<uint32_t>(pValue()->toLong(i)); const byte* pStrip = pData + baseOffset + offset; const uint32_t size = static_cast<uint32_t>(pSize->toLong(i)); if ( offset > sizeData || size > sizeData || baseOffset + offset > sizeData - size) { #ifndef SUPPRESS_WARNINGS EXV_WARNING << "Directory " << groupName(group()) << ", entry 0x" << std::setw(4) << std::setfill('0') << std::hex << tag() << ": Strip " << std::dec << i << " is outside of the data area; ignored.\n"; #endif } else if (size != 0) { strips_.push_back(std::make_pair(pStrip, size)); } } }
false
false
false
false
false
0
irq_ts_save(void) { /* * If in process context and not atomic, we can take a spurious DNA fault. * Otherwise, doing clts() in process context requires disabling preemption * or some heavy lifting like kernel_fpu_begin() */ if (!in_atomic()) return 0; if (read_cr0() & X86_CR0_TS) { clts(); return 1; } return 0; }
false
false
false
false
false
0
_enable_mono_map (HpOption UNUSEDARG this, HpOptSet optset, HpData data, const HpDeviceInfo UNUSEDARG *info) { HpOption cgam = hp_optset_get(optset, CUSTOM_GAMMA); return (cgam && hp_option_getint(cgam, data) && ( sanei_hp_optset_scanmode(optset, data) != HP_SCANMODE_COLOR || ! hp_optset_getByName(optset, SANE_NAME_GAMMA_VECTOR_R) )); }
false
false
false
false
false
0
setButtons(ButtonCodes buttonMask) { KPageDialog::setButtons(buttonMask); // Set Auto-Default mode ( KDE Bug #211187 ) if (buttonMask & KDialog::Ok) { button(KDialog::Ok)->setAutoDefault(true); } if (buttonMask & KDialog::Apply) { button(KDialog::Apply)->setAutoDefault(true); } if (buttonMask & KDialog::Default) { button(KDialog::Default)->setAutoDefault(true); } if (buttonMask & KDialog::Reset) { button(KDialog::Reset)->setAutoDefault(true); } if (buttonMask & KDialog::Cancel) { button(KDialog::Cancel)->setAutoDefault(true); } if (buttonMask & KDialog::Help) { button(KDialog::Help)->setAutoDefault(true); } // Old Reset Button enableButton(KDialog::User1, false); enableButton(KDialog::Reset, false); enableButton(KDialog::Apply, false); }
false
false
false
false
false
0
bfa_dport_is_sending_req(struct bfa_dport_s *dport) { if (bfa_sm_cmp_state(dport, bfa_dport_sm_enabling) || bfa_sm_cmp_state(dport, bfa_dport_sm_enabling_qwait) || bfa_sm_cmp_state(dport, bfa_dport_sm_disabling) || bfa_sm_cmp_state(dport, bfa_dport_sm_disabling_qwait) || bfa_sm_cmp_state(dport, bfa_dport_sm_starting) || bfa_sm_cmp_state(dport, bfa_dport_sm_starting_qwait)) { return BFA_TRUE; } else { return BFA_FALSE; } }
false
false
false
false
false
0
ProcessAICHAnswer(const byte* packet, uint32 size) { if (m_fAICHRequested == FALSE){ throw wxString(wxT("Received unrequested AICH Packet")); } m_fAICHRequested = FALSE; CMemFile data(packet, size); if (size <= 16){ CAICHHashSet::ClientAICHRequestFailed(this); return; } CMD4Hash hash = data.ReadHash(); CPartFile* pPartFile = theApp->downloadqueue->GetFileByID(hash); CAICHRequestedData request = CAICHHashSet::GetAICHReqDetails(this); uint16 nPart = data.ReadUInt16(); if (pPartFile != NULL && request.m_pPartFile == pPartFile && request.m_pClient.GetClient() == this && nPart == request.m_nPart){ CAICHHash ahMasterHash(&data); if ( (pPartFile->GetAICHHashset()->GetStatus() == AICH_TRUSTED || pPartFile->GetAICHHashset()->GetStatus() == AICH_VERIFIED) && ahMasterHash == pPartFile->GetAICHHashset()->GetMasterHash()) { if(pPartFile->GetAICHHashset()->ReadRecoveryData(request.m_nPart*PARTSIZE, &data)){ // finally all checks passed, everythings seem to be fine AddDebugLogLineN(logAICHTransfer, wxT("AICH Packet Answer: Succeeded to read and validate received recoverydata")); CAICHHashSet::RemoveClientAICHRequest(this); pPartFile->AICHRecoveryDataAvailable(request.m_nPart); return; } else { AddDebugLogLineN(logAICHTransfer, wxT("AICH Packet Answer: Succeeded to read and validate received recoverydata")); } } else { AddDebugLogLineN( logAICHTransfer, wxT("AICH Packet Answer: Masterhash differs from packethash or hashset has no trusted Masterhash") ); } } else { AddDebugLogLineN( logAICHTransfer, wxT("AICH Packet Answer: requested values differ from values in packet") ); } CAICHHashSet::ClientAICHRequestFailed(this); }
false
false
false
false
false
0
generate_aiff(const char *filename, unsigned sample_rate, unsigned channels, unsigned bps, unsigned samples) { const unsigned bytes_per_sample = (bps+7)/8; const unsigned true_size = channels * bytes_per_sample * samples; const unsigned padded_size = (true_size + 1) & (~1u); const unsigned shift = (bps%8)? 8 - (bps%8) : 0; const FLAC__int32 full_scale = (1 << (bps-1)) - 1; const double f1 = 441.0, a1 = 0.61, f2 = 661.5, a2 = 0.37; const double delta1 = 2.0 * M_PI / ( sample_rate / f1); const double delta2 = 2.0 * M_PI / ( sample_rate / f2); double theta1, theta2; FILE *f; unsigned i, j; if(0 == (f = flac_fopen(filename, "wb"))) return false; if(fwrite("FORM", 1, 4, f) < 4) goto foo; if(!write_big_endian_uint32(f, padded_size + 46)) goto foo; if(fwrite("AIFFCOMM\000\000\000\022", 1, 12, f) < 12) goto foo; if(!write_big_endian_uint16(f, (FLAC__uint16)channels)) goto foo; if(!write_big_endian_uint32(f, samples)) goto foo; if(!write_big_endian_uint16(f, (FLAC__uint16)bps)) goto foo; if(!write_sane_extended(f, sample_rate)) goto foo; if(fwrite("SSND", 1, 4, f) < 4) goto foo; if(!write_big_endian_uint32(f, true_size + 8)) goto foo; if(fwrite("\000\000\000\000\000\000\000\000", 1, 8, f) < 8) goto foo; for(i = 0, theta1 = theta2 = 0.0; i < samples; i++, theta1 += delta1, theta2 += delta2) { for(j = 0; j < channels; j++) { double val = (a1*sin(theta1) + a2*sin(theta2))*(double)full_scale; FLAC__int32 v = ((FLAC__int32)(val + 0.5) + ((GET_RANDOM_BYTE>>4)-8)) << shift; if(!write_big_endian(f, v, bytes_per_sample)) goto foo; } } for(i = true_size; i < padded_size; i++) if(fputc(0, f) == EOF) goto foo; fclose(f); return true; foo: fclose(f); return false; }
false
false
false
false
false
0
DisconnectRfmBranch(RfmBranch branch) { if (branch == NULL) { return; } if (branch->fork_prev) { branch->fork_prev->fork_next = branch->fork_next; } else { if (branch->fork_block) { branch->fork_block->fork_list = branch->fork_next; } } if (branch->fork_next) { branch->fork_next->fork_prev = branch->fork_prev; } if (branch->join_prev) { branch->join_prev->join_next = branch->join_next; } else { if (branch->join_block) { branch->join_block->join_list = branch->join_next; } } if (branch->join_next) { branch->join_next->join_prev = branch->join_prev; } }
false
false
false
false
false
0
_nc_keypad(SCREEN *sp, bool flag) { int rc = ERR; if (sp != 0) { #ifdef USE_PTHREADS /* * We might have this situation in a multithreaded application that * has wgetch() reading in more than one thread. putp() and below * may use SP explicitly. */ if (_nc_use_pthreads && sp != SP) { SCREEN *save_sp; /* cannot use use_screen(), since that is not in tinfo library */ _nc_lock_global(curses); save_sp = SP; _nc_set_screen(sp); rc = _nc_keypad(sp, flag); _nc_set_screen(save_sp); _nc_unlock_global(curses); } else #endif { if (flag) { (void) _nc_putp_flush("keypad_xmit", keypad_xmit); } else if (!flag && keypad_local) { (void) _nc_putp_flush("keypad_local", keypad_local); } if (flag && !sp->_tried) { _nc_init_keytry(sp); sp->_tried = TRUE; } sp->_keypad_on = flag; rc = OK; } } return (rc); }
false
false
false
false
false
0
q_addmsg(struct share_msgq *qq, struct chanset_t *chan, char *s) { struct share_msgq *q; int cnt; if (!qq) { q = nmalloc(sizeof *q); q->chan = chan; q->next = NULL; q->msg = nmalloc(strlen(s) + 1); strcpy(q->msg, s); return q; } cnt = 0; for (q = qq; q->next; q = q->next) cnt++; if (cnt > 1000) return NULL; /* Return null: did not alter queue */ q->next = nmalloc(sizeof *q->next); q = q->next; q->chan = chan; q->next = NULL; q->msg = nmalloc(strlen(s) + 1); strcpy(q->msg, s); return qq; }
false
false
false
false
false
0
getMatchingLine (int start, int direction) { int i = start; do { // Find SearchString at any place in string for line i for(int j = 0; BList[i][j]; j++) if (BList[i][j] == SearchString[0] && strnicmp(SearchString, BList[i]+j, SearchLen) == 0) { return i; } i += direction; if (i == BCount) i = 0; else if (i == -1) i = BCount - 1; } while (i != start); return -1; }
false
false
false
false
false
0
move_sgl(struct c2_data_addr * dst, struct ib_sge *src, int count, u32 * p_len, u8 * actual_count) { u32 tot = 0; /* running total */ u8 acount = 0; /* running total non-0 len sge's */ while (count > 0) { /* * If the addition of this SGE causes the * total SGL length to exceed 2^32-1, then * fail-n-bail. * * If the current total plus the next element length * wraps, then it will go negative and be less than the * current total... */ if ((tot + src->length) < tot) { return -EINVAL; } /* * Bug: 1456 (as well as 1498 & 1643) * Skip over any sge's supplied with len=0 */ if (src->length) { tot += src->length; dst->stag = cpu_to_be32(src->lkey); dst->to = cpu_to_be64(src->addr); dst->length = cpu_to_be32(src->length); dst++; acount++; } src++; count--; } if (acount == 0) { /* * Bug: 1476 (as well as 1498, 1456 and 1643) * Setup the SGL in the WR to make it easier for the RNIC. * This way, the FW doesn't have to deal with special cases. * Setting length=0 should be sufficient. */ dst->stag = 0; dst->to = 0; dst->length = 0; } *p_len = tot; *actual_count = acount; return 0; }
false
false
false
false
false
0
_PyFile_SanitizeMode(char *mode) { char *upos; size_t len = strlen(mode); if (!len) { PyErr_SetString(PyExc_ValueError, "empty mode string"); return -1; } upos = strchr(mode, 'U'); if (upos) { memmove(upos, upos+1, len-(upos-mode)); /* incl null char */ if (mode[0] == 'w' || mode[0] == 'a') { PyErr_Format(PyExc_ValueError, "universal newline " "mode can only be used with modes " "starting with 'r'"); return -1; } if (mode[0] != 'r') { memmove(mode+1, mode, strlen(mode)+1); mode[0] = 'r'; } if (!strchr(mode, 'b')) { memmove(mode+2, mode+1, strlen(mode)); mode[1] = 'b'; } } else if (mode[0] != 'r' && mode[0] != 'w' && mode[0] != 'a') { PyErr_Format(PyExc_ValueError, "mode string must begin with " "one of 'r', 'w', 'a' or 'U', not '%.200s'", mode); return -1; } #ifdef Py_VERIFY_WINNT /* additional checks on NT with visual studio 2005 and higher */ if (!_PyVerify_Mode_WINNT(mode)) { PyErr_Format(PyExc_ValueError, "Invalid mode ('%.50s')", mode); return -1; } #endif return 0; }
true
true
false
false
true
1
MIDI_GetVolume ( void ) { int volume; if ( _MIDI_Funcs == NULL ) { return( MIDI_NullMidiModule ); } SoundDriver_MIDI_Lock(); if ( _MIDI_Funcs->GetVolume ) { volume = _MIDI_Funcs->GetVolume(); } else { volume = _MIDI_TotalVolume; } SoundDriver_MIDI_Unlock(); return( volume ); }
false
false
false
false
false
0
e1000_phy_get_info(struct e1000_hw *hw, struct e1000_phy_info *phy_info) { s32 ret_val; u16 phy_data; phy_info->cable_length = e1000_cable_length_undefined; phy_info->extended_10bt_distance = e1000_10bt_ext_dist_enable_undefined; phy_info->cable_polarity = e1000_rev_polarity_undefined; phy_info->downshift = e1000_downshift_undefined; phy_info->polarity_correction = e1000_polarity_reversal_undefined; phy_info->mdix_mode = e1000_auto_x_mode_undefined; phy_info->local_rx = e1000_1000t_rx_status_undefined; phy_info->remote_rx = e1000_1000t_rx_status_undefined; if (hw->media_type != e1000_media_type_copper) { e_dbg("PHY info is only valid for copper media\n"); return -E1000_ERR_CONFIG; } ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); if (ret_val) return ret_val; ret_val = e1000_read_phy_reg(hw, PHY_STATUS, &phy_data); if (ret_val) return ret_val; if ((phy_data & MII_SR_LINK_STATUS) != MII_SR_LINK_STATUS) { e_dbg("PHY info is only valid if link is up\n"); return -E1000_ERR_CONFIG; } if (hw->phy_type == e1000_phy_igp) return e1000_phy_igp_get_info(hw, phy_info); else if ((hw->phy_type == e1000_phy_8211) || (hw->phy_type == e1000_phy_8201)) return E1000_SUCCESS; else return e1000_phy_m88_get_info(hw, phy_info); }
false
false
false
false
false
0
frob_ava(tentry *entry, int mode, char *ad, char *data, int n) { tattribute *a; switch (mode) { case FROB_RDN_CHECK: a = entry_find_attribute(entry, ad, 0); if (!a) return -1; if (attribute_find_value(a, data, n) == -1) return -1; break; case FROB_RDN_CHECK_NONE: a = entry_find_attribute(entry, ad, 0); if (!a) return 0; if (attribute_find_value(a, data, n) == -1) return 0; return -1; break; case FROB_RDN_REMOVE: a = entry_find_attribute(entry, ad, 0); attribute_remove_value(a, data, n); break; case FROB_RDN_ADD: a = entry_find_attribute(entry, ad, 1); if (attribute_find_value(a, data, n) == -1) attribute_append_value(a, data, n); break; } return 0; }
false
false
false
false
false
0
bottom(PDA p){R p->n>0?p->c[0]:0;}
false
false
false
false
false
0
toplevel_update_title_bar(toplevel_t * top) { char *log_path = seaudit_get_log_path(top->s); apol_policy_path_t *policy_path = seaudit_get_policy_path(top->s); char *policy_type_str = "Policy"; const char *primary_path; char *s; if (log_path == NULL) { log_path = "No Log"; } if (policy_path == NULL) { primary_path = "No Policy"; } else { if (apol_policy_path_get_type(policy_path) == APOL_POLICY_PATH_TYPE_MODULAR) { policy_type_str = "Base"; } primary_path = apol_policy_path_get_primary(policy_path); } if (asprintf(&s, "seaudit - [Log file: %s] [%s file: %s]", log_path, policy_type_str, primary_path) < 0) { toplevel_ERR(top, "%s", strerror(errno)); return; } gtk_window_set_title(top->w, s); free(s); }
false
false
false
false
false
0
ario_shell_coverselect_response_cb (GtkDialog *dialog, int response_id, ArioShellCoverselect *shell_coverselect) { ARIO_LOG_FUNCTION_START; if (response_id == GTK_RESPONSE_OK) { /* Save cover */ ario_shell_coverselect_save_cover (shell_coverselect); gtk_widget_hide (GTK_WIDGET (shell_coverselect)); } if (response_id == GTK_RESPONSE_CANCEL) gtk_widget_hide (GTK_WIDGET (shell_coverselect)); }
false
false
false
false
false
0
max_undo_depth_changed_cb (GSettings *settings, const gchar *key, gpointer user_data) { const GList *docn; g_settings_get (settings, key, "u", &max_undo_depth); docn = hex_document_get_list (); while (docn) { hex_document_set_max_undo (HEX_DOCUMENT (docn->data), max_undo_depth); docn = g_list_next (docn); } }
false
false
false
false
false
0
pxa2xx_spi_clear_rx_thre(const struct driver_data *drv_data, u32 *sccr1_reg) { u32 mask; switch (drv_data->ssp_type) { case QUARK_X1000_SSP: mask = QUARK_X1000_SSCR1_RFT; break; default: mask = SSCR1_RFT; break; } *sccr1_reg &= ~mask; }
false
false
false
false
false
0
folderview_set_target_folder_color(gint color_op) { gint firstone = 1; GList *list; FolderView *folderview; for (list = folderview_list; list != NULL; list = list->next) { folderview = (FolderView *)list->data; gtkut_convert_int_to_gdk_color(color_op, &folderview->color_op); if (firstone) { bold_tgtfold_style->fg[GTK_STATE_NORMAL] = folderview->color_op; firstone = 0; } } }
false
false
false
false
false
0
brasero_data_project_resort_tree (BraseroDataProject *self, BraseroFileNode *parent) { BraseroFileNode *iter; for (iter = BRASERO_FILE_NODE_CHILDREN (parent); iter; iter = iter->next) { if (iter->is_file) continue; brasero_data_project_reorder_children (self, iter); brasero_data_project_resort_tree (self, iter); } }
false
false
false
false
false
0
find_splits(int nx, int ny, int *splitx, int *splity) { int lasta,i,isleft = false; float ux,uy,ux2,uy2,angle,r; lasta = 999; *splity = -1; *splitx = nx-1; for (i = 0; i<ny; i++) { touser(nx-1,i,0,&ux,&uy); touser(0,i,0,&ux2,&uy2); fxy_polar(ux2-ux,uy2-uy,&r,&angle); if (angle<90) isleft = true; if (angle>=90) isleft = false; if (lasta==999) lasta = isleft; if (lasta!=isleft) { *splity = i-1; } lasta = isleft; } lasta=999; for (i = 0; i<nx; i++) { touser(i,0,0,&ux,&uy); touser(i,ny-1,0,&ux2,&uy2); fxy_polar(ux2-ux,uy2-uy,&r,&angle); if (angle<90) isleft = true; if (angle>=90) isleft = false; if (lasta==999) lasta = isleft; if (lasta!=isleft) { *splitx = i-1; } lasta = isleft; } }
false
false
false
false
false
0
compile_disable(char*label, struct symb_s symb) { if (label) compile_codelabel(label); /* Fill in the basics of the %disable in the instruction. */ vvp_code_t code = codespace_allocate(); code->opcode = of_DISABLE; compile_vpi_lookup(&code->handle, symb.text); }
false
false
false
false
false
0
zxsig_data(struct zx_ctx* c, int len, const char* data, char** sig, EVP_PKEY* priv_key, const char* lk) { RSA* rsa; DSA* dsa; char sha1[20]; /* 160 bits */ SHA1((unsigned char*)data, len, (unsigned char*)sha1); DD("%s: data(%.*s)", lk, len, data); DD("%s: data above %d", lk, hexdump("data: ", data, data+len, 4096)); DD("%s: sha1 above %d", lk, hexdump("sha1: ", sha1, sha1+20, 20)); if (!priv_key) { ERR(priv_key_missing_msg, geteuid(), getegid()); return 0; } switch (EVP_PKEY_type(priv_key->type)) { case EVP_PKEY_RSA: rsa = EVP_PKEY_get1_RSA(priv_key); len = RSA_size(rsa); *sig = ZX_ALLOC(c, len); if (RSA_sign(NID_sha1, (unsigned char*)sha1, 20, (unsigned char*)*sig, (unsigned int*)&len, rsa)) /* PKCS#1 v2.0 */ return len; ERR("%s: signing data failed. Perhaps you have bad, or no, RSA private key(%p) len=%d data=%p", lk, rsa, len, data); zx_report_openssl_error(lk); return -1; case EVP_PKEY_DSA: dsa = EVP_PKEY_get1_DSA(priv_key); len = DSA_size(dsa); *sig = ZX_ALLOC(c, len); if (DSA_sign(NID_sha1, (unsigned char*)sha1, 20, (unsigned char*)*sig, (unsigned int*)&len, dsa)) /* PKCS#1 v2.0 */ return len; ERR("%s: signing data failed. Perhaps you have bad, or no, DSA private key(%p) len=%d data=%p", lk, dsa, len, data); zx_report_openssl_error(lk); return -1; default: ERR("%s: Unknown private key type 0x%x. Wrong or corrupt private key?", lk, priv_key->type); return -1; } }
true
true
false
false
false
1
check_global_searchpath( const char *path, int position, const char *file, git_buf *temp) { char out[GIT_PATH_MAX]; /* build and set new path */ if (position < 0) cl_git_pass(git_buf_join(temp, GIT_PATH_LIST_SEPARATOR, path, "$PATH")); else if (position > 0) cl_git_pass(git_buf_join(temp, GIT_PATH_LIST_SEPARATOR, "$PATH", path)); else cl_git_pass(git_buf_sets(temp, path)); cl_git_pass(git_libgit2_opts( GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_GLOBAL, temp->ptr)); /* get path and make sure $PATH expansion worked */ cl_git_pass(git_libgit2_opts( GIT_OPT_GET_SEARCH_PATH, GIT_CONFIG_LEVEL_GLOBAL, out, sizeof(out))); if (position < 0) cl_assert(git__prefixcmp(out, path) == 0); else if (position > 0) cl_assert(git__suffixcmp(out, path) == 0); else cl_assert_equal_s(out, path); /* find file using new path */ cl_git_pass(git_futils_find_global_file(temp, file)); /* reset path and confirm file not found */ cl_git_pass(git_libgit2_opts( GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_GLOBAL, NULL)); cl_assert_equal_i( GIT_ENOTFOUND, git_futils_find_global_file(temp, file)); }
true
true
false
false
false
1
gd_stack_add (GtkContainer *container, GtkWidget *child) { GdStack *stack = GD_STACK (container); GdStackPrivate *priv = stack->priv; GdStackChildInfo *child_info; g_return_if_fail (child != NULL); child_info = g_slice_new (GdStackChildInfo); child_info->widget = child; child_info->name = NULL; child_info->title = NULL; child_info->symbolic_icon_name = NULL; priv->children = g_list_append (priv->children, child_info); gtk_widget_set_parent_window (child, priv->bin_window); gtk_widget_set_parent (child, GTK_WIDGET (stack)); g_signal_connect (child, "notify::visible", G_CALLBACK (stack_child_visibility_notify_cb), stack); gtk_widget_child_notify (child, "position"); if (priv->visible_child == NULL && gtk_widget_get_visible (child)) set_visible_child (stack, child_info); else gtk_widget_set_child_visible (child, FALSE); if (priv->homogeneous || priv->visible_child == child_info) gtk_widget_queue_resize (GTK_WIDGET (stack)); }
false
false
false
false
false
0
PoolFPrint(Pool *p, FILE *f, const char *format, ...) { va_list alist; if (p) { fprintf(f, "%*s", p->level*2, ""); } va_start(alist, format); vfprintf(f, format, alist); va_end(alist); }
false
false
false
false
true
1
cli_bcapi_ilog2(struct cli_bc_ctx *ctx, uint32_t a, uint32_t b) { double f; UNUSEDPARAM(ctx); if (!b) return 0x7fffffff; /* log(a/b) is -32..32, so 2^26*32=2^31 covers the entire range of int32 */ f = (1<<26)*log((double)a / b) / log(2); return (int32_t)myround(f); }
false
false
false
false
false
0
gt_sainseq_new_from_plainseq(const GtUchar *plainseq, unsigned long len) { const GtUchar *cptr; GtSainseq *sainseq = gt_malloc(sizeof *sainseq); sainseq->seqtype = GT_SAIN_PLAINSEQ; sainseq->seq.plainseq = plainseq; sainseq->totallength = len; sainseq->numofchars = UCHAR_MAX+1; sainseq->bucketsize = gt_calloc((size_t) sainseq->numofchars, sizeof (*sainseq->bucketsize)); sainseq->bucketfillptr = gt_malloc(sizeof (*sainseq->bucketfillptr) * sainseq->numofchars); if (gt_sain_decideforfastmethod(len+1,len)) { sainseq->roundtable = gt_malloc(sizeof (*sainseq->roundtable) * (size_t) GT_MULT2(sainseq->numofchars)); } else { sainseq->roundtable = NULL; } sainseq->sstarfirstcharcount = gt_calloc((size_t) sainseq->numofchars, sizeof (*sainseq->sstarfirstcharcount)); sainseq->bucketfillptrpoints2suftab = false; sainseq->bucketsizepoints2suftab = false; sainseq->roundtablepoints2suftab = false; for (cptr = sainseq->seq.plainseq; cptr < sainseq->seq.plainseq + len; cptr++) { sainseq->bucketsize[*cptr]++; } return sainseq; }
false
false
false
false
false
0
mouseReleaseEvent(QMouseEvent * e) { e->setAccepted(false); QGraphicsView::mouseReleaseEvent(e); if (e->isAccepted()) return; QMouseEvent fixedEvent (QEvent::MouseButtonRelease, viewportToViewport(e->pos()), e->button(), e->buttons(), e->modifiers()); handleMouseReleaseEvent(&fixedEvent); e->accept(); }
false
false
false
false
false
0
bltrimws (bstring b) { int i, len; if (b == NULL || b->data == NULL || b->mlen < b->slen || b->slen < 0 || b->mlen <= 0) return BSTR_ERR; for (len = b->slen, i = 0; i < len; i++) { if (!wspace (b->data[i])) { return bdelete (b, 0, i); } } b->data[0] = (unsigned char) '\0'; b->slen = 0; return BSTR_OK; }
false
false
false
false
false
0
levent_ctl_event(struct bufferevent *bev, short events, void *ptr) { struct lldpd_one_client *client = ptr; if (events & BEV_EVENT_ERROR) { log_warnx("event", "an error occurred with client: %s", evutil_socket_error_to_string(EVUTIL_SOCKET_ERROR())); levent_ctl_free_client(client); } else if (events & BEV_EVENT_EOF) { log_debug("event", "client has been disconnected"); levent_ctl_free_client(client); } }
false
false
false
false
false
0
_colors_save(Evas_Object *obj) { Eina_List *elist; Elm_Color_Item *item; ELM_COLORSELECTOR_DATA_GET(obj, sd); _elm_config_colors_free(sd->palette_name); EINA_LIST_FOREACH (sd->items, elist, item) _elm_config_color_set(sd->palette_name, item->color->r, item->color->g, item->color->b, item->color->a); }
false
false
false
false
false
0
exec_file ARGS2((fd,name), FILE *fd, /* file, if already opened, like stdin */ char *name) /* file name, if not already opened */ { int old_read_depth = read_depth; push_commandfd(fd,name); do /* main event loop of program */ { char response[200]; temp_free_all(); /* stray memory blocks */ free_discards(DISCARDS_SOME); /* from previous cycle */ memset(response,0,sizeof(response)); if ( prompt("Enter command: ",response,sizeof(response)) == EOF ) pop_commandfd(); else old_menu(response); } while ( read_depth > old_read_depth ); }
false
false
false
false
false
0
dirName() const { // Find last slash. This separates the file name from the path. std::string::size_type separatorPos = path().find_last_of( Directory::sep() ); // If there is no separator, the file is relative to the current directory. So an empty path is returned. if (separatorPos == std::string::npos) { return ""; } // Include trailing separator to be able to distinguish between no path ("") and a path // which is relative to the root ("/"), for example. return path().substr(0, separatorPos + 1); }
false
false
false
false
false
0
netsys_get_nonblock(value fd) { #ifdef _WIN32 invalid_argument("Netsys_posix.get_nonblcok not avaiable"); #else int r; r = fcntl(Int_val(fd), F_GETFL, 0); if (r == -1) uerror("fcntl", Nothing); return Val_bool((r & O_NONBLOCK) != 0); #endif }
false
false
false
false
false
0
garcon_menu_node_tree_set_merge_file_filename (GNode *tree, const gchar *filename) { g_return_if_fail (garcon_menu_node_tree_get_node_type (tree) == GARCON_MENU_NODE_TYPE_MERGE_FILE); garcon_menu_node_set_merge_file_filename (tree->data, filename); }
false
false
false
false
false
0
interpolate_1d(const ColumnVector& data, const float index) { float interpval; int low_bound = (int)floor(index); int high_bound = (int)ceil(index); if (in_bounds(data, index)) interpval = data(low_bound) + (index - low_bound)*(data(high_bound) - data(low_bound)); else interpval = extrapolate_1d(data, round(index)); return interpval; }
false
false
false
false
false
0
ValueSort(const CStatTreeItemBase* a, const CStatTreeItemBase* b) { if (a->m_id < 0x00000100 || a->m_id > 0x7fffffff || b->m_id < 0x00000100 || b->m_id > 0x7fffffff) { return a->m_id > b->m_id; } else { // ADUNANZA BEGIN // Back #if 0 return ((CStatTreeItemCounter*)a)->GetValue() > ((CStatTreeItemCounter*)b)->GetValue(); #else return dynamic_cast<const CStatTreeItemCounter*>(a)->GetValue() > dynamic_cast<const CStatTreeItemCounter*>(b)->GetValue(); #endif // ADUNANZA END } }
false
false
false
false
false
0
getCharWidthFromCache (UT_UCSChar c) const { // the way GR_CharWidthsCache is implemented will cause problems // fro any graphics plugin that wants to use the cache -- we will // need to instantiate the cache into a static member of // GR_Graphics so that the plugin could get to it without calling // the static getCharWidthCache() #ifndef ABI_GRAPHICS_PLUGIN_NO_WIDTHS // first of all, handle 0-width spaces ... if(c == 0xFEFF || c == 0x200B || c == UCS_LIGATURE_PLACEHOLDER) return 0; UT_sint32 iWidth = GR_CW_UNKNOWN; if (m_pCharWidths == NULL) { m_pCharWidths = GR_CharWidthsCache::getCharWidthCache()->getWidthsForFont(this); } iWidth = m_pCharWidths->getWidth(c); if (iWidth == GR_CW_UNKNOWN) { iWidth = measureUnremappedCharForCache(c); m_pCharWidths->setWidth(c, iWidth); } return iWidth; #else UT_return_val_if_fail(UT_NOT_IMPLEMENTED,0); #endif }
false
false
false
false
false
0
ReadConfig( string file ) { ifstream input( file.c_str() ); if ( !input ) { cerr << "Could not open config file: " << file << endl; return false; } string::size_type Position; string line, key, val; while ( input ) { getline( input, line ); //Strip whitespace from beginning and end if ( (Position = line.find_first_not_of(" \t")) != string::npos ) { line = line.substr(Position, (line.find_last_not_of(" \t", string::npos) - Position) + 1); } //Read next if nothing found if ( (Position == string::npos) || (line.size() == 0) ) continue; //Read next if commented if ( line.substr(0, 1) == "#" ) continue; //Find key and value if ( (Position = line.find_first_of(" \t")) != string::npos ) { key = line.substr(0, Position); if ( key == "REMOVETHISLINE" ) { cout << "Configuration is not edited!" << endl; cout << "You must delete REMOVETHISLINE option." << endl; cout << "Review the configuration carefully. :)" << endl; return false; } if ( (Position = line.find_first_not_of(" \t", Position + 1)) == string::npos ) { cout << "Invalid Config Line: " << line << endl; return false; } val = line.substr( Position ); Params::SetConfig( key, val ); } else { cout << "Invalid Config Line: " << line << endl; return false; } } input.close(); return true; }
false
false
false
false
false
0
radeonfb_bl_init(struct radeonfb_info *rinfo) { struct backlight_properties props; struct backlight_device *bd; struct radeon_bl_privdata *pdata; char name[12]; if (rinfo->mon1_type != MT_LCD) return; #ifdef CONFIG_PMAC_BACKLIGHT if (!pmac_has_backlight_type("ati") && !pmac_has_backlight_type("mnca")) return; #endif pdata = kmalloc(sizeof(struct radeon_bl_privdata), GFP_KERNEL); if (!pdata) { printk("radeonfb: Memory allocation failed\n"); goto error; } snprintf(name, sizeof(name), "radeonbl%d", rinfo->info->node); memset(&props, 0, sizeof(struct backlight_properties)); props.type = BACKLIGHT_RAW; props.max_brightness = FB_BACKLIGHT_LEVELS - 1; bd = backlight_device_register(name, rinfo->info->dev, pdata, &radeon_bl_data, &props); if (IS_ERR(bd)) { rinfo->info->bl_dev = NULL; printk("radeonfb: Backlight registration failed\n"); goto error; } pdata->rinfo = rinfo; /* Pardon me for that hack... maybe some day we can figure out in what * direction backlight should work on a given panel? */ pdata->negative = (rinfo->family != CHIP_FAMILY_RV200 && rinfo->family != CHIP_FAMILY_RV250 && rinfo->family != CHIP_FAMILY_RV280 && rinfo->family != CHIP_FAMILY_RV350); #ifdef CONFIG_PMAC_BACKLIGHT pdata->negative = pdata->negative || of_machine_is_compatible("PowerBook4,3") || of_machine_is_compatible("PowerBook6,3") || of_machine_is_compatible("PowerBook6,5"); #endif rinfo->info->bl_dev = bd; fb_bl_default_curve(rinfo->info, 0, 63 * FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL, 217 * FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL); bd->props.brightness = bd->props.max_brightness; bd->props.power = FB_BLANK_UNBLANK; backlight_update_status(bd); printk("radeonfb: Backlight initialized (%s)\n", name); return; error: kfree(pdata); return; }
false
false
false
false
false
0
move_is_check(int move, board_t * board) { undo_t undo[1]; bool check; int me, opp, king; int from, to, piece; ASSERT(move_is_ok(move)); ASSERT(board!=NULL); // slow test for complex moves if (MOVE_IS_SPECIAL(move)) { move_do(board,move,undo); check = IS_IN_CHECK(board,board->turn); move_undo(board,move,undo); return check; } // init me = board->turn; opp = COLOUR_OPP(me); king = KING_POS(board,opp); from = MOVE_FROM(move); to = MOVE_TO(move); piece = board->square[from]; ASSERT(COLOUR_IS(piece,me)); // direct check if (PIECE_ATTACK(board,piece,to,king)) return true; // indirect check if (is_pinned(board,from,opp) && DELTA_INC_LINE(king-to) != DELTA_INC_LINE(king-from)) { return true; } return false; }
false
false
false
false
false
0
pmsg_split(pmsg_t *mb, int offset) { int slen; /* Split length */ const char *start; g_assert(offset >= 0); g_assert(offset < pmsg_size(mb)); pmsg_check_consistency(mb); start = mb->m_rptr + offset; slen = mb->m_wptr - start; g_assert(slen > 0); mb->m_wptr -= slen; /* Logically removed */ return pmsg_new(mb->m_prio, start, slen); /* Copies data */ }
false
false
false
false
false
0
dialog_delete_callback (GtkWidget *widget, GdkEvent *event, gpointer data) { StpuiBasicCallback cancel_callback; GtkWidget *cancel_widget; cancel_callback = (StpuiBasicCallback) g_object_get_data (G_OBJECT (widget), "dialog_cancel_callback"); cancel_widget = (GtkWidget*) g_object_get_data (G_OBJECT (widget), "dialog_cancel_widget"); /* the cancel callback has to destroy the dialog */ if (cancel_callback) (* cancel_callback) (G_OBJECT(cancel_widget), data); return TRUE; }
false
false
false
false
false
0
ParseAOCDSpecificChargingUnits(struct Aoc *chanp, u_char *p, u_char *end, int dummy) { int recordedUnits; int typeOfChargingInfo; int billingId; INIT; XSEQUENCE_1(ParseRecordedUnitsList, ASN1_TAG_SEQUENCE, 1, &recordedUnits); XSEQUENCE_1(ParseTypeOfChargingInfo, ASN1_TAG_ENUM, 2, &typeOfChargingInfo); XSEQUENCE_OPT_1(ParseAOCDBillingId, ASN1_TAG_ENUM, 3, &billingId); chanp->type_of_charging_info = typeOfChargingInfo; chanp->amount = recordedUnits; return p - beg; }
false
false
false
false
true
1
zfile_scache_save(int id, z_stream *s, int calccrc, int iseof) { int res; if(id == 0 || iseof) { res = inflateEnd(s); if(res != Z_OK) { av_log(AVLOG_ERROR, "ZFILE: inflateEnd: %s (%i)", s->msg == NULL ? "" : s->msg, res); } return; } if(scache.id != 0) { res = inflateEnd(&scache.s); if(res != Z_OK) { av_log(AVLOG_ERROR, "ZFILE: inflateEnd: %s (%i)", scache.s.msg == NULL ? "" : scache.s.msg, res); } } if(scache.id == 0) atexit(zfile_scache_cleanup); scache.id = id; scache.s = *s; scache.calccrc = calccrc; scache.iseof = iseof; }
false
false
false
false
false
0
depop_seq_power_stage(struct snd_soc_codec *codec, int enable) { unsigned int soft_vol, hp_zc; /* depop control by register */ snd_soc_update_bits(codec, RT5631_DEPOP_FUN_CTRL_2, RT5631_EN_ONE_BIT_DEPOP, RT5631_EN_ONE_BIT_DEPOP); /* keep soft volume and zero crossing setting */ soft_vol = snd_soc_read(codec, RT5631_SOFT_VOL_CTRL); snd_soc_write(codec, RT5631_SOFT_VOL_CTRL, 0); hp_zc = snd_soc_read(codec, RT5631_INT_ST_IRQ_CTRL_2); snd_soc_write(codec, RT5631_INT_ST_IRQ_CTRL_2, hp_zc & 0xf7ff); if (enable) { /* config depop sequence parameter */ rt5631_write_index(codec, RT5631_SPK_INTL_CTRL, 0x303e); /* power on headphone and charge pump */ snd_soc_update_bits(codec, RT5631_PWR_MANAG_ADD3, RT5631_PWR_CHARGE_PUMP | RT5631_PWR_HP_L_AMP | RT5631_PWR_HP_R_AMP, RT5631_PWR_CHARGE_PUMP | RT5631_PWR_HP_L_AMP | RT5631_PWR_HP_R_AMP); /* power on soft generator and depop mode2 */ snd_soc_write(codec, RT5631_DEPOP_FUN_CTRL_1, RT5631_POW_ON_SOFT_GEN | RT5631_EN_DEPOP2_FOR_HP); msleep(100); /* stop depop mode */ snd_soc_update_bits(codec, RT5631_PWR_MANAG_ADD3, RT5631_PWR_HP_DEPOP_DIS, RT5631_PWR_HP_DEPOP_DIS); } else { /* config depop sequence parameter */ rt5631_write_index(codec, RT5631_SPK_INTL_CTRL, 0x303F); snd_soc_write(codec, RT5631_DEPOP_FUN_CTRL_1, RT5631_POW_ON_SOFT_GEN | RT5631_EN_MUTE_UNMUTE_DEPOP | RT5631_PD_HPAMP_L_ST_UP | RT5631_PD_HPAMP_R_ST_UP); msleep(75); snd_soc_write(codec, RT5631_DEPOP_FUN_CTRL_1, RT5631_POW_ON_SOFT_GEN | RT5631_PD_HPAMP_L_ST_UP | RT5631_PD_HPAMP_R_ST_UP); /* start depop mode */ snd_soc_update_bits(codec, RT5631_PWR_MANAG_ADD3, RT5631_PWR_HP_DEPOP_DIS, 0); /* config depop sequence parameter */ snd_soc_write(codec, RT5631_DEPOP_FUN_CTRL_1, RT5631_POW_ON_SOFT_GEN | RT5631_EN_DEPOP2_FOR_HP | RT5631_PD_HPAMP_L_ST_UP | RT5631_PD_HPAMP_R_ST_UP); msleep(80); snd_soc_write(codec, RT5631_DEPOP_FUN_CTRL_1, RT5631_POW_ON_SOFT_GEN); /* power down headphone and charge pump */ snd_soc_update_bits(codec, RT5631_PWR_MANAG_ADD3, RT5631_PWR_CHARGE_PUMP | RT5631_PWR_HP_L_AMP | RT5631_PWR_HP_R_AMP, 0); } /* recover soft volume and zero crossing setting */ snd_soc_write(codec, RT5631_SOFT_VOL_CTRL, soft_vol); snd_soc_write(codec, RT5631_INT_ST_IRQ_CTRL_2, hp_zc); }
false
false
false
false
false
0
ins_compl_key2dir(c) int c; { if (c == Ctrl_P || c == Ctrl_L || (pum_visible() && (c == K_PAGEUP || c == K_KPAGEUP || c == K_S_UP || c == K_UP))) return BACKWARD; return FORWARD; }
false
false
false
false
false
0
of10_flow_removed_print(const u_char *cp, const u_char *ep) { /* match */ if (ep == (cp = of10_match_print("\n\t ", cp, ep))) return ep; /* end of snapshot */ /* cookie */ TCHECK2(*cp, 8); printf("\n\t cookie 0x%016" PRIx64, EXTRACT_64BITS(cp)); cp += 8; /* priority */ TCHECK2(*cp, 2); if (EXTRACT_16BITS(cp)) printf(", priority %u", EXTRACT_16BITS(cp)); cp += 2; /* reason */ TCHECK2(*cp, 1); printf(", reason %s", tok2str(ofprr_str, "unknown (0x%02x)", *cp)); cp += 1; /* pad */ TCHECK2(*cp, 1); cp += 1; /* duration_sec */ TCHECK2(*cp, 4); printf(", duration_sec %u", EXTRACT_32BITS(cp)); cp += 4; /* duration_nsec */ TCHECK2(*cp, 4); printf(", duration_nsec %u", EXTRACT_32BITS(cp)); cp += 4; /* idle_timeout */ TCHECK2(*cp, 2); if (EXTRACT_16BITS(cp)) printf(", idle_timeout %u", EXTRACT_16BITS(cp)); cp += 2; /* pad2 */ TCHECK2(*cp, 2); cp += 2; /* packet_count */ TCHECK2(*cp, 8); printf(", packet_count %" PRIu64, EXTRACT_64BITS(cp)); cp += 8; /* byte_count */ TCHECK2(*cp, 8); printf(", byte_count %" PRIu64, EXTRACT_64BITS(cp)); return cp + 8; trunc: printf(" [|openflow]"); return ep; }
false
false
false
false
false
0
createWindow() { if (isRunning()) { sendMessage(m_files.join(QLatin1String("\n"))); return false; } #ifndef Q_OS_MAC setAttribute(Qt::AA_DontShowIconsInMenus, !QSettings().value("Window/MenuIcons", false).toBool()); #endif m_window = new Window(m_files); setActivationWindow(m_window); connect(this, SIGNAL(messageReceived(QString)), m_window, SLOT(addDocuments(QString))); return true; }
false
false
false
false
false
0
ast_framehook_list_destroy(struct ast_channel *chan) { struct ast_framehook *framehook; if (!ast_channel_framehooks(chan)) { return 0; } AST_LIST_TRAVERSE_SAFE_BEGIN(&ast_channel_framehooks(chan)->list, framehook, list) { AST_LIST_REMOVE_CURRENT(list); framehook_detach_and_destroy(framehook); } AST_LIST_TRAVERSE_SAFE_END; ast_free(ast_channel_framehooks(chan)); ast_channel_framehooks_set(chan, NULL); return 0; }
false
false
false
false
false
0
filterCompressedObjects(std::map<int, int> const& object_stream_data) { if (object_stream_data.empty()) { return; } // Transform object_to_obj_users and obj_user_to_objects so that // they refer only to uncompressed objects. If something is a // user of a compressed object, then it is really a user of the // object stream that contains it. std::map<ObjUser, std::set<QPDFObjGen> > t_obj_user_to_objects; std::map<QPDFObjGen, std::set<ObjUser> > t_object_to_obj_users; for (std::map<ObjUser, std::set<QPDFObjGen> >::iterator i1 = this->obj_user_to_objects.begin(); i1 != this->obj_user_to_objects.end(); ++i1) { ObjUser const& ou = (*i1).first; std::set<QPDFObjGen> const& objects = (*i1).second; for (std::set<QPDFObjGen>::const_iterator i2 = objects.begin(); i2 != objects.end(); ++i2) { QPDFObjGen const& og = (*i2); std::map<int, int>::const_iterator i3 = object_stream_data.find(og.getObj()); if (i3 == object_stream_data.end()) { t_obj_user_to_objects[ou].insert(og); } else { t_obj_user_to_objects[ou].insert(QPDFObjGen((*i3).second, 0)); } } } for (std::map<QPDFObjGen, std::set<ObjUser> >::iterator i1 = this->object_to_obj_users.begin(); i1 != this->object_to_obj_users.end(); ++i1) { QPDFObjGen const& og = (*i1).first; std::set<ObjUser> const& objusers = (*i1).second; for (std::set<ObjUser>::const_iterator i2 = objusers.begin(); i2 != objusers.end(); ++i2) { ObjUser const& ou = (*i2); std::map<int, int>::const_iterator i3 = object_stream_data.find(og.getObj()); if (i3 == object_stream_data.end()) { t_object_to_obj_users[og].insert(ou); } else { t_object_to_obj_users[QPDFObjGen((*i3).second, 0)].insert(ou); } } } this->obj_user_to_objects = t_obj_user_to_objects; this->object_to_obj_users = t_object_to_obj_users; }
false
false
false
false
false
0
atk_role_register (const gchar *name) { if (!role_names) initialize_role_names (); g_ptr_array_add (role_names, g_strdup (name)); return role_names->len - 1; }
false
false
false
false
false
0
method_encode_signature (MonoDynamicImage *assembly, MonoMethodSignature *sig) { SigBuffer buf; int i; guint32 nparams = sig->param_count; guint32 idx; if (!assembly->save) return 0; sigbuffer_init (&buf, 32); /* * FIXME: vararg, explicit_this, differenc call_conv values... */ idx = sig->call_convention; if (sig->hasthis) idx |= 0x20; /* hasthis */ if (sig->generic_param_count) idx |= 0x10; /* generic */ sigbuffer_add_byte (&buf, idx); if (sig->generic_param_count) sigbuffer_add_value (&buf, sig->generic_param_count); sigbuffer_add_value (&buf, nparams); encode_type (assembly, sig->ret, &buf); for (i = 0; i < nparams; ++i) { if (i == sig->sentinelpos) sigbuffer_add_byte (&buf, MONO_TYPE_SENTINEL); encode_type (assembly, sig->params [i], &buf); } idx = sigbuffer_add_to_blob_cached (assembly, &buf); sigbuffer_free (&buf); return idx; }
false
false
false
false
false
0