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 |
|---|---|---|---|---|---|---|
glob_match(const String &str, const String &pattern)
{
const char *send = str.end();
const char *pend = pattern.end();
Vector<const char *> state, nextstate;
state.push_back(pattern.data());
// quick common-case check for suffix matches
while (pattern.begin() < pend && str.begin() < send
&&... | false | false | false | false | false | 0 |
stopGame()
{
if (mpGameLogic->stopGame())
{
mpPlayManager->stopGame();
mpGameScene->stopGame();
mpGameScene->deleteGameItemGroups();
Kg::difficulty()->setGameRunning(false);
}
} | false | false | false | false | false | 0 |
compare (const value_base& other) const throw ()
{
int base = compare_base (other);
if (base != YIELD_COMPARE) return base;
if cast (&other, const ColorValue, like_other)
{
double luminance = value.get_luminance (),
other_luminance = like_other->value.get_luminance ();
if (luminance < other_luminance)
re... | false | false | false | false | false | 0 |
sequentialOverlappingRead(DcmElement *delem, DcmFileCache *dcache, unsigned char *buffer)
{
unsigned char *target = new unsigned char[BUFSIZE];
Uint32 offset = 0;
Uint32 bytes_to_read = 0;
OFCondition cond;
while (offset < BUFSIZE)
{
bytes_to_read = (rand() % 20)+1; // read 1 to 20 bytes... | false | false | false | false | false | 0 |
applicable(const S *ego, const problem *p_,
const planner *plnr)
{
const problem_mpi_rdft2 *p = (const problem_mpi_rdft2 *) p_;
return (1
&& p->sz->rnk > 1
&& p->flags == 0 /* TRANSPOSED/SCRAMBLED_IN/OUT not supported */
&& (!ego->preserve_input || (!NO_DESTROY_INPUTP(plnr)
&&... | false | false | false | false | false | 0 |
indexForRuleSet(const UChar* ruleset) const {
if (ruleset) {
for (int i = 0; i < getNumberOfRuleSets(); ++i) {
if (streq(ruleset, getRuleSetName(i))) {
return i;
}
}
}
return -1;
} | false | false | false | false | false | 0 |
gkm_gnome2_file_write_fd (GkmGnome2File *self, int fd, GkmSecret *login)
{
guint types[3] = { FILE_BLOCK_INDEX, FILE_BLOCK_PRIVATE, FILE_BLOCK_PUBLIC };
GList *unknowns, *unk;
UnknownBlock *block;
GkmDataResult res;
EggBuffer buffer;
guint type;
gint i;
g_return_val_if_fail (GKM_IS_GNOME2_FILE (self), GKM_DATA... | false | false | false | false | false | 0 |
ocfs2_qinfo_unlock(struct ocfs2_mem_dqinfo *oinfo, int ex)
{
struct ocfs2_lock_res *lockres = &oinfo->dqi_gqlock;
struct ocfs2_super *osb = OCFS2_SB(oinfo->dqi_gi.dqi_sb);
int level = ex ? DLM_LOCK_EX : DLM_LOCK_PR;
if (!ocfs2_is_hard_readonly(osb) && !ocfs2_mount_local(osb))
ocfs2_cluster_unlock(osb, lockres, l... | false | false | false | false | false | 0 |
ConnCreate(int serverFd)
{
Port *port;
if (!(port = (Port *) calloc(1, sizeof(Port))))
{
ereport(LOG,
(errcode(ERRCODE_OUT_OF_MEMORY),
errmsg("out of memory")));
ExitPostmaster(1);
}
if (StreamConnection(serverFd, port) != STATUS_OK)
{
StreamClose(port->sock);
ConnFree(port);
port = NULL;
... | false | false | false | false | false | 0 |
sm501_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
{
struct sm501_gpio_chip *smchip = to_sm501_gpio(chip);
struct sm501_gpio *smgpio = smchip->ourgpio;
unsigned long bit = 1 << offset;
void __iomem *regs = smchip->regbase;
unsigned long save;
unsigned long val;
dev_dbg(sm501_gpio_to_dev(smgpio)... | false | false | false | false | false | 0 |
simple_dmap_db_browse (SimpleDMAPDb *db,
GrlMedia *container,
GrlSource *source,
guint op_id,
guint skip,
guint count,
GrlSourceResultCb func,
gpointer user_da... | false | false | false | false | false | 0 |
__ecereMethod___ecereNameSpace__ecere__com__Map_Delete(struct __ecereNameSpace__ecere__com__Instance * this, struct __ecereNameSpace__ecere__com__MapNode * node)
{
struct __ecereNameSpace__ecere__com__MapNode * n = node;
if(((struct __ecereNameSpace__ecere__com__Instance *)(char *)this)->_class->templateArgs[5].dataTy... | false | false | false | false | false | 0 |
__unnormalize_ndx(struct net_t *np, int32 indi)
{
int32 r1, r2, obwid;
if (np->n_isarr) __getarr_range(np, &r1, &r2, &obwid);
else if (np->n_isavec) __getwir_range(np, &r1, &r2);
else return(indi);
if (r1 >= r2) return(r2 + indi); else return(r2 - indi);
} | false | false | false | false | false | 0 |
AnalyzeUsesOfPointer(Value *V,
SmallPtrSetImpl<Function *> *Readers,
SmallPtrSetImpl<Function *> *Writers,
GlobalValue *OkayStoreDest) {
if (!V->getType()->isPointerTy())
return true;
... | false | false | false | false | false | 0 |
fc_port_window_changed ( struct fc_port *port ) {
size_t window;
/* Check if transport layer is ready */
window = xfer_window ( &port->transport );
if ( window > 0 ) {
/* Transport layer is ready. Start login if the link
* is not already up.
*/
if ( ! fc_link_ok ( &port->link ) )
fc_link_start ( &po... | false | false | false | false | false | 0 |
zMakeEtermsFrom3(const zFeatureFactory *fac, coor_t pos, zSFList* sfl) {
coor_t i, frame, begin, end;
zSfeature* exon;
if (pos < PADDING) return;
if ((zGetUScore(fac->scan[STOP],pos-2) > MINIMUM_TWINSCAN_SIGNAL_SCORE) &&
(pos-2 < fac->scan[ACC]->seq->length-PADDING)) {
frame = (pos+1) % 3; /* Eterm frame i... | false | false | false | false | false | 0 |
atcommand_rankingpoint(const int fd, struct map_session_data* sd, AtCommandType command, const char* message)
{
int type,point;
struct map_session_data *pl_sd;
char char_name[100] = "";
nullpo_retr(-1, sd);
if (!message || !*message)
return -1;
if (sscanf(message, "%d %d %99[^\n]", &type, &point, char_name) <... | false | false | false | false | false | 0 |
XTIFFFdOpen(int fd, const char* name, const char* mode)
{
TIFF *tif;
/* Set up the callback */
XTIFFInitialize();
/* Open the file; the callback will set everything up
*/
tif = TIFFFdOpen(fd, name, mode);
if (!tif) return tif;
return tif;
} | false | false | false | false | false | 0 |
xsh_linetilt_is_duplicate( xsh_linetilt_list * list, float lambda,
int order )
{
int i, res = 0 ;
XSH_ASSURE_NOT_NULL( list );
for( i = 0 ; i<list->size ; i++ ) {
if ( list->list[i]->wavelength == lambda &&
list->list[i]->order == order ) {
res = 1 ;
break ;
}
}
cleanup:
re... | false | false | false | false | false | 0 |
gee_array_list_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeEqualDataFunc equal_func, void* equal_func_target, GDestroyNotify equal_func_target_destroy_notify) {
GeeArrayList * self = NULL;
GeeEqualDataFunc _tmp0_ = NULL;
void* _tmp0__target = NULL;
GeeEqu... | false | false | false | false | false | 0 |
operator+( const RealTimeInterval & difference ) const
{
SecondsCounterType seconds = this->m_Seconds + difference.m_Seconds;
MicroSecondsCounterType micro_seconds = this->m_MicroSeconds + difference.m_MicroSeconds;
CARRY_UNITS_OVER_UNSIGNED( seconds, micro_seconds );
Self result;
result.m_Seconds = sec... | false | false | false | false | false | 0 |
gnc_sql_free_query( QofBackend* pBEnd, gpointer pQuery )
{
GncSqlBackend *be = (GncSqlBackend*)pBEnd;
gnc_sql_query_info* pQueryInfo = (gnc_sql_query_info*)pQuery;
sql_backend be_data;
g_return_if_fail( pBEnd != NULL );
g_return_if_fail( pQuery != NULL );
ENTER( " " );
// Try various obje... | false | false | false | false | false | 0 |
bitwise_not_function(zval *result, zval *op1 TSRMLS_DC) /* {{{ */
{
zval op1_copy = *op1;
op1 = &op1_copy;
if (Z_TYPE_P(op1) == IS_LONG) {
ZVAL_LONG(result, ~Z_LVAL_P(op1));
return SUCCESS;
} else if (Z_TYPE_P(op1) == IS_DOUBLE) {
ZVAL_LONG(result, ~zend_dval_to_lval(Z_DVAL_P(op1)));
return SUCCESS;
} el... | false | false | false | false | false | 0 |
brcmf_vif_clear_mgmt_ies(struct brcmf_cfg80211_vif *vif)
{
s32 pktflags[] = {
BRCMF_VNDR_IE_PRBREQ_FLAG,
BRCMF_VNDR_IE_PRBRSP_FLAG,
BRCMF_VNDR_IE_BEACON_FLAG
};
int i;
for (i = 0; i < ARRAY_SIZE(pktflags); i++)
brcmf_vif_set_mgmt_ie(vif, pktflags[i], NULL, 0);
memset(&vif->saved_ie, 0, sizeof(vif->saved_... | false | false | false | false | false | 0 |
release_ref()
{
ref--;
if (ref == 0)
{
delete this;
return 0;
}
return ref;
} | false | false | false | false | false | 0 |
close(bool grace) {
_assert_(true);
SocketCore* core = (SocketCore*)opq_;
if (core->fd < 1) {
sockseterrmsg(core, "not opened");
return false;
}
bool err = false;
int32_t flags = ::fcntl(core->fd, F_GETFL, NULL);
if (::fcntl(core->fd, F_SETFL, flags | O_NONBLOCK) != 0) {
sockseterrmsg(core, "f... | false | false | false | false | false | 0 |
dfs_debug_mark (tree binfo, void * /*data*/)
{
tree t = BINFO_TYPE (binfo);
if (CLASSTYPE_DEBUG_REQUESTED (t))
return dfs_skip_bases;
CLASSTYPE_DEBUG_REQUESTED (t) = 1;
return NULL_TREE;
} | false | false | false | false | false | 0 |
toreal(const N a)
{
REAL h, l, f;
int i, bits;
ACC r;
DG sticky;
if (EXA != ZEROEXP) {
f = IRADIX;
i = LEN;
bits = 0;
h = (r = AD[--i]) * f; f *= IRADIX;
for (bits = 0; r > 0; ++bits)
r >>= 1;
/* first digit */
while (bits + SHFT <= BITS_IN_REAL) {
h += A... | false | false | false | false | false | 0 |
CheckScrollBars() {
int ls = 0, i;
PG_ScrollBar *scrollBars[] = { my_objVerticalScrollbar, my_objHorizontalScrollbar };
Uint32 listsizes[] = { GetListHeight(), GetListWidth() };
Uint16 sizes[] = { my_scrollarea->Height(), my_scrollarea->Width() };
Uint16 pos[] = { my_scrollarea->GetScrollPosY(), my_scrollarea->Get... | false | false | false | false | false | 0 |
init_call_fs(cf_node* cf) {
unsigned gpr = 0;
assert(target == TARGET_VS || target == TARGET_ES);
for(inputs_vec::const_iterator I = inputs.begin(),
E = inputs.end(); I != E; ++I, ++gpr) {
if (!I->preloaded)
add_pinned_gpr_values(cf->dst, gpr, I->comp_mask, false);
else
add_pinned_gpr_values(cf->src, ... | false | false | false | false | false | 0 |
jack_port_set_latency_range(jack_port_t *port, jack_latency_callback_mode_t mode, jack_latency_range_t *range)
{
JackGlobals::CheckContext("jack_port_set_latency_range");
uintptr_t port_aux = (uintptr_t)port;
jack_port_id_t myport = (jack_port_id_t)port_aux;
if (!CheckPort(myport)) {
jack_error... | false | false | false | false | false | 0 |
underflow() {
pos_ = 0;
buffer_[0] = 0;
if (!in_) return;
in_.read( buffer_, sizeof(buffer_)-1 );
buffer_[in_.gcount()] = 0;
} | false | false | false | false | false | 0 |
vi_prev_word(EditLine *el, Int c __attribute__((__unused__)))
{
if (el->el_line.cursor == el->el_line.buffer)
return CC_ERROR;
el->el_line.cursor = cv_prev_word(el->el_line.cursor,
el->el_line.buffer,
el->el_state.argument,
cv__isword);
if (el->el_chared.c_vcmd.action != NOP) {
cv_delfini(el);
... | false | false | false | false | false | 0 |
textCdQryNext(AjPQuery qry)
{
TextPCdEntry entry;
TextPCdQry qryd;
void* item;
qryd = qry->QryData;
if(!ajListGetLength(qry->ResultsList))
return ajFalse;
ajDebug("qry->ResultsList (b) length %Lu\n",
ajListGetLength(qry->ResultsList));
/*ajListTrace(qry->ResultsList);*/
a... | false | false | false | false | false | 0 |
wborder ( WINDOW *win, chtype ls, chtype rs,
chtype ts, chtype bs, chtype tl,
chtype tr, chtype bl, chtype br ) {
struct cursor_pos pos;
_store_curs_pos( win, &pos );
wmove(win,0,0);
_wputch(win,tl,WRAP);
while ( ( win->width - 1 ) - win->curs_x ) {
_wputch(win,ts,WRAP);
}
_wputch(win,tr,WRAP);... | false | false | false | false | false | 0 |
request_more_data (S9036_Scanner * s)
{
SANE_Status status;
int lines_available;
int bytes_per_line;
status = start_scan (s->fd, SANE_TRUE);
if (status != SANE_STATUS_GOOD)
return status;
wait_ready (s->fd);
status = get_read_sizes (s->fd, &lines_available, &bytes_per_line, 0);
if (!lines_availa... | false | false | false | false | true | 1 |
check(fp)
FILE *fp;
{
register unsigned code, c;
register int len;
char str[LENLINE];
void showcode();
unsigned guess();
code = extend ? BIT8 : BIT8 & ~DEC;
gsmode = M_ASCII;
insi = inso = innj = ingj = 0;
while (len = getstr(str, sizeof str, fp)) {
c = guess(str, len);
code |... | false | false | false | false | false | 0 |
buf_append_char (struct buffer *buf, int ch)
{
if (buf->data != NULL
&& (buf->last->text + BUFFER_DATA_SIZE
!= buf->last->bufp + buf->last->size))
{
*(buf->last->bufp + buf->last->size) = ch;
++buf->last->size;
}
else
{
char b;
b = ch;
buf_output (buf, &b, 1);
}
} | false | false | false | false | false | 0 |
chop(char *str)
{
int ret;
if (!str || !*str)
return set_errno(EINVAL);
while (str[1])
++str;
ret = *str;
*str = '\0';
return ret;
} | false | false | false | false | false | 0 |
get_layout_items_plus_primary_key(const LayoutGroup::type_list_items& items, const Document* document, const Glib::ustring& table_name)
{
if(!document)
{
std::cerr << G_STRFUNC << ": document was null." << std::endl;
return items;
}
const sharedptr<Field> field_primary_key = document->get_field_primary... | false | false | false | false | false | 0 |
GetInt(struct Expression * exp, int * value2)
{
struct Operand op2 = GetOperand(exp);
if(op2.kind == 3 && op2.type->isSigned)
*value2 = op2.i;
else if(op2.kind == 3)
*value2 = (int)op2.ui;
if(op2.kind == 4 && op2.type->isSigned)
*value2 = (int)op2.i64;
else if(op2.kind == 4)
*value2 = (int)op2.ui64;
else if(op2.kind =... | false | false | false | false | false | 0 |
nes_destroy_pau_qp(struct nes_device *nesdev, struct nes_qp *nesqp)
{
struct sk_buff *skb;
unsigned long flags;
atomic_inc(&pau_qps_destroyed);
/* Free packets that have not yet been forwarded */
/* Lock is acquired by skb_dequeue when removing the skb */
spin_lock_irqsave(&nesqp->pau_lock, flags);
while (skb_q... | false | false | false | false | false | 0 |
mlx4_en_refill_rx_buffers(struct mlx4_en_priv *priv,
struct mlx4_en_rx_ring *ring)
{
int index = ring->prod & ring->size_mask;
while ((u32) (ring->prod - ring->cons) < ring->actual_size) {
if (mlx4_en_prepare_rx_desc(priv, ring, index,
GFP_ATOMIC | __GFP_COLD))
break;
ring->prod++;
index =... | false | false | false | false | false | 0 |
ntfs_mark_quotas_out_of_date(ntfs_volume *vol)
{
ntfs_index_context *ictx;
QUOTA_CONTROL_ENTRY *qce;
const le32 qid = QUOTA_DEFAULTS_ID;
int err;
ntfs_debug("Entering.");
if (NVolQuotaOutOfDate(vol))
goto done;
if (!vol->quota_ino || !vol->quota_q_ino) {
ntfs_error(vol->sb, "Quota inodes are not open.");
... | false | false | false | false | false | 0 |
WriteInputMatrixShaper(cmsIOHANDLER* m, cmsHPROFILE hProfile, cmsStage* Matrix, cmsStage* Shaper)
{
cmsColorSpaceSignature ColorSpace;
int rc;
cmsCIEXYZ BlackPointAdaptedToD50;
ColorSpace = cmsGetColorSpace(hProfile);
cmsDetectBlackPoint(&BlackPointAdaptedToD50, hProfile, INTENT_RELATIVE_COLORIMET... | false | false | false | false | false | 0 |
AutoCompleteCompleted() {
int item = ac.GetSelection();
if (item == -1) {
AutoCompleteCancel();
return;
}
const std::string selected = ac.GetValue(item);
ac.Show(false);
SCNotification scn; memset(&scn, 0x00, sizeof(scn)); // C::B patch
scn.nmhdr.code = listType > 0 ? SCN_USERLISTSELECTION : SCN_AUTOCSELE... | false | false | false | false | false | 0 |
reset(){
int i,j,k,num=1;
for (i=0;i<3;i++){
for (j=0;j<3;j++){
for (k=0;k<3;k++){
pieces[i][j][k] = new Piece(point4(i-1,j-1,k-1,1.0), num++);
}
}
}
} | false | false | false | false | false | 0 |
visu_surfaces_setResource(VisuSurfaces *surf, int surf_index, VisuSurfacesResources *res)
{
int id;
g_return_if_fail(surf && res);
id = visu_surfaces_getPosition(surf, surf_index);
g_return_if_fail(id >= 0 && (guint)id < surf->nsurf);
if (!surf->resources[id]->surfnom)
visu_surfaces_resources_free(surf... | false | false | false | false | false | 0 |
executeJob()
{
QMutexLocker locker( &m_mutex );
if ( m_enabled && m_regions.count() > 0 )
calculateRegion( m_regions.takeFirst() );
finishJob();
handleState();
} | false | false | false | false | false | 0 |
alloc(size_t length, size_t* allocated, uint32_t flags) {
const VMemLocal& vMem = vMemGet();
size_t msize = IntUtil::alignTo<size_t>(length, vMem.pageSize);
int protection = PROT_READ;
if (flags & kVMemFlagWritable ) protection |= PROT_WRITE;
if (flags & kVMemFlagExecutable) protection |= PROT_EXEC;
void... | false | false | false | false | false | 0 |
duplicateAbstractFile2(AbstractFile* file, AbstractFile* backing, const unsigned int* key, const unsigned int* iv, AbstractFile* certificate) {
uint32_t signatureBE;
uint32_t signatureLE;
AbstractFile* orig;
AbstractFile* newFile;
file->seek(file, 0);
file->read(file, &signatureBE, sizeof(signatureBE));
signat... | false | false | false | false | false | 0 |
gst_structure_get_abbrs (gint * n_abbrs)
{
static GstStructureAbbreviation *abbrs = NULL;
static volatile gsize num = 0;
if (g_once_init_enter (&num)) {
/* dynamically generate the array */
gsize _num;
GstStructureAbbreviation dyn_abbrs[] = {
{"int", G_TYPE_INT}
,
{"i", G_TYPE_INT}
... | false | false | false | false | false | 0 |
photobucket_album_properties_dialog_construct (PhotobucketAlbumPropertiesDialog *self,
const char *name,
GList *albums)
{
GList *scan;
if (name != NULL)
gtk_entry_set_text (GTK_ENTRY (GET_WIDGET ("name_entry")), name);
gtk_lis... | false | false | false | false | false | 0 |
evaluate_eq_attr (exp, value, insn_code, insn_index)
rtx exp;
rtx value;
int insn_code, insn_index;
{
rtx orexp, andexp;
rtx right;
rtx newexp;
int i;
if (GET_CODE (value) == CONST_STRING)
{
if (! strcmp (XSTR (value, 0), XSTR (exp, 1)))
newexp = true_rtx;
else
newexp = false... | false | false | false | false | false | 0 |
get_atk_relation_type_from_java_key (JNIEnv *jniEnv,
jstring jrel_key)
{
if ( is_java_relation_key(jniEnv, jrel_key, "CHILD_NODE_OF") ) {
return ATK_RELATION_NODE_CHILD_OF;
}
if ( is_java_relation_key(jniEnv, jrel_key, "CONTROLLED_BY") ) {
return ATK_RELATION_CONTROLLED_BY;
}
if ( is_java_relation_key(jniE... | false | false | false | false | false | 0 |
process(const float *R__ mag, size_t /*increment*/)
{
float result = 0.0;
const int sz = m_windowSize / 2;
for (int n = 0; n <= sz; ++n) {
result = result + mag[n] * n;
}
return result;
} | false | false | false | false | false | 0 |
emit_engine_emit_cast( Chuck_Emitter * emit,
Chuck_Type * to, Chuck_Type * from )
{
// if type is already the same
if( equals( to, from ) )
return TRUE;
// int to float
if( equals( to, &t_int ) && equals( from, &t_float ) )
emit->append( new Chuck_Instr_... | false | false | false | false | false | 0 |
recordMatchesDataset(DcmDirectoryRecord *record,
DcmItem *dataset)
{
OFBool result = OFFalse;
if ((record != NULL) && (dataset != NULL))
{
OFString recordString, datasetString;
/* check matching depending on record type */
switch (record... | false | false | false | false | false | 0 |
pdf_text_widget_set_text(pdf_document *doc, fz_widget *tw, char *text)
{
pdf_annot *annot = (pdf_annot *)tw;
fz_context *ctx = doc->ctx;
int accepted = 0;
fz_try(ctx)
{
accepted = run_keystroke(doc, annot->obj, &text);
if (accepted)
accepted = pdf_field_set_value(doc, annot->obj, text);
}
fz_catch(ctx)
... | false | false | false | false | false | 0 |
ringbuf_copy(Ringbuf *rb){
Ringbuf *out;
out = ringbuf_init(&out, rb->fill+1);
int i;
/*
for(i = rb->read; i != rb->write; i=(i+1)%(rb->num_keys)){
out->keys[i] = rb->keys[i]; // now out is in charge of the memory
rb->keys[i] = NULL;
}
*/
int offset = rb->read;
for(i = rb->read; i != rb->write; i=(i+1)%(rb... | false | false | false | false | false | 0 |
usbnet_set_settings (struct net_device *net, struct ethtool_cmd *cmd)
{
struct usbnet *dev = netdev_priv(net);
int retval;
if (!dev->mii.mdio_write)
return -EOPNOTSUPP;
retval = mii_ethtool_sset(&dev->mii, cmd);
/* link speed/duplex might have changed */
if (dev->driver_info->link_reset)
dev->driver_info->... | false | false | false | false | false | 0 |
pdf_SepRGB_ConvertToCMYK (float *in, float *out)
{
float CMYK[4];
int i;
if (in[0] <= in[1] && in[0] <= in[2]) {
CMYK[3] = 1.0 - in[0];
} else {
if (in[1]<= in[0] && in[1] <= in[2]) {
CMYK[3] = 1.0 - in[1];
} else {
CMYK[3] = 1.0 - in[2];
}
}
... | false | false | false | false | false | 0 |
ios_setbuf(ios_t *s, char *buf, size_t size, int own)
{
ios_flush(s);
size_t nvalid=0;
nvalid = (size < s->size) ? size : s->size;
if (nvalid > 0)
memcpy(buf, s->buf, nvalid);
if (s->bpos > nvalid) {
// truncated
s->bpos = nvalid;
}
s->size = nvalid;
if (s->buf!... | false | true | false | false | false | 1 |
vidioc_enumaudio(struct file *file, void *fh, struct v4l2_audio *a)
{
struct go7007 *go = video_drvdata(file);
if (a->index >= go->board_info->num_aud_inputs)
return -EINVAL;
strlcpy(a->name, go->board_info->aud_inputs[a->index].name,
sizeof(a->name));
a->capability = V4L2_AUDCAP_STEREO;
return 0;
} | false | false | false | false | false | 0 |
makeSvg(ViewLayer::ViewLayerID viewLayerID) {
static const double labelFontSize = 200;
static const double totalHeight = 300;
static const double arrowWidth = totalHeight / 2;
static const double strokeWidth = 10;
static const double halfStrokeWidth = strokeWidth / 2;
static const double labelOf... | false | false | false | false | false | 0 |
ProjectManager_AddFileToProject(HSQUIRRELVM v)
{
StackHandler sa(v);
int paramCount = sa.GetParamCount();
if (paramCount == 4)
{
if (sa.GetType(4) == OT_INTEGER)
{
wxString fname = *SqPlus::GetInstance<wxString,false>(v, 2);
cbP... | false | false | false | false | false | 0 |
readdecesc (LexState *ls) {
int c[3], i;
int r = 0; /* result accumulator */
for (i = 0; i < 3 && lisdigit(ls->current); i++) { /* read up to 3 digits */
c[i] = ls->current;
r = 10*r + c[i] - '0';
next(ls);
}
if (r > UCHAR_MAX)
escerror(ls, c, i, "decimal escape too large");
return r;
} | false | false | false | false | false | 0 |
enlarge_s3_buf(struct srec_data *srec)
{
srec->s3_records = (struct s3_record *)
realloc(srec->s3_records,
2 * srec->s3_entries * sizeof(struct s3_record));
if (srec->s3_records == NULL) {
printf("Could not allocate memory for S3 records.\n");
exit(1);
}
memset(&srec->s3_records[srec->s3_entries], 0,
... | false | false | false | false | false | 0 |
kbd_backlight_read(struct samsung_laptop *samsung)
{
const struct sabi_commands *commands = &samsung->config->commands;
struct sabi_data data;
int retval;
memset(&data, 0, sizeof(data));
data.data[0] = 0x81;
retval = sabi_command(samsung, commands->kbd_backlight,
&data, &data);
if (retval)
return re... | false | false | false | false | false | 0 |
IsHomeDir(char *name)
/* This assumes that the dir lies under mountpattern */
{ char *sp;
struct Item *ip;
int slashes;
if (name == NULL || strlen(name) == 0)
{
return false;
}
if (VMOUNTLIST == NULL)
{
return (false);
}
for (ip = VHOMEPATLIST; ip != NULL; ip=ip->next)
{
slashe... | false | false | false | false | false | 0 |
hupHandler(int sig)
{
char byte = 'H';
if (!HupPending) {
HupPending = 1;
if (!CharPending) {
int errno_save = errno;
write(Pipe[1], &byte, 1);
errno = errno_save;
CharPending = 1;;
}
}
} | false | false | false | false | false | 0 |
chooseDownloadDirectory()
{
QString fileName = QFileDialog::getExistingDirectory(this, tr("Choose Directory"), downloadsLocation->text());
downloadsLocation->setText(fileName);
} | false | false | false | false | false | 0 |
gdm_xdmcp_send_got_managed_forward (GdmXdmcpDisplayFactory *factory,
GdmAddress *address,
GdmAddress *origin)
{
ARRAY8 addr;
XdmcpHeader header;
char *host;
host = NULL;
gd... | false | false | false | false | false | 0 |
hpsa_get_raid_map(struct ctlr_info *h,
unsigned char *scsi3addr, struct hpsa_scsi_dev_t *this_device)
{
int rc = 0;
struct CommandList *c;
struct ErrorInfo *ei;
c = cmd_alloc(h);
if (fill_cmd(c, HPSA_GET_RAID_MAP, h, &this_device->raid_map,
sizeof(this_device->raid_map), 0,
scsi3addr, TYPE_CMD)) {
dev_w... | false | false | false | false | false | 0 |
poll_reload(void)
{
int ret;
ret = sysconf(_SC_OPEN_MAX);
if (ret < maxconn) {
fatalx(EXIT_FAILURE,
"Your system limits the maximum number of connections to %d\n"
"but you requested %d. The server won't start until this\n"
"problem is resolved.\n", ret, maxconn);
}
fds = xrealloc(fds, maxconn * sizeo... | false | false | false | false | false | 0 |
hci_uart_dequeue(struct hci_uart *hu)
{
struct sk_buff *skb = hu->tx_skb;
if (!skb)
skb = hu->proto->dequeue(hu);
else
hu->tx_skb = NULL;
return skb;
} | false | false | false | false | false | 0 |
openraw(
char *dev_name // Name of device to open in raw mode
)
{
int dev_fdes; // open file designator
struct termio dev_termio; // man termio for usage info
// Open device for read/write access
if ((dev_fdes = open(dev_name, O_RDWR)) < 0)
{
return dev_fdes;
} // error openi... | false | false | false | false | false | 0 |
mailmessage_generic_fetch_section_body(mailmessage * msg_info,
struct mailmime * mime,
char ** result,
size_t * result_len)
{
MMAPString * mmapstr;
int r;
int res;
size_t cur_token;
cur_token = 0;
if (mime->mm_type == MAILMIME_MESSAGE) {
/* skip header */
while (... | false | false | false | false | false | 0 |
fix_fastsincos(fix a,fix *s,fix *c)
{
int i;
i = (a>>8)&0xff;
if (s) *s = sincos_table[i] << 2;
if (c) *c = sincos_table[i+64] << 2;
} | false | false | false | false | false | 0 |
finish_bookmark(void)
{
struct unistim_device *d = devices;
int i;
ast_mutex_lock(&devicelock);
while (d) {
for (i = 0; i < 6; i++) {
if (d->softkeyicon[i] == 1) { /* Something for us */
struct unistim_device *d2 = devices;
while (d2) {
if (!strcmp(d->softkeydevice[i], d2->name)) {
d->sp[i... | true | true | false | false | true | 1 |
main(int argc, char **argv)
{
ESL_GETOPTS *go = NULL;
ESL_RANDOMNESS *r = NULL;
int nselect = 0;
char *filename = NULL;
FILE *fp = NULL;
char **larr = NULL;
char *buf = NULL;
int buflen = 0;
char ... | false | false | true | true | true | 1 |
cw1200_link_id_reset(struct work_struct *work)
{
struct cw1200_common *priv =
container_of(work, struct cw1200_common, linkid_reset_work);
int temp_linkid;
if (!priv->action_linkid) {
/* In GO mode we can receive ACTION frames without a linkID */
temp_linkid = cw1200_alloc_link_id(priv,
&priv->action_fram... | false | false | false | false | false | 0 |
getDictLookup(const ContainedPtr& cont, const string& suffix = string())
{
string scope = Slice::Python::scopedToName(cont->scope());
assert(!scope.empty());
string package = Slice::Python::getPackageMetadata(cont);
if(!package.empty())
{
scope = package + "." + scope;
}
return "_M... | false | false | false | false | false | 0 |
gkd_secret_service_finalize (GObject *obj)
{
GkdSecretService *self = GKD_SECRET_SERVICE (obj);
g_assert (g_hash_table_size (self->clients) == 0);
g_hash_table_destroy (self->clients);
self->clients = NULL;
g_hash_table_destroy (self->aliases);
self->aliases = NULL;
G_OBJECT_CLASS (gkd_secret_service_parent_c... | false | false | false | false | false | 0 |
LI1__MAKE_CONTEXT__sharp(object first,...)
{
va_list ap;
int narg = VFUN_NARGS; VMB1 VMS1 VMV1
{object V1;
object V2;
object V3;
va_start(ap,first);
narg= narg - 0;
{
parse_key_new_new(narg,Vcs +0,(struct key *)(void *)&LI1key,first,ap);
if(Vcs[0]==OBJNULL){
V1= (VFUN_NARGS=5,(*(LnkLI22))(small_fixnum(0),((... | false | false | false | false | false | 0 |
gf_proc_dump_mem_info_to_dict (dict_t *dict)
{
if (!dict)
return;
#ifdef HAVE_MALLOC_STATS
struct mallinfo info;
int ret = -1;
memset (&info, 0, sizeof(struct mallinfo));
info = mallinfo ();
ret = dict_set_int32 (dict, "mallinfo.arena", info.arena);... | false | false | false | false | false | 0 |
format_mg_data(FILE *out, const void *thing, size_t count) {
const struct mg_data_t *p = (const struct mg_data_t *)thing;
while (1) {
if (p->value) {
fprintf(out, " %s\n %s", p->comment, p->value);
} else {
fputs(" 0", out);
}
++p;
if (!--count)
break;
fputs(",... | false | false | false | false | false | 0 |
string_to_T(vector<string>& vi, const string& s) {
string str(s), delin(",");
if(str.find(":")!=string::npos)
delin = ":";
str=str+delin;
vi.clear();
while(str.size()) {
string v = str.substr(0,str.find(delin));
vi.push_back(v);
str = str.substr(str.find(delin)+1,str.length()... | false | false | false | false | false | 0 |
add_power_attributes(struct device *dev)
{
int rc = 0;
if (is_usb_device(dev)) {
struct usb_device *udev = to_usb_device(dev);
rc = sysfs_merge_group(&dev->kobj, &power_attr_group);
if (udev->usb2_hw_lpm_capable == 1)
rc = sysfs_merge_group(&dev->kobj,
&usb2_hardware_lpm_attr_group);
if (udev->speed ... | false | false | false | false | false | 0 |
e_cal_backend_store_get_components_occuring_in_range (ECalBackendStore *store,
time_t start,
time_t end)
{
GList *l, *objects;
GSList *list = NULL;
icalcomponent *icalcomp;
g_return_val_if_fail (store != NUL... | false | false | false | false | false | 0 |
parse_comment( IOBUF inp, int pkttype, unsigned long pktlen, PACKET *packet )
{
byte *p;
/* Cap comment packet at a reasonable value to avoid an integer
overflow in the malloc below. Comment packets are actually not
anymore define my OpenPGP and we even stopped to use our
private comment ... | false | false | false | false | false | 0 |
isChild(const Window* window) const
{
const size_t child_count = getChildCount();
for (size_t i = 0; i < child_count; ++i)
if (d_children[i] == window)
return true;
return false;
} | false | false | false | false | false | 0 |
x_dialog_delattrib()
{
GtkWidget *dialog;
gint mincol, maxcol;
GtkSheet *sheet;
gint cur_page;
/* First verify that exactly one column is selected. */
cur_page = gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook));
sheet = GTK_SHEET(sheets[cur_page]);
if (sheet == NULL) {
return;
}
mincol ... | false | false | false | false | false | 0 |
_hs_bytestring_int_dec (int x, char* buf)
{
char c, *ptr = buf, *next_free;
int x_tmp;
// we cannot negate directly as 0 - (minBound :: Int) = minBound
if (x < 0) {
*ptr++ = '-';
buf++;
x_tmp = x;
x /= 10;
*ptr++ = digits[x * 10 - x_tmp];
if (x == 0)
... | false | false | false | false | false | 0 |
updateSeqStarts(MethodBlock *mb, char *code_pntr, BasicBlock *start,
int ins_start, BasicBlock *end, int ins_end) {
TRACE("Updating start block (%d len %d) %p\n", INUM(mb, start, ins_start),
start->length - ins_start, code_pntr);
start->start[ins_start].handler = code_pntr;
... | false | false | false | false | false | 0 |
drawCross ()
{
glDisable (GL_LIGHTING);
gl->enableAlphaBlending ();
glEnable (GL_ALPHA_TEST);
glAlphaFunc (GL_GEQUAL, 0.1);
// glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
if (fplayer->o == &model_fig || fplayer->o == &model_figg)
{
gl->enableTextures (texcross->textureID);... | false | false | false | false | false | 0 |
MakeExternal(v8::String::ExternalStringResource* resource) {
// Externalizing twice leaks the external resource, so it's
// prohibited by the API.
ASSERT(!this->IsExternalString());
#ifdef DEBUG
if (FLAG_enable_slow_asserts) {
// Assert that the resource and the string are equivalent.
ASSERT(static_cast... | false | false | false | false | false | 0 |
test_get_double (void)
{
JsonNode *node = json_node_new (JSON_NODE_VALUE);
json_node_set_double (node, 3.14);
g_assert_cmpfloat (json_node_get_double (node), ==, 3.14);
g_assert_cmpint (json_node_get_int (node), ==, 3);
g_assert (json_node_get_boolean (node));
json_node_free (node);
} | false | false | false | false | false | 0 |
pmbus_add_limit_attrs(struct i2c_client *client,
struct pmbus_data *data,
const struct pmbus_driver_info *info,
const char *name, int index, int page,
struct pmbus_sensor *base,
const struct pmbus_sensor_attr *attr)
{
const struct pmbus_limit_attr *l = attr->limit;
int nlimit = attr->nlimit;
... | false | false | false | false | false | 0 |
dicod_get_database_languages(dicod_database_t *db, dico_list_t dlist[])
{
if (!(db->flags & DICOD_DBF_LANG)) {
dicod_module_instance_t *inst = db->instance;
if (inst->module->dico_db_lang) {
/* FIXME: Return code? */
inst->module->dico_db_lang(db->mod_handle, db->langlist);
if (db->langlist[0] || d... | false | false | false | false | false | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.