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
create_simple_permissions (NautilusPropertiesWindow *window, GtkGrid *page_grid) { gboolean has_directory; gboolean has_file; GtkLabel *group_label; GtkLabel *owner_label; GtkWidget *value; GtkComboBox *group_combo_box; GtkComboBox *owner_combo_box; has_directory = files_has_directory (window); has_file = files_has_file (window); if (!is_multi_file_window (window) && nautilus_file_can_set_owner (get_target_file (window))) { owner_label = attach_title_field (page_grid, _("_Owner:")); /* Combo box in this case. */ owner_combo_box = attach_owner_combo_box (page_grid, GTK_WIDGET (owner_label), get_target_file (window)); gtk_label_set_mnemonic_widget (owner_label, GTK_WIDGET (owner_combo_box)); } else { owner_label = attach_title_field (page_grid, _("Owner:")); /* Static text in this case. */ value = attach_value_field (window, page_grid, GTK_WIDGET (owner_label), "owner", INCONSISTENT_STATE_STRING, FALSE); gtk_label_set_mnemonic_widget (owner_label, value); } if (has_directory && has_file) { add_permissions_combo_box (window, page_grid, PERMISSION_USER, TRUE, FALSE); add_permissions_combo_box (window, page_grid, PERMISSION_USER, FALSE, FALSE); } else { add_permissions_combo_box (window, page_grid, PERMISSION_USER, has_directory, TRUE); } append_blank_slim_row (page_grid); if (!is_multi_file_window (window) && nautilus_file_can_set_group (get_target_file (window))) { group_label = attach_title_field (page_grid, _("_Group:")); /* Combo box in this case. */ group_combo_box = attach_group_combo_box (page_grid, GTK_WIDGET (group_label), get_target_file (window)); gtk_label_set_mnemonic_widget (group_label, GTK_WIDGET (group_combo_box)); } else { group_label = attach_title_field (page_grid, _("Group:")); /* Static text in this case. */ value = attach_value_field (window, page_grid, GTK_WIDGET (group_label), "group", INCONSISTENT_STATE_STRING, FALSE); gtk_label_set_mnemonic_widget (group_label, value); } if (has_directory && has_file) { add_permissions_combo_box (window, page_grid, PERMISSION_GROUP, TRUE, FALSE); add_permissions_combo_box (window, page_grid, PERMISSION_GROUP, FALSE, FALSE); } else { add_permissions_combo_box (window, page_grid, PERMISSION_GROUP, has_directory, TRUE); } append_blank_slim_row (page_grid); attach_title_field (page_grid, _("Others")); if (has_directory && has_file) { add_permissions_combo_box (window, page_grid, PERMISSION_OTHER, TRUE, FALSE); add_permissions_combo_box (window, page_grid, PERMISSION_OTHER, FALSE, FALSE); } else { add_permissions_combo_box (window, page_grid, PERMISSION_OTHER, has_directory, TRUE); } if (!has_directory) { GtkLabel *execute_label; append_blank_slim_row (page_grid); execute_label = attach_title_field (page_grid, _("Execute:")); add_execute_checkbox_with_label (window, page_grid, GTK_WIDGET (execute_label), _("Allow _executing file as program"), UNIX_PERM_USER_EXEC|UNIX_PERM_GROUP_EXEC|UNIX_PERM_OTHER_EXEC, execute_label, FALSE); } }
false
false
false
false
false
0
selectedAux() { QList<QGraphicsItem*> selItems = scene()->selectedItems(); if(selItems.size() != 1) { return NULL; } else { return selItems[0]; } }
false
false
false
false
false
0
decode_range (unsigned range_state, unsigned range_label, unsigned range_level, word_t **domain, wfa_t *wfa) /* * Compute 'wfa' image of range (identified by 'state' and 'label') * at 'range_level (works as function decode_image()). * * Return value: * pointer to the pixels in SHORT format * * Side effects: * if 'domain' != NULL then also the domain blocks * of the corresponding range blocks are generated * and returned in domain[] * 'wfa->level_of_state []' is changed */ { unsigned root_state [3]; /* dummy (for alloc_state_images) */ image_t *state_image; /* regenerated state image */ word_t **images; /* pointer to array of pointers to state images */ u_word_t *offsets; /* pointer to array of state image offsets */ word_t *range; enlarge_image (range_level - (wfa->level_of_state [range_state] - 1), FORMAT_4_4_4, -1, wfa); root_state [0] = range_state; state_image = alloc_image (width_of_level (range_level + 1), height_of_level (range_level + 1), NO, FORMAT_4_4_4); alloc_state_images (&images, &offsets, state_image, NULL, range_state, range_level + 1, NO, wfa); compute_state_images (range_level + 1, images, offsets, wfa); range = fiasco_calloc (size_of_level (range_level), sizeof (word_t)); if ((range_level & 1) == 0) /* square image */ { memcpy (range, images [range_state + (range_level + 1) * wfa->states] + range_label * size_of_level (range_level), size_of_level (range_level) * sizeof (word_t)); } else /* rectangle */ { word_t *src, *dst; unsigned y; src = images [range_state + (range_level + 1) * wfa->states] + range_label * width_of_level (range_level); dst = range; for (y = height_of_level (range_level); y; y--) { memcpy (dst, src, width_of_level (range_level) * sizeof (word_t)); dst += width_of_level (range_level); src += width_of_level (range_level + 1); } } if (domain != NULL) /* copy domain images */ { int s; /* domain state */ unsigned edge; /* counter */ if (ischild (s = wfa->tree [range_state][range_label])) *domain++ = duplicate_state_image (images [s + (range_level) * wfa->states], offsets [s + (range_level) * wfa->states], range_level); for (edge = 0; isedge (s = wfa->into[range_state][range_label][edge]); edge++) *domain++ = duplicate_state_image (images [s + (range_level) * wfa->states], offsets [s + (range_level) * wfa->states], range_level); *domain = NULL; } free_state_images (range_level + 1, NO, images, offsets, NULL, range_state, NO, wfa); free_image (state_image); return range; }
false
false
false
false
true
1
get_block() { FLAC__ASSERT(is_valid()); Prototype *block = local::construct_block(::FLAC__metadata_iterator_get_block(iterator_)); if(0 != block) block->set_reference(true); return block; }
false
false
false
false
false
0
__ecereMethod___ecereNameSpace__ecere__sys__BufferedFile_Seek(struct __ecereNameSpace__ecere__com__Instance * this, int pos, int mode) { struct __ecereNameSpace__ecere__sys__BufferedFile * __ecerePointer___ecereNameSpace__ecere__sys__BufferedFile = (struct __ecereNameSpace__ecere__sys__BufferedFile *)(this ? (((char *)this) + 20) : 0); unsigned int newPosition = __ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->pos; switch(mode) { case 0: newPosition = pos; break; case 1: newPosition += pos; break; case 2: { newPosition = __ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->fileSize + pos; break; } } if(__ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->pos != newPosition) { if(newPosition >= __ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->pos - __ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->bufferPos && newPosition < __ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->pos + __ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->bufferSize) { if(newPosition < __ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->pos - __ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->bufferPos + __ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->bufferCount) __ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->bufferPos += newPosition - __ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->pos; else { unsigned int read = newPosition - __ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->pos - __ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->bufferCount; if(read < __ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->bufferCount * 2) { if(read > __ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->bufferSize) { __ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->bufferCount = 0; __ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->bufferPos = 0; } else { ((unsigned int (*)(struct __ecereNameSpace__ecere__com__Instance *, int pos, int mode))__ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->handle->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Seek])(__ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->handle, __ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->pos - __ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->bufferPos + __ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->bufferCount, 0); read = ((int (*)(struct __ecereNameSpace__ecere__com__Instance *, void * buffer, unsigned int size, unsigned int count))__ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->handle->_vTbl[__ecereVMethodID___ecereNameSpace__ecere__sys__File_Read])(__ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->handle, __ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->buffer + __ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->bufferCount, 1, read); __ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->bufferPos += newPosition - __ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->pos; __ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->bufferCount += read; } } else { __ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->bufferCount = 0; __ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->bufferPos = 0; } } } else { __ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->bufferCount = 0; __ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->bufferPos = 0; } __ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->eof = newPosition > __ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->fileSize; __ecerePointer___ecereNameSpace__ecere__sys__BufferedFile->pos = newPosition; } return 0x1; }
false
true
false
true
true
1
cards_hand_get_area(CardsHand *hand, GtkWidget *widget, CardsImage *image, gint *x, gint *y, gint *width, gint *height, gboolean with_selected) { gint offset_x = 0; gint offset_y = 0; if (hand->direction == NORTH || hand->direction == SOUTH) { offset_x = image->width / 4; if (with_selected) offset_y = image->height / 4; *width = (g_list_length(hand->list) * offset_x) + (image->width - offset_x); *height = image->height + offset_y; *x = (widget->allocation.width - *width) / 2; if (hand->direction == NORTH) *y = 10; else *y = widget->allocation.height - *height - 10; } else { offset_y = image->height / 4; if (with_selected) offset_x = image->width / 4; *height = (g_list_length(hand->list) * offset_y) + (image->height - offset_y); *width = image->width + offset_x; *y = (widget->allocation.height - *height) / 2; if (hand->direction == WEST) *x = 10; else { *x = widget->allocation.width - *width - 10; } } }
false
false
false
false
false
0
MemHashGrowTable(mem_hash_kv_engine *pEngine) { sxu32 nNewSize = pEngine->nBucket << 1; mem_hash_record *pEntry; mem_hash_record **apNew; sxu32 n,iBucket; /* Allocate a new larger table */ apNew = (mem_hash_record **)SyMemBackendAlloc(&pEngine->sAlloc, nNewSize * sizeof(mem_hash_record *)); if( apNew == 0 ){ /* Not so fatal, simply a performance hit */ return UNQLITE_OK; } /* Zero the new table */ SyZero((void *)apNew, nNewSize * sizeof(mem_hash_record *)); /* Rehash all entries */ n = 0; pEntry = pEngine->pLast; for(;;){ /* Loop one */ if( n >= pEngine->nRecord ){ break; } pEntry->pNextHash = pEntry->pPrevHash = 0; /* Install in the new bucket */ iBucket = pEntry->nHash & (nNewSize - 1); pEntry->pNextHash = apNew[iBucket]; if( apNew[iBucket] ){ apNew[iBucket]->pPrevHash = pEntry; } apNew[iBucket] = pEntry; /* Point to the next entry */ pEntry = pEntry->pNext; n++; /* Loop two */ if( n >= pEngine->nRecord ){ break; } pEntry->pNextHash = pEntry->pPrevHash = 0; /* Install in the new bucket */ iBucket = pEntry->nHash & (nNewSize - 1); pEntry->pNextHash = apNew[iBucket]; if( apNew[iBucket] ){ apNew[iBucket]->pPrevHash = pEntry; } apNew[iBucket] = pEntry; /* Point to the next entry */ pEntry = pEntry->pNext; n++; /* Loop three */ if( n >= pEngine->nRecord ){ break; } pEntry->pNextHash = pEntry->pPrevHash = 0; /* Install in the new bucket */ iBucket = pEntry->nHash & (nNewSize - 1); pEntry->pNextHash = apNew[iBucket]; if( apNew[iBucket] ){ apNew[iBucket]->pPrevHash = pEntry; } apNew[iBucket] = pEntry; /* Point to the next entry */ pEntry = pEntry->pNext; n++; /* Loop four */ if( n >= pEngine->nRecord ){ break; } pEntry->pNextHash = pEntry->pPrevHash = 0; /* Install in the new bucket */ iBucket = pEntry->nHash & (nNewSize - 1); pEntry->pNextHash = apNew[iBucket]; if( apNew[iBucket] ){ apNew[iBucket]->pPrevHash = pEntry; } apNew[iBucket] = pEntry; /* Point to the next entry */ pEntry = pEntry->pNext; n++; } /* Release the old table and reflect the change */ SyMemBackendFree(&pEngine->sAlloc,(void *)pEngine->apBucket); pEngine->apBucket = apNew; pEngine->nBucket = nNewSize; return UNQLITE_OK; }
false
false
false
false
false
0
upper_layer_checksum_ipv6(uint8_t *data, uint8_t proto) { uint16_t upper_layer_len; uint16_t sum; struct ip6_hdr *ipv6_hdr; uint8_t *upper_layer; uint32_t val; ipv6_hdr = (struct ip6_hdr *)data; upper_layer_len = ntohs(ipv6_hdr->ip6_plen); /* First sum pseudoheader. */ sum = 0; sum = chksum(sum, (const u8_t *)ipv6_hdr->ip6_src.s6_addr, sizeof(ipv6_hdr->ip6_src)); sum = chksum(sum, (const u8_t *)ipv6_hdr->ip6_dst.s6_addr, sizeof(ipv6_hdr->ip6_dst)); val = htons(upper_layer_len); sum = chksum(sum, (u8_t *)&val, sizeof(val)); val = htons(proto); sum = chksum(sum, (u8_t *)&val, sizeof(val)); upper_layer = (uint8_t *)(ipv6_hdr + 1); sum = chksum(sum, upper_layer, upper_layer_len); return (sum == 0) ? 0xffff : htons(sum); }
false
false
false
false
false
0
skipFreeList(skipList list) { skipFlushDeleted(list, TRUE); /* flush deleted items */ skipFreeAllItems(list); /* free list items */ if(list->threaded) { cDestroy(&list->flush); cDestroy(&list->resume); mDestroy(&list->write); mDestroy(&list->read); } free(list->tail); /* free list */ free(list->header); free(list->deleted); free(list); return; }
false
false
false
false
false
0
ReadAlignedBytesSafeAlloc( char ** outByteArray, unsigned int &inputLength, const unsigned int maxBytesToRead ) { rakFree_Ex(*outByteArray, _FILE_AND_LINE_ ); *outByteArray=0; if (ReadCompressed(inputLength)==false) return false; if (inputLength > maxBytesToRead) inputLength=maxBytesToRead; if (inputLength==0) return true; *outByteArray = (char*) rakMalloc_Ex( (size_t) inputLength, _FILE_AND_LINE_ ); return ReadAlignedBytes((unsigned char*) *outByteArray, inputLength); }
false
false
false
false
false
0
isValid(){ bool retorno = false; if (_a > 0 || _b > 0 || _c > 0 || _d > 0){ retorno = true; } return retorno; }
false
false
false
false
false
0
camel_folder_get_quota_info_finish (CamelFolder *folder, GAsyncResult *result, GError **error) { CamelFolderClass *class; g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL); class = CAMEL_FOLDER_GET_CLASS (folder); g_return_val_if_fail (class->get_quota_info_finish != NULL, NULL); return class->get_quota_info_finish (folder, result, error); }
false
false
false
true
false
1
hostap_init_ap_proc(local_info_t *local) { struct ap_data *ap = local->ap; ap->proc = local->proc; if (ap->proc == NULL) return; #ifndef PRISM2_NO_PROCFS_DEBUG proc_create_data("ap_debug", 0, ap->proc, &ap_debug_proc_fops, ap); #endif /* PRISM2_NO_PROCFS_DEBUG */ #ifndef PRISM2_NO_KERNEL_IEEE80211_MGMT proc_create_data("ap_control", 0, ap->proc, &ap_control_proc_fops, ap); proc_create_data("ap", 0, ap->proc, &prism2_ap_proc_fops, ap); #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ }
false
false
false
false
false
0
partitionMemory(struct IndexEntry *sortBuffer, int64_t lowerIdx, int64_t upperIdx) { int64_t pivotIndex = lowerIdx + (upperIdx-lowerIdx)/2; /* TODO: Median method. But: This is good enough since the data is either sorted or randomly distributed. */ struct IndexEntry pivotValue = sortBuffer[pivotIndex]; sortBuffer[pivotIndex] = sortBuffer[upperIdx]; sortBuffer[upperIdx] = pivotValue; int64_t storeIndex = lowerIdx; int64_t i; struct IndexEntry tmp; for(i = lowerIdx; i < upperIdx; i++) { if(hashcmp(sortBuffer[i].hash, pivotValue.hash) < 0) { tmp = sortBuffer[i]; sortBuffer[i] = sortBuffer[storeIndex]; sortBuffer[storeIndex] = tmp; storeIndex++; } } tmp = sortBuffer[storeIndex]; sortBuffer[storeIndex] = pivotValue; sortBuffer[upperIdx] = tmp; return storeIndex; }
false
false
false
false
false
0
optInfoEndElem (void *userData, const XML_Char *name) { struct OptInfoData *data = (struct OptInfoData *)userData; enum OptInfoElem elem = bsearchStr (name, OptInfoElems, OI_COUNT); switch (elem) { case OI_DRIINFO: data->inDriInfo = GL_FALSE; break; case OI_SECTION: data->inSection = GL_FALSE; break; case OI_DESCRIPTION: data->inDesc = GL_FALSE; break; case OI_OPTION: data->inOption = GL_FALSE; break; case OI_ENUM: data->inEnum = GL_FALSE; break; default: assert (0); /* should have been caught by StartElem */ } }
false
false
false
false
false
0
pvr2_wm8775_subdev_update(struct pvr2_hdw *hdw, struct v4l2_subdev *sd) { if (hdw->input_dirty || hdw->force_dirty) { u32 input; switch (hdw->input_val) { case PVR2_CVAL_INPUT_RADIO: input = 1; break; default: /* All other cases just use the second input */ input = 2; break; } pvr2_trace(PVR2_TRACE_CHIPS, "subdev wm8775" " set_input(val=%d route=0x%x)", hdw->input_val, input); sd->ops->audio->s_routing(sd, input, 0, 0); } }
false
false
false
false
false
0
printThreadsDump(Thread *self) { char buffer[256]; Thread *thread; suspendAllThreads(self); jam_printf("\n------ JamVM version %s Full Thread Dump -------\n", VERSION); for(thread = &main_thread; thread != NULL; thread = thread->next) { Object *jThread = thread->ee->thread; int priority = INST_DATA(jThread, int, priority_offset); int daemon = INST_DATA(jThread, int, daemon_offset); Frame *last = thread->ee->last_frame; /* Get thread name; we don't use String2Cstr(), as this mallocs memory and may deadlock with a thread suspended in malloc/realloc/free */ classlibThreadName2Buff(jThread, buffer, sizeof(buffer)); jam_printf("\n\"%s\"%s %p priority: %d tid: %p id: %d state: " "%s (0x%x)\n", buffer, daemon ? " (daemon)" : "", thread, priority, thread->tid, thread->id, getThreadStateString(thread), classlibGetThreadState(thread)); while(last->prev != NULL) { for(; last->mb != NULL; last = last->prev) { MethodBlock *mb = last->mb; ClassBlock *cb = CLASS_CB(mb->class); /* Convert slashes in class name to dots. Similar to above, we don't use slash2DotsDup(), as this mallocs memory */ slash2DotsBuff(cb->name, buffer, sizeof(buffer)); jam_printf("\tat %s.%s(", buffer, mb->name); if(mb->access_flags & ACC_NATIVE) jam_printf("Native method"); else if(cb->source_file_name == NULL) jam_printf("Unknown source"); else { int line = mapPC2LineNo(mb, last->last_pc); jam_printf("%s", cb->source_file_name); if(line != -1) jam_printf(":%d", line); } jam_printf(")\n"); } last = last->prev; } } resumeAllThreads(self); }
true
true
false
false
false
1
sh_mobile_ceu_clock_stop(struct soc_camera_host *ici) { struct sh_mobile_ceu_dev *pcdev = ici->priv; /* disable capture, disable interrupts */ ceu_write(pcdev, CEIER, 0); sh_mobile_ceu_soft_reset(pcdev); /* make sure active buffer is canceled */ spin_lock_irq(&pcdev->lock); if (pcdev->active) { list_del_init(&to_ceu_vb(pcdev->active)->queue); vb2_buffer_done(&pcdev->active->vb2_buf, VB2_BUF_STATE_ERROR); pcdev->active = NULL; } spin_unlock_irq(&pcdev->lock); pm_runtime_put(ici->v4l2_dev.dev); }
false
false
false
false
false
0
sb800_prefetch(struct device *dev, int on) { u16 misc; struct pci_dev *pdev = to_pci_dev(dev); pci_read_config_word(pdev, 0x50, &misc); if (on == 0) pci_write_config_word(pdev, 0x50, misc & 0xfcff); else pci_write_config_word(pdev, 0x50, misc | 0x0300); }
false
false
false
false
false
0
get_mountspec_from_uri (GDaemonVfs *vfs, const char *uri, GMountSpec **spec_out, char **path_out) { GMountSpec *spec; char *path; GVfsUriMapper *mapper; char *scheme; scheme = g_uri_parse_scheme (uri); if (scheme == NULL) return FALSE; /* convert the scheme to lower case since g_uri_parse_scheme * doesn't do that and we compare with g_str_equal */ str_tolower_inplace (scheme); spec = NULL; path = NULL; mapper = g_hash_table_lookup (vfs->from_uri_hash, scheme); if (mapper) spec = g_vfs_uri_mapper_from_uri (mapper, uri, &path); if (spec == NULL) { GDecodedUri *decoded; MountableInfo *mountable; char *type; int l; decoded = g_vfs_decode_uri (uri); if (decoded) { mountable = get_mountable_info_for_scheme (vfs, decoded->scheme); if (mountable) type = mountable->type; else type = decoded->scheme; spec = g_mount_spec_new (type); if (decoded->host && *decoded->host) { if (mountable && mountable->host_is_inet) { /* Convert hostname to lower case */ str_tolower_inplace (decoded->host); /* Remove brackets aroung ipv6 addresses */ l = strlen (decoded->host); if (decoded->host[0] == '[' && decoded->host[l - 1] == ']') g_mount_spec_set_with_len (spec, "host", decoded->host+1, l - 2); else g_mount_spec_set (spec, "host", decoded->host); } else g_mount_spec_set (spec, "host", decoded->host); } if (decoded->userinfo && *decoded->userinfo) g_mount_spec_set (spec, "user", decoded->userinfo); if (decoded->port != -1 && (mountable == NULL || mountable->default_port == 0 || mountable->default_port != decoded->port)) { char *port = g_strdup_printf ("%d", decoded->port); g_mount_spec_set (spec, "port", port); g_free (port); } if (decoded->query && *decoded->query) g_mount_spec_set (spec, "query", decoded->query); if (decoded->fragment && *decoded->fragment) g_mount_spec_set (spec, "fragment", decoded->fragment); path = g_strdup (decoded->path); g_vfs_decoded_uri_free (decoded); } } g_free (scheme); if (spec == NULL) return FALSE; *spec_out = spec; *path_out = path; return TRUE; }
false
false
false
false
false
0
operator>>(QDataStream &in, QServiceInterfaceDescriptor &dc) { const quint32 magicNumber = 0x77AFAFA; quint32 storedMagicNumber; in >> storedMagicNumber; if (storedMagicNumber != magicNumber) { qWarning() << "Datastream doesn't provide searialized QServiceInterfaceDescriptor"; return in; } const quint16 currentMajorVersion = 1; quint16 majorVersion = 0; quint16 minorVersion = 0; in >> majorVersion >> minorVersion; if (majorVersion != currentMajorVersion) { qWarning() << "Unknown serialization format for QServiceInterfaceDescriptor."; return in; } //Allow all minor versions. qint8 valid; in >> valid; if (valid) { if (!dc.isValid()) dc.d = new QServiceInterfaceDescriptorPrivate; in >> dc.d->serviceName; in >> dc.d->interfaceName; in >> dc.d->major; in >> dc.d->minor; in >> dc.d->attributes; in >> dc.d->customAttributes; in >> valid; dc.d->scope = (QService::Scope) valid; } else { //input stream contains invalid descriptor //use assignment operator dc = QServiceInterfaceDescriptor(); } return in; }
false
false
false
false
false
0
_illume_running(void) { /* hack to find out out if illume is running, dont grab if this is the case... */ Eina_List *l; E_Module *m; EINA_LIST_FOREACH (e_module_list(), l, m) if (!strcmp(m->name, "illume2") && m->enabled) return EINA_TRUE; return EINA_FALSE; }
false
false
false
false
false
0
kwsysProcessClosePipes(kwsysProcess* cp) { int i; /* Close any pipes that are still open. */ for(i=0; i < KWSYSPE_PIPE_COUNT; ++i) { if(cp->PipeReadEnds[i] >= 0) { #if KWSYSPE_USE_SELECT /* If the pipe was reported by the last call to select, we must read from it. This is needed to satisfy the suggestions from "man select_tut" and is not needed for the polling implementation. Ignore the data. */ if(FD_ISSET(cp->PipeReadEnds[i], &cp->PipeSet)) { /* We are handling this pipe now. Remove it from the set. */ FD_CLR(cp->PipeReadEnds[i], &cp->PipeSet); /* The pipe is ready to read without blocking. Keep trying to read until the operation is not interrupted. */ while((read(cp->PipeReadEnds[i], cp->PipeBuffer, KWSYSPE_PIPE_BUFFER_SIZE) < 0) && (errno == EINTR)); } #endif /* We are done reading from this pipe. */ kwsysProcessCleanupDescriptor(&cp->PipeReadEnds[i]); --cp->PipesLeft; } } }
false
true
false
false
true
1
event_trigger_callback(struct event_command *cmd_ops, struct trace_event_file *file, char *glob, char *cmd, char *param) { struct event_trigger_data *trigger_data; struct event_trigger_ops *trigger_ops; char *trigger = NULL; char *number; int ret; /* separate the trigger from the filter (t:n [if filter]) */ if (param && isdigit(param[0])) trigger = strsep(&param, " \t"); trigger_ops = cmd_ops->get_trigger_ops(cmd, trigger); ret = -ENOMEM; trigger_data = kzalloc(sizeof(*trigger_data), GFP_KERNEL); if (!trigger_data) goto out; trigger_data->count = -1; trigger_data->ops = trigger_ops; trigger_data->cmd_ops = cmd_ops; INIT_LIST_HEAD(&trigger_data->list); if (glob[0] == '!') { cmd_ops->unreg(glob+1, trigger_ops, trigger_data, file); kfree(trigger_data); ret = 0; goto out; } if (trigger) { number = strsep(&trigger, ":"); ret = -EINVAL; if (!strlen(number)) goto out_free; /* * We use the callback data field (which is a pointer) * as our counter. */ ret = kstrtoul(number, 0, &trigger_data->count); if (ret) goto out_free; } if (!param) /* if param is non-empty, it's supposed to be a filter */ goto out_reg; if (!cmd_ops->set_filter) goto out_reg; ret = cmd_ops->set_filter(param, trigger_data, file); if (ret < 0) goto out_free; out_reg: ret = cmd_ops->reg(glob, trigger_ops, trigger_data, file); /* * The above returns on success the # of functions enabled, * but if it didn't find any functions it returns zero. * Consider no functions a failure too. */ if (!ret) { ret = -ENOENT; goto out_free; } else if (ret < 0) goto out_free; ret = 0; out: return ret; out_free: if (cmd_ops->set_filter) cmd_ops->set_filter(NULL, trigger_data, NULL); kfree(trigger_data); goto out; }
false
false
false
false
false
0
PlaceWidget(double bds[6]) { int i; double bounds[6], center[3]; this->AdjustBounds(bds, bounds, center); for (i=0; i<6; i++) { this->InitialBounds[i] = bounds[i]; } this->InitialLength = sqrt((bounds[1]-bounds[0])*(bounds[1]-bounds[0]) + (bounds[3]-bounds[2])*(bounds[3]-bounds[2]) + (bounds[5]-bounds[4])*(bounds[5]-bounds[4])); if ( this->Anchor ) {//no longer in world space this->Anchor->Delete(); this->Anchor = NULL; } double e[2]; e[0] = static_cast<double>(bounds[0]); e[1] = static_cast<double>(bounds[2]); this->Balloon->StartWidgetInteraction(e); this->Balloon->SetImageSize(static_cast<int>(bounds[1]-bounds[0]), static_cast<int>(bounds[3]-bounds[2])); }
false
false
false
false
false
0
_update_cache_vginfo_lock_state(struct lvmcache_vginfo *vginfo, int locked) { struct lvmcache_info *info; int cached_vgmetadata_valid = 1; dm_list_iterate_items(info, &vginfo->infos) _update_cache_info_lock_state(info, locked, &cached_vgmetadata_valid); if (!cached_vgmetadata_valid) _free_cached_vgmetadata(vginfo); }
false
false
false
false
false
0
_cdio_strsplit(const char str[], char delim) /* fixme -- non-reentrant */ { int n; char **strv = NULL; char *_str, *p; char _delim[2] = { 0, 0 }; cdio_assert (str != NULL); _str = strdup(str); _delim[0] = delim; cdio_assert (_str != NULL); n = 1; p = _str; while(*p) if (*(p++) == delim) n++; strv = calloc (1, sizeof (char *) * (n+1)); n = 0; while((p = strtok(n ? NULL : _str, _delim)) != NULL) strv[n++] = strdup(p); free(_str); return strv; }
false
false
false
true
true
1
adv7511_encoder_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, struct drm_display_mode *adj_mode) { struct adv7511 *adv7511 = encoder_to_adv7511(encoder); unsigned int low_refresh_rate; unsigned int hsync_polarity = 0; unsigned int vsync_polarity = 0; if (adv7511->embedded_sync) { unsigned int hsync_offset, hsync_len; unsigned int vsync_offset, vsync_len; hsync_offset = adj_mode->crtc_hsync_start - adj_mode->crtc_hdisplay; vsync_offset = adj_mode->crtc_vsync_start - adj_mode->crtc_vdisplay; hsync_len = adj_mode->crtc_hsync_end - adj_mode->crtc_hsync_start; vsync_len = adj_mode->crtc_vsync_end - adj_mode->crtc_vsync_start; /* The hardware vsync generator has a off-by-one bug */ vsync_offset += 1; regmap_write(adv7511->regmap, ADV7511_REG_HSYNC_PLACEMENT_MSB, ((hsync_offset >> 10) & 0x7) << 5); regmap_write(adv7511->regmap, ADV7511_REG_SYNC_DECODER(0), (hsync_offset >> 2) & 0xff); regmap_write(adv7511->regmap, ADV7511_REG_SYNC_DECODER(1), ((hsync_offset & 0x3) << 6) | ((hsync_len >> 4) & 0x3f)); regmap_write(adv7511->regmap, ADV7511_REG_SYNC_DECODER(2), ((hsync_len & 0xf) << 4) | ((vsync_offset >> 6) & 0xf)); regmap_write(adv7511->regmap, ADV7511_REG_SYNC_DECODER(3), ((vsync_offset & 0x3f) << 2) | ((vsync_len >> 8) & 0x3)); regmap_write(adv7511->regmap, ADV7511_REG_SYNC_DECODER(4), vsync_len & 0xff); hsync_polarity = !(adj_mode->flags & DRM_MODE_FLAG_PHSYNC); vsync_polarity = !(adj_mode->flags & DRM_MODE_FLAG_PVSYNC); } else { enum adv7511_sync_polarity mode_hsync_polarity; enum adv7511_sync_polarity mode_vsync_polarity; /** * If the input signal is always low or always high we want to * invert or let it passthrough depending on the polarity of the * current mode. **/ if (adj_mode->flags & DRM_MODE_FLAG_NHSYNC) mode_hsync_polarity = ADV7511_SYNC_POLARITY_LOW; else mode_hsync_polarity = ADV7511_SYNC_POLARITY_HIGH; if (adj_mode->flags & DRM_MODE_FLAG_NVSYNC) mode_vsync_polarity = ADV7511_SYNC_POLARITY_LOW; else mode_vsync_polarity = ADV7511_SYNC_POLARITY_HIGH; if (adv7511->hsync_polarity != mode_hsync_polarity && adv7511->hsync_polarity != ADV7511_SYNC_POLARITY_PASSTHROUGH) hsync_polarity = 1; if (adv7511->vsync_polarity != mode_vsync_polarity && adv7511->vsync_polarity != ADV7511_SYNC_POLARITY_PASSTHROUGH) vsync_polarity = 1; } if (mode->vrefresh <= 24000) low_refresh_rate = ADV7511_LOW_REFRESH_RATE_24HZ; else if (mode->vrefresh <= 25000) low_refresh_rate = ADV7511_LOW_REFRESH_RATE_25HZ; else if (mode->vrefresh <= 30000) low_refresh_rate = ADV7511_LOW_REFRESH_RATE_30HZ; else low_refresh_rate = ADV7511_LOW_REFRESH_RATE_NONE; regmap_update_bits(adv7511->regmap, 0xfb, 0x6, low_refresh_rate << 1); regmap_update_bits(adv7511->regmap, 0x17, 0x60, (vsync_polarity << 6) | (hsync_polarity << 5)); /* * TODO Test first order 4:2:2 to 4:4:4 up conversion method, which is * supposed to give better results. */ adv7511->f_tmds = mode->clock; }
false
false
false
false
false
0
WriteHeader(OBConversion* pConv) { ostream& ofs = *pConv->GetOutStream(); set<string> elements; vector<string> species; MolSet::iterator itr; for(itr= OMols.begin();itr!=OMols.end();++itr) { const char* title = (*itr)->GetTitle(); if(strcmp(title, "M")) species.push_back(title); FOR_ATOMS_OF_MOL(atom, itr->get()) elements.insert(etab.GetSymbol(atom->GetAtomicNum())); } if(!elements.empty()) { ofs << "ELEMENTS\n"; copy(elements.begin(),elements.end(), ostream_iterator<string>(ofs," ")); ofs << "\nEND\n"; } else obErrorLog.ThrowError(__FUNCTION__, "No element data available", obWarning); ofs << "SPECIES\n"; vector<string>::iterator sitr; unsigned int maxlen=0; for(sitr= species.begin();sitr!=species.end();++sitr) if(sitr->size()>maxlen) maxlen = sitr->size(); unsigned int n=0; for(sitr=species.begin();sitr!=species.end();++sitr, ++n) { if(maxlen>0 && n > 80 / maxlen) { ofs << '\n'; n=0; } ofs << setw(maxlen+1) << *sitr; } ofs << "\nEND\n"; if(!pConv->IsOption("t")) { OBFormat* pFormat = OBConversion::FindFormat("therm"); if(!pFormat) { obErrorLog.ThrowError(__FUNCTION__, "Thermo format needed but not available", obError); return false; } else { stringstream thermss; thermss << "THERMO ALL\n"; thermss << " 300.000 1000.000 5000.000\n"; OBConversion ConvThermo(*pConv); ConvThermo.SetOutFormat(pFormat); ConvThermo.SetOutStream(&thermss); int ntherm=0; for(itr= OMols.begin();itr!=OMols.end();++itr) { const char* title = (*itr)->GetTitle(); if(strcmp(title, "M")) if(ConvThermo.Write(itr->get())) ++ntherm; } thermss << "END\n"; if(ntherm) ofs << thermss.str(); //but don't output unless there was some thermo data } } return true; }
false
false
false
false
false
0
remove_backend(struct Backend_head *head, struct Backend *backend) { STAILQ_REMOVE(head, backend, Backend, entries); free_backend(backend); }
false
false
false
false
false
0
clipToStrokePath(GfxState *state) { SplashPath *path, *path2; path = convertPath(state, state->getPath()); path2 = splash->makeStrokePath(path); delete path; splash->clipToPath(path2, gFalse); delete path2; }
false
false
false
false
false
0
serialize(std::stringstream& ss, size_t indentLevel) const { ss << "["; for (size_t i = 1; i < data.size(); ++i) { data[i - 1]->serialize(ss, indentLevel); ss << ", "; } if (data.size() > 0) { data[size() - 1]->serialize(ss, indentLevel); } ss << "]"; }
false
false
false
false
false
0
endTable() { coverSpannedRows(); delete tableStack_.get(); }
false
false
false
false
false
0
gpk_modal_dialog_make_progressbar_pulse (GpkModalDialog *dialog) { GtkProgressBar *progress_bar; if (dialog->priv->pulse_timer_id == 0) { progress_bar = GTK_PROGRESS_BAR (gtk_builder_get_object (dialog->priv->builder, "progressbar_percent")); gtk_progress_bar_set_pulse_step (progress_bar, 0.04); dialog->priv->pulse_timer_id = g_timeout_add (75, (GSourceFunc) gpk_modal_dialog_pulse_progress, dialog); g_source_set_name_by_id (dialog->priv->pulse_timer_id, "[GpkModalDialog] pulse"); } }
false
false
false
false
false
0
pqGetErrorNotice2(PGconn *conn, bool isError) { PGresult *res = NULL; PQExpBufferData workBuf; char *startp; char *splitp; /* * Since the message might be pretty long, we create a temporary * PQExpBuffer rather than using conn->workBuffer. workBuffer is intended * for stuff that is expected to be short. */ initPQExpBuffer(&workBuf); if (pqGets(&workBuf, conn)) goto failure; /* * Make a PGresult to hold the message. We temporarily lie about the * result status, so that PQmakeEmptyPGresult doesn't uselessly copy * conn->errorMessage. * * NB: This allocation can fail, if you run out of memory. The rest of the * function handles that gracefully, and we still try to set the error * message as the connection's error message. */ res = PQmakeEmptyPGresult(conn, PGRES_EMPTY_QUERY); if (res) { res->resultStatus = isError ? PGRES_FATAL_ERROR : PGRES_NONFATAL_ERROR; res->errMsg = pqResultStrdup(res, workBuf.data); } /* * Break the message into fields. We can't do very much here, but we can * split the severity code off, and remove trailing newlines. Also, we use * the heuristic that the primary message extends only to the first * newline --- anything after that is detail message. (In some cases it'd * be better classed as hint, but we can hardly be expected to guess that * here.) */ while (workBuf.len > 0 && workBuf.data[workBuf.len - 1] == '\n') workBuf.data[--workBuf.len] = '\0'; splitp = strstr(workBuf.data, ": "); if (splitp) { /* what comes before the colon is severity */ *splitp = '\0'; pqSaveMessageField(res, PG_DIAG_SEVERITY, workBuf.data); startp = splitp + 3; } else { /* can't find a colon? oh well... */ startp = workBuf.data; } splitp = strchr(startp, '\n'); if (splitp) { /* what comes before the newline is primary message */ *splitp++ = '\0'; pqSaveMessageField(res, PG_DIAG_MESSAGE_PRIMARY, startp); /* the rest is detail; strip any leading whitespace */ while (*splitp && isspace((unsigned char) *splitp)) splitp++; pqSaveMessageField(res, PG_DIAG_MESSAGE_DETAIL, splitp); } else { /* single-line message, so all primary */ pqSaveMessageField(res, PG_DIAG_MESSAGE_PRIMARY, startp); } /* * Either save error as current async result, or just emit the notice. * Also, if it's an error and we were in a transaction block, assume the * server has now gone to error-in-transaction state. */ if (isError) { pqClearAsyncResult(conn); conn->result = res; resetPQExpBuffer(&conn->errorMessage); if (res && !PQExpBufferDataBroken(workBuf) && res->errMsg) appendPQExpBufferStr(&conn->errorMessage, res->errMsg); else printfPQExpBuffer(&conn->errorMessage, libpq_gettext("out of memory")); if (conn->xactStatus == PQTRANS_INTRANS) conn->xactStatus = PQTRANS_INERROR; } else { if (res) { if (res->noticeHooks.noticeRec != NULL) (*res->noticeHooks.noticeRec) (res->noticeHooks.noticeRecArg, res); PQclear(res); } } termPQExpBuffer(&workBuf); return 0; failure: if (res) PQclear(res); termPQExpBuffer(&workBuf); return EOF; }
false
false
false
false
false
0
vmw_resource_alloc_id(struct vmw_resource *res) { struct vmw_private *dev_priv = res->dev_priv; int ret; struct idr *idr = &dev_priv->res_idr[res->func->res_type]; BUG_ON(res->id != -1); idr_preload(GFP_KERNEL); write_lock(&dev_priv->resource_lock); ret = idr_alloc(idr, res, 1, 0, GFP_NOWAIT); if (ret >= 0) res->id = ret; write_unlock(&dev_priv->resource_lock); idr_preload_end(); return ret < 0 ? ret : 0; }
false
false
false
false
false
0
mono_aot_init_llvm_method (gpointer aot_module, guint32 method_index) { MonoAotModule *amodule = (MonoAotModule *)aot_module; gboolean res; // FIXME: Handle failure res = init_llvm_method (amodule, method_index, NULL, NULL, NULL); g_assert (res); }
false
false
false
false
false
0
e_cell_combo_dispose (GObject *object) { ECellCombo *ecc = E_CELL_COMBO (object); if (ecc->popup_window != NULL) { gtk_widget_destroy (ecc->popup_window); ecc->popup_window = NULL; } if (ecc->grabbed_keyboard != NULL) { gdk_device_ungrab (ecc->grabbed_keyboard, GDK_CURRENT_TIME); g_object_unref (ecc->grabbed_keyboard); ecc->grabbed_keyboard = NULL; } if (ecc->grabbed_pointer != NULL) { gdk_device_ungrab (ecc->grabbed_pointer, GDK_CURRENT_TIME); g_object_unref (ecc->grabbed_pointer); ecc->grabbed_pointer = NULL; } G_OBJECT_CLASS (e_cell_combo_parent_class)->dispose (object); }
false
false
false
false
false
0
qt_reset_color_avail() { int i; for ( i = 0; i < screencount; i++ ) { screendata[i]->colors_avail = true; screendata[i]->g_carr_fetch = true; // do XQueryColors if !colors_avail } }
false
false
false
false
false
0
utils_unlock(GeanyDocument *doc) { if (utils_attrib(doc, SCOPE_LOCK)) { doc_lock_unlock(doc, FALSE); g_object_steal_data(G_OBJECT(doc->editor->sci), SCOPE_LOCK); } line_mark_unmark(doc, FALSE); tooltip_remove(doc->editor); }
false
false
false
false
false
0
test_cant_write_private_without_login (Test *test, gconstpointer unused) { GkmDataResult res; res = gkm_gnome2_file_create_entry (test->data_file, "identifier_private", GKM_GNOME2_FILE_SECTION_PRIVATE); g_assert (res == GKM_DATA_SUCCESS); res = gkm_gnome2_file_write_fd (test->data_file, test->write_fd, NULL); g_assert (res == GKM_DATA_LOCKED); }
false
false
false
false
false
0
gst_caps_to_string (const GstCaps * caps) { guint i, slen, clen; GString *s; /* NOTE: This function is potentially called by the debug system, * so any calls to gst_log() (and GST_DEBUG(), GST_LOG(), etc.) * should be careful to avoid recursion. This includes any functions * called by gst_caps_to_string. In particular, calls should * not use the GST_PTR_FORMAT extension. */ if (caps == NULL) { return g_strdup ("NULL"); } if (CAPS_IS_ANY (caps)) { return g_strdup ("ANY"); } if (CAPS_IS_EMPTY_SIMPLE (caps)) { return g_strdup ("EMPTY"); } /* estimate a rough string length to avoid unnecessary reallocs in GString */ slen = 0; clen = caps->structs->len; for (i = 0; i < clen; i++) { slen += STRUCTURE_ESTIMATED_STRING_LEN (gst_caps_get_structure_unchecked (caps, i)); } s = g_string_sized_new (slen); for (i = 0; i < clen; i++) { GstStructure *structure; if (i > 0) { /* ';' is now added by gst_structure_to_string */ g_string_append_c (s, ' '); } structure = gst_caps_get_structure_unchecked (caps, i); priv_gst_structure_append_to_gstring (structure, s); } if (s->len && s->str[s->len - 1] == ';') { /* remove latest ';' */ s->str[--s->len] = '\0'; } return g_string_free (s, FALSE); }
false
false
false
false
false
0
get_dict_file_name(const DictInfo * mi, String & main_wl, String & flags) { const DictInfoNode * node = reinterpret_cast<const DictInfoNode *>(mi); if (node->direct) { main_wl = node->info_file; flags = ""; return no_err; } else { FStream f; RET_ON_ERR(f.open(node->info_file, "r")); String buf; DataPair dp; bool res = getdata_pair(f, dp, buf); main_wl = dp.key; flags = dp.value; f.close(); if (!res) return make_err(bad_file_format, node->info_file, ""); return no_err; } }
false
false
false
false
false
0
DebugString() const { string contents = "syntax = \"proto2\";\n\n"; for (int i = 0; i < dependency_count(); i++) { strings::SubstituteAndAppend(&contents, "import \"$0\";\n", dependency(i)->name()); } if (!package().empty()) { strings::SubstituteAndAppend(&contents, "package $0;\n\n", package()); } if (FormatLineOptions(0, options(), &contents)) { contents.append("\n"); // add some space if we had options } for (int i = 0; i < enum_type_count(); i++) { enum_type(i)->DebugString(0, &contents); contents.append("\n"); } // Find all the 'group' type extensions; we will not output their nested // definitions (those will be done with their group field descriptor). set<const Descriptor*> groups; for (int i = 0; i < extension_count(); i++) { if (extension(i)->type() == FieldDescriptor::TYPE_GROUP) { groups.insert(extension(i)->message_type()); } } for (int i = 0; i < message_type_count(); i++) { if (groups.count(message_type(i)) == 0) { strings::SubstituteAndAppend(&contents, "message $0", message_type(i)->name()); message_type(i)->DebugString(0, &contents); contents.append("\n"); } } for (int i = 0; i < service_count(); i++) { service(i)->DebugString(&contents); contents.append("\n"); } const Descriptor* containing_type = NULL; for (int i = 0; i < extension_count(); i++) { if (extension(i)->containing_type() != containing_type) { if (i > 0) contents.append("}\n\n"); containing_type = extension(i)->containing_type(); strings::SubstituteAndAppend(&contents, "extend .$0 {\n", containing_type->full_name()); } extension(i)->DebugString(1, &contents); } if (extension_count() > 0) contents.append("}\n\n"); return contents; }
false
false
false
false
false
0
knh_inferMapObject(CTX ctx, const knh_ClassTBL_t *sct, const knh_ClassTBL_t *tct) { if(sct->p1 == CLASS_String) { return new_TypeMap(ctx, 0, sct->cid, tct->cid, Map_Object); } return NULL; }
false
false
false
false
false
0
ptr_message(struct spptr *pp, const int code) { struct remote *rp; struct sp_omsg rq; if (!(rp = inl_find_connected(pp->spp_netid))) return; rq.spr_act = htons((USHORT) code); rq.spr_pid = 0; rq.spr_seq = htons(rp->ht_seqto); rq.spr_jobno = 0; rq.spr_arg1 = 0; rq.spr_arg2 = 0; rq.spr_netid = myhostid; rq.spr_jpslot = htonl(pp->spp_rslot); chk_write(rp, (char *) &rq, sizeof(rq)); }
false
false
false
false
false
0
frame_outbuffer(mpg123_handle *fr) { size_t size = mpg123_safe_buffer()*AUDIOBUFSIZE; if(!fr->own_buffer) fr->buffer.data = NULL; if(fr->buffer.data != NULL && fr->buffer.size != size) { free(fr->buffer.data); fr->buffer.data = NULL; } fr->buffer.size = size; if(fr->buffer.data == NULL) fr->buffer.data = (unsigned char*) malloc(fr->buffer.size); if(fr->buffer.data == NULL) { fr->err = MPG123_OUT_OF_MEM; return -1; } fr->own_buffer = TRUE; fr->buffer.fill = 0; return 0; }
false
false
false
false
false
0
v4l2_buffers_mapped(int index) { unsigned int i; if (!v4l2_needs_conversion(index)) { /* Normal (no conversion) mode */ struct v4l2_buffer buf; for (i = 0; i < devices[index].no_frames; i++) { buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; buf.memory = V4L2_MEMORY_MMAP; buf.index = i; if (devices[index].dev_ops->ioctl( devices[index].dev_ops_priv, devices[index].fd, VIDIOC_QUERYBUF, &buf)) { int saved_err = errno; V4L2_PERROR("querying buffer %u", i); errno = saved_err; break; } if (buf.flags & V4L2_BUF_FLAG_MAPPED) break; } } else { /* Conversion mode */ for (i = 0; i < devices[index].no_frames; i++) if (devices[index].frame_map_count[i]) break; } if (i != devices[index].no_frames) V4L2_LOG("v4l2_buffers_mapped(): buffers still mapped\n"); return i != devices[index].no_frames; }
false
false
false
false
false
0
chise_make_hash_table (size_t size) { CHISE_HASH_TABLE* hash = (CHISE_HASH_TABLE*)malloc (sizeof (CHISE_HASH_TABLE)); if (hash == NULL) return NULL; hash->data = (CHISE_HASH_TABLE_ENTRY*) malloc (sizeof (CHISE_HASH_TABLE_ENTRY) * size); if (hash->data == NULL) { free (hash); return NULL; } hash->size = size; memset (hash->data, 0, sizeof (CHISE_HASH_TABLE_ENTRY) * size); return hash; }
false
true
false
false
false
1
numericoidValidate( Syntax *syntax, struct berval *in ) { struct berval val = *in; if( BER_BVISEMPTY( &val ) ) { /* disallow empty strings */ return LDAP_INVALID_SYNTAX; } while( OID_LEADCHAR( val.bv_val[0] ) ) { if ( val.bv_len == 1 ) { return LDAP_SUCCESS; } if ( val.bv_val[0] == '0' && !OID_SEPARATOR( val.bv_val[1] )) { break; } val.bv_val++; val.bv_len--; while ( OID_LEADCHAR( val.bv_val[0] )) { val.bv_val++; val.bv_len--; if ( val.bv_len == 0 ) { return LDAP_SUCCESS; } } if( !OID_SEPARATOR( val.bv_val[0] )) { break; } val.bv_val++; val.bv_len--; } return LDAP_INVALID_SYNTAX; }
false
false
false
false
false
0
print_key_purpose (gnutls_buffer_st * str, const char *prefix, int type, cert_type_t cert) { int indx; char *buffer = NULL; size_t size; int err; for (indx = 0;; indx++) { size = 0; if (type == TYPE_CRT) err = gnutls_x509_crt_get_key_purpose_oid (cert.crt, indx, buffer, &size, NULL); else if (type == TYPE_CRQ) err = gnutls_x509_crq_get_key_purpose_oid (cert.crq, indx, buffer, &size, NULL); else return; if (err == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) return; if (err != GNUTLS_E_SHORT_MEMORY_BUFFER) { addf (str, "error: get_key_purpose_oid: %s\n", gnutls_strerror (err)); return; } buffer = gnutls_malloc (size); if (!buffer) { addf (str, "error: malloc: %s\n", gnutls_strerror (GNUTLS_E_MEMORY_ERROR)); return; } if (type == TYPE_CRT) err = gnutls_x509_crt_get_key_purpose_oid (cert.crt, indx, buffer, &size, NULL); else err = gnutls_x509_crq_get_key_purpose_oid (cert.crq, indx, buffer, &size, NULL); if (err < 0) { gnutls_free (buffer); addf (str, "error: get_key_purpose_oid2: %s\n", gnutls_strerror (err)); return; } if (strcmp (buffer, GNUTLS_KP_TLS_WWW_SERVER) == 0) addf (str, _("%s\t\t\tTLS WWW Server.\n"), prefix); else if (strcmp (buffer, GNUTLS_KP_TLS_WWW_CLIENT) == 0) addf (str, _("%s\t\t\tTLS WWW Client.\n"), prefix); else if (strcmp (buffer, GNUTLS_KP_CODE_SIGNING) == 0) addf (str, _("%s\t\t\tCode signing.\n"), prefix); else if (strcmp (buffer, GNUTLS_KP_EMAIL_PROTECTION) == 0) addf (str, _("%s\t\t\tEmail protection.\n"), prefix); else if (strcmp (buffer, GNUTLS_KP_TIME_STAMPING) == 0) addf (str, _("%s\t\t\tTime stamping.\n"), prefix); else if (strcmp (buffer, GNUTLS_KP_OCSP_SIGNING) == 0) addf (str, _("%s\t\t\tOCSP signing.\n"), prefix); else if (strcmp (buffer, GNUTLS_KP_IPSEC_IKE) == 0) addf (str, _("%s\t\t\tIpsec IKE.\n"), prefix); else if (strcmp (buffer, GNUTLS_KP_ANY) == 0) addf (str, _("%s\t\t\tAny purpose.\n"), prefix); else addf (str, "%s\t\t\t%s\n", prefix, buffer); gnutls_free (buffer); } }
false
false
false
false
false
0
parse_str(const char* buf, const char* tag, char* dest, int destlen) { string str; const char* p; int len; p = strstr(buf, tag); if (!p) return false; p = strchr(p, '>'); p++; const char* q = strchr(p, '<'); if (!q) return false; len = (int)(q-p); if (len >= destlen) len = destlen-1; memcpy(dest, p, len); dest[len] = 0; strip_whitespace(dest); xml_unescape(dest); return true; }
false
false
false
false
false
0
lan87xx_read_status(struct phy_device *phydev) { int err = genphy_read_status(phydev); int i; if (!phydev->link) { /* Disable EDPD to wake up PHY */ int rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS); if (rc < 0) return rc; rc = phy_write(phydev, MII_LAN83C185_CTRL_STATUS, rc & ~MII_LAN83C185_EDPWRDOWN); if (rc < 0) return rc; /* Wait max 640 ms to detect energy */ for (i = 0; i < 64; i++) { /* Sleep to allow link test pulses to be sent */ msleep(10); rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS); if (rc < 0) return rc; if (rc & MII_LAN83C185_ENERGYON) break; } /* Re-enable EDPD */ rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS); if (rc < 0) return rc; rc = phy_write(phydev, MII_LAN83C185_CTRL_STATUS, rc | MII_LAN83C185_EDPWRDOWN); if (rc < 0) return rc; } return err; }
false
false
false
false
false
0
image_load_set_signals(ImageWindow *imd, gboolean override_old_signals) { g_assert(imd->il); if (override_old_signals) { /* override the old signals */ g_signal_handlers_disconnect_matched(G_OBJECT(imd->il), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, imd); } g_signal_connect(G_OBJECT(imd->il), "area_ready", (GCallback)image_load_area_cb, imd); g_signal_connect(G_OBJECT(imd->il), "error", (GCallback)image_load_error_cb, imd); g_signal_connect(G_OBJECT(imd->il), "done", (GCallback)image_load_done_cb, imd); g_signal_connect(G_OBJECT(imd->il), "size_prepared", (GCallback)image_load_size_cb, imd); }
false
false
false
false
false
0
HPCC_FreeBuckets (Bucket_Ptr Buckets, int numPEs) { Update_Ptr ptr1, ptr2; int i; HPCC_ra_Heap_Free(); for (i = 0; i < numPEs; i ++) { ptr1 = Buckets[i].updateList; while (ptr1 != NULL_UPDATE_PTR) { ptr2 = ptr1; ptr1 = ptr1->forward; HPCC_PoolReturnObj(Update_Pool, ptr2); } } HPCC_PoolFree(Update_Pool); free(Update_Pool); free (Buckets); }
false
false
false
false
false
0
test_config_read__local_config_overrides_global_config_overrides_system_config(void) { git_config *cfg; int32_t i; cl_git_pass(git_config_new(&cfg)); cl_git_pass(git_config_add_file_ondisk(cfg, cl_fixture("config/config9"), GIT_CONFIG_LEVEL_SYSTEM, 0)); cl_git_pass(git_config_add_file_ondisk(cfg, cl_fixture("config/config15"), GIT_CONFIG_LEVEL_GLOBAL, 0)); cl_git_pass(git_config_add_file_ondisk(cfg, cl_fixture("config/config16"), GIT_CONFIG_LEVEL_LOCAL, 0)); cl_git_pass(git_config_get_int32(&i, cfg, "core.dummy2")); cl_assert_equal_i(28, i); git_config_free(cfg); cl_git_pass(git_config_new(&cfg)); cl_git_pass(git_config_add_file_ondisk(cfg, cl_fixture("config/config9"), GIT_CONFIG_LEVEL_SYSTEM, 0)); cl_git_pass(git_config_add_file_ondisk(cfg, cl_fixture("config/config15"), GIT_CONFIG_LEVEL_GLOBAL, 0)); cl_git_pass(git_config_get_int32(&i, cfg, "core.dummy2")); cl_assert_equal_i(7, i); git_config_free(cfg); }
false
false
false
false
false
0
getLength() const { if (address_family==AF_INET) { if (ipv4.s_addr == INADDR_BROADCAST) return addressLengthBits(); if (ipv4.s_addr == 0) return 0; unsigned int n = ntohl(ipv4.s_addr); int i=0; while (n) { n=n<<1; i++; } return i; } else { int bits = 0; for (int i=3; i>=0; --i) { uint32_t n = ntohl(((uint32_t*)(&ipv6))[i]); if (n==0) { bits += 32; continue; } while ((n & 1) == 0) { bits++; n = n >> 1; } bits = 128 - bits; break; } return bits; } }
false
false
false
false
false
0
nmea_cksum(const char* const buf) { int x = 0 ; const char* p; for (p = buf; *p; p++) { x ^= *p; } return x; }
false
false
false
false
false
0
scsi_inq_str(unsigned char *buf, unsigned char *inq, unsigned first, unsigned end) { unsigned term = 0, idx; for (idx = 0; idx + first < end && idx + first < inq[4] + 5; idx++) { if (inq[idx+first] > ' ') { buf[idx] = inq[idx+first]; term = idx+1; } else { buf[idx] = ' '; } } buf[term] = 0; return buf; }
false
false
false
false
false
0
ParseVarDeclarations(bool is_global) { while (scan.GetToken().IsVar()) { ParseVarDeclarationFactory(is_global ? SYM_VAR_GLOBAL : SYM_VAR_LOCAL); CheckTokOrDie(TOK_SEMICOLON); } }
false
false
false
false
false
0
EvaluateAttributeFilter(OGRFeature* poFeature) { return (m_poAttrQuery == NULL || m_poAttrQuery->Evaluate( poFeature )); }
false
false
false
false
false
0
scan(struct jv_parser* p, char ch, jv* out) { p->column++; if (ch == '\n') { p->line++; p->column = 0; } presult answer = 0; if (p->st == JV_PARSER_NORMAL) { chclass cls = classify(ch); if (cls != LITERAL) { TRY(check_literal(p)); if (check_done(p, out)) answer = OK; } switch (cls) { case LITERAL: tokenadd(p, ch); break; case WHITESPACE: break; case QUOTE: p->st = JV_PARSER_STRING; break; case STRUCTURE: TRY(token(p, ch)); break; case INVALID: return "Invalid character"; } if (check_done(p, out)) answer = OK; } else { if (ch == '"' && p->st == JV_PARSER_STRING) { TRY(found_string(p)); p->st = JV_PARSER_NORMAL; if (check_done(p, out)) answer = OK; } else { tokenadd(p, ch); if (ch == '\\' && p->st == JV_PARSER_STRING) { p->st = JV_PARSER_STRING_ESCAPE; } else { p->st = JV_PARSER_STRING; } } } return answer; }
false
false
false
false
false
0
bnx2x_restart_autoneg(struct bnx2x_phy *phy, struct link_params *params, u8 enable_cl73) { struct bnx2x *bp = params->bp; u16 mii_control; DP(NETIF_MSG_LINK, "bnx2x_restart_autoneg\n"); /* Enable and restart BAM/CL37 aneg */ if (enable_cl73) { CL22_RD_OVER_CL45(bp, phy, MDIO_REG_BANK_CL73_IEEEB0, MDIO_CL73_IEEEB0_CL73_AN_CONTROL, &mii_control); CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_CL73_IEEEB0, MDIO_CL73_IEEEB0_CL73_AN_CONTROL, (mii_control | MDIO_CL73_IEEEB0_CL73_AN_CONTROL_AN_EN | MDIO_CL73_IEEEB0_CL73_AN_CONTROL_RESTART_AN)); } else { CL22_RD_OVER_CL45(bp, phy, MDIO_REG_BANK_COMBO_IEEE0, MDIO_COMBO_IEEE0_MII_CONTROL, &mii_control); DP(NETIF_MSG_LINK, "bnx2x_restart_autoneg mii_control before = 0x%x\n", mii_control); CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_COMBO_IEEE0, MDIO_COMBO_IEEE0_MII_CONTROL, (mii_control | MDIO_COMBO_IEEO_MII_CONTROL_AN_EN | MDIO_COMBO_IEEO_MII_CONTROL_RESTART_AN)); } }
false
false
false
false
false
0
atp_on_tool_delete (GtkButton *button, gpointer user_data) { ATPToolDialog *this = (ATPToolDialog *)user_data; ATPUserTool *tool; tool = get_current_tool (this); if ((tool != NULL) && (atp_user_tool_get_storage (tool) > ATP_TSTORE_GLOBAL)) { if (anjuta_util_dialog_boolean_question (GTK_WINDOW (this->dialog), FALSE, _("Are you sure you want to delete the '%s' tool?"), atp_user_tool_get_name(tool))) { atp_user_tool_free (tool); atp_tool_dialog_refresh (this, NULL); } } }
false
false
false
false
false
0
plot_x_errorbar (double x, double y, double delta_x, double error_width2, GMT_LONG line) { double x_1, x_2, y_1, y_2; GMT_LONG tip1, tip2; tip1 = tip2 = (error_width2 > 0.0); GMT_geo_to_xy (x - delta_x, y, &x_1, &y_1); GMT_geo_to_xy (x + delta_x, y, &x_2, &y_2); if (GMT_is_dnan (x_1)) { fprintf (stderr, "%s: Warning: X error bar exceeded domain near line %ld. Set to x_min\n", GMT_program, line); x_1 = project_info.xmin; tip1 = FALSE; } if (GMT_is_dnan (x_2)) { fprintf (stderr, "%s: Warning: X error bar exceeded domain near line %ld. Set to x_max\n", GMT_program, line); x_2 = project_info.xmax; tip2 = FALSE; } ps_segment (x_1, y_1, x_2, y_2); if (tip1) ps_segment (x_1, y_1 - error_width2, x_1, y_1 + error_width2); if (tip2) ps_segment (x_2, y_2 - error_width2, x_2, y_2 + error_width2); }
false
false
false
false
false
0
qr_imag_cost(const Operand* op0, const Operand* op1) { if (! (is_float(op0->tbl.v->type) && is_complex(op1->tbl.v->type))) { ERROR_TYPE_MISMATCH("IMAG"); } return load_operand_with_alias_cost(op1, 1, op0->tbl.v->type, op0, 0); }
false
false
false
false
false
0
setup_peak_filter (GstIirEqualizer * equ, GstIirEqualizerBand * band) { gint rate = GST_AUDIO_FILTER_RATE (equ); g_return_if_fail (rate); { gdouble gain, omega, bw; gdouble alpha, alpha1, alpha2, b0; gain = arg_to_scale (band->gain); omega = calculate_omega (band->freq, rate); bw = calculate_bw (band, rate); if (bw == 0.0) goto out; alpha = tan (bw / 2.0); alpha1 = alpha * gain; alpha2 = alpha / gain; b0 = (1.0 + alpha2); band->a0 = (1.0 + alpha1) / b0; band->a1 = (-2.0 * cos (omega)) / b0; band->a2 = (1.0 - alpha1) / b0; band->b1 = (2.0 * cos (omega)) / b0; band->b2 = -(1.0 - alpha2) / b0; out: GST_INFO ("gain = %5.1f, width= %7.2f, freq = %7.2f, a0 = %7.5g, a1 = %7.5g, a2=%7.5g b1 = %7.5g, b2 = %7.5g", band->gain, band->width, band->freq, band->a0, band->a1, band->a2, band->b1, band->b2); } }
false
false
false
false
false
0
bfa_flash_sem_get(void __iomem *bar) { u32 n = FLASH_BLOCKING_OP_MAX; while (!bfa_raw_sem_get(bar)) { if (--n <= 0) return BFA_STATUS_BADFLASH; mdelay(10); } return BFA_STATUS_OK; }
false
false
false
false
false
0
gst_mpeg_video_packet_parse_picture_header (const GstMpegVideoPacket * packet, GstMpegVideoPictureHdr * hdr) { GstBitReader br; if (packet->size < 4) goto failed; gst_bit_reader_init (&br, &packet->data[packet->offset], packet->size); /* temperal sequence number */ if (!gst_bit_reader_get_bits_uint16 (&br, &hdr->tsn, 10)) goto failed; /* frame type */ if (!gst_bit_reader_get_bits_uint8 (&br, (guint8 *) & hdr->pic_type, 3)) goto failed; if (hdr->pic_type == 0 || hdr->pic_type > 4) goto bad_pic_type; /* Corrupted picture packet */ /* skip VBV delay */ if (!gst_bit_reader_skip (&br, 16)) goto failed; if (hdr->pic_type == GST_MPEG_VIDEO_PICTURE_TYPE_P || hdr->pic_type == GST_MPEG_VIDEO_PICTURE_TYPE_B) { READ_UINT8 (&br, hdr->full_pel_forward_vector, 1); READ_UINT8 (&br, hdr->f_code[0][0], 3); hdr->f_code[0][1] = hdr->f_code[0][0]; } else { hdr->full_pel_forward_vector = 0; hdr->f_code[0][0] = hdr->f_code[0][1] = 0; } if (hdr->pic_type == GST_MPEG_VIDEO_PICTURE_TYPE_B) { READ_UINT8 (&br, hdr->full_pel_backward_vector, 1); READ_UINT8 (&br, hdr->f_code[1][0], 3); hdr->f_code[1][1] = hdr->f_code[1][0]; } else { hdr->full_pel_backward_vector = 0; hdr->f_code[1][0] = hdr->f_code[1][1] = 0; } return TRUE; bad_pic_type: { GST_WARNING ("Unsupported picture type : %d", hdr->pic_type); return FALSE; } failed: { GST_WARNING ("Not enough data to parse picture header"); return FALSE; } }
false
false
false
false
false
0
stp_set_boolean_parameter(stp_vars_t *v, const char *parameter, int ival) { stp_list_t *list = v->params[STP_PARAMETER_TYPE_BOOLEAN]; value_t *val; stp_list_item_t *item = stp_list_get_item_by_name(list, parameter); stp_deprintf(STP_DBG_VARS, "stp_set_boolean_parameter(0x%p, %s, %d)\n", (const void *) v, parameter, ival); if (item) { val = (value_t *) stp_list_item_get_data(item); if (val->active == STP_PARAMETER_DEFAULTED) val->active = STP_PARAMETER_ACTIVE; } else { val = stp_malloc(sizeof(value_t)); val->name = stp_strdup(parameter); val->typ = STP_PARAMETER_TYPE_BOOLEAN; val->active = STP_PARAMETER_ACTIVE; stp_list_item_create(list, NULL, val); } if (ival) val->value.ival = 1; else val->value.ival = 0; stp_set_verified(v, 0); }
false
false
false
false
false
0
mos7810_check(struct usb_serial *serial) { int i, pass_count = 0; u8 *buf; __u16 data = 0, mcr_data = 0; __u16 test_pattern = 0x55AA; int res; buf = kmalloc(VENDOR_READ_LENGTH, GFP_KERNEL); if (!buf) return 0; /* failed to identify 7810 */ /* Store MCR setting */ res = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), MCS_RDREQ, MCS_RD_RTYPE, 0x0300, MODEM_CONTROL_REGISTER, buf, VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); if (res == VENDOR_READ_LENGTH) mcr_data = *buf; for (i = 0; i < 16; i++) { /* Send the 1-bit test pattern out to MCS7810 test pin */ usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), MCS_WRREQ, MCS_WR_RTYPE, (0x0300 | (((test_pattern >> i) & 0x0001) << 1)), MODEM_CONTROL_REGISTER, NULL, 0, MOS_WDR_TIMEOUT); /* Read the test pattern back */ res = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), MCS_RDREQ, MCS_RD_RTYPE, 0, GPIO_REGISTER, buf, VENDOR_READ_LENGTH, MOS_WDR_TIMEOUT); if (res == VENDOR_READ_LENGTH) data = *buf; /* If this is a MCS7810 device, both test patterns must match */ if (((test_pattern >> i) ^ (~data >> 1)) & 0x0001) break; pass_count++; } /* Restore MCR setting */ usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), MCS_WRREQ, MCS_WR_RTYPE, 0x0300 | mcr_data, MODEM_CONTROL_REGISTER, NULL, 0, MOS_WDR_TIMEOUT); kfree(buf); if (pass_count == 16) return 1; return 0; }
false
false
false
false
false
0
snmp_callback_available(int major, int minor) { if (major >= MAX_CALLBACK_IDS || minor >= MAX_CALLBACK_SUBIDS) { return SNMPERR_GENERR; } if (_callback_need_init) init_callbacks(); if (thecallbacks[major][minor] != NULL) { return SNMPERR_SUCCESS; } return SNMPERR_GENERR; }
false
false
false
false
false
0
pixConvertToPdfData(PIX *pix, l_int32 type, l_int32 quality, l_uint8 **pdata, size_t *pnbytes, l_int32 x, l_int32 y, l_int32 res, const char *title, L_PDF_DATA **plpd, l_int32 position) { l_int32 pixres, w, h, ret; l_float32 xpt, ypt, wpt, hpt; L_COMP_DATA *cid = NULL; L_PDF_DATA *lpd = NULL; PROCNAME("pixConvertToPdfData"); if (!pdata) return ERROR_INT("&data not defined", procName, 1); *pdata = NULL; if (!pnbytes) return ERROR_INT("&nbytes not defined", procName, 1); *pnbytes = 0; if (!pix) return ERROR_INT("pix not defined", procName, 1); if (plpd) { /* part of multi-page invocation */ if (position == L_FIRST_IMAGE) *plpd = NULL; } /* Generate the compressed image data. It must NOT * be ascii85 encoded. */ pixGenerateCIData(pix, type, quality, 0, &cid); if (!cid) return ERROR_INT("cid not made", procName, 1); /* Get media box in pts. Guess the input image resolution * based on the input parameter @res, the resolution data in * the pix, and the size of the image. */ pixres = cid->res; w = cid->w; h = cid->h; if (res <= 0.0) { if (pixres > 0) res = pixres; else res = DEFAULT_INPUT_RES; } xpt = x * 72. / res; ypt = y * 72. / res; wpt = w * 72. / res; hpt = h * 72. / res; /* Set up lpd */ if (!plpd) { /* single image */ if ((lpd = pdfdataCreate(title)) == NULL) return ERROR_INT("lpd not made", procName, 1); } else if (position == L_FIRST_IMAGE) { /* first of multiple images */ if ((lpd = pdfdataCreate(title)) == NULL) return ERROR_INT("lpd not made", procName, 1); *plpd = lpd; } else { /* not the first of multiple images */ lpd = *plpd; } /* Add the data to the lpd */ ptraAdd(lpd->cida, cid); lpd->n++; ptaAddPt(lpd->xy, xpt, ypt); ptaAddPt(lpd->wh, wpt, hpt); /* If a single image or the last of multiple images, * generate the pdf and destroy the lpd */ if (!plpd || (position == L_LAST_IMAGE)) { ret = l_generatePdf(pdata, pnbytes, lpd); pdfdataDestroy(&lpd); if (plpd) *plpd = NULL; if (ret) return ERROR_INT("pdf output not made", procName, 1); } return 0; }
false
false
false
false
false
0
ex_scriptnames(eap) exarg_T *eap UNUSED; { int i; for (i = 1; i <= script_items.ga_len && !got_int; ++i) if (SCRIPT_ITEM(i).sn_name != NULL) smsg((char_u *)"%3d: %s", i, SCRIPT_ITEM(i).sn_name); }
false
false
false
false
false
0
__ecereMethod___ecereNameSpace__ecere__gfx3D__Camera_Project(struct __ecereNameSpace__ecere__com__Instance * this, struct __ecereNameSpace__ecere__gfx3D__Vector3D * vector, struct __ecereNameSpace__ecere__gfx3D__Vector3D * point) { struct __ecereNameSpace__ecere__gfx3D__Camera * __ecerePointer___ecereNameSpace__ecere__gfx3D__Camera = (struct __ecereNameSpace__ecere__gfx3D__Camera *)(this ? (((char *)this) + __ecereClass___ecereNameSpace__ecere__gfx3D__Camera->offset) : 0); if(vector->z >= __ecerePointer___ecereNameSpace__ecere__gfx3D__Camera->zMin) { float floatZ; point->x = (vector->x * __ecerePointer___ecereNameSpace__ecere__gfx3D__Camera->focalX / vector->z); point->y = (vector->y * __ecerePointer___ecereNameSpace__ecere__gfx3D__Camera->focalY / vector->z); point->z = (((__ecerePointer___ecereNameSpace__ecere__gfx3D__Camera->zMax * __ecerePointer___ecereNameSpace__ecere__gfx3D__Camera->zMin / -vector->z) + __ecerePointer___ecereNameSpace__ecere__gfx3D__Camera->zMax) / (__ecerePointer___ecereNameSpace__ecere__gfx3D__Camera->zMax - __ecerePointer___ecereNameSpace__ecere__gfx3D__Camera->zMin)); floatZ = ((((float)__ecerePointer___ecereNameSpace__ecere__gfx3D__Camera->zMax * (float)__ecerePointer___ecereNameSpace__ecere__gfx3D__Camera->zMin / -(float)vector->z) + (float)__ecerePointer___ecereNameSpace__ecere__gfx3D__Camera->zMax) / ((float)__ecerePointer___ecereNameSpace__ecere__gfx3D__Camera->zMax - (float)__ecerePointer___ecereNameSpace__ecere__gfx3D__Camera->zMin)); point->x += (double)__ecerePointer___ecereNameSpace__ecere__gfx3D__Camera->origin.x; point->y += (double)__ecerePointer___ecereNameSpace__ecere__gfx3D__Camera->origin.y; return (point->x >= (double)0 && point->y >= (double)0 && point->x < (double)__ecerePointer___ecereNameSpace__ecere__gfx3D__Camera->width && point->y < (double)__ecerePointer___ecereNameSpace__ecere__gfx3D__Camera->height); } return 0x0; }
false
false
false
true
false
1
sendBody() { // If we have cached data, the it is either a repost or a DAV request so send // the cached data... if (m_POSTbuf) return sendCachedBody(); if (m_iPostDataSize == NO_SIZE) { // Try the old approach of retireving content data from the job // before giving up. if (retrieveAllData()) return sendCachedBody(); error(ERR_POST_NO_SIZE, m_request.url.host()); return false; } kDebug(7113) << "sending data (size=" << m_iPostDataSize << ")"; infoMessage(i18n("Sending data to %1", m_request.url.host())); QByteArray cLength ("Content-Length: "); cLength += QByteArray::number(m_iPostDataSize); cLength += "\r\n\r\n"; kDebug(7113) << cLength.trimmed(); // Send the content length... bool sendOk = (write(cLength.data(), cLength.size()) == (ssize_t) cLength.size()); if (!sendOk) { // The server might have closed the connection due to a timeout, or maybe // some transport problem arose while the connection was idle. if (m_request.isKeepAlive) { httpCloseConnection(); return true; // Try again } kDebug(7113) << "Connection broken while sending POST content size to" << m_request.url.host(); error( ERR_CONNECTION_BROKEN, m_request.url.host() ); return false; } // Send the amount totalSize(m_iPostDataSize); // If content-length is 0, then do nothing but simply return true. if (m_iPostDataSize == 0) return true; sendOk = true; KIO::filesize_t bytesSent = 0; while (true) { dataReq(); QByteArray buffer; const int bytesRead = readData(buffer); // On done... if (bytesRead == 0) { sendOk = (bytesSent == m_iPostDataSize); break; } // On error return false... if (bytesRead < 0) { error(ERR_ABORTED, m_request.url.host()); sendOk = false; break; } // Cache the POST data in case of a repost request. cachePostData(buffer); // This will only happen if transmitting the data fails, so we will simply // cache the content locally for the potential re-transmit... if (!sendOk) continue; if (write(buffer.data(), bytesRead) == static_cast<ssize_t>(bytesRead)) { bytesSent += bytesRead; processedSize(bytesSent); // Send update status... continue; } kDebug(7113) << "Connection broken while sending POST content to" << m_request.url.host(); error(ERR_CONNECTION_BROKEN, m_request.url.host()); sendOk = false; } return sendOk; }
false
false
false
false
false
0
openssl_post_errors(JCR *jcr, int code, const char *errstring) { char buf[512]; unsigned long sslerr; /* Pop errors off of the per-thread queue */ while((sslerr = ERR_get_error()) != 0) { /* Acquire the human readable string */ ERR_error_string_n(sslerr, buf, sizeof(buf)); Dmsg3(50, "jcr=%p %s: ERR=%s\n", jcr, errstring, buf); Qmsg2(jcr, M_ERROR, 0, "%s: ERR=%s\n", errstring, buf); } }
false
false
false
false
false
0
writeData( const char *data /*0 to finish*/, qint64 len ) { KFilterBase* filter = d->filter; Q_ASSERT ( filter->mode() == QIODevice::WriteOnly ); // If we had an error, return 0. if ( d->result != KFilterBase::Ok ) return 0; bool finish = (data == 0L); if (!finish) { filter->setInBuffer( data, len ); if (d->bNeedHeader) { (void)filter->writeHeader( d->origFileName ); d->bNeedHeader = false; } } uint dataWritten = 0; uint availIn = len; while ( dataWritten < len || finish ) { d->result = filter->compress( finish ); if (d->result == KFilterBase::Error) { qWarning() << "KFilterDev: Error when compressing data"; // What to do ? break; } // Wrote everything ? if (filter->inBufferEmpty() || (d->result == KFilterBase::End)) { // We got that much data since the last time we went here uint wrote = availIn - filter->inBufferAvailable(); //kDebug(7005) << " Wrote everything for now. avail_in=" << filter->inBufferAvailable() << "result=" << d->result << "wrote=" << wrote; // Move on in the input buffer data += wrote; dataWritten += wrote; availIn = len - dataWritten; //kDebug(7005) << " availIn=" << availIn << "dataWritten=" << dataWritten << "pos=" << pos(); if ( availIn > 0 ) filter->setInBuffer( data, availIn ); } if (filter->outBufferFull() || (d->result == KFilterBase::End) || finish) { //kDebug(7005) << " writing to underlying. avail_out=" << filter->outBufferAvailable(); int towrite = d->buffer.size() - filter->outBufferAvailable(); if ( towrite > 0 ) { // Write compressed data to underlying device int size = filter->device()->write( d->buffer.data(), towrite ); if ( size != towrite ) { qWarning() << "KFilterDev::write. Could only write " << size << " out of " << towrite << " bytes"; return 0; // indicate an error (happens on disk full) } //else //kDebug(7005) << " wrote " << size << " bytes"; } if (d->result == KFilterBase::End) { //kDebug(7005) << " END"; Q_ASSERT(finish); // hopefully we don't get end before finishing break; } d->buffer.resize(BUFFER_SIZE); filter->setOutBuffer( d->buffer.data(), d->buffer.size() ); } } return dataWritten; }
false
false
false
false
false
0
DetachGlobal() { if (IsDeadCheck("v8::Context::DetachGlobal()")) return; ENTER_V8; i::Object** ctx = reinterpret_cast<i::Object**>(this); i::Handle<i::Context> context = i::Handle<i::Context>::cast(i::Handle<i::Object>(ctx)); i::Bootstrapper::DetachGlobal(context); }
false
false
false
false
false
0
is_sdma_eng_name(char *buf, size_t bsize, unsigned int source) { /* what interrupt */ unsigned int what = source / TXE_NUM_SDMA_ENGINES; /* which engine */ unsigned int which = source % TXE_NUM_SDMA_ENGINES; if (likely(what < 3)) snprintf(buf, bsize, "%s%u", sdma_int_names[what], which); else snprintf(buf, bsize, "Invalid SDMA interrupt %u", source); return buf; }
false
false
false
false
false
0
timerEvent( QTimerEvent *ev ) { if( ev->timerId() == m_trackBarAnimationTimer ) animateTrackLabels(); else QToolBar::timerEvent( ev ); }
false
false
false
false
false
0
mod_secdownload_patch_connection(server *srv, connection *con, plugin_data *p) { size_t i, j; plugin_config *s = p->config_storage[0]; PATCH(secret); PATCH(doc_root); PATCH(uri_prefix); PATCH(timeout); /* skip the first, the global context */ for (i = 1; i < srv->config_context->used; i++) { data_config *dc = (data_config *)srv->config_context->data[i]; s = p->config_storage[i]; /* condition didn't match */ if (!config_check_cond(srv, con, dc)) continue; /* merge config */ for (j = 0; j < dc->value->used; j++) { data_unset *du = dc->value->data[j]; if (buffer_is_equal_string(du->key, CONST_STR_LEN("secdownload.secret"))) { PATCH(secret); } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("secdownload.document-root"))) { PATCH(doc_root); } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("secdownload.uri-prefix"))) { PATCH(uri_prefix); } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("secdownload.timeout"))) { PATCH(timeout); } } } return 0; }
false
false
false
false
false
0
gx_forward_include_color_space(gx_device *dev, gs_color_space *cspace, const byte *res_name, int name_length) { gx_device_forward * const fdev = (gx_device_forward *)dev; gx_device *tdev = fdev->target; /* Note that clist sets fdev->target == fdev, so this function is unapplicable to clist. */ if (tdev == 0) return 0; else return dev_proc(tdev, include_color_space)(tdev, cspace, res_name, name_length); }
false
false
false
false
false
0
iodbcdm_drvconn_dialbox ( HWND hwnd, LPSTR szInOutConnStr, DWORD cbInOutConnStr, int * sqlStat, SQLUSMALLINT fDriverCompletion, UWORD *config) { RETCODE retcode = SQL_ERROR; wchar_t *_string_w = NULL; if (cbInOutConnStr > 0) { if ((_string_w = malloc (cbInOutConnStr * sizeof(wchar_t) + 1)) == NULL) goto done; } dm_StrCopyOut2_A2W (szInOutConnStr, _string_w, cbInOutConnStr * sizeof(wchar_t), NULL); retcode = iodbcdm_drvconn_dialboxw (hwnd, _string_w, cbInOutConnStr, sqlStat, fDriverCompletion, config); if (retcode == SQL_SUCCESS) { dm_StrCopyOut2_W2A (_string_w, szInOutConnStr, cbInOutConnStr - 1, NULL); } done: MEM_FREE (_string_w); return retcode; }
false
true
false
false
false
1
main(int argc, char* argv[]) { if( argc < 3 ) return printhelp(NULL); bool vertexShader = false, freename = false; const char* source = 0; char* dest = 0; for( int i=1; i < argc; i++ ) { if( argv[i][0] == '-' ) { if( 0 == strcmp("-v", argv[i]) ) vertexShader = true; if( 0 == strcmp("-f", argv[i]) ) vertexShader = false; } else { if( source == 0 ) source = argv[i]; else if( dest == 0 ) dest = argv[i]; } } if( !source ) return printhelp("Must give a source"); if( !init() ) { printf("Failed to initialize glslopt!\n"); return 1; } if ( !dest ) { dest = (char *) calloc(strlen(source)+5, sizeof(char)); snprintf(dest, strlen(source)+5, "%s.out", source); freename = true; } int result = 0; if( !compileShader(dest, source, vertexShader) ) result = 1; if( freename ) free(dest); term(); return result; }
false
false
false
false
false
0
gf_odf_write_od_update(GF_BitStream *bs, GF_ODUpdate *odUp) { GF_Err e; GF_Descriptor *tmp; u32 size, i; if (! odUp) return GF_BAD_PARAM; e = gf_odf_size_od_update(odUp, &size); if (e) return e; gf_odf_write_base_descriptor(bs, odUp->tag, size); if (e) return e; i=0; while ((tmp = (GF_Descriptor *)gf_list_enum(odUp->objectDescriptors, &i))) { e = gf_odf_write_descriptor(bs, tmp); if (e) return e; } //OD commands are aligned gf_bs_align(bs); return GF_OK; }
false
false
false
false
false
0
cpl_table_get_column_names(const cpl_table *table) { cpl_array *names; cpl_size i; if (table == NULL) { cpl_error_set_(CPL_ERROR_NULL_INPUT); return NULL; } names = cpl_array_new(table->nc, CPL_TYPE_STRING); for (i = 0; i < table->nc; i++) cpl_array_set_string(names, i, cpl_column_get_name(table->columns[i])); return names; }
false
false
false
false
false
0
sensor_hub_resume(struct hid_device *hdev) { struct sensor_hub_data *pdata = hid_get_drvdata(hdev); struct hid_sensor_hub_callbacks_list *callback; unsigned long flags; hid_dbg(hdev, " sensor_hub_resume\n"); spin_lock_irqsave(&pdata->dyn_callback_lock, flags); list_for_each_entry(callback, &pdata->dyn_callback_list, list) { if (callback->usage_callback->resume) callback->usage_callback->resume( callback->hsdev, callback->priv); } spin_unlock_irqrestore(&pdata->dyn_callback_lock, flags); return 0; }
false
false
false
false
false
0
j2k_destroy_compress(opj_j2k_t *j2k) { int tileno; if(!j2k) return; if(j2k->cp != NULL) { opj_cp_t *cp = j2k->cp; if(cp->comment) { opj_free(cp->comment); } if(cp->matrice) { opj_free(cp->matrice); } for (tileno = 0; tileno < cp->tw * cp->th; tileno++) { opj_free(cp->tcps[tileno].tccps); } opj_free(cp->tcps); opj_free(cp); } opj_free(j2k); }
false
false
false
false
false
0
IsLynxScanEqui( LynxEqui, Name ) chain_list *LynxEqui; char *Name; { chain_list *Index; rdsbegin(); for ( Index = LynxEqui; Index != (chain_list *)0; Index = Index->NEXT ) { if ( (char *)(Index->DATA) == Name ) break; } rdsend(); return ( Index != (chain_list *)0 ); }
false
false
false
false
false
0
init_handles_slot (int idx) { int thr_ret; thr_ret = mono_os_mutex_lock (&scan_mutex); g_assert (thr_ret == 0); if (_wapi_private_handles [idx] == NULL) { _wapi_private_handles [idx] = g_new0 (struct _WapiHandleUnshared, _WAPI_HANDLE_INITIAL_COUNT); g_assert (_wapi_private_handles [idx]); } thr_ret = mono_os_mutex_unlock (&scan_mutex); g_assert (thr_ret == 0); }
false
false
false
false
false
0
gst_implements_interface_cast (gpointer from, GType iface_type) { GstImplementsInterface *iface; /* check cast, give warning+fail if it's invalid */ if (!(iface = G_TYPE_CHECK_INSTANCE_CAST (from, iface_type, GstImplementsInterface))) { return NULL; } /* if we're an element, take care that this interface * is actually implemented */ if (GST_IS_ELEMENT (from)) { g_return_val_if_fail (gst_element_implements_interface (GST_ELEMENT (from), iface_type), NULL); } return iface; }
false
false
false
false
false
0
free_data_refs (vec<data_reference_p> datarefs) { unsigned int i; struct data_reference *dr; FOR_EACH_VEC_ELT (datarefs, i, dr) free_data_ref (dr); datarefs.release (); }
false
false
false
false
false
0
run_all_rng_tests (const char *program) { static const char *options[] = { "--early-rng-check", "--early-rng-check --prefer-standard-rng", "--early-rng-check --prefer-fips-rng", "--early-rng-check --prefer-system-rng", "--prefer-standard-rng", "--prefer-fips-rng", "--prefer-system-rng", NULL }; int idx; size_t len, maxlen; char *cmdline; maxlen = 0; for (idx=0; options[idx]; idx++) { len = strlen (options[idx]); if (len > maxlen) maxlen = len; } maxlen += strlen (program); maxlen += strlen (" --in-recursion --verbose --debug --progress"); maxlen++; cmdline = malloc (maxlen + 1); if (!cmdline) die ("out of core\n"); for (idx=0; options[idx]; idx++) { if (verbose) inf ("now running with options '%s'\n", options[idx]); strcpy (cmdline, program); strcat (cmdline, " --in-recursion"); if (verbose) strcat (cmdline, " --verbose"); if (debug) strcat (cmdline, " --debug"); if (with_progress) strcat (cmdline, " --progress"); strcat (cmdline, " "); strcat (cmdline, options[idx]); if (system (cmdline)) die ("running '%s' failed\n", cmdline); } free (cmdline); }
false
false
false
false
false
0
__filter_xattrs (dict_t *dict) { struct list_head keys; struct _xattr_key *key; struct _xattr_key *tmp; INIT_LIST_HEAD (&keys); dict_foreach (dict, __gather_xattr_keys, (void *) &keys); list_for_each_entry_safe (key, tmp, &keys, list) { dict_del (dict, key->key); list_del_init (&key->list); GF_FREE (key); } }
false
false
false
false
false
0
dup_node(struct node *p) { struct node *node_left, *node_right; struct node *d; if(!p) return NULL; d = cli_malloc(sizeof(*d)); if(!d) { cli_errmsg("dup_node: Unable to allocate memory for duplicate node\n"); return NULL; } d->type = p->type; d->parent = NULL; switch(p->type) { case leaf: d->u.leaf_char = p->u.leaf_char; break; case leaf_class: d->u.leaf_class_bitmap = cli_malloc(32); if(!d->u.leaf_class_bitmap) { cli_errmsg("make_node: Unable to allocate memory for leaf class\n"); free(d); return NULL; } memcpy(d->u.leaf_class_bitmap, p->u.leaf_class_bitmap, 32); break; default: node_left = dup_node(p->u.children.left); node_right = dup_node(p->u.children.right); d->u.children.left = node_left; d->u.children.right = node_right; if(node_left) node_left->parent = d; if(node_right) node_right->parent = d; break; } return d; }
false
false
false
false
false
0
deinit() { if(init_flag) { mem_del(firm_build_array); mem_del(firm_bitmap_array); res_bitmap.deinit(); init_flag = 0; } }
false
false
false
false
false
0
main(int argc, char *argv[]) { if (argc < 2) { fprintf(stderr, "%s <file>\n", argv[0]); return -1; } if (load_matrix(argv[1]) < 0) { fprintf(stderr, "Error on reading intergers from file: %s\n", argv[1]); return -1; } //vertex_vertices_dump (); //edge_dump (); int min_cuts = random_contraction_min_cut (); printf("min cuts: %i\n", min_cuts); return min_cuts; }
false
false
false
false
false
0
xfs_buf_item_pin( struct xfs_log_item *lip) { struct xfs_buf_log_item *bip = BUF_ITEM(lip); ASSERT(atomic_read(&bip->bli_refcount) > 0); ASSERT((bip->bli_flags & XFS_BLI_LOGGED) || (bip->bli_flags & XFS_BLI_ORDERED) || (bip->bli_flags & XFS_BLI_STALE)); trace_xfs_buf_item_pin(bip); atomic_inc(&bip->bli_refcount); atomic_inc(&bip->bli_buf->b_pin_count); }
false
false
false
false
false
0
prestlv_print(register const u_char * pptr, register u_int len, u_int16_t op_msk _U_, int indent) { const struct forces_tlv *tlv = (struct forces_tlv *)pptr; register const u_char *tdp = (u_char *) TLV_DATA(tlv); struct res_val *r = (struct res_val *)tdp; u_int dlen; /* * pdatacnt_print() has ensured that len (the TLV length) * >= TLV_HDRL. */ dlen = len - TLV_HDRL; if (dlen != RESLEN) { printf("illegal RESULT-TLV: %d bytes!\n", dlen); return -1; } TCHECK(*r); if (r->result >= 0x18 && r->result <= 0xFE) { printf("illegal reserved result code: 0x%x!\n", r->result); return -1; } if (vflag >= 3) { char *ib = indent_pr(indent, 0); printf("%s Result: %s (code 0x%x)\n", ib, tok2str(ForCES_errs, NULL, r->result), r->result); } return 0; trunc: fputs("[|forces]", stdout); return -1; }
false
false
false
false
false
0