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
exit_program( GtkWidget *widget, gpointer data ) { #if 0 #ifndef __WIN32__ void *p; #endif #endif if(pthread_self() == server_tid) pthread_exit(0); ebook_end(); gdk_window_get_root_origin(main_window->window, &window_x, &window_y); window_width = main_window->allocation.width; window_height = main_window->allocation.height; tree_width = note_tree->allocation.width; tree_height = note_tree->allocation.height; save_preference(); gtk_main_quit (); if(server_tid != (pthread_t)-1) pthread_cancel(server_tid); close(conn); unlink(sock_name); #if 0 #ifndef __WIN32__ pthread_join(server_tid, &p); #endif #endif // exit(0); }
false
false
false
false
false
0
printheader(struct fetchheaderinfo *fi, const char *p, size_t s) { size_t i; if (fi->skipping) { if (fi->skipping > s) { fi->skipping -= s; return; } p += fi->skipping; s -= fi->skipping; fi->skipping=0; } if (s > fi->cnt) s=fi->cnt; for (i=0; i <= s; i++) if (p[i] != '\r') ++header_count; writemem(p, s); fi->cnt -= s; }
false
false
false
false
false
0
read_metadata_block_data_picture_cb_(FLAC__IOHandle handle, FLAC__IOCallback_Read read_cb, FLAC__StreamMetadata_Picture *block) { FLAC__Metadata_SimpleIteratorStatus status; FLAC__byte buffer[4]; /* asserted below that this is big enough */ FLAC__uint32 len; FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_TYPE_LEN/8); FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN/8); FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN/8); FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN/8); FLAC__ASSERT(sizeof(buffer) >= FLAC__STREAM_METADATA_PICTURE_COLORS_LEN/8); FLAC__ASSERT(FLAC__STREAM_METADATA_PICTURE_TYPE_LEN % 8 == 0); len = FLAC__STREAM_METADATA_PICTURE_TYPE_LEN / 8; if(read_cb(buffer, 1, len, handle) != len) return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; block->type = (FLAC__StreamMetadata_Picture_Type)unpack_uint32_(buffer, len); if((status = read_metadata_block_data_picture_cstring_cb_(handle, read_cb, (FLAC__byte**)(&(block->mime_type)), &len, FLAC__STREAM_METADATA_PICTURE_MIME_TYPE_LENGTH_LEN)) != FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK) return status; if((status = read_metadata_block_data_picture_cstring_cb_(handle, read_cb, &(block->description), &len, FLAC__STREAM_METADATA_PICTURE_DESCRIPTION_LENGTH_LEN)) != FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK) return status; FLAC__ASSERT(FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN % 8 == 0); len = FLAC__STREAM_METADATA_PICTURE_WIDTH_LEN / 8; if(read_cb(buffer, 1, len, handle) != len) return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; block->width = unpack_uint32_(buffer, len); FLAC__ASSERT(FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN % 8 == 0); len = FLAC__STREAM_METADATA_PICTURE_HEIGHT_LEN / 8; if(read_cb(buffer, 1, len, handle) != len) return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; block->height = unpack_uint32_(buffer, len); FLAC__ASSERT(FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN % 8 == 0); len = FLAC__STREAM_METADATA_PICTURE_DEPTH_LEN / 8; if(read_cb(buffer, 1, len, handle) != len) return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; block->depth = unpack_uint32_(buffer, len); FLAC__ASSERT(FLAC__STREAM_METADATA_PICTURE_COLORS_LEN % 8 == 0); len = FLAC__STREAM_METADATA_PICTURE_COLORS_LEN / 8; if(read_cb(buffer, 1, len, handle) != len) return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_READ_ERROR; block->colors = unpack_uint32_(buffer, len); /* for convenience we use read_metadata_block_data_picture_cstring_cb_() even though it adds an extra terminating NUL we don't use */ if((status = read_metadata_block_data_picture_cstring_cb_(handle, read_cb, &(block->data), &(block->data_length), FLAC__STREAM_METADATA_PICTURE_DATA_LENGTH_LEN)) != FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK) return status; return FLAC__METADATA_SIMPLE_ITERATOR_STATUS_OK; }
false
false
false
false
false
0
win_wininfo_build(const WinInfo *wi, gboolean *modified) { GtkWidget *vbox, *frame, *hbox, *sframe; GList *iter; gchar tmp[64]; WinDef *win; vbox = gtk_vbox_new(FALSE, 0); for(iter = wi->windows; iter != NULL; iter = g_list_next(iter)) { win = iter->data; g_snprintf(tmp, sizeof tmp, "%c%s", toupper(*win->label), win->label + 1); frame = gtk_frame_new(tmp); hbox = gtk_hbox_new(FALSE, 0); sframe = subframe_build(wi, win, SUBFRAME_POSITION, modified); gtk_box_pack_start(GTK_BOX(hbox), sframe, TRUE, TRUE, 5); sframe = subframe_build(wi, win, SUBFRAME_SIZE, modified); gtk_box_pack_start(GTK_BOX(hbox), sframe, TRUE, TRUE, 5); gtk_container_add(GTK_CONTAINER(frame), hbox); gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 5); } return vbox; }
false
false
false
false
false
0
wusbhc_rh_create(struct wusbhc *wusbhc) { int result = -ENOMEM; size_t port_size, itr; port_size = wusbhc->ports_max * sizeof(wusbhc->port[0]); wusbhc->port = kzalloc(port_size, GFP_KERNEL); if (wusbhc->port == NULL) goto error_port_alloc; for (itr = 0; itr < wusbhc->ports_max; itr++) wusb_port_init(&wusbhc->port[itr]); result = 0; error_port_alloc: return result; }
false
false
false
false
false
0
ras_validate(jas_stream_t *in) { uchar buf[RAS_MAGICLEN]; int i; int n; uint_fast32_t magic; assert(JAS_STREAM_MAXPUTBACK >= RAS_MAGICLEN); /* Read the validation data (i.e., the data used for detecting the format). */ if ((n = jas_stream_read(in, buf, RAS_MAGICLEN)) < 0) { return -1; } /* Put the validation data back onto the stream, so that the stream position will not be changed. */ for (i = n - 1; i >= 0; --i) { if (jas_stream_ungetc(in, buf[i]) == EOF) { return -1; } } /* Did we read enough data? */ if (n < RAS_MAGICLEN) { return -1; } magic = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3]; /* Is the signature correct for the Sun Rasterfile format? */ if (magic != RAS_MAGIC) { return -1; } return 0; }
false
false
false
false
false
0
snd_pcm_free_stream(struct snd_pcm_str * pstr) { struct snd_pcm_substream *substream, *substream_next; #if IS_ENABLED(CONFIG_SND_PCM_OSS) struct snd_pcm_oss_setup *setup, *setupn; #endif substream = pstr->substream; while (substream) { substream_next = substream->next; snd_pcm_timer_done(substream); snd_pcm_substream_proc_done(substream); kfree(substream); substream = substream_next; } snd_pcm_stream_proc_done(pstr); #if IS_ENABLED(CONFIG_SND_PCM_OSS) for (setup = pstr->oss.setup_list; setup; setup = setupn) { setupn = setup->next; kfree(setup->task_name); kfree(setup); } #endif free_chmap(pstr); if (pstr->substream_count) put_device(&pstr->dev); }
false
false
false
false
false
0
A_RestoreSpecialThing1(mobj_t * thing) { if (thing->type == MT_WMACE) { // Do random mace placement P_RepositionMace(thing); } thing->flags2 &= ~MF2_DONTDRAW; S_StartSound(thing, sfx_respawn); }
false
false
false
false
false
0
simpleSplit (const UT_String & str, char separator, size_t max) { UT_GenericVector<UT_String*> * utvResult = new UT_GenericVector<UT_String*>(); UT_String* utsEntry; UT_uint32 start = 0; for(size_t j = 0; (max == 0 || j < max) && start < str.size(); j++) { utsEntry = new UT_String; for (; (str[start] != separator || j == max - 1) && start < str.size(); start++) *utsEntry += str[start]; start++; // skipping over the separator character // itself if (utsEntry->empty()) delete utsEntry; else utvResult->addItem(utsEntry); } return utvResult; }
false
false
false
false
false
0
setDataToUi() { ui->databaseList->clear(); d->m_Infos = drugsBase().getAllDrugSourceInformation(); const DrugsDB::DatabaseInfos *actual = drugsBase().actualDatabaseInformation(); if (!actual) return; int row = 0; foreach(DrugsDB::DatabaseInfos *info, d->m_Infos) { if (!info) continue; ui->databaseList->addItem(info->translatedName()); if (info->identifier == actual->identifier) { ui->databaseList->setCurrentRow(row, QItemSelectionModel::Select); } ++row; } }
false
false
false
false
false
0
ui_asg_manage_getlast(struct ui_asg_manage_data *data) { gchar *txt; gboolean bool; Assign *item; DB( g_print("\n(ui_asg_manage_getlast)\n") ); DB( g_print(" -> for assign id=%d\n", data->lastkey) ); item = da_asg_get(data->lastkey); if(item != NULL) { data->change++; txt = (gchar *)gtk_entry_get_text(GTK_ENTRY(data->ST_name)); if (txt && *txt) { bool = assign_rename(item, txt); if(bool) { gtk_tree_view_columns_autosize (GTK_TREE_VIEW(data->LV_rul)); } else { gtk_entry_set_text(GTK_ENTRY(data->ST_name), item->name); } } item->exact = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(data->CM_exact)); item->kcat = ui_cat_comboboxentry_get_key_add_new(GTK_COMBO_BOX(data->PO_cat)); item->kpay = ui_pay_comboboxentry_get_key_add_new(GTK_COMBO_BOX(data->PO_pay)); } }
false
false
false
false
false
0
_e_color_dialog_button2_click(void *data, E_Dialog *edia __UNUSED__) { E_Color_Dialog *dia; dia = data; if (dia->cancel_func && dia->initial) dia->cancel_func(dia, dia->initial, dia->cancel_data); _e_color_dialog_free(data); }
false
false
false
false
false
0
check_specified_kernel_debug_file() { if (pc->flags & GDB_INIT) return NULL; return (pc->namelist_debug ? pc->namelist_debug : NULL); }
false
false
false
false
false
0
in_denotation (NODE_T *p) { if (IS (p, ROW_CHAR_DENOTATION)) { in_literal (NSYMBOL (p)); } else if (IS (p, LONGETY) || IS (p, SHORTETY)) { in_sizety (SUB (p)); in_denotation (NEXT (p)); } else { put_sym (p, !KEYWORD); } }
false
false
false
false
false
0
cob_sync (cob_file *f, const int mode) { #ifdef WITH_DB struct indexed_file *p; size_t i; #ifdef USE_DB41 int n; #endif #endif #if defined(WITH_CISAM) || defined(WITH_DISAM) || defined(WITH_VBISAM) struct indexfile *fh = f->file; #endif if (f->organization == COB_ORG_INDEXED) { #ifdef WITH_DB p = f->file; for (i = 0; i < f->nkeys; i++) { if (p->db[i]) { DB_SYNC (p->db[i]); } } if (mode == 2) { for (i = 0; i < f->nkeys; i++) { if (p->db[i]) { #ifdef USE_DB41 fsync (p->db[i]->fd (p->db[i], &n)); #else fsync (p->db[i]->fd (p->db[i])); #endif } } } #endif /* WITH_DB */ #if defined(WITH_CISAM) || defined(WITH_DISAM) || defined(WITH_VBISAM) if (fh) { isflush (fh->isfd); } #endif return; } if (f->organization != COB_ORG_SORT) { fflush ((FILE *)f->file); if (mode == 2) { fsync (fileno ((FILE *)f->file)); } } }
false
false
false
false
false
0
get_genomic_range(const void *sa) { GtSSplicedAlignment *alignment = *(GtSSplicedAlignment**) sa; gt_assert(alignment); return gt_sspliced_alignment_genomic_range(alignment); }
false
false
false
false
false
0
cgroup_config_try_unmount(struct cg_mount_table_s *mount_info) { char *controller, *controller_list; struct cg_mount_point *mount = &(mount_info->mount); void *handle = NULL; int ret, lvl; struct cgroup_file_info info; char *saveptr = NULL; /* parse the first controller name from list of controllers */ controller_list = strdup(mount_info->name); if (!controller_list) { last_errno = errno; return ECGOTHER; } controller = strtok_r(controller_list, ",", &saveptr); if (!controller) { free(controller_list); return ECGINVAL; } /* check if the hierarchy is empty */ ret = cgroup_walk_tree_begin(controller, "/", 0, &handle, &info, &lvl); free(controller_list); if (ret == ECGCONTROLLEREXISTS) return 0; if (ret) return ret; /* skip the first found directory, it's '/' */ ret = cgroup_walk_tree_next(0, &handle, &info, lvl); /* find any other subdirectory */ while (ret == 0) { if (info.type == CGROUP_FILE_TYPE_DIR) break; ret = cgroup_walk_tree_next(0, &handle, &info, lvl); } cgroup_walk_tree_end(&handle); if (ret == 0) { cgroup_dbg("won't unmount %s: hieararchy is not empty\n", mount_info->name); return 0; /* the hieararchy is not empty */ } if (ret != ECGEOF) return ret; /* * ret must be ECGEOF now = there is only root group in the hierarchy * -> unmount all mount points. */ ret = 0; while (mount) { int err; cgroup_dbg("unmounting %s at %s\n", mount_info->name, mount->path); err = umount(mount->path); if (err && !ret) { ret = ECGOTHER; last_errno = errno; } mount = mount->next; } return ret; }
false
false
false
false
false
0
popTransparencyGroup() { /* pop color space */ ColorSpaceStack *css = groupColorSpaceStack; if (css->knockout) { knockoutCount--; if (!knockoutCount) { /* we don't need to track the shape anymore because * we are not above any knockout groups */ cairo_destroy(cairo_shape); cairo_shape = NULL; } } groupColorSpaceStack = css->next; delete css; }
false
false
false
false
false
0
FreeImage_Invert(FIBITMAP *src) { if (!FreeImage_HasPixels(src)) return FALSE; unsigned i, x, y, k; const unsigned width = FreeImage_GetWidth(src); const unsigned height = FreeImage_GetHeight(src); const unsigned bpp = FreeImage_GetBPP(src); FREE_IMAGE_TYPE image_type = FreeImage_GetImageType(src); if(image_type == FIT_BITMAP) { switch(bpp) { case 1 : case 4 : case 8 : { // if the dib has a colormap, just invert it // else, keep the linear grayscale if (FreeImage_GetColorType(src) == FIC_PALETTE) { RGBQUAD *pal = FreeImage_GetPalette(src); for(i = 0; i < FreeImage_GetColorsUsed(src); i++) { pal[i].rgbRed = 255 - pal[i].rgbRed; pal[i].rgbGreen = 255 - pal[i].rgbGreen; pal[i].rgbBlue = 255 - pal[i].rgbBlue; } } else { for(y = 0; y < height; y++) { BYTE *bits = FreeImage_GetScanLine(src, y); for (x = 0; x < FreeImage_GetLine(src); x++) { bits[x] = ~bits[x]; } } } break; } case 24 : case 32 : { // Calculate the number of bytes per pixel (3 for 24-bit or 4 for 32-bit) const unsigned bytespp = FreeImage_GetLine(src) / width; for(y = 0; y < height; y++) { BYTE *bits = FreeImage_GetScanLine(src, y); for(x = 0; x < width; x++) { for(k = 0; k < bytespp; k++) { bits[k] = ~bits[k]; } bits += bytespp; } } break; } default: return FALSE; } } else if((image_type == FIT_UINT16) || (image_type == FIT_RGB16) || (image_type == FIT_RGBA16)) { // Calculate the number of words per pixel (1 for 16-bit, 3 for 48-bit or 4 for 64-bit) const unsigned wordspp = (FreeImage_GetLine(src) / width) / sizeof(WORD); for(y = 0; y < height; y++) { WORD *bits = (WORD*)FreeImage_GetScanLine(src, y); for(x = 0; x < width; x++) { for(k = 0; k < wordspp; k++) { bits[k] = ~bits[k]; } bits += wordspp; } } } else { // anything else ... return FALSE; } return TRUE; }
false
false
false
false
false
0
str_units(int n) { /* n==1: use singular */ if (n == 1) return display_in_cyl_units ? "cylinder" : "sector"; return display_in_cyl_units ? "cylinders" : "sectors"; }
false
false
false
false
false
0
byword(register const char *const word, register const struct lookup *const table) { register const struct lookup * foundlp; register const struct lookup * lp; if (word == NULL || table == NULL) return NULL; /* ** Look for exact match. */ for (lp = table; lp->l_word != NULL; ++lp) if (ciequal(word, lp->l_word)) return lp; /* ** Look for inexact match. */ foundlp = NULL; for (lp = table; lp->l_word != NULL; ++lp) if (itsabbr(word, lp->l_word)) { if (foundlp == NULL) foundlp = lp; else return NULL; /* multiple inexact matches */ } return foundlp; }
false
false
false
false
false
0
pmu_code(struct nv50_devinit *init, u32 pmu, u32 img, u32 len, bool sec) { struct nvkm_device *device = init->base.subdev.device; struct nvkm_bios *bios = device->bios; int i; nvkm_wr32(device, 0x10a180, 0x01000000 | (sec ? 0x10000000 : 0) | pmu); for (i = 0; i < len; i += 4) { if ((i & 0xff) == 0) nvkm_wr32(device, 0x10a188, (pmu + i) >> 8); nvkm_wr32(device, 0x10a184, nvbios_rd32(bios, img + i)); } while (i & 0xff) { nvkm_wr32(device, 0x10a184, 0x00000000); i += 4; } }
false
false
false
false
false
0
_mesa_remove_dead_code_local(struct gl_program *prog) { GLboolean *removeInst; GLuint i, arg, rem = 0; removeInst = calloc(1, prog->NumInstructions * sizeof(GLboolean)); for (i = 0; i < prog->NumInstructions; i++) { const struct prog_instruction *inst = prog->Instructions + i; const GLuint index = inst->DstReg.Index; const GLuint mask = inst->DstReg.WriteMask; enum inst_use use; /* We must deactivate the pass as soon as some indirection is used */ if (inst->DstReg.RelAddr) goto done; for (arg = 0; arg < _mesa_num_inst_src_regs(inst->Opcode); arg++) if (inst->SrcReg[arg].RelAddr) goto done; if (_mesa_is_flow_control_opcode(inst->Opcode) || _mesa_num_inst_dst_regs(inst->Opcode) == 0 || inst->DstReg.File != PROGRAM_TEMPORARY || inst->DstReg.RelAddr) continue; use = find_next_use(prog, i+1, index, mask); if (use == WRITE || use == END) removeInst[i] = GL_TRUE; } rem = remove_instructions(prog, removeInst); done: free(removeInst); return rem != 0; }
false
false
false
false
false
0
init(std::string _host, std::string _port, std::string _topic) { ns[""] = "http://eu-emi.eu/namespaces/2012/11/aggregatedcomputerecord"; ns["urf"] = "http://eu-emi.eu/namespaces/2012/11/computerecord"; ns_query["car"] = "http://eu-emi.eu/namespaces/2012/11/aggregatedcomputerecord"; ns_query["urf"] = "http://eu-emi.eu/namespaces/2012/11/computerecord"; // Get cert, key, CA path from environment std::string certfile=Arc::GetEnv("X509_USER_CERT"); std::string keyfile=Arc::GetEnv("X509_USER_KEY"); std::string cadir=Arc::GetEnv("X509_CERT_DIR"); // ...or by default, use host cert, key, CA path if (certfile.empty()) certfile=JURA_DEFAULT_CERT_FILE; if (keyfile.empty()) keyfile=JURA_DEFAULT_KEY_FILE; if (cadir.empty()) cadir=JURA_DEFAULT_CA_DIR; cfg.AddCertificate(certfile); cfg.AddPrivateKey(keyfile); cfg.AddCADir(cadir); host = _host; port = _port; topic = _topic; //read the previous aggregation records std::string default_path = (std::string)JURA_DEFAULT_DIR_PREFIX + "/urs/"; aggr_record_location = default_path + host + "_aggregation_records.xml"; if (!aggregationrecordset.ReadFromFile(aggr_record_location)) { logger.msg(Arc::INFO, "Aggregation record (%s) not exist, initialize it...", aggr_record_location); if (aggregationrecordset.SaveToFile(aggr_record_location)) { logger.msg(Arc::INFO, "Aggregation record (%s) initialization successful.", aggr_record_location); } else { logger.msg(Arc::ERROR, "Some error happens during the Aggregation record (%s) initialization.", aggr_record_location); } } else { logger.msg(Arc::DEBUG, "Aggregation record (%s) read from file successful.", aggr_record_location); } }
false
false
false
false
false
0
inf_gtk_chat_strdup_strftime(const char* format, const struct tm* tm, gsize* len) { gsize alloc; gchar* str; size_t result; alloc = 64; str = g_malloc(alloc * sizeof(gchar)); result = strftime(str, alloc, format, tm); while(result == 0 && alloc < 1024) { alloc *= 2; str = g_realloc(str, alloc * sizeof(gchar)); result = strftime(str, alloc, format, tm); } if(result == 0) { g_free(str); return NULL; } if(len) *len = result; return str; }
false
false
false
false
false
0
intel_panel_get_backlight(struct intel_connector *connector) { struct drm_device *dev = connector->base.dev; struct drm_i915_private *dev_priv = dev->dev_private; struct intel_panel *panel = &connector->panel; u32 val = 0; mutex_lock(&dev_priv->backlight_lock); if (panel->backlight.enabled) { val = panel->backlight.get(connector); val = intel_panel_compute_brightness(connector, val); } mutex_unlock(&dev_priv->backlight_lock); DRM_DEBUG_DRIVER("get backlight PWM = %d\n", val); return val; }
false
false
false
false
false
0
horizonv(float *z,int ix1,int iy1,int ix2,int iy2) { float ux; int x1,x2,putback=false; float y1,y2; if (sf.zcolour[0]!=0 && (z[ix1 + iy1 * (int32)nnx] <= min_zed || z[ix2 + iy2 * (int32)nnx] <= min_zed)) { putback = true; g_set_color_if_defined(sf.zcolour); } touser(ix1,iy1,z[ix1 + iy1 * (int32)nnx],&ux,&y1); x1 = (int)maph(ux); touser(ix2,iy2,z[ix2 + iy2 * (int32)nnx],&ux,&y2); x2 = (int)maph(ux); hclipvec(x1,y1,x2,y2,true); if (putback) { putback = true; g_set_color_if_defined(sf.top_color); } }
false
false
false
false
false
0
ldapqry_delete_folder( LdapQuery *qry ) { AddressCache *cache; ItemFolder *folder; cm_return_if_fail( qry != NULL ); folder = ADDRQUERY_FOLDER(qry); if( folder ) { cache = qry->server->addressCache; folder = addrcache_remove_folder_delete( cache, folder ); if( folder ) { addritem_free_item_folder( folder ); } ADDRQUERY_FOLDER(qry) = NULL; } }
false
false
false
false
false
0
newsgroup_list_append(GSList *group_list, const gchar *str) { gchar *work; gchar *workp; if (!str) return group_list; Xstrdup_a(work, str, return group_list); workp = work; while (workp && *workp) { gchar *p, *next; if ((p = strchr_with_skip_quote(workp, '"', ','))) { *p = '\0'; next = p + 1; } else next = NULL; g_strstrip(workp); if (*workp) group_list = g_slist_append(group_list, g_strdup(workp)); workp = next; } return group_list; }
false
false
false
false
false
0
set_mode(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct virtual_consumer_data *data = dev_get_drvdata(dev); unsigned int mode; int ret; /* * sysfs_streq() doesn't need the \n's, but we add them so the strings * will be shared with show_mode(), above. */ if (sysfs_streq(buf, "fast\n")) mode = REGULATOR_MODE_FAST; else if (sysfs_streq(buf, "normal\n")) mode = REGULATOR_MODE_NORMAL; else if (sysfs_streq(buf, "idle\n")) mode = REGULATOR_MODE_IDLE; else if (sysfs_streq(buf, "standby\n")) mode = REGULATOR_MODE_STANDBY; else { dev_err(dev, "Configuring invalid mode\n"); return count; } mutex_lock(&data->lock); ret = regulator_set_mode(data->regulator, mode); if (ret == 0) data->mode = mode; else dev_err(dev, "Failed to configure mode: %d\n", ret); mutex_unlock(&data->lock); return count; }
false
false
false
false
false
0
acl_index_by_name(char *name) { named_acl_t *curr = named_acls; if ( !name || !named_acls ) return(0); while ( curr ) { if ( !strcmp(curr->name, name) ) { return(curr->internal_number); } curr = curr->next; } return(0); }
false
false
false
false
false
0
grow_trail (int pl, int size) { int i, k; k = ((trail_offset[pl] + trail_size[pl] - 1) & (maxq - 1)); while (size != 0 && trail_size[pl] + 5 < maxq) { i = ((trail_offset[pl] + trail_size[pl]) & (maxq - 1)); trail_pos[pl][i] = trail_pos[pl][k]; trail_way[pl][i] = trail_way[pl][k]; trail_size[pl]++; --size; } if (trail_size[pl] >= 55 && game_mode == M_QUEST) { if (player[pl].cpu == 2) event_sfx (89); add_end_level_bonuses (); } }
false
false
false
false
false
0
buildFullPathname(string& fullpath, const char* filename) { char old[FAUST_PATH_MAX]; if (isAbsolutePathname(filename)) { fullpath = filename; } else { fullpath = getcwd (old, FAUST_PATH_MAX); fullpath += '/'; fullpath += filename; } }
false
false
false
false
false
0
mptspi_deny_binding(struct scsi_target *starget) { struct _MPT_SCSI_HOST *hd = (struct _MPT_SCSI_HOST *)dev_to_shost(starget->dev.parent)->hostdata; return ((mptspi_is_raid(hd, starget->id)) && starget->channel == 0) ? 1 : 0; }
false
false
false
false
false
0
readFData( FILE* fp, fData* t, const fDataType* types ) { char** currentRow; char* rowPtr; int rowCount = 0; int i; int errFlag = 0;//not used, but possibly for future usage. set when data types disagree //allocate the datatypes table, and set the default values t->types = (fDataType*)malloc( sizeof(fDataType) * t->numCols ); for(i=0;i<t->numCols;i++) { t->types[i].type = INT; t->types[i].sigDigits = 0; t->types[i].inSigDigits = 0; } //allocate the first row of data t->data = (char***)malloc((sizeof( char** )) ); while(!EOFDETECTED) { //read in a row if((rowPtr = getRow(fp))==NULL) break; //this is not really an error //parse the row currentRow = readRow( rowPtr, t->numCols ); if(types != NULL)//check to see if the dataTypes in TYPES are OK with the data read. { if(!verifyRow(currentRow, types, t->numCols)) {fprintf(stderr,"On row %d\n", rowCount);errFlag = 1;} } if(EOFDETECTED) break; if(! currentRow ) { fprintf(stderr,"Flib::readRawData: I cant read line #%d\n",rowCount); t->data = NULL; return 1;; } //make space for another row t->data = (char***) realloc( t->data, (sizeof(char**) * (rowCount + 1)) ); //set the values for the row, and increment rowCount t->data[rowCount++] = currentRow; getDataTypes( t->numCols, t->types, currentRow ); free(rowPtr); } t->numRows = rowCount; return errFlag; }
false
true
false
false
true
1
nssCertificate_AddRef ( NSSCertificate *c ) { if (c) { nssPKIObject_AddRef(&c->object); } return c; }
false
false
false
false
false
0
retrieve( char* buf, int buf_len ) { char *name; debug(D_SYSCALL, "retrieving location"); if(!data || list_size(data)<=0) return 0; name = (char*)list_pop_head(data); memset(buf, 0, buf_len); strncpy(buf, name, buf_len); buf[buf_len-1] = 0; free(name); return strlen(buf); }
false
false
false
false
false
0
lex_open_file(LEX *lf, const char *filename, LEX_ERROR_HANDLER *scan_error) { LEX *nf; FILE *fd; BPIPE *bpipe = NULL; char *fname = bstrdup(filename); if (fname[0] == '|') { if ((bpipe = open_bpipe(fname+1, 0, "rb")) == NULL) { free(fname); return NULL; } fd = bpipe->rfd; } else if ((fd = fopen(fname, "rb")) == NULL) { free(fname); return NULL; } Dmsg1(400, "Open config file: %s\n", fname); nf = (LEX *)malloc(sizeof(LEX)); if (lf) { memcpy(nf, lf, sizeof(LEX)); memset(lf, 0, sizeof(LEX)); lf->next = nf; /* if have lf, push it behind new one */ lf->options = nf->options; /* preserve user options */ /* * preserve err_type to prevent bacula exiting on 'reload' * if config is invalid. Fixes bug #877 */ lf->err_type = nf->err_type; } else { lf = nf; /* start new packet */ memset(lf, 0, sizeof(LEX)); lex_set_error_handler_error_type(lf, M_ERROR_TERM); } if (scan_error) { lf->scan_error = scan_error; } else { lex_set_default_error_handler(lf); } lf->fd = fd; lf->bpipe = bpipe; lf->fname = fname; lf->state = lex_none; lf->ch = L_EOL; Dmsg1(dbglvl, "Return lex=%x\n", lf); return lf; }
false
false
false
false
true
1
plural_lookup (domain, n, translation, translation_len) struct loaded_l10nfile *domain; unsigned long int n; const char *translation; size_t translation_len; { struct loaded_domain *domaindata = (struct loaded_domain *) domain->data; unsigned long int index; const char *p; index = plural_eval (domaindata->plural, n); if (index >= domaindata->nplurals) /* This should never happen. It means the plural expression and the given maximum value do not match. */ index = 0; /* Skip INDEX strings at TRANSLATION. */ p = translation; while (index-- > 0) { #ifdef _LIBC p = __rawmemchr (p, '\0'); #else p = strchr (p, '\0'); #endif /* And skip over the NUL byte. */ p++; if (p >= translation + translation_len) /* This should never happen. It means the plural expression evaluated to a value larger than the number of variants available for MSGID1. */ return (char *) translation; } return (char *) p; }
false
false
false
false
false
0
globus_i_gss_assist_gridmap_line_free( globus_i_gss_assist_gridmap_line_t * gline) { static char * _function_name_ = "globus_i_gss_assist_gridmap_line_free"; GLOBUS_I_GSI_GSS_ASSIST_DEBUG_ENTER; if (gline != NULL) { if (gline->dn != NULL) { free(gline->dn); } if (gline->user_ids != NULL) { char ** userids_tmp = gline->user_ids; while (*userids_tmp != NULL) { free(*userids_tmp++); } free(gline->user_ids); } free(gline); } }
false
false
false
false
false
0
rfbSetTcpNoDelay(int sock) { int one = 1; struct sockaddr_in addr; socklen_t addrlen = sizeof(addr); memset(&addr, 0, sizeof(addr)); if (getsockname(sock, (struct sockaddr *)&addr, &addrlen) < 0) { /* non-socket */ return TRUE; } if (addr.sin_family == AF_INET) { if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (char *)&one, sizeof(one)) < 0) { rfbLogPerror("setsockopt TCP_NODELAY"); return FALSE; } } return TRUE; }
false
false
false
false
false
0
stk3310_read_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int *val, int *val2, long mask) { u8 reg; __be16 buf; int ret; unsigned int index; struct stk3310_data *data = iio_priv(indio_dev); struct i2c_client *client = data->client; if (chan->type != IIO_LIGHT && chan->type != IIO_PROXIMITY) return -EINVAL; switch (mask) { case IIO_CHAN_INFO_RAW: if (chan->type == IIO_LIGHT) reg = STK3310_REG_ALS_DATA_MSB; else reg = STK3310_REG_PS_DATA_MSB; mutex_lock(&data->lock); ret = regmap_bulk_read(data->regmap, reg, &buf, 2); if (ret < 0) { dev_err(&client->dev, "register read failed\n"); mutex_unlock(&data->lock); return ret; } *val = be16_to_cpu(buf); mutex_unlock(&data->lock); return IIO_VAL_INT; case IIO_CHAN_INFO_INT_TIME: if (chan->type == IIO_LIGHT) ret = regmap_field_read(data->reg_als_it, &index); else ret = regmap_field_read(data->reg_ps_it, &index); if (ret < 0) return ret; *val = stk3310_it_table[index][0]; *val2 = stk3310_it_table[index][1]; return IIO_VAL_INT_PLUS_MICRO; case IIO_CHAN_INFO_SCALE: if (chan->type == IIO_LIGHT) ret = regmap_field_read(data->reg_als_gain, &index); else ret = regmap_field_read(data->reg_ps_gain, &index); if (ret < 0) return ret; *val = stk3310_scale_table[index][0]; *val2 = stk3310_scale_table[index][1]; return IIO_VAL_INT_PLUS_MICRO; } return -EINVAL; }
false
false
false
false
false
0
set_field_sens(KILL_WIDGETS *w, int field) { int msgid = field == KillFieldMsgid; int all_sens = field < 0; XtSetSensitive(w->messageid_field, all_sens || msgid); XtSetSensitive(w->subject_field, all_sens || !msgid); XtSetSensitive(w->from_field, all_sens || !msgid); XtSetSensitive(w->xref_field, all_sens || !msgid); }
false
false
false
false
false
0
printrusage(struct tcb *tcp, long addr) { struct rusage ru; if (!addr) tprintf("NULL"); else if (syserror(tcp) || !verbose(tcp)) tprintf("%#lx", addr); else if (umove(tcp, addr, &ru) < 0) tprintf("{...}"); else if (!abbrev(tcp)) { tprintf("{ru_utime={%lu, %lu}, ru_stime={%lu, %lu}, ", (long) ru.ru_utime.tv_sec, (long) ru.ru_utime.tv_usec, (long) ru.ru_stime.tv_sec, (long) ru.ru_stime.tv_usec); tprintf("ru_maxrss=%lu, ru_ixrss=%lu, ", ru.ru_maxrss, ru.ru_ixrss); tprintf("ru_idrss=%lu, ru_isrss=%lu, ", ru.ru_idrss, ru.ru_isrss); tprintf("ru_minflt=%lu, ru_majflt=%lu, ru_nswap=%lu, ", ru.ru_minflt, ru.ru_majflt, ru.ru_nswap); tprintf("ru_inblock=%lu, ru_oublock=%lu, ", ru.ru_inblock, ru.ru_oublock); tprintf("ru_msgsnd=%lu, ru_msgrcv=%lu, ", ru.ru_msgsnd, ru.ru_msgrcv); tprintf("ru_nsignals=%lu, ru_nvcsw=%lu, ru_nivcsw=%lu}", ru.ru_nsignals, ru.ru_nvcsw, ru.ru_nivcsw); } else { tprintf("{ru_utime={%lu, %lu}, ru_stime={%lu, %lu}, ...}", (long) ru.ru_utime.tv_sec, (long) ru.ru_utime.tv_usec, (long) ru.ru_stime.tv_sec, (long) ru.ru_stime.tv_usec); } }
false
false
false
false
false
0
setoptstring(ns_server_t *server, char **field, const cfg_obj_t *obj) { if (cfg_obj_isvoid(obj)) return (setstring(server, field, NULL)); else return (setstring(server, field, cfg_obj_asstring(obj))); }
false
false
false
false
false
0
movl(const Operand& dst, Label* src) { EnsureSpace ensure_space(this); emit_optional_rex_32(dst); emit(0xC7); emit_operand(0, dst); if (src->is_bound()) { int offset = src->pos() - pc_offset() - sizeof(int32_t); ASSERT(offset <= 0); emitl(offset); } else if (src->is_linked()) { emitl(src->pos()); src->link_to(pc_offset() - sizeof(int32_t)); } else { ASSERT(src->is_unused()); int32_t current = pc_offset(); emitl(current); src->link_to(current); } }
false
false
false
false
false
0
importer_ib ( void ) { GtkWidget *dialog; gint resultat; gchar *budget_name; gint last_transaction_number; GtkFileFilter * filter; dialog = gtk_file_chooser_dialog_new ( _("Import budgetary lines"), GTK_WINDOW ( window ), GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_OK, NULL); gtk_file_chooser_set_current_folder ( GTK_FILE_CHOOSER ( dialog ), gsb_file_get_last_path () ); gtk_window_set_position ( GTK_WINDOW ( dialog ), GTK_WIN_POS_CENTER_ON_PARENT ); filter = gtk_file_filter_new (); gtk_file_filter_set_name ( filter, _("Grisbi budgetary lines files (*.igsb)") ); gtk_file_filter_add_pattern ( filter, "*.igsb" ); gtk_file_chooser_add_filter ( GTK_FILE_CHOOSER ( dialog ), filter ); gtk_file_chooser_set_filter ( GTK_FILE_CHOOSER ( dialog ), filter ); filter = gtk_file_filter_new (); gtk_file_filter_set_name ( filter, _("Grisbi category files (*.cgsb)") ); gtk_file_filter_add_pattern ( filter, "*.cgsb" ); gtk_file_chooser_add_filter ( GTK_FILE_CHOOSER ( dialog ), filter ); filter = gtk_file_filter_new (); gtk_file_filter_set_name ( filter, _("All files") ); gtk_file_filter_add_pattern ( filter, "*" ); gtk_file_chooser_add_filter ( GTK_FILE_CHOOSER ( dialog ), filter ); resultat = gtk_dialog_run ( GTK_DIALOG ( dialog )); if ( resultat != GTK_RESPONSE_OK ) { gtk_widget_destroy ( dialog ); return; } budget_name = file_selection_get_filename ( GTK_FILE_CHOOSER ( dialog )); gsb_file_update_last_path (file_selection_get_last_directory (GTK_FILE_CHOOSER (dialog), TRUE)); gtk_widget_destroy ( GTK_WIDGET ( dialog )); last_transaction_number = gsb_data_transaction_get_last_number(); /* on permet de remplacer/fusionner la liste */ dialog = dialogue_special_no_run ( GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, make_hint ( _("Merge imported budgetary lines with existing?"), ( last_transaction_number ? _("File already contains budgetary lines. If you decide to continue, existing budgetary lines will be merged with imported ones.") : _("File does not contain budgetary lines. " "If you decide to continue, existing budgetary lines will be merged with imported ones. " "Once performed, there is no undo for this.\n" "You may also decide to replace existing budgetary lines with imported ones." ) ) ) ); if ( !last_transaction_number) gtk_dialog_add_buttons ( GTK_DIALOG(dialog), _("Replace existing"), 2, NULL ); gtk_dialog_add_buttons ( GTK_DIALOG(dialog), GTK_STOCK_CANCEL, 0, GTK_STOCK_OK, 1, NULL ); resultat = gtk_dialog_run ( GTK_DIALOG ( dialog )); gtk_widget_destroy ( GTK_WIDGET ( dialog )); switch ( resultat ) { case 2 : /* we want to replace the list */ if ( !last_transaction_number ) gsb_data_budget_init_variables (); case 1 : if ( g_str_has_suffix ( budget_name, ".cgsb" ) ) gsb_file_others_load_budget_from_category ( budget_name ); else gsb_file_others_load_budget ( budget_name ); break; default : return; } }
false
false
false
false
false
0
AsFloat() const { if( !typeTag_ ) throw MissingArgumentException(); else if( *typeTag_ == FLOAT_TYPE_TAG ) return AsFloatUnchecked(); else throw WrongArgumentTypeException(); }
false
false
false
false
false
0
arma_model_get_x_coeffs (const MODEL *pmod) { const double *xc = NULL; if (pmod->ci == ARMA && gretl_model_get_int(pmod, "armax")) { xc = pmod->coeff; xc += pmod->ifc; xc += arma_AR_lags(pmod); xc += arma_MA_lags(pmod); xc += gretl_model_get_int(pmod, "arma_P"); xc += gretl_model_get_int(pmod, "arma_Q"); } return xc; }
false
false
false
false
false
0
main(int argc, char **argv) { l_int32 i, j, equal; PIX *pixs, *pixt, *pixd; static char mainName[] = "rasteropip_reg"; pixs = pixRead("test8.jpg"); pixt = pixCopy(NULL, pixs); /* Copy, in-place and one COLUMN at a time, from the right side to the left side. */ for (j = 0; j < 200; j++) pixRasterop(pixs, 20 + j, 20, 1, 250, PIX_SRC, pixs, 250 + j, 20); pixDisplay(pixs, 50, 50); /* Copy, in-place and one ROW at a time, from the right side to the left side. */ for (i = 0; i < 250; i++) pixRasterop(pixt, 20, 20 + i, 200, 1, PIX_SRC, pixt, 250, 20 + i); pixDisplay(pixt, 620, 50); /* Test */ pixEqual(pixs, pixt, &equal); if (equal) fprintf(stderr, "OK: images are the same\n"); else fprintf(stderr, "Error: images are different\n"); pixWrite("/tmp/junkpix.png", pixs, IFF_PNG); pixDestroy(&pixs); pixDestroy(&pixt); /* Show the mirrored border, which uses the general pixRasterop() on an image in-place. */ pixs = pixRead("test8.jpg"); pixt = pixRemoveBorder(pixs, 40); pixd = pixAddMirroredBorder(pixt, 25, 25, 25, 25); pixDisplay(pixd, 50, 550); pixDestroy(&pixs); pixDestroy(&pixt); pixDestroy(&pixd); return 0; }
false
false
false
false
false
0
avrcp_handle_request_continuing(struct avrcp_player *player, struct avrcp_header *pdu, uint8_t transaction) { uint16_t len = ntohs(pdu->params_len); struct pending_pdu *pending; if (len != 1 || player->pending_pdu == NULL) goto err; pending = player->pending_pdu; if (pending->pdu_id != pdu->params[0]) goto err; len = 0; pending->attr_ids = player_fill_media_attribute(player, pending->attr_ids, pdu->params, &len, &pending->offset); pdu->pdu_id = pending->pdu_id; if (pending->attr_ids == NULL) { g_free(player->pending_pdu); player->pending_pdu = NULL; pdu->packet_type = AVRCP_PACKET_TYPE_END; } else { pdu->packet_type = AVRCP_PACKET_TYPE_CONTINUING; } pdu->params_len = htons(len); return AVC_CTYPE_STABLE; err: pdu->params_len = htons(1); pdu->params[0] = E_INVALID_PARAM; return AVC_CTYPE_REJECTED; }
false
false
false
false
false
0
rk3x_i2c_clk_notifier_cb(struct notifier_block *nb, unsigned long event, void *data) { struct clk_notifier_data *ndata = data; struct rk3x_i2c *i2c = container_of(nb, struct rk3x_i2c, clk_rate_nb); unsigned long div_low, div_high; switch (event) { case PRE_RATE_CHANGE: if (rk3x_i2c_calc_divs(ndata->new_rate, i2c->scl_frequency, i2c->scl_rise_ns, i2c->scl_fall_ns, i2c->sda_fall_ns, &div_low, &div_high) != 0) return NOTIFY_STOP; /* scale up */ if (ndata->new_rate > ndata->old_rate) rk3x_i2c_adapt_div(i2c, ndata->new_rate); return NOTIFY_OK; case POST_RATE_CHANGE: /* scale down */ if (ndata->new_rate < ndata->old_rate) rk3x_i2c_adapt_div(i2c, ndata->new_rate); return NOTIFY_OK; case ABORT_RATE_CHANGE: /* scale up */ if (ndata->new_rate > ndata->old_rate) rk3x_i2c_adapt_div(i2c, ndata->old_rate); return NOTIFY_OK; default: return NOTIFY_DONE; } }
false
false
false
false
false
0
get_gicon (ButtonData *button_data) { switch (button_data->type) { case ROOT_BUTTON: return g_themed_icon_new (NAUTILUS_ICON_FILESYSTEM); case HOME_BUTTON: return g_themed_icon_new (NAUTILUS_ICON_HOME); case MOUNT_BUTTON: return get_gicon_for_mount (button_data); default: return NULL; } return NULL; }
false
false
false
false
false
0
control_to_string(control c) { map<string,control>::iterator it = bigraph::control_map.begin(); while(it != control_map.end()) { if(it->second == c) return it->first; ++it; } return "<unknown control>"; }
false
false
false
false
false
0
add_sorter (ESelectionModel *model, ESorter *sorter) { model->sorter = sorter; if (sorter) { g_object_ref (sorter); } }
false
false
false
false
false
0
Sop_a8_to_Dacc( GenefxState *gfxs ) { int w = gfxs->length; GenefxAccumulator *D = gfxs->Dacc; u8 *S = gfxs->Sop[0]; while (w--) { D->RGB.a = *S++; D->RGB.r = 0xFF; D->RGB.g = 0xFF; D->RGB.b = 0xFF; D++; } }
false
false
false
false
false
0
parse_cookie(struct b43legacy_wldev *dev, u16 cookie, struct b43legacy_pio_txpacket **packet) { struct b43legacy_pio *pio = &dev->pio; struct b43legacy_pioqueue *queue = NULL; int packetindex; switch (cookie & 0xF000) { case 0x0000: queue = pio->queue0; break; case 0x1000: queue = pio->queue1; break; case 0x2000: queue = pio->queue2; break; case 0x3000: queue = pio->queue3; break; default: B43legacy_WARN_ON(1); } packetindex = (cookie & 0x0FFF); B43legacy_WARN_ON(!(packetindex >= 0 && packetindex < B43legacy_PIO_MAXTXPACKETS)); *packet = &(queue->tx_packets_cache[packetindex]); return queue; }
false
false
false
false
false
0
detach_data(CL_ResourceData *data) { std::map<std::string, CL_ResourceData *>::iterator it; for (it = impl->datas.begin(); it != impl->datas.end(); it++) { if (it->second == data) { impl->datas.erase(it); break; } } }
false
false
false
false
false
0
rtl8187b_init_status_urb(struct ieee80211_hw *dev) { struct rtl8187_priv *priv = dev->priv; struct urb *entry; int ret = 0; entry = usb_alloc_urb(0, GFP_KERNEL); if (!entry) return -ENOMEM; usb_fill_bulk_urb(entry, priv->udev, usb_rcvbulkpipe(priv->udev, 9), &priv->b_tx_status.buf, sizeof(priv->b_tx_status.buf), rtl8187b_status_cb, dev); usb_anchor_urb(entry, &priv->anchored); ret = usb_submit_urb(entry, GFP_KERNEL); if (ret) usb_unanchor_urb(entry); usb_free_urb(entry); return ret; }
false
false
false
false
false
0
SaveEmoticon(GtkTreeModel* model, GtkTreePath* path UNUSED, GtkTreeIter* iter, FILE* file) { gchar* text = NULL; gtk_tree_model_get( model, iter, 0, &text, -1 ); if( text ) { fprintf(file, "%s\n", text); g_free(text); } return false; }
false
false
false
false
false
0
default_tokenization(cst_utterance *u) { const char *text,*token; cst_tokenstream *fd; cst_item *t; cst_relation *r; text = utt_input_text(u); r = utt_relation_create(u,"Token"); fd = ts_open_string(text, get_param_string(u->features,"text_whitespace",NULL), get_param_string(u->features,"text_singlecharsymbols",NULL), get_param_string(u->features,"text_prepunctuation",NULL), get_param_string(u->features,"text_postpunctuation",NULL)); while(!ts_eof(fd)) { token = ts_get(fd); if (cst_strlen(token) > 0) { t = relation_append(r,NULL); item_set_string(t,"name",token); item_set_string(t,"whitespace",fd->whitespace); item_set_string(t,"prepunctuation",fd->prepunctuation); item_set_string(t,"punc",fd->postpunctuation); item_set_int(t,"file_pos",fd->file_pos); item_set_int(t,"line_number",fd->line_number); } } ts_close(fd); return u; }
false
false
false
false
false
0
media_open(struct inode *inode, struct file *filp) { struct media_devnode *mdev; int ret; /* Check if the media device is available. This needs to be done with * the media_devnode_lock held to prevent an open/unregister race: * without the lock, the device could be unregistered and freed between * the media_devnode_is_registered() and get_device() calls, leading to * a crash. */ mutex_lock(&media_devnode_lock); mdev = container_of(inode->i_cdev, struct media_devnode, cdev); /* return ENXIO if the media device has been removed already or if it is not registered anymore. */ if (!media_devnode_is_registered(mdev)) { mutex_unlock(&media_devnode_lock); return -ENXIO; } /* and increase the device refcount */ get_device(&mdev->dev); mutex_unlock(&media_devnode_lock); filp->private_data = mdev; if (mdev->fops->open) { ret = mdev->fops->open(filp); if (ret) { put_device(&mdev->dev); return ret; } } return 0; }
false
false
false
false
true
1
getCopyStart(PGconn *conn, ExecStatusType copytype) { PGresult *result; int nfields; int i; result = PQmakeEmptyPGresult(conn, copytype); if (!result) goto failure; if (pqGetc(&conn->copy_is_binary, conn)) goto failure; result->binary = conn->copy_is_binary; /* the next two bytes are the number of fields */ if (pqGetInt(&(result->numAttributes), 2, conn)) goto failure; nfields = result->numAttributes; /* allocate space for the attribute descriptors */ if (nfields > 0) { result->attDescs = (PGresAttDesc *) pqResultAlloc(result, nfields * sizeof(PGresAttDesc), TRUE); if (!result->attDescs) goto failure; MemSet(result->attDescs, 0, nfields * sizeof(PGresAttDesc)); } for (i = 0; i < nfields; i++) { int format; if (pqGetInt(&format, 2, conn)) goto failure; /* * Since pqGetInt treats 2-byte integers as unsigned, we need to * coerce these results to signed form. */ format = (int) ((int16) format); result->attDescs[i].format = format; } /* Success! */ conn->result = result; return 0; failure: PQclear(result); return EOF; }
false
false
false
false
false
0
sync_init(void) { int res; sync_queue = q_init(); if (!sync_queue) return -1; pthread_mutex_lock(&m_sync_ht); /* initialize dirname ht */ ht_init(&sync_ht, sync_hash, sync_cmp); /* load sync data from db, call sync_ht_set() for each row */ res = db_load_sync(sync_ht_set); pthread_mutex_unlock(&m_sync_ht); return res; }
false
false
false
false
false
0
clnt_reacquire_lock_error (xlator_t *this, clnt_fd_ctx_t *fdctx, clnt_conf_t *conf) { int32_t ret = -1; GF_VALIDATE_OR_GOTO ("client", this, out); GF_VALIDATE_OR_GOTO (this->name, fdctx, out); GF_VALIDATE_OR_GOTO (this->name, conf, out); clnt_release_reopen_fd (this, fdctx); ret = 0; out: return ret; }
false
false
false
false
false
0
setToken(Trie *trie, int tokenLength, Token token, Priority::Type pri, TokenVector &ambiguities) { if (tokenLength > trie->tokenLength_ || (tokenLength == trie->tokenLength_ && pri > trie->priority_)) { trie->tokenLength_ = tokenLength; trie->token_ = token; trie->priority_ = pri; } else if (trie->tokenLength_ == tokenLength && trie->priority_ == pri && trie->token_ != token && trie->token_ != 0) { ambiguities.push_back(Token(trie->token_)); ambiguities.push_back(token); } if (trie->hasNext()) { for (int i = 0; i < nCodes_; i++) setToken(&trie->next_[i], tokenLength, token, pri, ambiguities); } }
false
false
false
false
false
0
rhash_sha1_process_block(unsigned* hash, const unsigned* block) { int t; /* Loop counter */ uint32_t temp; /* Temporary word value */ uint32_t W[80]; /* Word sequence */ uint32_t A, B, C, D, E; /* Word buffers */ /* initialize the first 16 words in the array W */ for (t = 0; t < 16; t++) { /* note: it is much faster to apply be2me here, then using be32_copy */ W[t] = be2me_32(block[t]); } /* initialize the rest */ for (t = 16; t < 80; t++) { W[t] = ROTL32(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1); } A = hash[0]; B = hash[1]; C = hash[2]; D = hash[3]; E = hash[4]; for (t = 0; t < 20; t++) { /* the following is faster than ((B & C) | ((~B) & D)) */ temp = ROTL32(A, 5) + (((C ^ D) & B) ^ D) + E + W[t] + 0x5A827999; E = D; D = C; C = ROTL32(B, 30); B = A; A = temp; } for (t = 20; t < 40; t++) { temp = ROTL32(A, 5) + (B ^ C ^ D) + E + W[t] + 0x6ED9EBA1; E = D; D = C; C = ROTL32(B, 30); B = A; A = temp; } for (t = 40; t < 60; t++) { temp = ROTL32(A, 5) + ((B & C) | (B & D) | (C & D)) + E + W[t] + 0x8F1BBCDC; E = D; D = C; C = ROTL32(B, 30); B = A; A = temp; } for (t = 60; t < 80; t++) { temp = ROTL32(A, 5) + (B ^ C ^ D) + E + W[t] + 0xCA62C1D6; E = D; D = C; C = ROTL32(B, 30); B = A; A = temp; } hash[0] += A; hash[1] += B; hash[2] += C; hash[3] += D; hash[4] += E; }
false
false
false
false
false
0
open_chfile(void) { char *chfile = envprocess(CHFILE); if ((chfid = open(chfile, O_WRONLY|O_APPEND|O_CREAT, 0644)) < 0) report(1133); /* {Create charge file error} */ free(chfile); if (Daemuid != ROOTID) #if defined(HAVE_FCHOWN) && !defined(M88000) fchown(chfid, Daemuid, getegid()); #else chown(chfile, Daemuid, getegid()); #endif fcntl(chfid, F_SETFD, 1); }
false
false
false
false
false
0
backup_pidmem_free( Backup_pid *bp ) { pthread_mutex_lock( &pid_holder.lock ); if( bp->pids->in_use ) { bp->next = bp->pids->to_free; bp->pids->to_free = bp; pthread_mutex_unlock( &pid_holder.lock ); return; } bp->pids->s[ bp->pids_idx ] = 0; bp->pids->count--; pthread_mutex_unlock( &pid_holder.lock ); bp->next = NULL; pthread_mutex_destroy( &bp->lock ); pthread_cond_destroy( &bp->wait ); entry_free( bp ); }
false
false
false
false
false
0
MV_Mix16BitStereo16Stereo( unsigned int position, unsigned int rate, char *start, unsigned int length ) { unsigned short *source = (unsigned short *) start; short *dest = (short *) MV_MixDestination; int sample0l, sample0h, sample0; int sample1l, sample1h, sample1; while (length--) { sample0 = source[(position >> 16) << 1]; sample1 = source[((position >> 16) << 1) + 1]; #ifdef BIGENDIAN sample0l = sample0 >> 8; sample0h = (sample0 & 255) ^ 128; sample1l = sample1 >> 8; sample1h = (sample1 & 255) ^ 128; #else sample0l = sample0 & 255; sample0h = (sample0 >> 8) ^ 128; sample1l = sample1 & 255; sample1h = (sample1 >> 8) ^ 128; #endif position += rate; sample0l = MV_LeftVolume[sample0l] >> 8; sample0h = MV_LeftVolume[sample0h]; sample1l = MV_RightVolume[sample1l] >> 8; sample1h = MV_RightVolume[sample1h]; sample0 = sample0l + sample0h + 128 + *dest; sample1 = sample1l + sample1h + 128 + *(dest + MV_RightChannelOffset/2); if (sample0 < -32768) sample0 = -32768; else if (sample0 > 32767) sample0 = 32767; if (sample1 < -32768) sample1 = -32768; else if (sample1 > 32767) sample1 = 32767; *dest = (short) sample0; *(dest + MV_RightChannelOffset/2) = (short) sample1; dest += MV_SampleSize / 2; } MV_MixPosition = position; MV_MixDestination = (char *) dest; }
false
false
false
false
false
0
bch_data_invalidate(struct closure *cl) { struct data_insert_op *op = container_of(cl, struct data_insert_op, cl); struct bio *bio = op->bio; pr_debug("invalidating %i sectors from %llu", bio_sectors(bio), (uint64_t) bio->bi_iter.bi_sector); while (bio_sectors(bio)) { unsigned sectors = min(bio_sectors(bio), 1U << (KEY_SIZE_BITS - 1)); if (bch_keylist_realloc(&op->insert_keys, 2, op->c)) goto out; bio->bi_iter.bi_sector += sectors; bio->bi_iter.bi_size -= sectors << 9; bch_keylist_add(&op->insert_keys, &KEY(op->inode, bio->bi_iter.bi_sector, sectors)); } op->insert_data_done = true; bio_put(bio); out: continue_at(cl, bch_data_insert_keys, op->wq); }
false
false
false
false
false
0
undo_move(MOVE *m) { #if PRINT if ( m->totype == O_Type ) fprintf( stderr, "\nundo move %d from %d out (at %d)\n\n", m->card_index, m->from, m->turn_index ); else fprintf( stderr, "\nundo move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); print_layout(); #endif int from, to; card_t card; from = m->from; to = m->to; if ( from == 4 ) { for ( int i = 3; i >= 0; --i ) { card = *Wp[i]; Wp[i]--; Wlen[i]--; Wp[from]++; *Wp[from] = ( SUIT( card ) << 4 ) + RANK( card ) + ( 1 << 7 ); Wlen[from]++; hashpile( i ); } hashpile( from ); } else { card = *Wp[to]; Wp[to]--; Wlen[to]--; Wp[from]++; *Wp[from] = card; Wlen[from]++; hashpile( to ); hashpile(from); } #if PRINT print_layout(); #endif }
false
false
false
false
false
0
e_printable_print_page (EPrintable *e_printable, GtkPrintContext *context, gdouble width, gdouble height, gboolean quantized) { g_return_if_fail (E_IS_PRINTABLE (e_printable)); g_signal_emit ( e_printable, e_printable_signals[PRINT_PAGE], 0, context, width, height, quantized); }
false
false
false
false
false
0
CrossLinkService( ServiceDescriptor* service, const ServiceDescriptorProto& proto) { if (service->options_ == NULL) { service->options_ = &ServiceOptions::default_instance(); } for (int i = 0; i < service->method_count(); i++) { CrossLinkMethod(&service->methods_[i], proto.method(i)); } }
false
false
false
false
false
0
ut_find_eol (char * eol_name) { ASSERT (eol_name) UtEolType j; for (j= UT_EOL_CR; j<UT_EOL_NONE; j++) if ( UT_EOL_NAME[j] && ut_str_fuzzy_cmp (eol_name, UT_EOL_NAME[j], 0) ) break; if (j==UT_EOL_NONE) return UT_EOL_UNSET; else return j; }
false
false
false
false
false
0
scld_dock_exrom_from_snapshot( memory_page *dest, int page_num, int writable, void *source ) { int i; libspectrum_byte *data = memory_pool_allocate( 0x2000 ); memcpy( data, source, 0x2000 ); for( i = 0; i < MEMORY_PAGES_IN_8K; i++ ) { memory_page *page = &dest[ page_num * MEMORY_PAGES_IN_8K + i ]; page->offset = i * MEMORY_PAGE_SIZE; page->page_num = page_num; page->writable = writable; page->page = data + page->offset; page->save_to_snapshot = 1; } }
false
true
false
false
false
1
pCurrentGroup(int p_group_num) { _ParticleState &_ps = _GetPState(); if(_ps.in_new_list) return; // ERROR _ps.pgrp = _ps.GetGroupPtr(p_group_num); if(_ps.pgrp) _ps.group_id = p_group_num; else _ps.group_id = -1; }
false
false
false
false
false
0
pixCountConnComp(PIX *pixs, l_int32 connectivity, l_int32 *pcount) { l_int32 h, iszero; l_int32 x, y, xstart, ystart; PIX *pixt; PSTACK *pstack, *auxstack; PROCNAME("pixCountConnComp"); if (!pcount) return ERROR_INT("&count not defined", procName, 1); *pcount = 0; /* initialize the count to 0 */ if (!pixs || pixGetDepth(pixs) != 1) return ERROR_INT("pixs not defined or not 1 bpp", procName, 1); if (connectivity != 4 && connectivity != 8) return ERROR_INT("connectivity not 4 or 8", procName, 1); pixZero(pixs, &iszero); if (iszero) return 0; if ((pixt = pixCopy(NULL, pixs)) == NULL) return ERROR_INT("pixt not made", procName, 1); h = pixGetDepth(pixs); if ((pstack = pstackCreate(h)) == NULL) return ERROR_INT("pstack not made", procName, 1); if ((auxstack = pstackCreate(0)) == NULL) return ERROR_INT("auxstack not made", procName, 1); pstack->auxstack = auxstack; xstart = 0; ystart = 0; while (1) { if (!nextOnPixelInRaster(pixt, xstart, ystart, &x, &y)) break; pixSeedfill(pixt, pstack, x, y, connectivity); (*pcount)++; xstart = x; ystart = y; } /* Cleanup, freeing the fillsegs on each stack */ pstackDestroy(&pstack, TRUE); pixDestroy(&pixt); return 0; }
false
false
false
false
true
1
embDmxScophitToHit(EmbPHit *to, const AjPScophit from) { if(!from) { ajWarn("NULL arg passed to embDmxScophitToHit"); return ajFalse; } if(!(*to)) *to = embHitNew(); ajStrAssignS(&(*to)->Seq, from->Seq); (*to)->Start = from->Start; (*to)->End = from->End; ajStrAssignS(&(*to)->Acc, from->Acc); ajStrAssignS(&(*to)->Spr, from->Spr); ajStrAssignS(&(*to)->Dom, from->Dom); ajStrAssignS(&(*to)->Typeobj, from->Typeobj); ajStrAssignS(&(*to)->Typesbj, from->Typesbj); ajStrAssignS(&(*to)->Model, from->Model); ajStrAssignS(&(*to)->Alg, from->Alg); ajStrAssignS(&(*to)->Group, from->Group); (*to)->Rank = from->Rank; (*to)->Score = from->Score; (*to)->Eval = from->Eval; (*to)->Pval = from->Pval; (*to)->Target = from->Target; (*to)->Target2 = from->Target2; (*to)->Priority = from->Priority; return ajTrue; }
false
false
false
false
false
0
H5S_hyper_reset_scratch(H5S_t *space) { FUNC_ENTER_NOAPI_NOINIT_NOERR HDassert(space); /* Check if there are spans in the span tree */ if(space->select.sel_info.hslab->span_lst != NULL) /* Reset the scratch pointers for the next routine which needs them */ H5S_hyper_span_scratch(space->select.sel_info.hslab->span_lst, NULL); FUNC_LEAVE_NOAPI(SUCCEED) }
false
false
false
false
false
0
getOverflowComparisonString(const UnicodeString &lowerLimit, UErrorCode &/*status*/) { for (int32_t i=0; i<firstScriptCharacters_->size(); i++) { const UnicodeString *s = static_cast<const UnicodeString *>(firstScriptCharacters_->elementAt(i)); if (collator_->compare(*s, lowerLimit) > 0) { return *s; } } return *EMPTY_STRING; }
false
false
false
false
false
0
trsp_selected_cb (GtkComboBox *box, gpointer data) { GtkRigCtrl *ctrl = GTK_RIG_CTRL (data); gint i, n; i = gtk_combo_box_get_active (box); n = g_slist_length (ctrl->trsplist); if (i == -1) { /* clear transponder data */ ctrl->trsp = NULL; } else if (i < n) { ctrl->trsp = (trsp_t *) g_slist_nth_data (ctrl->trsplist, i); } else { sat_log_log (SAT_LOG_LEVEL_BUG, _("%s: Inconsistency detected in internal transponder data (%d,%d)"), __FUNCTION__, i, n); } }
false
false
false
false
false
0
kook_ASSURE_asm(CTX ctx, kStmtExpr *stmt) { kStmtExpr *stmt0 = stmtNN(stmt, 0); kStmtExpr *stmt1 = stmtNN(stmt, 1); CALL(ctx, COMPILER_API.ASSURE, 3, stmt, stmt0, stmt1); }
false
false
false
false
false
0
getAdrLabelOpValue(const MCInst &MI, unsigned OpIdx, SmallVectorImpl<MCFixup> &Fixups) const { const MCOperand MO = MI.getOperand(OpIdx); if (MO.isExpr()) return ::getBranchTargetOpValue(MI, OpIdx, ARM::fixup_arm_adr_pcrel_12, Fixups); int32_t offset = MO.getImm(); uint32_t Val = 0x2000; if (offset < 0) { Val = 0x1000; offset *= -1; } Val |= offset; return Val; }
false
false
false
false
false
0
DecodeMem(MCInst &MI, unsigned insn, uint64_t Address, const void *Decoder, bool isLoad, DecodeFunc DecodeRD) { unsigned rd = fieldFromInstruction(insn, 25, 5); unsigned rs1 = fieldFromInstruction(insn, 14, 5); bool isImm = fieldFromInstruction(insn, 13, 1); bool hasAsi = fieldFromInstruction(insn, 23, 1); // (in op3 field) unsigned asi = fieldFromInstruction(insn, 5, 8); unsigned rs2 = 0; unsigned simm13 = 0; if (isImm) simm13 = SignExtend32<13>(fieldFromInstruction(insn, 0, 13)); else rs2 = fieldFromInstruction(insn, 0, 5); DecodeStatus status; if (isLoad) { status = DecodeRD(MI, rd, Address, Decoder); if (status != MCDisassembler::Success) return status; } // Decode rs1. status = DecodeIntRegsRegisterClass(MI, rs1, Address, Decoder); if (status != MCDisassembler::Success) return status; // Decode imm|rs2. if (isImm) MI.addOperand(MCOperand::createImm(simm13)); else { status = DecodeIntRegsRegisterClass(MI, rs2, Address, Decoder); if (status != MCDisassembler::Success) return status; } if (hasAsi) MI.addOperand(MCOperand::createImm(asi)); if (!isLoad) { status = DecodeRD(MI, rd, Address, Decoder); if (status != MCDisassembler::Success) return status; } return MCDisassembler::Success; }
false
false
false
false
false
0
PrintSelf(std::ostream & os, Indent indent) const { os << indent << "Dimension: " << m_Dimension << std::endl; os << indent << "Degree: " << m_Degree << std::endl; os << indent << "DomainSize: "; for ( unsigned int i = 0; i < m_DomainSize.size(); ++i ) { os << m_DomainSize[i] << " "; } os << std::endl; os << indent << "Cached X coefficients: "; for ( unsigned int i = 0; i < m_CachedXCoef.size(); ++i ) { os << m_CachedXCoef[i] << " "; } os << std::endl; os << indent << "Cached Y coefficients: "; for ( unsigned int i = 0; i < m_CachedYCoef.size(); ++i ) { os << m_CachedYCoef[i] << " "; } os << std::endl; os << indent << "Cached Z coefficients: "; for ( unsigned int i = 0; i < m_CachedZCoef.size(); ++i ) { os << m_CachedZCoef[i] << " "; } os << std::endl; os << indent << "Coefficients: "; for ( unsigned int i = 0; i < m_CoefficientArray.size(); ++i ) { os << m_CoefficientArray[i] << " "; } os << std::endl; os << indent << "Normalization factors: "; for ( unsigned int i = 0; i < m_NormFactor.size(); ++i ) { os << m_NormFactor[i] << " "; } os << std::endl; os << indent << "Previous Y index: " << m_PrevY << std::endl; os << indent << "Previous Z index: " << m_PrevZ << std::endl; }
false
false
false
false
false
0
skl_tplg_alloc_pipe_widget(struct device *dev, struct snd_soc_dapm_widget *w, struct skl_pipe *pipe) { struct skl_module_cfg *src_module = NULL; struct snd_soc_dapm_path *p = NULL; struct skl_pipe_module *p_module = NULL; p_module = devm_kzalloc(dev, sizeof(*p_module), GFP_KERNEL); if (!p_module) return -ENOMEM; p_module->w = w; list_add_tail(&p_module->node, &pipe->w_list); snd_soc_dapm_widget_for_each_sink_path(w, p) { if ((p->sink->priv == NULL) && (!is_skl_dsp_widget_type(w))) continue; if ((p->sink->priv != NULL) && p->connect && is_skl_dsp_widget_type(p->sink)) { src_module = p->sink->priv; if (pipe->ppl_id == src_module->pipe->ppl_id) skl_tplg_alloc_pipe_widget(dev, p->sink, pipe); } } return 0; }
false
false
false
false
false
0
partons(tcPDPtr particle) const { assert(thePDF); return thePDF->partons(particle); }
false
false
false
false
false
0
zone_show(struct device *dev, struct device_attribute *attr, char *buf) { struct platform_zone *target_zone; target_zone = match_zone(attr); if (target_zone == NULL) return sprintf(buf, "red: -1, green: -1, blue: -1\n"); return sprintf(buf, "red: %d, green: %d, blue: %d\n", target_zone->colors.red, target_zone->colors.green, target_zone->colors.blue); }
false
false
false
false
false
0
define_attr_by_hp(HSCPRC * hp, STRPTR default_value, ULONG unmasked_flags) { HSCATTR *attr = define_var(hp, hp->defattr, 0); if (attr) { /* set scope for local attribute */ attr->macro_id = ((attr->varflag & VF_GLOBAL) ? MCI_GLOBAL : get_current_mci(hp)); /* see "attrib.h" why this */ attr->varflag |= VF_MACRO; /* set new value (copy from default) if passed */ if (get_vardeftext(attr)) { if (default_value) panic("default value already set"); else clr_vartext(attr); } /* set default value passed in function args */ if (default_value) set_vartext(attr, default_value); /* remove default value */ clr_attrdef(attr); } return (attr); }
false
false
false
false
false
0
isValid() const { /* ConceptNameCodeSequence not allowed */ return DSRDocumentTreeNode::isValid() && getConceptName().isEmpty() && ValidReference; }
false
false
false
false
false
0
set_buttons(void* data) { SocketListDialog* instance_p = static_cast<SocketListDialog*>(data); // see if anything is selected GtkTreeSelection* selection_p = gtk_tree_view_get_selection(instance_p->tree_view_p); if (gtk_tree_selection_get_selected(selection_p, 0, 0)) { gtk_widget_set_sensitive(instance_p->view_button_p, true); gtk_widget_set_sensitive(instance_p->remove_button_p, true); gtk_widget_set_sensitive(instance_p->send_button_p, true); gtk_button_set_relief(GTK_BUTTON(instance_p->view_button_p), GTK_RELIEF_NORMAL); gtk_button_set_relief(GTK_BUTTON(instance_p->remove_button_p), GTK_RELIEF_NORMAL); gtk_button_set_relief(GTK_BUTTON(instance_p->send_button_p), GTK_RELIEF_NORMAL); } else { gtk_widget_set_sensitive(instance_p->view_button_p, false); gtk_widget_set_sensitive(instance_p->remove_button_p, false); gtk_widget_set_sensitive(instance_p->send_button_p, false); gtk_button_set_relief(GTK_BUTTON(instance_p->view_button_p), GTK_RELIEF_NONE); gtk_button_set_relief(GTK_BUTTON(instance_p->remove_button_p), GTK_RELIEF_NONE); gtk_button_set_relief(GTK_BUTTON(instance_p->send_button_p), GTK_RELIEF_NONE); } }
false
false
false
false
false
0
parseTime(const std::string& ts, long& time) { std::string hstr, mstr, sstr; char *cts = new char[ts.length() + 1]; strcpy(cts, ts.c_str()); char *tmp = ::strtok(cts, ":"); if (tmp) hstr = tmp; tmp = ::strtok(0, ":"); if (tmp) mstr = tmp; tmp = ::strtok(0, ":"); if (tmp) sstr = tmp; delete[] cts; int sign = 1; long hh(0), mm(0), ss(0); // [-]HH part if (!Util::strtol(hstr.c_str(), hh)) return false; if (hh < 0) { sign = -1; hh *= -1; } // check for the -0 special case if (hh == 0 && hstr.find('-') != std::string::npos) sign = -1; // MM part, if there is one if (mstr != "") { if (!Util::strtol(mstr.c_str(), mm)) return false; if (mm > 59) return false; if (mm < 0) return false; } // SS part, if there is one if (sstr != "") { if (!Util::strtol(sstr.c_str(), ss)) return false; if (ss > 59) return false; if (ss < 0) return false; } time = sign * (hh * 3600 + mm * 60 + ss); return true; }
false
false
false
false
false
0
command_setlights(struct gspca_dev *gspca_dev) { struct sd *sd = (struct sd *) gspca_dev; int ret, p1, p2; p1 = (sd->params.qx3.bottomlight == 0) << 1; p2 = (sd->params.qx3.toplight == 0) << 3; ret = do_command(gspca_dev, CPIA_COMMAND_WriteVCReg, 0x90, 0x8f, 0x50, 0); if (ret) return ret; return do_command(gspca_dev, CPIA_COMMAND_WriteMCPort, 2, 0, p1 | p2 | 0xe0, 0); }
false
false
false
false
false
0
get_unaligned(size_t size, void *buffer, ErrorHandler *errh) { // we may need to read bits of the file if (_pos + size <= _len) { const uint8_t *chunk = _buffer + _pos; _pos += size; return reinterpret_cast<const uint8_t *>(chunk); } else if (read(buffer, size, errh) == (int)size) return reinterpret_cast<uint8_t *>(buffer); else return 0; }
false
false
false
false
false
0
bigauss_derivative(const double x[], const double a[], double result[]) { errno = 0; if (a[5] != 0.0 && a[6] != 0.0 && 1.0 - a[2] * a[2] >= 0.0) { const double b1 = 1 / (1 - a[2] * a[2]); const double b2 = (x[0] - a[3]) / a[5]; const double b3 = (x[1] - a[4]) / a[6]; const double b0 = b2 * b2 - 2 * a[2] * b2 * b3 + b3 * b3; const double b4 = exp(-0.5 * b1 * b0); const double b5 = sqrt(1.0 - a[2] * a[2]); const double b6 = CPL_MATH_PI * a[5] * a[6] * b5; const double b7 = 0.5 * a[1] * b4 / b6; result[0] = 1.0; result[1] = 0.5 * b4 / b6; result[2] = b7 * b1 * ((b2 * b3 - a[2] * b0 * b1) + a[2]); result[3] = b7 / a[5] * b1 * (b2 - a[2] * b3); result[4] = b7 / a[6] * b1 * (b3 - a[2] * b2); result[5] =-b7 / a[5] * (b1 * b2 * (a[2] * b3 - b2) + 1); result[6] =-b7 / a[6] * (b1 * b3 * (a[2] * b2 - b3) + 1); if (errno) { result[0] = result[1] = result[2] = result[3] = result[4] = result[5] = result[6] = 0.0; } } else { result[0] = result[1] = result[2] = result[3] = result[4] = result[5] = result[6] = 0.0; } return 0; }
false
false
false
false
false
0
getQuaternaries(uint32_t variableTop, uint32_t pair) { // Return the primary weight of a variable CE, // or the maximum primary weight for a non-variable, not-completely-ignorable CE. if(pair <= 0xffff) { // one mini CE if(pair >= MIN_SHORT) { // A high secondary weight means we really have two CEs, // a primary CE and a secondary CE. if((pair & SECONDARY_MASK) >= MIN_SEC_HIGH) { pair = TWO_SHORT_PRIMARIES_MASK; } else { pair = SHORT_PRIMARY_MASK; } } else if(pair > variableTop) { pair = SHORT_PRIMARY_MASK; } else if(pair >= MIN_LONG) { pair &= LONG_PRIMARY_MASK; // variable } // else special mini CE } else { // two mini CEs, same primary groups, neither expands like above uint32_t ce = pair & 0xffff; if(ce > variableTop) { pair = TWO_SHORT_PRIMARIES_MASK; } else { U_ASSERT(ce >= MIN_LONG); pair &= TWO_LONG_PRIMARIES_MASK; // variable } } return pair; }
false
false
false
false
false
0
cpl_table_duplicate_column(cpl_table *to_table, const char *to_name, const cpl_table *from_table, const char *from_name) { cpl_column *column; if (to_table == 0x0 || from_table == 0x0 || to_name == 0x0 || from_name == 0x0) return cpl_error_set_(CPL_ERROR_NULL_INPUT); if (to_table->nr != from_table->nr) return cpl_error_set_(CPL_ERROR_INCOMPATIBLE_INPUT); if (cpl_table_find_column(to_table, to_name)) return cpl_error_set_(CPL_ERROR_ILLEGAL_OUTPUT); column = cpl_table_find_column(from_table, from_name); if (!column) return cpl_error_set_(CPL_ERROR_DATA_NOT_FOUND); column = cpl_column_duplicate(column); cpl_column_set_name(column, to_name); cpl_table_append_column(to_table, column); return CPL_ERROR_NONE; }
false
false
false
false
false
0
Pickler_dealloc(PicklerObject *self) { PyObject_GC_UnTrack(self); Py_XDECREF(self->output_buffer); Py_XDECREF(self->write); Py_XDECREF(self->pers_func); Py_XDECREF(self->dispatch_table); Py_XDECREF(self->fast_memo); PyMemoTable_Del(self->memo); Py_TYPE(self)->tp_free((PyObject *)self); }
false
false
false
false
false
0
copy_array_region_list(Array_region_list *source) { Array_region_list *dest; if(source == NULL) return NULL; dest = alloc_array_region_list(); dest->dim_head = copy_array_range(source->dim_head); dest->next = copy_array_region_list(source->next); return dest; }
false
false
false
false
false
0