idx
int64
func
string
target
int64
296,858
static int vidioc_s_input(struct file *file, void *fh, unsigned int i) { struct v4l2_loopback_device *dev = v4l2loopback_getdevice(file); if (!dev->announce_all_caps && !dev->ready_for_capture) return -ENOTTY; if (i == 0) return 0; return -EINVAL; }
0
303,882
TEST_F(QuicUnencryptedServerTransportTest, FirstPacketProcessedCallback) { getFakeHandshakeLayer()->allowZeroRttKeys(); EXPECT_CALL(connCallback, onFirstPeerPacketProcessed()).Times(1); recvClientHello(); loopForWrites(); AckBlocks acks; acks.insert(0); auto aead = getInitialCipher(); auto headerCipher = getInitialHeaderCipher(); EXPECT_CALL(connCallback, onFirstPeerPacketProcessed()).Times(0); deliverData(packetToBufCleartext( createAckPacket( server->getNonConstConn(), clientNextInitialPacketNum, acks, PacketNumberSpace::Initial, aead.get()), *aead, *headerCipher, clientNextInitialPacketNum)); }
0
216,730
bool doReadUintHelper(T* value) { *value = 0; uint8_t currentByte; int shift = 0; do { if (m_position >= m_length) return false; currentByte = m_buffer[m_position++]; *value |= ((currentByte & varIntMask) << shift); shift += varIntShift; } while (currentByte & (1 << varIntShift)); return true; }
0
98,052
static void out_string(conn *c, const char *str) { size_t len; assert(c != NULL); if (c->noreply) { if (settings.verbose > 1) fprintf(stderr, ">%d NOREPLY %s\n", c->sfd, str); c->noreply = false; conn_set_state(c, conn_new_cmd); return; } if (settings.verbose > 1) fprintf(stderr, ">%d %s\n", c->sfd, str); /* Nuke a partial output... */ c->msgcurr = 0; c->msgused = 0; c->iovused = 0; add_msghdr(c); len = strlen(str); if ((len + 2) > c->wsize) { /* ought to be always enough. just fail for simplicity */ str = "SERVER_ERROR output line too long"; len = strlen(str); } memcpy(c->wbuf, str, len); memcpy(c->wbuf + len, "\r\n", 2); c->wbytes = len + 2; c->wcurr = c->wbuf; conn_set_state(c, conn_write); c->write_and_go = conn_new_cmd; return; }
0
348,759
void Downstream::inspect_http1_request() { if (req_.method == HTTP_CONNECT) { req_.upgrade_request = true; } else if (req_.http_minor > 0) { auto upgrade = req_.fs.header(http2::HD_UPGRADE); if (upgrade) { const auto &val = upgrade->value; // TODO Perform more strict checking for upgrade headers if (util::streq_l(NGHTTP2_CLEARTEXT_PROTO_VERSION_ID, val.c_str(), val.size())) { req_.http2_upgrade_seen = true; } else { req_.upgrade_request = true; // TODO Should we check Sec-WebSocket-Key, and // Sec-WebSocket-Version as well? if (util::strieq_l("websocket", val)) { req_.connect_proto = ConnectProto::WEBSOCKET; } } } } auto transfer_encoding = req_.fs.header(http2::HD_TRANSFER_ENCODING); if (transfer_encoding) { req_.fs.content_length = -1; if (util::iends_with_l(transfer_encoding->value, "chunked")) { chunked_request_ = true; } } }
1
192,526
RenderRegion* RenderBlock::regionAtBlockOffset(LayoutUnit blockOffset) const { RenderFlowThread* flowThread = flowThreadContainingBlock(); if (!flowThread || !flowThread->hasValidRegionInfo()) return 0; return flowThread->regionAtBlockOffset(offsetFromLogicalTopOfFirstPage() + blockOffset, true); }
0
486,181
usage (void) { printf ("Usage: %s [OPTIONS]\n", prog); }
0
297,441
sixel_allocator_calloc( sixel_allocator_t /* in */ *allocator, /* allocator object */ size_t /* in */ nelm, /* number of elements */ size_t /* in */ elsize) /* size of element */ { size_t n; /* precondition */ assert(allocator); assert(allocator->fn_calloc); n = nelm * elsize; if (n == 0) { sixel_helper_set_additional_message( "sixel_allocator_malloc: called with n == 0"); return NULL; } if (n > SIXEL_ALLOCATE_BYTES_MAX) { return NULL; } return allocator->fn_calloc(nelm, elsize); }
0
351,094
Init_date_core(void) { #ifdef HAVE_RB_EXT_RACTOR_SAFE RB_EXT_RACTOR_SAFE(true); #endif id_cmp = rb_intern_const("<=>"); id_le_p = rb_intern_const("<="); id_ge_p = rb_intern_const(">="); id_eqeq_p = rb_intern_const("=="); half_days_in_day = rb_rational_new2(INT2FIX(1), INT2FIX(2)); #if (LONG_MAX / DAY_IN_SECONDS) > SECOND_IN_NANOSECONDS day_in_nanoseconds = LONG2NUM((long)DAY_IN_SECONDS * SECOND_IN_NANOSECONDS); #elif defined HAVE_LONG_LONG day_in_nanoseconds = LL2NUM((LONG_LONG)DAY_IN_SECONDS * SECOND_IN_NANOSECONDS); #else day_in_nanoseconds = f_mul(INT2FIX(DAY_IN_SECONDS), INT2FIX(SECOND_IN_NANOSECONDS)); #endif rb_gc_register_mark_object(half_days_in_day); rb_gc_register_mark_object(day_in_nanoseconds); positive_inf = +INFINITY; negative_inf = -INFINITY; /* * date and datetime class - Tadayoshi Funaba 1998-2011 * * 'date' provides two classes: Date and DateTime. * * == Terms and Definitions * * Some terms and definitions are based on ISO 8601 and JIS X 0301. * * === Calendar Date * * The calendar date is a particular day of a calendar year, * identified by its ordinal number within a calendar month within * that year. * * In those classes, this is so-called "civil". * * === Ordinal Date * * The ordinal date is a particular day of a calendar year identified * by its ordinal number within the year. * * In those classes, this is so-called "ordinal". * * === Week Date * * The week date is a date identified by calendar week and day numbers. * * The calendar week is a seven day period within a calendar year, * starting on a Monday and identified by its ordinal number within * the year; the first calendar week of the year is the one that * includes the first Thursday of that year. In the Gregorian * calendar, this is equivalent to the week which includes January 4. * * In those classes, this is so-called "commercial". * * === Julian Day Number * * The Julian day number is in elapsed days since noon (Greenwich Mean * Time) on January 1, 4713 BCE (in the Julian calendar). * * In this document, the astronomical Julian day number is the same as * the original Julian day number. And the chronological Julian day * number is a variation of the Julian day number. Its days begin at * midnight on local time. * * In this document, when the term "Julian day number" simply appears, * it just refers to "chronological Julian day number", not the * original. * * In those classes, those are so-called "ajd" and "jd". * * === Modified Julian Day Number * * The modified Julian day number is in elapsed days since midnight * (Coordinated Universal Time) on November 17, 1858 CE (in the * Gregorian calendar). * * In this document, the astronomical modified Julian day number is * the same as the original modified Julian day number. And the * chronological modified Julian day number is a variation of the * modified Julian day number. Its days begin at midnight on local * time. * * In this document, when the term "modified Julian day number" simply * appears, it just refers to "chronological modified Julian day * number", not the original. * * In those classes, those are so-called "amjd" and "mjd". * * == Date * * A subclass of Object that includes the Comparable module and * easily handles date. * * A Date object is created with Date::new, Date::jd, Date::ordinal, * Date::commercial, Date::parse, Date::strptime, Date::today, * Time#to_date, etc. * * require 'date' * * Date.new(2001,2,3) * #=> #<Date: 2001-02-03 ...> * Date.jd(2451944) * #=> #<Date: 2001-02-03 ...> * Date.ordinal(2001,34) * #=> #<Date: 2001-02-03 ...> * Date.commercial(2001,5,6) * #=> #<Date: 2001-02-03 ...> * Date.parse('2001-02-03') * #=> #<Date: 2001-02-03 ...> * Date.strptime('03-02-2001', '%d-%m-%Y') * #=> #<Date: 2001-02-03 ...> * Time.new(2001,2,3).to_date * #=> #<Date: 2001-02-03 ...> * * All date objects are immutable; hence cannot modify themselves. * * The concept of a date object can be represented as a tuple * of the day count, the offset and the day of calendar reform. * * The day count denotes the absolute position of a temporal * dimension. The offset is relative adjustment, which determines * decoded local time with the day count. The day of calendar * reform denotes the start day of the new style. The old style * of the West is the Julian calendar which was adopted by * Caesar. The new style is the Gregorian calendar, which is the * current civil calendar of many countries. * * The day count is virtually the astronomical Julian day number. * The offset in this class is usually zero, and cannot be * specified directly. * * A Date object can be created with an optional argument, * the day of calendar reform as a Julian day number, which * should be 2298874 to 2426355 or negative/positive infinity. * The default value is +Date::ITALY+ (2299161=1582-10-15). * See also sample/cal.rb. * * $ ruby sample/cal.rb -c it 10 1582 * October 1582 * S M Tu W Th F S * 1 2 3 4 15 16 * 17 18 19 20 21 22 23 * 24 25 26 27 28 29 30 * 31 * * $ ruby sample/cal.rb -c gb 9 1752 * September 1752 * S M Tu W Th F S * 1 2 14 15 16 * 17 18 19 20 21 22 23 * 24 25 26 27 28 29 30 * * A Date object has various methods. See each reference. * * d = Date.parse('3rd Feb 2001') * #=> #<Date: 2001-02-03 ...> * d.year #=> 2001 * d.mon #=> 2 * d.mday #=> 3 * d.wday #=> 6 * d += 1 #=> #<Date: 2001-02-04 ...> * d.strftime('%a %d %b %Y') #=> "Sun 04 Feb 2001" * */ cDate = rb_define_class("Date", rb_cObject); eDateError = rb_define_class_under(cDate, "Error", rb_eArgError); rb_include_module(cDate, rb_mComparable); /* An array of strings of full month names in English. The first * element is nil. */ rb_define_const(cDate, "MONTHNAMES", mk_ary_of_str(13, monthnames)); /* An array of strings of abbreviated month names in English. The * first element is nil. */ rb_define_const(cDate, "ABBR_MONTHNAMES", mk_ary_of_str(13, abbr_monthnames)); /* An array of strings of the full names of days of the week in English. * The first is "Sunday". */ rb_define_const(cDate, "DAYNAMES", mk_ary_of_str(7, daynames)); /* An array of strings of abbreviated day names in English. The * first is "Sun". */ rb_define_const(cDate, "ABBR_DAYNAMES", mk_ary_of_str(7, abbr_daynames)); /* The Julian day number of the day of calendar reform for Italy * and some catholic countries. */ rb_define_const(cDate, "ITALY", INT2FIX(ITALY)); /* The Julian day number of the day of calendar reform for England * and her colonies. */ rb_define_const(cDate, "ENGLAND", INT2FIX(ENGLAND)); /* The Julian day number of the day of calendar reform for the * proleptic Julian calendar. */ rb_define_const(cDate, "JULIAN", DBL2NUM(JULIAN)); /* The Julian day number of the day of calendar reform for the * proleptic Gregorian calendar. */ rb_define_const(cDate, "GREGORIAN", DBL2NUM(GREGORIAN)); rb_define_alloc_func(cDate, d_lite_s_alloc_simple); #ifndef NDEBUG rb_define_private_method(CLASS_OF(cDate), "_valid_jd?", date_s__valid_jd_p, -1); rb_define_private_method(CLASS_OF(cDate), "_valid_ordinal?", date_s__valid_ordinal_p, -1); rb_define_private_method(CLASS_OF(cDate), "_valid_civil?", date_s__valid_civil_p, -1); rb_define_private_method(CLASS_OF(cDate), "_valid_date?", date_s__valid_civil_p, -1); rb_define_private_method(CLASS_OF(cDate), "_valid_commercial?", date_s__valid_commercial_p, -1); rb_define_private_method(CLASS_OF(cDate), "_valid_weeknum?", date_s__valid_weeknum_p, -1); rb_define_private_method(CLASS_OF(cDate), "_valid_nth_kday?", date_s__valid_nth_kday_p, -1); #endif rb_define_singleton_method(cDate, "valid_jd?", date_s_valid_jd_p, -1); rb_define_singleton_method(cDate, "valid_ordinal?", date_s_valid_ordinal_p, -1); rb_define_singleton_method(cDate, "valid_civil?", date_s_valid_civil_p, -1); rb_define_singleton_method(cDate, "valid_date?", date_s_valid_civil_p, -1); rb_define_singleton_method(cDate, "valid_commercial?", date_s_valid_commercial_p, -1); #ifndef NDEBUG rb_define_private_method(CLASS_OF(cDate), "valid_weeknum?", date_s_valid_weeknum_p, -1); rb_define_private_method(CLASS_OF(cDate), "valid_nth_kday?", date_s_valid_nth_kday_p, -1); rb_define_private_method(CLASS_OF(cDate), "zone_to_diff", date_s_zone_to_diff, 1); #endif rb_define_singleton_method(cDate, "julian_leap?", date_s_julian_leap_p, 1); rb_define_singleton_method(cDate, "gregorian_leap?", date_s_gregorian_leap_p, 1); rb_define_singleton_method(cDate, "leap?", date_s_gregorian_leap_p, 1); #ifndef NDEBUG rb_define_singleton_method(cDate, "new!", date_s_new_bang, -1); rb_define_alias(rb_singleton_class(cDate), "new_l!", "new"); #endif rb_define_singleton_method(cDate, "jd", date_s_jd, -1); rb_define_singleton_method(cDate, "ordinal", date_s_ordinal, -1); rb_define_singleton_method(cDate, "civil", date_s_civil, -1); rb_define_singleton_method(cDate, "commercial", date_s_commercial, -1); #ifndef NDEBUG rb_define_singleton_method(cDate, "weeknum", date_s_weeknum, -1); rb_define_singleton_method(cDate, "nth_kday", date_s_nth_kday, -1); #endif rb_define_singleton_method(cDate, "today", date_s_today, -1); rb_define_singleton_method(cDate, "_strptime", date_s__strptime, -1); rb_define_singleton_method(cDate, "strptime", date_s_strptime, -1); rb_define_singleton_method(cDate, "_parse", date_s__parse, -1); rb_define_singleton_method(cDate, "parse", date_s_parse, -1); rb_define_singleton_method(cDate, "_iso8601", date_s__iso8601, 1); rb_define_singleton_method(cDate, "iso8601", date_s_iso8601, -1); rb_define_singleton_method(cDate, "_rfc3339", date_s__rfc3339, 1); rb_define_singleton_method(cDate, "rfc3339", date_s_rfc3339, -1); rb_define_singleton_method(cDate, "_xmlschema", date_s__xmlschema, 1); rb_define_singleton_method(cDate, "xmlschema", date_s_xmlschema, -1); rb_define_singleton_method(cDate, "_rfc2822", date_s__rfc2822, 1); rb_define_singleton_method(cDate, "_rfc822", date_s__rfc2822, 1); rb_define_singleton_method(cDate, "rfc2822", date_s_rfc2822, -1); rb_define_singleton_method(cDate, "rfc822", date_s_rfc2822, -1); rb_define_singleton_method(cDate, "_httpdate", date_s__httpdate, 1); rb_define_singleton_method(cDate, "httpdate", date_s_httpdate, -1); rb_define_singleton_method(cDate, "_jisx0301", date_s__jisx0301, 1); rb_define_singleton_method(cDate, "jisx0301", date_s_jisx0301, -1); rb_define_method(cDate, "initialize", date_initialize, -1); rb_define_method(cDate, "initialize_copy", d_lite_initialize_copy, 1); #ifndef NDEBUG rb_define_method(cDate, "fill", d_lite_fill, 0); #endif rb_define_method(cDate, "ajd", d_lite_ajd, 0); rb_define_method(cDate, "amjd", d_lite_amjd, 0); rb_define_method(cDate, "jd", d_lite_jd, 0); rb_define_method(cDate, "mjd", d_lite_mjd, 0); rb_define_method(cDate, "ld", d_lite_ld, 0); rb_define_method(cDate, "year", d_lite_year, 0); rb_define_method(cDate, "yday", d_lite_yday, 0); rb_define_method(cDate, "mon", d_lite_mon, 0); rb_define_method(cDate, "month", d_lite_mon, 0); rb_define_method(cDate, "mday", d_lite_mday, 0); rb_define_method(cDate, "day", d_lite_mday, 0); rb_define_method(cDate, "day_fraction", d_lite_day_fraction, 0); rb_define_method(cDate, "cwyear", d_lite_cwyear, 0); rb_define_method(cDate, "cweek", d_lite_cweek, 0); rb_define_method(cDate, "cwday", d_lite_cwday, 0); #ifndef NDEBUG rb_define_private_method(cDate, "wnum0", d_lite_wnum0, 0); rb_define_private_method(cDate, "wnum1", d_lite_wnum1, 0); #endif rb_define_method(cDate, "wday", d_lite_wday, 0); rb_define_method(cDate, "sunday?", d_lite_sunday_p, 0); rb_define_method(cDate, "monday?", d_lite_monday_p, 0); rb_define_method(cDate, "tuesday?", d_lite_tuesday_p, 0); rb_define_method(cDate, "wednesday?", d_lite_wednesday_p, 0); rb_define_method(cDate, "thursday?", d_lite_thursday_p, 0); rb_define_method(cDate, "friday?", d_lite_friday_p, 0); rb_define_method(cDate, "saturday?", d_lite_saturday_p, 0); #ifndef NDEBUG rb_define_method(cDate, "nth_kday?", d_lite_nth_kday_p, 2); #endif rb_define_private_method(cDate, "hour", d_lite_zero, 0); rb_define_private_method(cDate, "min", d_lite_zero, 0); rb_define_private_method(cDate, "minute", d_lite_zero, 0); rb_define_private_method(cDate, "sec", d_lite_zero, 0); rb_define_private_method(cDate, "second", d_lite_zero, 0); rb_define_method(cDate, "julian?", d_lite_julian_p, 0); rb_define_method(cDate, "gregorian?", d_lite_gregorian_p, 0); rb_define_method(cDate, "leap?", d_lite_leap_p, 0); rb_define_method(cDate, "start", d_lite_start, 0); rb_define_method(cDate, "new_start", d_lite_new_start, -1); rb_define_method(cDate, "italy", d_lite_italy, 0); rb_define_method(cDate, "england", d_lite_england, 0); rb_define_method(cDate, "julian", d_lite_julian, 0); rb_define_method(cDate, "gregorian", d_lite_gregorian, 0); rb_define_method(cDate, "+", d_lite_plus, 1); rb_define_method(cDate, "-", d_lite_minus, 1); rb_define_method(cDate, "next_day", d_lite_next_day, -1); rb_define_method(cDate, "prev_day", d_lite_prev_day, -1); rb_define_method(cDate, "next", d_lite_next, 0); rb_define_method(cDate, "succ", d_lite_next, 0); rb_define_method(cDate, ">>", d_lite_rshift, 1); rb_define_method(cDate, "<<", d_lite_lshift, 1); rb_define_method(cDate, "next_month", d_lite_next_month, -1); rb_define_method(cDate, "prev_month", d_lite_prev_month, -1); rb_define_method(cDate, "next_year", d_lite_next_year, -1); rb_define_method(cDate, "prev_year", d_lite_prev_year, -1); rb_define_method(cDate, "step", d_lite_step, -1); rb_define_method(cDate, "upto", d_lite_upto, 1); rb_define_method(cDate, "downto", d_lite_downto, 1); rb_define_method(cDate, "<=>", d_lite_cmp, 1); rb_define_method(cDate, "===", d_lite_equal, 1); rb_define_method(cDate, "eql?", d_lite_eql_p, 1); rb_define_method(cDate, "hash", d_lite_hash, 0); rb_define_method(cDate, "to_s", d_lite_to_s, 0); #ifndef NDEBUG rb_define_method(cDate, "inspect_raw", d_lite_inspect_raw, 0); #endif rb_define_method(cDate, "inspect", d_lite_inspect, 0); rb_define_method(cDate, "strftime", d_lite_strftime, -1); rb_define_method(cDate, "asctime", d_lite_asctime, 0); rb_define_method(cDate, "ctime", d_lite_asctime, 0); rb_define_method(cDate, "iso8601", d_lite_iso8601, 0); rb_define_method(cDate, "xmlschema", d_lite_iso8601, 0); rb_define_method(cDate, "rfc3339", d_lite_rfc3339, 0); rb_define_method(cDate, "rfc2822", d_lite_rfc2822, 0); rb_define_method(cDate, "rfc822", d_lite_rfc2822, 0); rb_define_method(cDate, "httpdate", d_lite_httpdate, 0); rb_define_method(cDate, "jisx0301", d_lite_jisx0301, 0); #ifndef NDEBUG rb_define_method(cDate, "marshal_dump_old", d_lite_marshal_dump_old, 0); #endif rb_define_method(cDate, "marshal_dump", d_lite_marshal_dump, 0); rb_define_method(cDate, "marshal_load", d_lite_marshal_load, 1); rb_define_singleton_method(cDate, "_load", date_s__load, 1); /* * == DateTime * * A subclass of Date that easily handles date, hour, minute, second, * and offset. * * DateTime class is considered deprecated. Use Time class. * * DateTime does not consider any leap seconds, does not track * any summer time rules. * * A DateTime object is created with DateTime::new, DateTime::jd, * DateTime::ordinal, DateTime::commercial, DateTime::parse, * DateTime::strptime, DateTime::now, Time#to_datetime, etc. * * require 'date' * * DateTime.new(2001,2,3,4,5,6) * #=> #<DateTime: 2001-02-03T04:05:06+00:00 ...> * * The last element of day, hour, minute, or second can be a * fractional number. The fractional number's precision is assumed * at most nanosecond. * * DateTime.new(2001,2,3.5) * #=> #<DateTime: 2001-02-03T12:00:00+00:00 ...> * * An optional argument, the offset, indicates the difference * between the local time and UTC. For example, <tt>Rational(3,24)</tt> * represents ahead of 3 hours of UTC, <tt>Rational(-5,24)</tt> represents * behind of 5 hours of UTC. The offset should be -1 to +1, and * its precision is assumed at most second. The default value is * zero (equals to UTC). * * DateTime.new(2001,2,3,4,5,6,Rational(3,24)) * #=> #<DateTime: 2001-02-03T04:05:06+03:00 ...> * * The offset also accepts string form: * * DateTime.new(2001,2,3,4,5,6,'+03:00') * #=> #<DateTime: 2001-02-03T04:05:06+03:00 ...> * * An optional argument, the day of calendar reform (+start+), denotes * a Julian day number, which should be 2298874 to 2426355 or * negative/positive infinity. * The default value is +Date::ITALY+ (2299161=1582-10-15). * * A DateTime object has various methods. See each reference. * * d = DateTime.parse('3rd Feb 2001 04:05:06+03:30') * #=> #<DateTime: 2001-02-03T04:05:06+03:30 ...> * d.hour #=> 4 * d.min #=> 5 * d.sec #=> 6 * d.offset #=> (7/48) * d.zone #=> "+03:30" * d += Rational('1.5') * #=> #<DateTime: 2001-02-04%16:05:06+03:30 ...> * d = d.new_offset('+09:00') * #=> #<DateTime: 2001-02-04%21:35:06+09:00 ...> * d.strftime('%I:%M:%S %p') * #=> "09:35:06 PM" * d > DateTime.new(1999) * #=> true * * === When should you use DateTime and when should you use Time? * * It's a common misconception that * {William Shakespeare}[https://en.wikipedia.org/wiki/William_Shakespeare] * and * {Miguel de Cervantes}[https://en.wikipedia.org/wiki/Miguel_de_Cervantes] * died on the same day in history - * so much so that UNESCO named April 23 as * {World Book Day because of this fact}[https://en.wikipedia.org/wiki/World_Book_Day]. * However, because England hadn't yet adopted the * {Gregorian Calendar Reform}[https://en.wikipedia.org/wiki/Gregorian_calendar#Gregorian_reform] * (and wouldn't until {1752}[https://en.wikipedia.org/wiki/Calendar_(New_Style)_Act_1750]) * their deaths are actually 10 days apart. * Since Ruby's Time class implements a * {proleptic Gregorian calendar}[https://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar] * and has no concept of calendar reform there's no way * to express this with Time objects. This is where DateTime steps in: * * shakespeare = DateTime.iso8601('1616-04-23', Date::ENGLAND) * #=> Tue, 23 Apr 1616 00:00:00 +0000 * cervantes = DateTime.iso8601('1616-04-23', Date::ITALY) * #=> Sat, 23 Apr 1616 00:00:00 +0000 * * Already you can see something is weird - the days of the week * are different. Taking this further: * * cervantes == shakespeare * #=> false * (shakespeare - cervantes).to_i * #=> 10 * * This shows that in fact they died 10 days apart (in reality * 11 days since Cervantes died a day earlier but was buried on * the 23rd). We can see the actual date of Shakespeare's death by * using the #gregorian method to convert it: * * shakespeare.gregorian * #=> Tue, 03 May 1616 00:00:00 +0000 * * So there's an argument that all the celebrations that take * place on the 23rd April in Stratford-upon-Avon are actually * the wrong date since England is now using the Gregorian calendar. * You can see why when we transition across the reform * date boundary: * * # start off with the anniversary of Shakespeare's birth in 1751 * shakespeare = DateTime.iso8601('1751-04-23', Date::ENGLAND) * #=> Tue, 23 Apr 1751 00:00:00 +0000 * * # add 366 days since 1752 is a leap year and April 23 is after February 29 * shakespeare + 366 * #=> Thu, 23 Apr 1752 00:00:00 +0000 * * # add another 365 days to take us to the anniversary in 1753 * shakespeare + 366 + 365 * #=> Fri, 04 May 1753 00:00:00 +0000 * * As you can see, if we're accurately tracking the number of * {solar years}[https://en.wikipedia.org/wiki/Tropical_year] * since Shakespeare's birthday then the correct anniversary date * would be the 4th May and not the 23rd April. * * So when should you use DateTime in Ruby and when should * you use Time? Almost certainly you'll want to use Time * since your app is probably dealing with current dates and * times. However, if you need to deal with dates and times in a * historical context you'll want to use DateTime to avoid * making the same mistakes as UNESCO. If you also have to deal * with timezones then best of luck - just bear in mind that * you'll probably be dealing with * {local solar times}[https://en.wikipedia.org/wiki/Solar_time], * since it wasn't until the 19th century that the introduction * of the railways necessitated the need for * {Standard Time}[https://en.wikipedia.org/wiki/Standard_time#Great_Britain] * and eventually timezones. */ cDateTime = rb_define_class("DateTime", cDate); rb_define_alloc_func(cDateTime, d_lite_s_alloc_complex); rb_define_singleton_method(cDateTime, "jd", datetime_s_jd, -1); rb_define_singleton_method(cDateTime, "ordinal", datetime_s_ordinal, -1); rb_define_singleton_method(cDateTime, "civil", datetime_s_civil, -1); rb_define_singleton_method(cDateTime, "new", datetime_s_civil, -1); rb_define_singleton_method(cDateTime, "commercial", datetime_s_commercial, -1); #ifndef NDEBUG rb_define_singleton_method(cDateTime, "weeknum", datetime_s_weeknum, -1); rb_define_singleton_method(cDateTime, "nth_kday", datetime_s_nth_kday, -1); #endif rb_undef_method(CLASS_OF(cDateTime), "today"); rb_define_singleton_method(cDateTime, "now", datetime_s_now, -1); rb_define_singleton_method(cDateTime, "_strptime", datetime_s__strptime, -1); rb_define_singleton_method(cDateTime, "strptime", datetime_s_strptime, -1); rb_define_singleton_method(cDateTime, "parse", datetime_s_parse, -1); rb_define_singleton_method(cDateTime, "iso8601", datetime_s_iso8601, -1); rb_define_singleton_method(cDateTime, "rfc3339", datetime_s_rfc3339, -1); rb_define_singleton_method(cDateTime, "xmlschema", datetime_s_xmlschema, -1); rb_define_singleton_method(cDateTime, "rfc2822", datetime_s_rfc2822, -1); rb_define_singleton_method(cDateTime, "rfc822", datetime_s_rfc2822, -1); rb_define_singleton_method(cDateTime, "httpdate", datetime_s_httpdate, -1); rb_define_singleton_method(cDateTime, "jisx0301", datetime_s_jisx0301, -1); rb_define_method(cDateTime, "hour", d_lite_hour, 0); rb_define_method(cDateTime, "min", d_lite_min, 0); rb_define_method(cDateTime, "minute", d_lite_min, 0); rb_define_method(cDateTime, "sec", d_lite_sec, 0); rb_define_method(cDateTime, "second", d_lite_sec, 0); rb_define_method(cDateTime, "sec_fraction", d_lite_sec_fraction, 0); rb_define_method(cDateTime, "second_fraction", d_lite_sec_fraction, 0); rb_define_method(cDateTime, "offset", d_lite_offset, 0); rb_define_method(cDateTime, "zone", d_lite_zone, 0); rb_define_method(cDateTime, "new_offset", d_lite_new_offset, -1); rb_define_method(cDateTime, "to_s", dt_lite_to_s, 0); rb_define_method(cDateTime, "strftime", dt_lite_strftime, -1); rb_define_method(cDateTime, "iso8601", dt_lite_iso8601, -1); rb_define_method(cDateTime, "xmlschema", dt_lite_iso8601, -1); rb_define_method(cDateTime, "rfc3339", dt_lite_rfc3339, -1); rb_define_method(cDateTime, "jisx0301", dt_lite_jisx0301, -1); /* conversions */ rb_define_method(rb_cTime, "to_time", time_to_time, 0); rb_define_method(rb_cTime, "to_date", time_to_date, 0); rb_define_method(rb_cTime, "to_datetime", time_to_datetime, 0); rb_define_method(cDate, "to_time", date_to_time, 0); rb_define_method(cDate, "to_date", date_to_date, 0); rb_define_method(cDate, "to_datetime", date_to_datetime, 0); rb_define_method(cDateTime, "to_time", datetime_to_time, 0); rb_define_method(cDateTime, "to_date", datetime_to_date, 0); rb_define_method(cDateTime, "to_datetime", datetime_to_datetime, 0); #ifndef NDEBUG /* tests */ rb_define_singleton_method(cDate, "test_civil", date_s_test_civil, 0); rb_define_singleton_method(cDate, "test_ordinal", date_s_test_ordinal, 0); rb_define_singleton_method(cDate, "test_commercial", date_s_test_commercial, 0); rb_define_singleton_method(cDate, "test_weeknum", date_s_test_weeknum, 0); rb_define_singleton_method(cDate, "test_nth_kday", date_s_test_nth_kday, 0); rb_define_singleton_method(cDate, "test_unit_conv", date_s_test_unit_conv, 0); rb_define_singleton_method(cDate, "test_all", date_s_test_all, 0); #endif }
1
447,174
void aarp_cleanup_module(void) { del_timer_sync(&aarp_timer); unregister_netdevice_notifier(&aarp_notifier); unregister_snap_client(aarp_dl); aarp_purge(); }
0
364,227
ExtendSolidArea(rfbClientPtr cl, int x, int y, int w, int h, uint32_t colorValue, int *x_ptr, int *y_ptr, int *w_ptr, int *h_ptr) { int cx, cy; /* Try to extend the area upwards. */ for ( cy = *y_ptr - 1; cy >= y && CheckSolidTile(cl, *x_ptr, cy, *w_ptr, 1, &colorValue, TRUE); cy-- ); *h_ptr += *y_ptr - (cy + 1); *y_ptr = cy + 1; /* ... downwards. */ for ( cy = *y_ptr + *h_ptr; cy < y + h && CheckSolidTile(cl, *x_ptr, cy, *w_ptr, 1, &colorValue, TRUE); cy++ ); *h_ptr += cy - (*y_ptr + *h_ptr); /* ... to the left. */ for ( cx = *x_ptr - 1; cx >= x && CheckSolidTile(cl, cx, *y_ptr, 1, *h_ptr, &colorValue, TRUE); cx-- ); *w_ptr += *x_ptr - (cx + 1); *x_ptr = cx + 1; /* ... to the right. */ for ( cx = *x_ptr + *w_ptr; cx < x + w && CheckSolidTile(cl, cx, *y_ptr, 1, *h_ptr, &colorValue, TRUE); cx++ ); *w_ptr += cx - (*x_ptr + *w_ptr); }
0
5,664
static int read_data(void *opaque, uint8_t *buf, int buf_size) { struct playlist *v = opaque; HLSContext *c = v->parent->priv_data; int ret, i; int just_opened = 0; restart: if (!v->needed) return AVERROR_EOF; if (!v->input) { int64_t reload_interval; struct segment *seg; /* Check that the playlist is still needed before opening a new * segment. */ if (v->ctx && v->ctx->nb_streams) { v->needed = 0; for (i = 0; i < v->n_main_streams; i++) { if (v->main_streams[i]->discard < AVDISCARD_ALL) { v->needed = 1; break; } } } if (!v->needed) { av_log(v->parent, AV_LOG_INFO, "No longer receiving playlist %d\n", v->index); return AVERROR_EOF; } /* If this is a live stream and the reload interval has elapsed since * the last playlist reload, reload the playlists now. */ reload_interval = default_reload_interval(v); reload: if (!v->finished && av_gettime_relative() - v->last_load_time >= reload_interval) { if ((ret = parse_playlist(c, v->url, v, NULL)) < 0) { av_log(v->parent, AV_LOG_WARNING, "Failed to reload playlist %d\n", v->index); return ret; } /* If we need to reload the playlist again below (if * there's still no more segments), switch to a reload * interval of half the target duration. */ reload_interval = v->target_duration / 2; } if (v->cur_seq_no < v->start_seq_no) { av_log(NULL, AV_LOG_WARNING, "skipping %d segments ahead, expired from playlists\n", v->start_seq_no - v->cur_seq_no); v->cur_seq_no = v->start_seq_no; } if (v->cur_seq_no >= v->start_seq_no + v->n_segments) { if (v->finished) return AVERROR_EOF; while (av_gettime_relative() - v->last_load_time < reload_interval) { if (ff_check_interrupt(c->interrupt_callback)) return AVERROR_EXIT; av_usleep(100*1000); } /* Enough time has elapsed since the last reload */ goto reload; } seg = current_segment(v); /* load/update Media Initialization Section, if any */ ret = update_init_section(v, seg); if (ret) return ret; ret = open_input(c, v, seg); if (ret < 0) { if (ff_check_interrupt(c->interrupt_callback)) return AVERROR_EXIT; av_log(v->parent, AV_LOG_WARNING, "Failed to open segment of playlist %d\n", v->index); v->cur_seq_no += 1; goto reload; } just_opened = 1; } if (v->init_sec_buf_read_offset < v->init_sec_data_len) { /* Push init section out first before first actual segment */ int copy_size = FFMIN(v->init_sec_data_len - v->init_sec_buf_read_offset, buf_size); memcpy(buf, v->init_sec_buf, copy_size); v->init_sec_buf_read_offset += copy_size; return copy_size; } ret = read_from_url(v, current_segment(v), buf, buf_size, READ_NORMAL); if (ret > 0) { if (just_opened && v->is_id3_timestamped != 0) { /* Intercept ID3 tags here, elementary audio streams are required * to convey timestamps using them in the beginning of each segment. */ intercept_id3(v, buf, buf_size, &ret); } return ret; } ff_format_io_close(v->parent, &v->input); v->cur_seq_no++; c->cur_seq_no = v->cur_seq_no; goto restart; }
1
198,484
int BackendImpl::OpenEntry(const std::string& key, Entry** entry, const CompletionCallback& callback) { DCHECK(!callback.is_null()); background_queue_.OpenEntry(key, entry, callback); return net::ERR_IO_PENDING; }
0
211,085
MetricsWebContentsObserver* MetricsWebContentsObserver::CreateForWebContents( content::WebContents* web_contents, std::unique_ptr<PageLoadMetricsEmbedderInterface> embedder_interface) { DCHECK(web_contents); MetricsWebContentsObserver* metrics = FromWebContents(web_contents); if (!metrics) { metrics = new MetricsWebContentsObserver(web_contents, std::move(embedder_interface)); web_contents->SetUserData(UserDataKey(), base::WrapUnique(metrics)); } return metrics; }
0
490,036
static int coolkey_get_serial_nr_from_CUID(sc_card_t* card, sc_serial_number_t* serial) { coolkey_private_data_t * priv = COOLKEY_DATA(card); SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_NORMAL); memcpy(serial->value, &priv->cuid, sizeof(priv->cuid)); serial->len = sizeof(priv->cuid); SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_NORMAL, SC_SUCCESS); }
0
246,094
int RenderLayerScrollableArea::pageStep(ScrollbarOrientation orientation) const { int length = (orientation == HorizontalScrollbar) ? box().pixelSnappedClientWidth() : box().pixelSnappedClientHeight(); int minPageStep = static_cast<float>(length) * ScrollableArea::minFractionToStepWhenPaging(); int pageStep = max(minPageStep, length - ScrollableArea::maxOverlapBetweenPages()); return max(pageStep, 1); }
0
162,349
lys_container_free(struct ly_ctx *ctx, struct lys_node_container *cont, void (*private_destructor)(const struct lys_node *node, void *priv)) { int i; /* handle only specific parts for LY_NODE_CONTAINER */ lydict_remove(ctx, cont->presence); for (i = 0; i < cont->tpdf_size; i++) { lys_tpdf_free(ctx, &cont->tpdf[i], private_destructor); } free(cont->tpdf); for (i = 0; i < cont->must_size; i++) { lys_restr_free(ctx, &cont->must[i], private_destructor); } free(cont->must); lys_when_free(ctx, cont->when, private_destructor); }
0
432,194
static bool toneport_has_led(struct usb_line6_toneport *toneport) { switch (toneport->type) { case LINE6_GUITARPORT: case LINE6_TONEPORT_GX: /* add your device here if you are missing support for the LEDs */ return true; default: return false; } }
0
381,759
UpdateChangedParamSet(PlanState *node, Bitmapset *newchg) { Bitmapset *parmset; /* * The plan node only depends on params listed in its allParam set. Don't * include anything else into its chgParam set. */ parmset = bms_intersect(node->plan->allParam, newchg); /* * Keep node->chgParam == NULL if there's not actually any members; this * allows the simplest possible tests in executor node files. */ if (!bms_is_empty(parmset)) node->chgParam = bms_join(node->chgParam, parmset); else bms_free(parmset); }
0
50,775
int kvm_apic_match_physical_addr(struct kvm_lapic *apic, u16 dest) { return dest == 0xff || kvm_apic_id(apic) == dest; }
0
178,261
const SSL_CIPHER *dtls1_get_cipher(unsigned int u) { const SSL_CIPHER *ciph = ssl3_get_cipher(u); if (ciph != NULL) { if (ciph->algorithm_enc == SSL_RC4) return NULL; } return ciph; }
0
87,280
build_oid_noalloc(oid * in, size_t in_len, size_t * out_len, oid * prefix, size_t prefix_len, netsnmp_variable_list * indexes) { netsnmp_variable_list *var; if (prefix) { if (in_len < prefix_len) return SNMPERR_GENERR; memcpy(in, prefix, prefix_len * sizeof(oid)); *out_len = prefix_len; } else { *out_len = 0; } for (var = indexes; var != NULL; var = var->next_variable) { if (build_oid_segment(var) != SNMPERR_SUCCESS) return SNMPERR_GENERR; if (var->name_length + *out_len <= in_len) { memcpy(&(in[*out_len]), var->name, sizeof(oid) * var->name_length); *out_len += var->name_length; } else { return SNMPERR_GENERR; } } DEBUGMSGTL(("build_oid_noalloc", "generated: ")); DEBUGMSGOID(("build_oid_noalloc", in, *out_len)); DEBUGMSG(("build_oid_noalloc", "\n")); return SNMPERR_SUCCESS; }
0
390,555
X509_STORE* X509_STORE_new(void) { // TODO: return 0; }
0
271,184
MagickPrivate NexusInfo **AcquirePixelCacheNexus(const size_t number_threads) { NexusInfo **magick_restrict nexus_info; register ssize_t i; nexus_info=(NexusInfo **) MagickAssumeAligned(AcquireAlignedMemory( number_threads,sizeof(*nexus_info))); if (nexus_info == (NexusInfo **) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); nexus_info[0]=(NexusInfo *) AcquireQuantumMemory(number_threads, sizeof(**nexus_info)); if (nexus_info[0] == (NexusInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed"); (void) ResetMagickMemory(nexus_info[0],0,number_threads*sizeof(**nexus_info)); for (i=0; i < (ssize_t) number_threads; i++) { nexus_info[i]=(&nexus_info[0][i]); nexus_info[i]->signature=MagickCoreSignature; } return(nexus_info); }
0
205,434
void DevToolsUIBindings::ShowDevToolsConfirmInfoBar( const base::string16& message, const InfoBarCallback& callback) { if (!delegate_->GetInfoBarService()) { callback.Run(false); return; } std::unique_ptr<DevToolsConfirmInfoBarDelegate> delegate( new DevToolsConfirmInfoBarDelegate(callback, message)); GlobalConfirmInfoBar::Show(std::move(delegate)); }
0
413,492
void slurmctld_req(slurm_msg_t *msg, connection_arg_t *arg) { DEF_TIMERS; int i, rpc_type_index = -1, rpc_user_index = -1; uint32_t rpc_uid; if (arg && (arg->newsockfd >= 0)) fd_set_nonblocking(arg->newsockfd); #ifndef NDEBUG if ((msg->flags & SLURM_DROP_PRIV)) drop_priv = true; #endif /* Just to validate the cred */ rpc_uid = (uint32_t) g_slurm_auth_get_uid(msg->auth_cred, slurmctld_config.auth_info); if (g_slurm_auth_errno(msg->auth_cred) != SLURM_SUCCESS) { error("Bad authentication: %s", g_slurm_auth_errstr(g_slurm_auth_errno(msg->auth_cred))); return; } slurm_mutex_lock(&rpc_mutex); if (rpc_type_size == 0) { rpc_type_size = 100; /* Capture info for first 100 RPC types */ rpc_type_id = xmalloc(sizeof(uint16_t) * rpc_type_size); rpc_type_cnt = xmalloc(sizeof(uint32_t) * rpc_type_size); rpc_type_time = xmalloc(sizeof(uint64_t) * rpc_type_size); } for (i = 0; i < rpc_type_size; i++) { if (rpc_type_id[i] == 0) rpc_type_id[i] = msg->msg_type; else if (rpc_type_id[i] != msg->msg_type) continue; rpc_type_index = i; break; } if (rpc_user_size == 0) { rpc_user_size = 200; /* Capture info for first 200 RPC users */ rpc_user_id = xmalloc(sizeof(uint32_t) * rpc_user_size); rpc_user_cnt = xmalloc(sizeof(uint32_t) * rpc_user_size); rpc_user_time = xmalloc(sizeof(uint64_t) * rpc_user_size); } for (i = 0; i < rpc_user_size; i++) { if ((rpc_user_id[i] == 0) && (i != 0)) rpc_user_id[i] = rpc_uid; else if (rpc_user_id[i] != rpc_uid) continue; rpc_user_index = i; break; } slurm_mutex_unlock(&rpc_mutex); /* Debug the protocol layer. */ START_TIMER; if (slurmctld_conf.debug_flags & DEBUG_FLAG_PROTOCOL) { char *p = rpc_num2string(msg->msg_type); if (msg->conn) { info("%s: received opcode %s from persist conn on (%s)%s", __func__, p, msg->conn->cluster_name, msg->conn->rem_host); } else if (arg) { char inetbuf[64]; slurm_print_slurm_addr(&arg->cli_addr, inetbuf, sizeof(inetbuf)); info("%s: received opcode %s from %s", __func__, p, inetbuf); } else { error("%s: No arg given and this doesn't appear to be a persistent connection, this should never happen", __func__); } } switch (msg->msg_type) { case REQUEST_RESOURCE_ALLOCATION: _slurm_rpc_allocate_resources(msg); break; case REQUEST_JOB_PACK_ALLOCATION: _slurm_rpc_allocate_pack(msg); break; case REQUEST_BUILD_INFO: _slurm_rpc_dump_conf(msg); break; case REQUEST_JOB_INFO: _slurm_rpc_dump_jobs(msg); break; case REQUEST_JOB_USER_INFO: _slurm_rpc_dump_jobs_user(msg); break; case REQUEST_JOB_INFO_SINGLE: _slurm_rpc_dump_job_single(msg); break; case REQUEST_BATCH_SCRIPT: _slurm_rpc_dump_batch_script(msg); break; case REQUEST_SHARE_INFO: _slurm_rpc_get_shares(msg); break; case REQUEST_PRIORITY_FACTORS: _slurm_rpc_get_priority_factors(msg); break; case REQUEST_JOB_END_TIME: _slurm_rpc_end_time(msg); break; case REQUEST_FED_INFO: _slurm_rpc_get_fed(msg); break; case REQUEST_FRONT_END_INFO: _slurm_rpc_dump_front_end(msg); break; case REQUEST_NODE_INFO: _slurm_rpc_dump_nodes(msg); break; case REQUEST_NODE_INFO_SINGLE: _slurm_rpc_dump_node_single(msg); break; case REQUEST_PARTITION_INFO: _slurm_rpc_dump_partitions(msg); break; case MESSAGE_EPILOG_COMPLETE: i = 0; _slurm_rpc_epilog_complete(msg, (bool *)&i, 0); break; case REQUEST_CANCEL_JOB_STEP: _slurm_rpc_job_step_kill(rpc_uid, msg); break; case REQUEST_COMPLETE_JOB_ALLOCATION: _slurm_rpc_complete_job_allocation(msg); break; case REQUEST_COMPLETE_PROLOG: _slurm_rpc_complete_prolog(msg); break; case REQUEST_COMPLETE_BATCH_JOB: case REQUEST_COMPLETE_BATCH_SCRIPT: i = 0; _slurm_rpc_complete_batch_script(msg, (bool *)&i, 0); break; case REQUEST_JOB_STEP_CREATE: _slurm_rpc_job_step_create(msg); break; case REQUEST_JOB_STEP_INFO: _slurm_rpc_job_step_get_info(msg); break; case REQUEST_JOB_WILL_RUN: _slurm_rpc_job_will_run(msg); break; case REQUEST_SIB_JOB_LOCK: _slurm_rpc_sib_job_lock(rpc_uid, msg); break; case REQUEST_SIB_JOB_UNLOCK: _slurm_rpc_sib_job_unlock(rpc_uid, msg); break; case REQUEST_CTLD_MULT_MSG: _proc_multi_msg(rpc_uid, msg); break; case MESSAGE_NODE_REGISTRATION_STATUS: _slurm_rpc_node_registration(msg, 0); break; case REQUEST_JOB_ALLOCATION_INFO: case DEFUNCT_REQUEST_JOB_ALLOCATION_INFO_LITE: _slurm_rpc_job_alloc_info(msg); break; case REQUEST_JOB_PACK_ALLOC_INFO: _slurm_rpc_job_pack_alloc_info(msg); break; case REQUEST_JOB_SBCAST_CRED: _slurm_rpc_job_sbcast_cred(msg); break; case REQUEST_PING: _slurm_rpc_ping(msg); break; case REQUEST_RECONFIGURE: _slurm_rpc_reconfigure_controller(msg); break; case REQUEST_CONTROL: _slurm_rpc_shutdown_controller(msg); break; case REQUEST_TAKEOVER: _slurm_rpc_takeover(msg); break; case REQUEST_SHUTDOWN: _slurm_rpc_shutdown_controller(msg); break; case REQUEST_SHUTDOWN_IMMEDIATE: _slurm_rpc_shutdown_controller_immediate(msg); break; case REQUEST_SUBMIT_BATCH_JOB: _slurm_rpc_submit_batch_job(msg); break; case REQUEST_SUBMIT_BATCH_JOB_PACK: _slurm_rpc_submit_batch_pack_job(msg); break; case REQUEST_UPDATE_FRONT_END: _slurm_rpc_update_front_end(msg); break; case REQUEST_UPDATE_JOB: _slurm_rpc_update_job(msg); break; case REQUEST_UPDATE_NODE: _slurm_rpc_update_node(msg); break; case REQUEST_UPDATE_LAYOUT: _slurm_rpc_update_layout(msg); break; case REQUEST_CREATE_PARTITION: case REQUEST_UPDATE_PARTITION: _slurm_rpc_update_partition(msg); break; case REQUEST_UPDATE_POWERCAP: _slurm_rpc_update_powercap(msg); break; case REQUEST_DELETE_PARTITION: _slurm_rpc_delete_partition(msg); break; case REQUEST_CREATE_RESERVATION: _slurm_rpc_resv_create(msg); break; case REQUEST_UPDATE_RESERVATION: _slurm_rpc_resv_update(msg); break; case REQUEST_DELETE_RESERVATION: _slurm_rpc_resv_delete(msg); break; case REQUEST_UPDATE_BLOCK: _slurm_rpc_update_block(msg); break; case REQUEST_RESERVATION_INFO: _slurm_rpc_resv_show(msg); break; case REQUEST_LAYOUT_INFO: _slurm_rpc_layout_show(msg); break; case REQUEST_NODE_REGISTRATION_STATUS: error("slurmctld is talking with itself. " "SlurmctldPort == SlurmdPort"); slurm_send_rc_msg(msg, EINVAL); break; case REQUEST_CHECKPOINT: _slurm_rpc_checkpoint(msg); break; case REQUEST_CHECKPOINT_COMP: _slurm_rpc_checkpoint_comp(msg); break; case REQUEST_CHECKPOINT_TASK_COMP: _slurm_rpc_checkpoint_task_comp(msg); break; case REQUEST_SUSPEND: _slurm_rpc_suspend(msg); break; case REQUEST_TOP_JOB: _slurm_rpc_top_job(msg); break; case REQUEST_JOB_REQUEUE: _slurm_rpc_requeue(msg); break; case REQUEST_JOB_READY: _slurm_rpc_job_ready(msg); break; case REQUEST_BLOCK_INFO: _slurm_rpc_block_info(msg); break; case REQUEST_BURST_BUFFER_INFO: _slurm_rpc_burst_buffer_info(msg); break; case REQUEST_STEP_COMPLETE: _slurm_rpc_step_complete(msg, 0); break; case REQUEST_STEP_LAYOUT: _slurm_rpc_step_layout(msg); break; case REQUEST_UPDATE_JOB_STEP: _slurm_rpc_step_update(msg); break; case REQUEST_TRIGGER_SET: _slurm_rpc_trigger_set(msg); break; case REQUEST_TRIGGER_GET: _slurm_rpc_trigger_get(msg); break; case REQUEST_TRIGGER_CLEAR: _slurm_rpc_trigger_clear(msg); break; case REQUEST_TRIGGER_PULL: _slurm_rpc_trigger_pull(msg); break; case REQUEST_JOB_NOTIFY: _slurm_rpc_job_notify(msg); break; case REQUEST_SET_DEBUG_FLAGS: _slurm_rpc_set_debug_flags(msg); break; case REQUEST_SET_DEBUG_LEVEL: _slurm_rpc_set_debug_level(msg); break; case REQUEST_SET_SCHEDLOG_LEVEL: _slurm_rpc_set_schedlog_level(msg); break; case ACCOUNTING_UPDATE_MSG: _slurm_rpc_accounting_update_msg(msg); break; case ACCOUNTING_FIRST_REG: _slurm_rpc_accounting_first_reg(msg); break; case ACCOUNTING_REGISTER_CTLD: _slurm_rpc_accounting_register_ctld(msg); break; case REQUEST_TOPO_INFO: _slurm_rpc_get_topo(msg); break; case REQUEST_POWERCAP_INFO: _slurm_rpc_get_powercap(msg); break; case REQUEST_SPANK_ENVIRONMENT: _slurm_rpc_dump_spank(msg); break; case REQUEST_REBOOT_NODES: _slurm_rpc_reboot_nodes(msg); break; case REQUEST_STATS_INFO: _slurm_rpc_dump_stats(msg); break; case REQUEST_LICENSE_INFO: _slurm_rpc_dump_licenses(msg); break; case REQUEST_KILL_JOB: _slurm_rpc_kill_job(msg); break; case MESSAGE_COMPOSITE: _slurm_rpc_composite_msg(msg); break; case REQUEST_ASSOC_MGR_INFO: _slurm_rpc_assoc_mgr_info(msg); break; case REQUEST_PERSIST_INIT: if (msg->conn) error("We already have a persistent connect, this should never happen"); _slurm_rpc_persist_init(msg, arg); break; case REQUEST_EVENT_LOG: _slurm_rpc_event_log(msg); break; case REQUEST_SET_FS_DAMPENING_FACTOR: _slurm_rpc_set_fs_dampening_factor(msg); break; default: error("invalid RPC msg_type=%u", msg->msg_type); slurm_send_rc_msg(msg, EINVAL); break; } END_TIMER; slurm_mutex_lock(&rpc_mutex); if (rpc_type_index >= 0) { rpc_type_cnt[rpc_type_index]++; rpc_type_time[rpc_type_index] += DELTA_TIMER; } if (rpc_user_index >= 0) { rpc_user_cnt[rpc_user_index]++; rpc_user_time[rpc_user_index] += DELTA_TIMER; } slurm_mutex_unlock(&rpc_mutex); }
0
262,145
static inline int is_timeval_eq(const struct timeval *i1, const struct timeval *i2) { return i1->tv_sec == i2->tv_sec && i1->tv_usec == i2->tv_usec; }
0
377,134
bool bdrv_is_first_non_filter(BlockDriverState *candidate) { BlockDriverState *bs; /* walk down the bs forest recursively */ QTAILQ_FOREACH(bs, &bdrv_states, device_list) { bool perm; /* try to recurse in this top level bs */ perm = bdrv_recurse_is_first_non_filter(bs, candidate); /* candidate is the first non filter */ if (perm) { return true; } } return false; }
0
229,091
void CL_Disconnect( qboolean showMainMenu ) { if ( !com_cl_running || !com_cl_running->integer ) { return; } Cvar_Set("r_uiFullScreen", "1"); if ( clc.demorecording ) { CL_StopRecord_f (); } if (clc.download) { FS_FCloseFile( clc.download ); clc.download = 0; } *clc.downloadTempName = *clc.downloadName = 0; Cvar_Set( "cl_downloadName", "" ); #ifdef USE_MUMBLE if (cl_useMumble->integer && mumble_islinked()) { Com_Printf("Mumble: Unlinking from Mumble application\n"); mumble_unlink(); } #endif #ifdef USE_VOIP if (cl_voipSend->integer) { int tmp = cl_voipUseVAD->integer; cl_voipUseVAD->integer = 0; // disable this for a moment. clc.voipOutgoingDataSize = 0; // dump any pending VoIP transmission. Cvar_Set("cl_voipSend", "0"); CL_CaptureVoip(); // clean up any state... cl_voipUseVAD->integer = tmp; } if (clc.voipCodecInitialized) { int i; opus_encoder_destroy(clc.opusEncoder); for (i = 0; i < MAX_CLIENTS; i++) { opus_decoder_destroy(clc.opusDecoder[i]); } clc.voipCodecInitialized = qfalse; } Cmd_RemoveCommand ("voip"); #endif if ( clc.demofile ) { FS_FCloseFile( clc.demofile ); clc.demofile = 0; } if ( uivm && showMainMenu ) { VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_NONE ); } SCR_StopCinematic (); S_ClearSoundBuffer(); if ( clc.state >= CA_CONNECTED ) { CL_AddReliableCommand("disconnect", qtrue); CL_WritePacket(); CL_WritePacket(); CL_WritePacket(); } FS_PureServerSetLoadedPaks("", ""); FS_PureServerSetReferencedPaks( "", "" ); CL_ClearState (); Com_Memset( &clc, 0, sizeof( clc ) ); clc.state = CA_DISCONNECTED; Cvar_Set( "sv_cheats", "1" ); cl_connectedToPureServer = qfalse; #ifdef USE_VOIP clc.voipEnabled = qfalse; #endif if( CL_VideoRecording( ) ) { SCR_UpdateScreen( ); CL_CloseAVI( ); } CL_UpdateGUID( NULL, 0 ); if(!noGameRestart) CL_OldGame(); else noGameRestart = qfalse; }
0
462,426
static void lo_lookup(fuse_req_t req, fuse_ino_t parent, const char *name) { struct fuse_entry_param e; int err; fuse_log(FUSE_LOG_DEBUG, "lo_lookup(parent=%" PRIu64 ", name=%s)\n", parent, name); /* * Don't use is_safe_path_component(), allow "." and ".." for NFS export * support. */ if (strchr(name, '/')) { fuse_reply_err(req, EINVAL); return; } err = lo_do_lookup(req, parent, name, &e, NULL); if (err) { fuse_reply_err(req, err); } else { fuse_reply_entry(req, &e); } }
0
55,348
static void rpmsg_upref_sleepers(struct virtproc_info *vrp) { /* support multiple concurrent senders */ mutex_lock(&vrp->tx_lock); /* are we the first sleeping context waiting for tx buffers ? */ if (atomic_inc_return(&vrp->sleepers) == 1) /* enable "tx-complete" interrupts before dozing off */ virtqueue_enable_cb(vrp->svq); mutex_unlock(&vrp->tx_lock); }
0
261,174
size_t mobi_get_aid_offset(const MOBIPart *html, const char *aid) { size_t length = html->size; const char *data = (char *) html->data; const size_t aid_length = strlen(aid); const size_t attr_length = 5; /* "aid='" length */ do { if (length > (aid_length + attr_length) && memcmp(data, "aid=", attr_length - 1) == 0) { data += attr_length; length -= attr_length; if (memcmp(data, aid, aid_length) == 0) { if (data[aid_length] == '\'' || data[aid_length] == '"') { return html->size - length; } } } data++; } while (--length); return SIZE_MAX; }
0
53,384
static int dwc3_gadget_set_ep_config(struct dwc3 *dwc, struct dwc3_ep *dep, bool modify, bool restore) { const struct usb_ss_ep_comp_descriptor *comp_desc; const struct usb_endpoint_descriptor *desc; struct dwc3_gadget_ep_cmd_params params; if (dev_WARN_ONCE(dwc->dev, modify && restore, "Can't modify and restore\n")) return -EINVAL; comp_desc = dep->endpoint.comp_desc; desc = dep->endpoint.desc; memset(&params, 0x00, sizeof(params)); params.param0 = DWC3_DEPCFG_EP_TYPE(usb_endpoint_type(desc)) | DWC3_DEPCFG_MAX_PACKET_SIZE(usb_endpoint_maxp(desc)); /* Burst size is only needed in SuperSpeed mode */ if (dwc->gadget.speed >= USB_SPEED_SUPER) { u32 burst = dep->endpoint.maxburst; params.param0 |= DWC3_DEPCFG_BURST_SIZE(burst - 1); } if (modify) { params.param0 |= DWC3_DEPCFG_ACTION_MODIFY; } else if (restore) { params.param0 |= DWC3_DEPCFG_ACTION_RESTORE; params.param2 |= dep->saved_state; } else { params.param0 |= DWC3_DEPCFG_ACTION_INIT; } if (usb_endpoint_xfer_control(desc)) params.param1 = DWC3_DEPCFG_XFER_COMPLETE_EN; if (dep->number <= 1 || usb_endpoint_xfer_isoc(desc)) params.param1 |= DWC3_DEPCFG_XFER_NOT_READY_EN; if (usb_ss_max_streams(comp_desc) && usb_endpoint_xfer_bulk(desc)) { params.param1 |= DWC3_DEPCFG_STREAM_CAPABLE | DWC3_DEPCFG_STREAM_EVENT_EN; dep->stream_capable = true; } if (!usb_endpoint_xfer_control(desc)) params.param1 |= DWC3_DEPCFG_XFER_IN_PROGRESS_EN; /* * We are doing 1:1 mapping for endpoints, meaning * Physical Endpoints 2 maps to Logical Endpoint 2 and * so on. We consider the direction bit as part of the physical * endpoint number. So USB endpoint 0x81 is 0x03. */ params.param1 |= DWC3_DEPCFG_EP_NUMBER(dep->number); /* * We must use the lower 16 TX FIFOs even though * HW might have more */ if (dep->direction) params.param0 |= DWC3_DEPCFG_FIFO_NUMBER(dep->number >> 1); if (desc->bInterval) { params.param1 |= DWC3_DEPCFG_BINTERVAL_M1(desc->bInterval - 1); dep->interval = 1 << (desc->bInterval - 1); } return dwc3_send_gadget_ep_cmd(dep, DWC3_DEPCMD_SETEPCONFIG, &params); }
0
271,506
BOOL JavascriptArray::SetAccessors(PropertyId propertyId, Var getter, Var setter, PropertyOperationFlags flags) { ScriptContext* scriptContext = this->GetScriptContext(); uint32 index; if (scriptContext->IsNumericPropertyId(propertyId, &index)) { return GetTypeHandler()->ConvertToTypeWithItemAttributes(this) ->SetItemAccessors(this, index, getter, setter); } return __super::SetAccessors(propertyId, getter, setter, flags); }
0
29,397
static void * prplcb_account_request_authorize ( PurpleAccount * account , const char * remote_user , const char * id , const char * alias , const char * message , gboolean on_list , PurpleAccountRequestAuthorizationCb authorize_cb , PurpleAccountRequestAuthorizationCb deny_cb , void * user_data ) { struct im_connection * ic = purple_ic_by_pa ( account ) ; char * q ; if ( alias ) { q = g_strdup_printf ( "%s (%s) wants to add you to his/her contact " "list. (%s)" , alias , remote_user , message ) ; } else { q = g_strdup_printf ( "%s wants to add you to his/her contact " "list. (%s)" , remote_user , message ) ; } imcb_ask_with_free ( ic , q , user_data , authorize_cb , deny_cb , NULL ) ; g_free ( q ) ; return NULL ; }
0
288,206
XSharedMemoryId AttachSharedMemory(Display* display, int shared_memory_key) { DCHECK(QuerySharedMemorySupport(display)); XShmSegmentInfo shminfo; memset(&shminfo, 0, sizeof(shminfo)); shminfo.shmid = shared_memory_key; if (!XShmAttach(display, &shminfo)) NOTREACHED(); return shminfo.shmseg; }
1
488,825
static gboolean avdtp_reconf_cmd(struct avdtp *session, uint8_t transaction, struct seid_req *req, int size) { struct conf_rej rej; rej.error = AVDTP_NOT_SUPPORTED_COMMAND; rej.category = 0x00; return avdtp_send(session, transaction, AVDTP_MSG_TYPE_REJECT, AVDTP_RECONFIGURE, &rej, sizeof(rej)); }
0
429,818
smpl_t aubio_onset_get_thresholded_descriptor(const aubio_onset_t * o) { fvec_t * thresholded = aubio_peakpicker_get_thresholded_input(o->pp); return thresholded->data[0]; }
0
188,098
static inline int s16(byte *p) { return (signed short)( (p[0] << 8) | p[1] ); }
0
219,375
ProfileChooserView::ProfileChooserView(views::Button* anchor_button, Browser* browser, profiles::BubbleViewMode view_mode, signin::GAIAServiceType service_type, signin_metrics::AccessPoint access_point) : BubbleDialogDelegateView(anchor_button, views::BubbleBorder::TOP_RIGHT), browser_(browser), anchor_button_(anchor_button), view_mode_(view_mode), gaia_service_type_(service_type), access_point_(access_point), close_bubble_helper_(this, browser), dice_enabled_(AccountConsistencyModeManager::IsDiceEnabledForProfile( browser->profile())), menu_width_(dice_enabled_ ? kFixedMenuWidthDice : kFixedMenuWidthPreDice) { set_margins(gfx::Insets(0, views::GridLayout::kFixedSize, 2, 0)); ResetView(); chrome::RecordDialogCreation(chrome::DialogIdentifier::PROFILE_CHOOSER); }
0
144,476
static inline u64 vmx_control_msr(u32 low, u32 high) { return low | ((u64)high << 32); }
0
55,088
PJ_DEF(pjsip_dialog*) pjsip_tdata_get_dlg( pjsip_tx_data *tdata ) { return (pjsip_dialog*) tdata->mod_data[mod_ua.mod.id]; }
0
362,854
static __inline__ void sk_add_bind_node(struct sock *sk, struct hlist_head *list) { hlist_add_head(&sk->sk_bind_node, list); }
0
295,785
cib_remote_connection_destroy(gpointer user_data) { crm_err("Connection destroyed"); #ifdef HAVE_GNUTLS_GNUTLS_H cib_tls_close(user_data); #endif return; }
0
157,271
mono_image_create_pefile (MonoReflectionModuleBuilder *mb, HANDLE file) { MonoMSDOSHeader *msdos; MonoDotNetHeader *header; MonoSectionTable *section; MonoCLIHeader *cli_header; guint32 size, image_size, virtual_base, text_offset; guint32 header_start, section_start, file_offset, virtual_offset; MonoDynamicImage *assembly; MonoReflectionAssemblyBuilder *assemblyb; MonoDynamicStream pefile_stream = {0}; MonoDynamicStream *pefile = &pefile_stream; int i, nsections; guint32 *rva, value; guchar *p; static const unsigned char msheader[] = { 0x4d, 0x5a, 0x90, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x0e, 0x1f, 0xba, 0x0e, 0x00, 0xb4, 0x09, 0xcd, 0x21, 0xb8, 0x01, 0x4c, 0xcd, 0x21, 0x54, 0x68, 0x69, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x20, 0x63, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x20, 0x62, 0x65, 0x20, 0x72, 0x75, 0x6e, 0x20, 0x69, 0x6e, 0x20, 0x44, 0x4f, 0x53, 0x20, 0x6d, 0x6f, 0x64, 0x65, 0x2e, 0x0d, 0x0d, 0x0a, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; assemblyb = mb->assemblyb; mono_image_basic_init (assemblyb); assembly = mb->dynamic_image; assembly->pe_kind = assemblyb->pe_kind; assembly->machine = assemblyb->machine; ((MonoDynamicImage*)assemblyb->dynamic_assembly->assembly.image)->pe_kind = assemblyb->pe_kind; ((MonoDynamicImage*)assemblyb->dynamic_assembly->assembly.image)->machine = assemblyb->machine; mono_image_build_metadata (mb); if (mb->is_main && assemblyb->resources) { int len = mono_array_length (assemblyb->resources); for (i = 0; i < len; ++i) assembly_add_resource (mb, assembly, (MonoReflectionResource*)mono_array_addr (assemblyb->resources, MonoReflectionResource, i)); } if (mb->resources) { int len = mono_array_length (mb->resources); for (i = 0; i < len; ++i) assembly_add_resource (mb, assembly, (MonoReflectionResource*)mono_array_addr (mb->resources, MonoReflectionResource, i)); } build_compressed_metadata (assembly); if (mb->is_main) assembly_add_win32_resources (assembly, assemblyb); nsections = calc_section_size (assembly); /* The DOS header and stub */ g_assert (sizeof (MonoMSDOSHeader) == sizeof (msheader)); mono_image_add_stream_data (pefile, (char*)msheader, sizeof (msheader)); /* the dotnet header */ header_start = mono_image_add_stream_zero (pefile, sizeof (MonoDotNetHeader)); /* the section tables */ section_start = mono_image_add_stream_zero (pefile, sizeof (MonoSectionTable) * nsections); file_offset = section_start + sizeof (MonoSectionTable) * nsections; virtual_offset = VIRT_ALIGN; image_size = 0; for (i = 0; i < MONO_SECTION_MAX; ++i) { if (!assembly->sections [i].size) continue; /* align offsets */ file_offset += FILE_ALIGN - 1; file_offset &= ~(FILE_ALIGN - 1); virtual_offset += VIRT_ALIGN - 1; virtual_offset &= ~(VIRT_ALIGN - 1); assembly->sections [i].offset = file_offset; assembly->sections [i].rva = virtual_offset; file_offset += assembly->sections [i].size; virtual_offset += assembly->sections [i].size; image_size += (assembly->sections [i].size + VIRT_ALIGN - 1) & ~(VIRT_ALIGN - 1); } file_offset += FILE_ALIGN - 1; file_offset &= ~(FILE_ALIGN - 1); image_size += section_start + sizeof (MonoSectionTable) * nsections; /* back-patch info */ msdos = (MonoMSDOSHeader*)pefile->data; msdos->pe_offset = GUINT32_FROM_LE (sizeof (MonoMSDOSHeader)); header = (MonoDotNetHeader*)(pefile->data + header_start); header->pesig [0] = 'P'; header->pesig [1] = 'E'; header->coff.coff_machine = GUINT16_FROM_LE (assemblyb->machine); header->coff.coff_sections = GUINT16_FROM_LE (nsections); header->coff.coff_time = GUINT32_FROM_LE (time (NULL)); header->coff.coff_opt_header_size = GUINT16_FROM_LE (sizeof (MonoDotNetHeader) - sizeof (MonoCOFFHeader) - 4); if (assemblyb->pekind == 1) { /* it's a dll */ header->coff.coff_attributes = GUINT16_FROM_LE (0x210e); } else { /* it's an exe */ header->coff.coff_attributes = GUINT16_FROM_LE (0x010e); } virtual_base = 0x400000; /* FIXME: 0x10000000 if a DLL */ header->pe.pe_magic = GUINT16_FROM_LE (0x10B); header->pe.pe_major = 6; header->pe.pe_minor = 0; size = assembly->sections [MONO_SECTION_TEXT].size; size += FILE_ALIGN - 1; size &= ~(FILE_ALIGN - 1); header->pe.pe_code_size = GUINT32_FROM_LE(size); size = assembly->sections [MONO_SECTION_RSRC].size; size += FILE_ALIGN - 1; size &= ~(FILE_ALIGN - 1); header->pe.pe_data_size = GUINT32_FROM_LE(size); g_assert (START_TEXT_RVA == assembly->sections [MONO_SECTION_TEXT].rva); header->pe.pe_rva_code_base = GUINT32_FROM_LE (assembly->sections [MONO_SECTION_TEXT].rva); header->pe.pe_rva_data_base = GUINT32_FROM_LE (assembly->sections [MONO_SECTION_RSRC].rva); /* pe_rva_entry_point always at the beginning of the text section */ header->pe.pe_rva_entry_point = GUINT32_FROM_LE (assembly->sections [MONO_SECTION_TEXT].rva); header->nt.pe_image_base = GUINT32_FROM_LE (virtual_base); header->nt.pe_section_align = GUINT32_FROM_LE (VIRT_ALIGN); header->nt.pe_file_alignment = GUINT32_FROM_LE (FILE_ALIGN); header->nt.pe_os_major = GUINT16_FROM_LE (4); header->nt.pe_os_minor = GUINT16_FROM_LE (0); header->nt.pe_subsys_major = GUINT16_FROM_LE (4); size = section_start; size += FILE_ALIGN - 1; size &= ~(FILE_ALIGN - 1); header->nt.pe_header_size = GUINT32_FROM_LE (size); size = image_size; size += VIRT_ALIGN - 1; size &= ~(VIRT_ALIGN - 1); header->nt.pe_image_size = GUINT32_FROM_LE (size); /* // Translate the PEFileKind value to the value expected by the Windows loader */ { short kind; /* // PEFileKinds.Dll == 1 // PEFileKinds.ConsoleApplication == 2 // PEFileKinds.WindowApplication == 3 // // need to get: // IMAGE_SUBSYSTEM_WINDOWS_GUI 2 // Image runs in the Windows GUI subsystem. // IMAGE_SUBSYSTEM_WINDOWS_CUI 3 // Image runs in the Windows character subsystem. */ if (assemblyb->pekind == 3) kind = 2; else kind = 3; header->nt.pe_subsys_required = GUINT16_FROM_LE (kind); } header->nt.pe_stack_reserve = GUINT32_FROM_LE (0x00100000); header->nt.pe_stack_commit = GUINT32_FROM_LE (0x00001000); header->nt.pe_heap_reserve = GUINT32_FROM_LE (0x00100000); header->nt.pe_heap_commit = GUINT32_FROM_LE (0x00001000); header->nt.pe_loader_flags = GUINT32_FROM_LE (0); header->nt.pe_data_dir_count = GUINT32_FROM_LE (16); /* fill data directory entries */ header->datadir.pe_resource_table.size = GUINT32_FROM_LE (assembly->sections [MONO_SECTION_RSRC].size); header->datadir.pe_resource_table.rva = GUINT32_FROM_LE (assembly->sections [MONO_SECTION_RSRC].rva); header->datadir.pe_reloc_table.size = GUINT32_FROM_LE (assembly->sections [MONO_SECTION_RELOC].size); header->datadir.pe_reloc_table.rva = GUINT32_FROM_LE (assembly->sections [MONO_SECTION_RELOC].rva); header->datadir.pe_cli_header.size = GUINT32_FROM_LE (72); header->datadir.pe_cli_header.rva = GUINT32_FROM_LE (assembly->text_rva + assembly->cli_header_offset); header->datadir.pe_iat.size = GUINT32_FROM_LE (8); header->datadir.pe_iat.rva = GUINT32_FROM_LE (assembly->text_rva + assembly->iat_offset); /* patch entrypoint name */ if (assemblyb->pekind == 1) memcpy (assembly->code.data + assembly->imp_names_offset + 2, "_CorDllMain", 12); else memcpy (assembly->code.data + assembly->imp_names_offset + 2, "_CorExeMain", 12); /* patch imported function RVA name */ rva = (guint32*)(assembly->code.data + assembly->iat_offset); *rva = GUINT32_FROM_LE (assembly->text_rva + assembly->imp_names_offset); /* the import table */ header->datadir.pe_import_table.size = GUINT32_FROM_LE (79); /* FIXME: magic number? */ header->datadir.pe_import_table.rva = GUINT32_FROM_LE (assembly->text_rva + assembly->idt_offset); /* patch imported dll RVA name and other entries in the dir */ rva = (guint32*)(assembly->code.data + assembly->idt_offset + G_STRUCT_OFFSET (MonoIDT, name_rva)); *rva = GUINT32_FROM_LE (assembly->text_rva + assembly->imp_names_offset + 14); /* 14 is hint+strlen+1 of func name */ rva = (guint32*)(assembly->code.data + assembly->idt_offset + G_STRUCT_OFFSET (MonoIDT, import_address_table_rva)); *rva = GUINT32_FROM_LE (assembly->text_rva + assembly->iat_offset); rva = (guint32*)(assembly->code.data + assembly->idt_offset + G_STRUCT_OFFSET (MonoIDT, import_lookup_table)); *rva = GUINT32_FROM_LE (assembly->text_rva + assembly->ilt_offset); p = (guchar*)(assembly->code.data + assembly->ilt_offset); value = (assembly->text_rva + assembly->imp_names_offset); *p++ = (value) & 0xff; *p++ = (value >> 8) & (0xff); *p++ = (value >> 16) & (0xff); *p++ = (value >> 24) & (0xff); /* the CLI header info */ cli_header = (MonoCLIHeader*)(assembly->code.data + assembly->cli_header_offset); cli_header->ch_size = GUINT32_FROM_LE (72); cli_header->ch_runtime_major = GUINT16_FROM_LE (2); cli_header->ch_runtime_minor = GUINT16_FROM_LE (5); cli_header->ch_flags = GUINT32_FROM_LE (assemblyb->pe_kind); if (assemblyb->entry_point) { guint32 table_idx = 0; if (!strcmp (assemblyb->entry_point->object.vtable->klass->name, "MethodBuilder")) { MonoReflectionMethodBuilder *methodb = (MonoReflectionMethodBuilder*)assemblyb->entry_point; table_idx = methodb->table_idx; } else { table_idx = GPOINTER_TO_UINT (g_hash_table_lookup (assembly->method_to_table_idx, assemblyb->entry_point->method)); } cli_header->ch_entry_point = GUINT32_FROM_LE (table_idx | MONO_TOKEN_METHOD_DEF); } else { cli_header->ch_entry_point = GUINT32_FROM_LE (0); } /* The embedded managed resources */ text_offset = assembly->text_rva + assembly->code.index; cli_header->ch_resources.rva = GUINT32_FROM_LE (text_offset); cli_header->ch_resources.size = GUINT32_FROM_LE (assembly->resources.index); text_offset += assembly->resources.index; cli_header->ch_metadata.rva = GUINT32_FROM_LE (text_offset); cli_header->ch_metadata.size = GUINT32_FROM_LE (assembly->meta_size); text_offset += assembly->meta_size; if (assembly->strong_name_size) { cli_header->ch_strong_name.rva = GUINT32_FROM_LE (text_offset); cli_header->ch_strong_name.size = GUINT32_FROM_LE (assembly->strong_name_size); text_offset += assembly->strong_name_size; } /* write the section tables and section content */ section = (MonoSectionTable*)(pefile->data + section_start); for (i = 0; i < MONO_SECTION_MAX; ++i) { static const char section_names [][7] = { ".text", ".rsrc", ".reloc" }; if (!assembly->sections [i].size) continue; strcpy (section->st_name, section_names [i]); /*g_print ("output section %s (%d), size: %d\n", section->st_name, i, assembly->sections [i].size);*/ section->st_virtual_address = GUINT32_FROM_LE (assembly->sections [i].rva); section->st_virtual_size = GUINT32_FROM_LE (assembly->sections [i].size); section->st_raw_data_size = GUINT32_FROM_LE (GUINT32_TO_LE (section->st_virtual_size) + (FILE_ALIGN - 1)); section->st_raw_data_size &= GUINT32_FROM_LE (~(FILE_ALIGN - 1)); section->st_raw_data_ptr = GUINT32_FROM_LE (assembly->sections [i].offset); section->st_flags = GUINT32_FROM_LE (assembly->sections [i].attrs); section ++; } checked_write_file (file, pefile->data, pefile->index); mono_dynamic_stream_reset (pefile); for (i = 0; i < MONO_SECTION_MAX; ++i) { if (!assembly->sections [i].size) continue; if (SetFilePointer (file, assembly->sections [i].offset, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER) g_error ("SetFilePointer returned %d\n", GetLastError ()); switch (i) { case MONO_SECTION_TEXT: /* patch entry point */ p = (guchar*)(assembly->code.data + 2); value = (virtual_base + assembly->text_rva + assembly->iat_offset); *p++ = (value) & 0xff; *p++ = (value >> 8) & 0xff; *p++ = (value >> 16) & 0xff; *p++ = (value >> 24) & 0xff; checked_write_file (file, assembly->code.data, assembly->code.index); checked_write_file (file, assembly->resources.data, assembly->resources.index); checked_write_file (file, assembly->image.raw_metadata, assembly->meta_size); checked_write_file (file, assembly->strong_name, assembly->strong_name_size); g_free (assembly->image.raw_metadata); break; case MONO_SECTION_RELOC: { struct { guint32 page_rva; guint32 block_size; guint16 type_and_offset; guint16 term; } reloc; g_assert (sizeof (reloc) == 12); reloc.page_rva = GUINT32_FROM_LE (assembly->text_rva); reloc.block_size = GUINT32_FROM_LE (12); /* * the entrypoint is always at the start of the text section * 3 is IMAGE_REL_BASED_HIGHLOW * 2 is patch_size_rva - text_rva */ reloc.type_and_offset = GUINT16_FROM_LE ((3 << 12) + (2)); reloc.term = 0; checked_write_file (file, &reloc, sizeof (reloc)); break; } case MONO_SECTION_RSRC: if (assembly->win32_res) { /* Fixup the offsets in the IMAGE_RESOURCE_DATA_ENTRY structures */ fixup_resource_directory (assembly->win32_res, assembly->win32_res, assembly->sections [i].rva); checked_write_file (file, assembly->win32_res, assembly->win32_res_size); } break; default: g_assert_not_reached (); } } /* check that the file is properly padded */ if (SetFilePointer (file, file_offset, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER) g_error ("SetFilePointer returned %d\n", GetLastError ()); if (! SetEndOfFile (file)) g_error ("SetEndOfFile returned %d\n", GetLastError ()); mono_dynamic_stream_reset (&assembly->code); mono_dynamic_stream_reset (&assembly->us); mono_dynamic_stream_reset (&assembly->blob); mono_dynamic_stream_reset (&assembly->guid); mono_dynamic_stream_reset (&assembly->sheap); g_hash_table_foreach (assembly->blob_cache, (GHFunc)g_free, NULL); g_hash_table_destroy (assembly->blob_cache); assembly->blob_cache = NULL; }
0
513,083
virtual void dump() {}
0
300,198
int af9005_read_ofdm_register(struct dvb_usb_device *d, u16 reg, u8 * value) { int ret; deb_reg("read register %x ", reg); ret = af9005_generic_read_write(d, reg, AF9005_CMD_READ, AF9005_OFDM_REG, value, 1); if (ret) deb_reg("failed\n"); else deb_reg("value %x\n", *value); return ret; }
0
62,223
void ASC_getUserIdentAC(T_ASC_Parameters* params, UserIdentityNegotiationSubItemAC** usrIdentAC) { *usrIdentAC = params->DULparams.ackUserIdentNeg; }
0
442,024
vhost_user_set_log_base(struct virtio_net **pdev, struct VhostUserMsg *msg, int main_fd __rte_unused) { struct virtio_net *dev = *pdev; int fd = msg->fds[0]; uint64_t size, off; void *addr; if (validate_msg_fds(msg, 1) != 0) return RTE_VHOST_MSG_RESULT_ERR; if (fd < 0) { VHOST_LOG_CONFIG(ERR, "invalid log fd: %d\n", fd); return RTE_VHOST_MSG_RESULT_ERR; } if (msg->size != sizeof(VhostUserLog)) { VHOST_LOG_CONFIG(ERR, "invalid log base msg size: %"PRId32" != %d\n", msg->size, (int)sizeof(VhostUserLog)); return RTE_VHOST_MSG_RESULT_ERR; } size = msg->payload.log.mmap_size; off = msg->payload.log.mmap_offset; /* Check for mmap size and offset overflow. */ if (off >= -size) { VHOST_LOG_CONFIG(ERR, "log offset %#"PRIx64" and log size %#"PRIx64" overflow\n", off, size); return RTE_VHOST_MSG_RESULT_ERR; } VHOST_LOG_CONFIG(INFO, "log mmap size: %"PRId64", offset: %"PRId64"\n", size, off); /* * mmap from 0 to workaround a hugepage mmap bug: mmap will * fail when offset is not page size aligned. */ addr = mmap(0, size + off, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); close(fd); if (addr == MAP_FAILED) { VHOST_LOG_CONFIG(ERR, "mmap log base failed!\n"); return RTE_VHOST_MSG_RESULT_ERR; } /* * Free previously mapped log memory on occasionally * multiple VHOST_USER_SET_LOG_BASE. */ if (dev->log_addr) { munmap((void *)(uintptr_t)dev->log_addr, dev->log_size); } dev->log_addr = (uint64_t)(uintptr_t)addr; dev->log_base = dev->log_addr + off; dev->log_size = size; /* * The spec is not clear about it (yet), but QEMU doesn't expect * any payload in the reply. */ msg->size = 0; msg->fd_num = 0; return RTE_VHOST_MSG_RESULT_REPLY; }
0
386,577
/* {{{ PHP_RSHUTDOWN_FUNCTION */ PHP_RSHUTDOWN_FUNCTION(date) { if (DATEG(timezone)) { efree(DATEG(timezone)); } DATEG(timezone) = NULL; if(DATEG(tzcache)) { zend_hash_destroy(DATEG(tzcache)); FREE_HASHTABLE(DATEG(tzcache)); DATEG(tzcache) = NULL; } if (DATEG(last_errors)) { timelib_error_container_dtor(DATEG(last_errors)); DATEG(last_errors) = NULL; }
0
102,246
R_API RBuffer *r_buf_new_with_bytes(const ut8 *bytes, ut64 len) { struct buf_bytes_user u = { 0 }; u.data = bytes; u.length = len; return new_buffer (R_BUFFER_BYTES, &u); }
0
505,106
static int append_ia5(STACK_OF(OPENSSL_STRING) **sk, ASN1_IA5STRING *email) { char *emtmp; /* First some sanity checks */ if(email->type != V_ASN1_IA5STRING) return 1; if(!email->data || !email->length) return 1; if(!*sk) *sk = sk_OPENSSL_STRING_new(sk_strcmp); if(!*sk) return 0; /* Don't add duplicates */ if(sk_OPENSSL_STRING_find(*sk, (char *)email->data) != -1) return 1; emtmp = BUF_strdup((char *)email->data); if(!emtmp || !sk_OPENSSL_STRING_push(*sk, emtmp)) { X509_email_free(*sk); *sk = NULL; return 0; } return 1; }
0
137,557
static void kvm_sched_yield(struct kvm_vcpu *vcpu, unsigned long dest_id) { struct kvm_vcpu *target = NULL; struct kvm_apic_map *map; vcpu->stat.directed_yield_attempted++; if (single_task_running()) goto no_yield; rcu_read_lock(); map = rcu_dereference(vcpu->kvm->arch.apic_map); if (likely(map) && dest_id <= map->max_apic_id && map->phys_map[dest_id]) target = map->phys_map[dest_id]->vcpu; rcu_read_unlock(); if (!target || !READ_ONCE(target->ready)) goto no_yield; /* Ignore requests to yield to self */ if (vcpu == target) goto no_yield; if (kvm_vcpu_yield_to(target) <= 0) goto no_yield; vcpu->stat.directed_yield_successful++; no_yield: return; }
0
315,700
CanvasResourceProvider* HTMLCanvasElement::GetOrCreateCanvasResourceProvider( AccelerationHint hint) { if (Is2d()) return GetOrCreateCanvas2DLayerBridge()->GetOrCreateResourceProvider(hint); return CanvasRenderingContextHost::GetOrCreateCanvasResourceProvider(hint); }
0
212,186
void PrintPreviewMessageHandler::OnRequestPrintPreview( content::RenderFrameHost* render_frame_host, const PrintHostMsg_RequestPrintPreview_Params& params) { if (params.webnode_only) { PrintViewManager::FromWebContents(web_contents())->PrintPreviewForWebNode( render_frame_host); } PrintPreviewDialogController::PrintPreview(web_contents()); PrintPreviewUI::SetInitialParams(GetPrintPreviewDialog(), params); }
0
217,422
int BrowserActionsContainer::GetCurrentTabId() const { TabContents* tab_contents = toolbar_->browser()->GetSelectedTabContents(); if (!tab_contents) return -1; return tab_contents->controller().session_id().id(); }
0
517,276
Item_default_value(THD *thd, Name_resolution_context *context_arg, Field *a) :Item_field(thd, context_arg, (const char *)NULL, (const char *)NULL, (const char *)NULL), arg(NULL),cached_field(NULL) {}
0
459,187
MagickExport void ConvertRGBToHCLp(const Quantum red,const Quantum green, const Quantum blue,double *hue,double *chroma,double *luma) { double b, c, g, h, max, r; /* Convert RGB to HCLp colorspace. */ assert(hue != (double *) NULL); assert(chroma != (double *) NULL); assert(luma != (double *) NULL); r=(double) red; g=(double) green; b=(double) blue; max=MagickMax(r,MagickMax(g,b)); c=max-(double) MagickMin(r,MagickMin(g,b)); h=0.0; if (fabs(c) < MagickEpsilon) h=0.0; else if (red == (Quantum) max) h=fmod((g-b)/c+6.0,6.0); else if (green == (Quantum) max) h=((b-r)/c)+2.0; else if (blue == (Quantum) max) h=((r-g)/c)+4.0; *hue=(h/6.0); *chroma=QuantumScale*c; *luma=QuantumScale*(0.298839*r+0.586811*g+0.114350*b); }
0
23,888
static gboolean k12_dump_finish ( wtap_dumper * wdh , int * err ) { k12_dump_t * k12 = ( k12_dump_t * ) wdh -> priv ; union { guint8 b [ sizeof ( guint32 ) ] ; guint32 u ; } d ; if ( ! wtap_dump_file_write ( wdh , k12_eof , 2 , err ) ) return FALSE ; k12 -> file_len += 2 ; if ( wtap_dump_file_seek ( wdh , K12_FILE_HDR_FILE_SIZE , SEEK_SET , err ) == - 1 ) return FALSE ; d . u = g_htonl ( k12 -> file_len ) ; if ( ! wtap_dump_file_write ( wdh , d . b , 4 , err ) ) return FALSE ; if ( wtap_dump_file_seek ( wdh , K12_FILE_HDR_PAGE_SIZE , SEEK_SET , err ) == - 1 ) return FALSE ; d . u = g_htonl ( 8192 ) ; if ( ! wtap_dump_file_write ( wdh , d . b , 4 , err ) ) return FALSE ; if ( wtap_dump_file_seek ( wdh , K12_FILE_HDR_RECORD_COUNT_1 , SEEK_SET , err ) == - 1 ) return FALSE ; d . u = g_htonl ( k12 -> num_of_records ) ; if ( ! wtap_dump_file_write ( wdh , d . b , 4 , err ) ) return FALSE ; if ( wtap_dump_file_seek ( wdh , K12_FILE_HDR_RECORD_COUNT_2 , SEEK_SET , err ) == - 1 ) return FALSE ; d . u = g_htonl ( k12 -> num_of_records ) ; if ( ! wtap_dump_file_write ( wdh , d . b , 4 , err ) ) return FALSE ; return TRUE ; }
0
68,088
sampled_guards_update_from_consensus(guard_selection_t *gs) { tor_assert(gs); const int REMOVE_UNLISTED_GUARDS_AFTER = (get_remove_unlisted_guards_after_days() * 86400); const int unlisted_since_slop = REMOVE_UNLISTED_GUARDS_AFTER / 5; // It's important to use only a live consensus here; we don't want to // make changes based on anything expired or old. if (live_consensus_is_missing(gs)) { log_info(LD_GUARD, "Not updating the sample guard set; we have " "no live consensus."); return; } log_info(LD_GUARD, "Updating sampled guard status based on received " "consensus."); int n_changes = 0; /* First: Update listed/unlisted. */ SMARTLIST_FOREACH_BEGIN(gs->sampled_entry_guards, entry_guard_t *, guard) { /* XXXX #20827 check ed ID too */ const int is_listed = entry_guard_is_listed(gs, guard); if (is_listed && ! guard->currently_listed) { ++n_changes; guard->currently_listed = 1; guard->unlisted_since_date = 0; log_info(LD_GUARD, "Sampled guard %s is now listed again.", entry_guard_describe(guard)); } else if (!is_listed && guard->currently_listed) { ++n_changes; guard->currently_listed = 0; guard->unlisted_since_date = randomize_time(approx_time(), unlisted_since_slop); log_info(LD_GUARD, "Sampled guard %s is now unlisted.", entry_guard_describe(guard)); } else if (is_listed && guard->currently_listed) { log_debug(LD_GUARD, "Sampled guard %s is still listed.", entry_guard_describe(guard)); } else { tor_assert(! is_listed && ! guard->currently_listed); log_debug(LD_GUARD, "Sampled guard %s is still unlisted.", entry_guard_describe(guard)); } /* Clean up unlisted_since_date, just in case. */ if (guard->currently_listed && guard->unlisted_since_date) { ++n_changes; guard->unlisted_since_date = 0; log_warn(LD_BUG, "Sampled guard %s was listed, but with " "unlisted_since_date set. Fixing.", entry_guard_describe(guard)); } else if (!guard->currently_listed && ! guard->unlisted_since_date) { ++n_changes; guard->unlisted_since_date = randomize_time(approx_time(), unlisted_since_slop); log_warn(LD_BUG, "Sampled guard %s was unlisted, but with " "unlisted_since_date unset. Fixing.", entry_guard_describe(guard)); } } SMARTLIST_FOREACH_END(guard); const time_t remove_if_unlisted_since = approx_time() - REMOVE_UNLISTED_GUARDS_AFTER; const time_t maybe_remove_if_sampled_before = approx_time() - get_guard_lifetime(); const time_t remove_if_confirmed_before = approx_time() - get_guard_confirmed_min_lifetime(); /* Then: remove the ones that have been junk for too long */ SMARTLIST_FOREACH_BEGIN(gs->sampled_entry_guards, entry_guard_t *, guard) { int rmv = 0; if (guard->currently_listed == 0 && guard->unlisted_since_date < remove_if_unlisted_since) { /* "We have a live consensus, and {IS_LISTED} is false, and {FIRST_UNLISTED_AT} is over {REMOVE_UNLISTED_GUARDS_AFTER} days in the past." */ log_info(LD_GUARD, "Removing sampled guard %s: it has been unlisted " "for over %d days", entry_guard_describe(guard), get_remove_unlisted_guards_after_days()); rmv = 1; } else if (guard->sampled_on_date < maybe_remove_if_sampled_before) { /* We have a live consensus, and {ADDED_ON_DATE} is over {GUARD_LIFETIME} ago, *and* {CONFIRMED_ON_DATE} is either "never", or over {GUARD_CONFIRMED_MIN_LIFETIME} ago. */ if (guard->confirmed_on_date == 0) { rmv = 1; log_info(LD_GUARD, "Removing sampled guard %s: it was sampled " "over %d days ago, but never confirmed.", entry_guard_describe(guard), get_guard_lifetime() / 86400); } else if (guard->confirmed_on_date < remove_if_confirmed_before) { rmv = 1; log_info(LD_GUARD, "Removing sampled guard %s: it was sampled " "over %d days ago, and confirmed over %d days ago.", entry_guard_describe(guard), get_guard_lifetime() / 86400, get_guard_confirmed_min_lifetime() / 86400); } } if (rmv) { ++n_changes; SMARTLIST_DEL_CURRENT(gs->sampled_entry_guards, guard); remove_guard_from_confirmed_and_primary_lists(gs, guard); entry_guard_free(guard); } } SMARTLIST_FOREACH_END(guard); if (n_changes) { gs->primary_guards_up_to_date = 0; entry_guards_update_filtered_sets(gs); /* We don't need to rebuild the confirmed list right here -- we may have * removed confirmed guards above, but we can't have added any new * confirmed guards. */ entry_guards_changed_for_guard_selection(gs); } }
0
17,517
static void dissect_zcl_identify_identify ( tvbuff_t * tvb , proto_tree * tree , guint * offset ) { proto_tree_add_item ( tree , hf_zbee_zcl_identify_identify_time , tvb , * offset , 2 , ENC_LITTLE_ENDIAN ) ; * offset += 2 ; }
0
69,009
static int i40e_config_netdev(struct i40e_vsi *vsi) { struct i40e_pf *pf = vsi->back; struct i40e_hw *hw = &pf->hw; struct i40e_netdev_priv *np; struct net_device *netdev; u8 broadcast[ETH_ALEN]; u8 mac_addr[ETH_ALEN]; int etherdev_size; netdev_features_t hw_enc_features; netdev_features_t hw_features; etherdev_size = sizeof(struct i40e_netdev_priv); netdev = alloc_etherdev_mq(etherdev_size, vsi->alloc_queue_pairs); if (!netdev) return -ENOMEM; vsi->netdev = netdev; np = netdev_priv(netdev); np->vsi = vsi; hw_enc_features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_HIGHDMA | NETIF_F_SOFT_FEATURES | NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_GSO_GRE | NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_PARTIAL | NETIF_F_GSO_IPXIP4 | NETIF_F_GSO_IPXIP6 | NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_SCTP_CRC | NETIF_F_RXHASH | NETIF_F_RXCSUM | 0; if (!(pf->hw_features & I40E_HW_OUTER_UDP_CSUM_CAPABLE)) netdev->gso_partial_features |= NETIF_F_GSO_UDP_TUNNEL_CSUM; netdev->gso_partial_features |= NETIF_F_GSO_GRE_CSUM; netdev->hw_enc_features |= hw_enc_features; /* record features VLANs can make use of */ netdev->vlan_features |= hw_enc_features | NETIF_F_TSO_MANGLEID; /* enable macvlan offloads */ netdev->hw_features |= NETIF_F_HW_L2FW_DOFFLOAD; hw_features = hw_enc_features | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX; if (!(pf->flags & I40E_FLAG_MFP_ENABLED)) hw_features |= NETIF_F_NTUPLE | NETIF_F_HW_TC; netdev->hw_features |= hw_features; netdev->features |= hw_features | NETIF_F_HW_VLAN_CTAG_FILTER; netdev->hw_enc_features |= NETIF_F_TSO_MANGLEID; if (vsi->type == I40E_VSI_MAIN) { SET_NETDEV_DEV(netdev, &pf->pdev->dev); ether_addr_copy(mac_addr, hw->mac.perm_addr); /* The following steps are necessary for two reasons. First, * some older NVM configurations load a default MAC-VLAN * filter that will accept any tagged packet, and we want to * replace this with a normal filter. Additionally, it is * possible our MAC address was provided by the platform using * Open Firmware or similar. * * Thus, we need to remove the default filter and install one * specific to the MAC address. */ i40e_rm_default_mac_filter(vsi, mac_addr); spin_lock_bh(&vsi->mac_filter_hash_lock); i40e_add_mac_filter(vsi, mac_addr); spin_unlock_bh(&vsi->mac_filter_hash_lock); } else { /* Relate the VSI_VMDQ name to the VSI_MAIN name. Note that we * are still limited by IFNAMSIZ, but we're adding 'v%d\0' to * the end, which is 4 bytes long, so force truncation of the * original name by IFNAMSIZ - 4 */ snprintf(netdev->name, IFNAMSIZ, "%.*sv%%d", IFNAMSIZ - 4, pf->vsi[pf->lan_vsi]->netdev->name); eth_random_addr(mac_addr); spin_lock_bh(&vsi->mac_filter_hash_lock); i40e_add_mac_filter(vsi, mac_addr); spin_unlock_bh(&vsi->mac_filter_hash_lock); } /* Add the broadcast filter so that we initially will receive * broadcast packets. Note that when a new VLAN is first added the * driver will convert all filters marked I40E_VLAN_ANY into VLAN * specific filters as part of transitioning into "vlan" operation. * When more VLANs are added, the driver will copy each existing MAC * filter and add it for the new VLAN. * * Broadcast filters are handled specially by * i40e_sync_filters_subtask, as the driver must to set the broadcast * promiscuous bit instead of adding this directly as a MAC/VLAN * filter. The subtask will update the correct broadcast promiscuous * bits as VLANs become active or inactive. */ eth_broadcast_addr(broadcast); spin_lock_bh(&vsi->mac_filter_hash_lock); i40e_add_mac_filter(vsi, broadcast); spin_unlock_bh(&vsi->mac_filter_hash_lock); ether_addr_copy(netdev->dev_addr, mac_addr); ether_addr_copy(netdev->perm_addr, mac_addr); /* i40iw_net_event() reads 16 bytes from neigh->primary_key */ netdev->neigh_priv_len = sizeof(u32) * 4; netdev->priv_flags |= IFF_UNICAST_FLT; netdev->priv_flags |= IFF_SUPP_NOFCS; /* Setup netdev TC information */ i40e_vsi_config_netdev_tc(vsi, vsi->tc_config.enabled_tc); netdev->netdev_ops = &i40e_netdev_ops; netdev->watchdog_timeo = 5 * HZ; i40e_set_ethtool_ops(netdev); /* MTU range: 68 - 9706 */ netdev->min_mtu = ETH_MIN_MTU; netdev->max_mtu = I40E_MAX_RXBUFFER - I40E_PACKET_HDR_PAD; return 0; }
0
501,435
size_t ZSTD_freeCCtx(ZSTD_CCtx* cctx) { if (cctx==NULL) return 0; /* support free on NULL */ if (cctx->staticSize) return ERROR(memory_allocation); /* not compatible with static CCtx */ ZSTD_freeCCtxContent(cctx); ZSTD_free(cctx, cctx->customMem); return 0; }
0
245,500
blink::WebAppBannerClient* RenderFrameImpl::appBannerClient() { if (!app_banner_client_) { app_banner_client_ = GetContentClient()->renderer()->CreateAppBannerClient(this); } return app_banner_client_.get(); }
0
335,658
static void mpegts_write_section(MpegTSSection *s, uint8_t *buf, int len) { unsigned int crc; unsigned char packet[TS_PACKET_SIZE]; const unsigned char *buf_ptr; unsigned char *q; int first, b, len1, left; crc = av_bswap32(av_crc(av_crc_get_table(AV_CRC_32_IEEE), -1, buf, len - 4)); buf[len - 4] = (crc >> 24) & 0xff; buf[len - 3] = (crc >> 16) & 0xff; buf[len - 2] = (crc >> 8) & 0xff; buf[len - 1] = crc & 0xff; /* send each packet */ buf_ptr = buf; while (len > 0) { first = buf == buf_ptr; q = packet; *q++ = 0x47; b = s->pid >> 8; if (first) b |= 0x40; *q++ = b; *q++ = s->pid; s->cc = s->cc + 1 & 0xf; *q++ = 0x10 | s->cc; if (first) *q++ = 0; /* 0 offset */ len1 = TS_PACKET_SIZE - (q - packet); if (len1 > len) len1 = len; memcpy(q, buf_ptr, len1); q += len1; /* add known padding data */ left = TS_PACKET_SIZE - (q - packet); if (left > 0) memset(q, 0xff, left); s->write_packet(s, packet); buf_ptr += len1; len -= len1;
1
241,022
void CapturerMac::ClearInvalidRects() { helper_.ClearInvalidRects(); }
0
86,267
static int ahash_setkey_unaligned(struct crypto_ahash *tfm, const u8 *key, unsigned int keylen) { unsigned long alignmask = crypto_ahash_alignmask(tfm); int ret; u8 *buffer, *alignbuffer; unsigned long absize; absize = keylen + alignmask; buffer = kmalloc(absize, GFP_KERNEL); if (!buffer) return -ENOMEM; alignbuffer = (u8 *)ALIGN((unsigned long)buffer, alignmask + 1); memcpy(alignbuffer, key, keylen); ret = tfm->setkey(tfm, alignbuffer, keylen); kzfree(buffer); return ret; }
0
132,219
static void process_stats_conns(ADD_STAT add_stats, void *c) { int i; char key_str[STAT_KEY_LEN]; char val_str[STAT_VAL_LEN]; size_t extras_len = sizeof("unix:") + sizeof("65535"); char addr[MAXPATHLEN + extras_len]; char svr_addr[MAXPATHLEN + extras_len]; int klen = 0, vlen = 0; assert(add_stats); for (i = 0; i < max_fds; i++) { if (conns[i]) { /* This is safe to do unlocked because conns are never freed; the * worst that'll happen will be a minor inconsistency in the * output -- not worth the complexity of the locking that'd be * required to prevent it. */ if (IS_UDP(conns[i]->transport)) { APPEND_NUM_STAT(i, "UDP", "%s", "UDP"); } if (conns[i]->state != conn_closed) { conn_to_str(conns[i], addr, svr_addr); APPEND_NUM_STAT(i, "addr", "%s", addr); if (conns[i]->state != conn_listening && !(IS_UDP(conns[i]->transport) && conns[i]->state == conn_read)) { APPEND_NUM_STAT(i, "listen_addr", "%s", svr_addr); } APPEND_NUM_STAT(i, "state", "%s", state_text(conns[i]->state)); APPEND_NUM_STAT(i, "secs_since_last_cmd", "%d", current_time - conns[i]->last_cmd_time); } } } }
0
389,794
void qemu_ram_remap(ram_addr_t addr, ram_addr_t length) { RAMBlock *block; ram_addr_t offset; int flags; void *area, *vaddr; QLIST_FOREACH_RCU(block, &ram_list.blocks, next) { offset = addr - block->offset; if (offset < block->max_length) { vaddr = ramblock_ptr(block, offset); if (block->flags & RAM_PREALLOC) { ; } else if (xen_enabled()) { abort(); } else { flags = MAP_FIXED; if (block->fd >= 0) { flags |= (block->flags & RAM_SHARED ? MAP_SHARED : MAP_PRIVATE); area = mmap(vaddr, length, PROT_READ | PROT_WRITE, flags, block->fd, offset); } else { /* * Remap needs to match alloc. Accelerators that * set phys_mem_alloc never remap. If they did, * we'd need a remap hook here. */ assert(phys_mem_alloc == qemu_anon_ram_alloc); flags |= MAP_PRIVATE | MAP_ANONYMOUS; area = mmap(vaddr, length, PROT_READ | PROT_WRITE, flags, -1, 0); } if (area != vaddr) { fprintf(stderr, "Could not remap addr: " RAM_ADDR_FMT "@" RAM_ADDR_FMT "\n", length, addr); exit(1); } memory_try_enable_merging(vaddr, length); qemu_ram_setup_dump(vaddr, length); } } } }
0
13,020
gst_vorbis_tag_add_coverart (GstTagList * tags, const gchar * img_data_base64, gint base64_len) { GstBuffer *img; guchar *img_data; gsize img_len; guint save = 0; gint state = 0; if (base64_len < 2) goto not_enough_data; img_data = g_try_malloc0 (base64_len * 3 / 4); if (img_data == NULL) goto alloc_failed; img_len = g_base64_decode_step (img_data_base64, base64_len, img_data, &state, &save); if (img_len == 0) goto decode_failed; img = gst_tag_image_data_to_image_buffer (img_data, img_len, GST_TAG_IMAGE_TYPE_NONE); if (img == NULL) gst_tag_list_add (tags, GST_TAG_MERGE_APPEND, GST_TAG_PREVIEW_IMAGE, img, NULL); GST_TAG_PREVIEW_IMAGE, img, NULL); gst_buffer_unref (img); g_free (img_data); return; /* ERRORS */ { GST_WARNING ("COVERART tag with too little base64-encoded data"); GST_WARNING ("COVERART tag with too little base64-encoded data"); return; } alloc_failed: { GST_WARNING ("Couldn't allocate enough memory to decode COVERART tag"); return; } decode_failed: { GST_WARNING ("Couldn't decode bas64 image data from COVERART tag"); g_free (img_data); return; } convert_failed: { GST_WARNING ("Couldn't extract image or image type from COVERART tag"); g_free (img_data); return; } }
1
198,368
HistogramBase* CustomHistogram::DeserializeInfoImpl(PickleIterator* iter) { std::string histogram_name; int flags; int declared_min; int declared_max; uint32_t bucket_count; uint32_t range_checksum; if (!ReadHistogramArguments(iter, &histogram_name, &flags, &declared_min, &declared_max, &bucket_count, &range_checksum)) { return NULL; } std::vector<Sample> sample_ranges(bucket_count - 1); for (uint32_t i = 0; i < sample_ranges.size(); ++i) { if (!iter->ReadInt(&sample_ranges[i])) return NULL; } HistogramBase* histogram = CustomHistogram::FactoryGet( histogram_name, sample_ranges, flags); if (!ValidateRangeChecksum(*histogram, range_checksum)) { return NULL; } return histogram; }
0
353,410
dtls1_buffer_message(SSL *s, int is_ccs) { pitem *item; hm_fragment *frag; unsigned char seq64be[8]; /* this function is called immediately after a message has * been serialized */ OPENSSL_assert(s->init_off == 0); frag = dtls1_hm_fragment_new(s->init_num); memcpy(frag->fragment, s->init_buf->data, s->init_num); if ( is_ccs) { OPENSSL_assert(s->d1->w_msg_hdr.msg_len + ((s->version==DTLS1_VERSION)?DTLS1_CCS_HEADER_LENGTH:3) == (unsigned int)s->init_num); } else { OPENSSL_assert(s->d1->w_msg_hdr.msg_len + DTLS1_HM_HEADER_LENGTH == (unsigned int)s->init_num); } frag->msg_header.msg_len = s->d1->w_msg_hdr.msg_len; frag->msg_header.seq = s->d1->w_msg_hdr.seq; frag->msg_header.type = s->d1->w_msg_hdr.type; frag->msg_header.frag_off = 0; frag->msg_header.frag_len = s->d1->w_msg_hdr.msg_len; frag->msg_header.is_ccs = is_ccs; /* save current state*/ frag->msg_header.saved_retransmit_state.enc_write_ctx = s->enc_write_ctx; frag->msg_header.saved_retransmit_state.write_hash = s->write_hash; frag->msg_header.saved_retransmit_state.compress = s->compress; frag->msg_header.saved_retransmit_state.session = s->session; frag->msg_header.saved_retransmit_state.epoch = s->d1->w_epoch; memset(seq64be,0,sizeof(seq64be)); seq64be[6] = (unsigned char)(dtls1_get_queue_priority(frag->msg_header.seq, frag->msg_header.is_ccs)>>8); seq64be[7] = (unsigned char)(dtls1_get_queue_priority(frag->msg_header.seq, frag->msg_header.is_ccs)); item = pitem_new(seq64be, frag); if ( item == NULL) { dtls1_hm_fragment_free(frag); return 0; } #if 0 fprintf( stderr, "buffered messge: \ttype = %xx\n", msg_buf->type); fprintf( stderr, "\t\t\t\t\tlen = %d\n", msg_buf->len); fprintf( stderr, "\t\t\t\t\tseq_num = %d\n", msg_buf->seq_num); #endif pqueue_insert(s->d1->sent_messages, item); return 1; }
1
13,683
void PlatformSensorFusion::Create( mojo::ScopedSharedBufferMapping mapping, PlatformSensorProvider* provider, std::unique_ptr<PlatformSensorFusionAlgorithm> fusion_algorithm, const PlatformSensorProviderBase::CreateSensorCallback& callback) { Factory::CreateSensorFusion(std::move(mapping), std::move(fusion_algorithm), callback, provider); }
1
444,257
int ConnectionImpl::onMetadataFrameComplete(int32_t stream_id, bool end_metadata) { ENVOY_CONN_LOG(trace, "recv METADATA frame on stream {}, end_metadata: {}", connection_, stream_id, end_metadata); StreamImpl* stream = getStream(stream_id); if (stream == nullptr) { return 0; } bool result = stream->getMetadataDecoder().onMetadataFrameComplete(end_metadata); return result ? 0 : NGHTTP2_ERR_CALLBACK_FAILURE; }
0
208,194
virtual bool livesLocally(node_id node, pid_t pid) { Parcel data, reply; data.writeInterfaceToken(IOMX::getInterfaceDescriptor()); data.writeInt32((int32_t)node); data.writeInt32(pid); remote()->transact(LIVES_LOCALLY, data, &reply); return reply.readInt32() != 0; }
0
142,125
static int ntop_change_user_host_pool(lua_State* vm) { char *username, *host_pool_id; ntop->getTrace()->traceEvent(TRACE_DEBUG, "%s() called", __FUNCTION__); if(!Utils::isUserAdministrator(vm)) return(CONST_LUA_ERROR); if(ntop_lua_check(vm, __FUNCTION__, 1, LUA_TSTRING)) return(CONST_LUA_PARAM_ERROR); if((username = (char*)lua_tostring(vm, 1)) == NULL) return(CONST_LUA_PARAM_ERROR); if(ntop_lua_check(vm, __FUNCTION__, 2, LUA_TSTRING)) return(CONST_LUA_PARAM_ERROR); if((host_pool_id = (char*)lua_tostring(vm, 2)) == NULL) return(CONST_LUA_PARAM_ERROR); return ntop->changeUserHostPool(username, host_pool_id); }
0
368,269
token_clear(directory_token_t *tok) { if (tok->key) crypto_free_pk_env(tok->key); }
0
184,293
void QuotaManager::GetGlobalUsage(StorageType type, const GlobalUsageCallback& callback) { LazyInitialize(); GetUsageTracker(type)->GetGlobalUsage(callback); }
0
503,446
ra_input(void) { uip_lladdr_t lladdr_aligned; LOG_INFO("Received RA from "); LOG_INFO_6ADDR(&UIP_IP_BUF->srcipaddr); LOG_INFO_(" to "); LOG_INFO_6ADDR(&UIP_IP_BUF->destipaddr); LOG_INFO_("\n"); UIP_STAT(++uip_stat.nd6.recv); #if UIP_CONF_IPV6_CHECKS if((UIP_IP_BUF->ttl != UIP_ND6_HOP_LIMIT) || (!uip_is_addr_linklocal(&UIP_IP_BUF->srcipaddr)) || (UIP_ICMP_BUF->icode != 0)) { LOG_ERR("RA received is bad"); goto discard; } #endif /*UIP_CONF_IPV6_CHECKS */ if(UIP_ND6_RA_BUF->cur_ttl != 0) { uip_ds6_if.cur_hop_limit = UIP_ND6_RA_BUF->cur_ttl; LOG_INFO("uip_ds6_if.cur_hop_limit %u\n", uip_ds6_if.cur_hop_limit); } if(UIP_ND6_RA_BUF->reachable_time != 0) { if(uip_ds6_if.base_reachable_time != uip_ntohl(UIP_ND6_RA_BUF->reachable_time)) { uip_ds6_if.base_reachable_time = uip_ntohl(UIP_ND6_RA_BUF->reachable_time); uip_ds6_if.reachable_time = uip_ds6_compute_reachable_time(); } } if(UIP_ND6_RA_BUF->retrans_timer != 0) { uip_ds6_if.retrans_timer = uip_ntohl(UIP_ND6_RA_BUF->retrans_timer); } /* Options processing */ nd6_opt_offset = UIP_ND6_RA_LEN; while(uip_l3_icmp_hdr_len + nd6_opt_offset < uip_len) { if(ND6_OPT_HDR_BUF(nd6_opt_offset)->len == 0) { LOG_ERR("RA received is bad"); goto discard; } switch (ND6_OPT_HDR_BUF(nd6_opt_offset)->type) { case UIP_ND6_OPT_SLLAO: LOG_DBG("Processing SLLAO option in RA\n"); nd6_opt_llao = (uint8_t *) ND6_OPT_HDR_BUF(nd6_opt_offset); nbr = uip_ds6_nbr_lookup(&UIP_IP_BUF->srcipaddr); if(!extract_lladdr_from_llao_aligned(&lladdr_aligned)) { /* failed to extract llao - discard packet */ goto discard; } if(nbr == NULL) { nbr = uip_ds6_nbr_add(&UIP_IP_BUF->srcipaddr, &lladdr_aligned, 1, NBR_STALE, NBR_TABLE_REASON_IPV6_ND, NULL); } else { const uip_lladdr_t *lladdr = uip_ds6_nbr_get_ll(nbr); if(lladdr == NULL) { goto discard; } if(nbr->state == NBR_INCOMPLETE) { nbr->state = NBR_STALE; } if(memcmp(&nd6_opt_llao[UIP_ND6_OPT_DATA_OFFSET], lladdr, UIP_LLADDR_LEN) != 0) { /* change of link layer address */ if(uip_ds6_nbr_update_ll(&nbr, (const uip_lladdr_t *)&lladdr_aligned) < 0) { /* failed to update the lladdr */ goto discard; } nbr->state = NBR_STALE; } nbr->isrouter = 1; } break; case UIP_ND6_OPT_MTU: LOG_DBG("Processing MTU option in RA\n"); uip_ds6_if.link_mtu = uip_ntohl(((uip_nd6_opt_mtu *) ND6_OPT_HDR_BUF(nd6_opt_offset))->mtu); break; case UIP_ND6_OPT_PREFIX_INFO: LOG_DBG("Processing PREFIX option in RA\n"); nd6_opt_prefix_info = (uip_nd6_opt_prefix_info *) ND6_OPT_HDR_BUF(nd6_opt_offset); if((uip_ntohl(nd6_opt_prefix_info->validlt) >= uip_ntohl(nd6_opt_prefix_info->preferredlt)) && (!uip_is_addr_linklocal(&nd6_opt_prefix_info->prefix))) { /* on-link flag related processing */ if(nd6_opt_prefix_info->flagsreserved1 & UIP_ND6_RA_FLAG_ONLINK) { prefix = uip_ds6_prefix_lookup(&nd6_opt_prefix_info->prefix, nd6_opt_prefix_info->preflen); if(prefix == NULL) { if(nd6_opt_prefix_info->validlt != 0) { if(nd6_opt_prefix_info->validlt != UIP_ND6_INFINITE_LIFETIME) { prefix = uip_ds6_prefix_add(&nd6_opt_prefix_info->prefix, nd6_opt_prefix_info->preflen, uip_ntohl(nd6_opt_prefix_info-> validlt)); } else { prefix = uip_ds6_prefix_add(&nd6_opt_prefix_info->prefix, nd6_opt_prefix_info->preflen, 0); } } } else { switch (nd6_opt_prefix_info->validlt) { case 0: uip_ds6_prefix_rm(prefix); break; case UIP_ND6_INFINITE_LIFETIME: prefix->isinfinite = 1; break; default: LOG_DBG("Updating timer of prefix "); LOG_DBG_6ADDR(&prefix->ipaddr); LOG_DBG_(" new value %"PRIu32"\n", uip_ntohl(nd6_opt_prefix_info->validlt)); stimer_set(&prefix->vlifetime, uip_ntohl(nd6_opt_prefix_info->validlt)); prefix->isinfinite = 0; break; } } } /* End of on-link flag related processing */ /* autonomous flag related processing */ if((nd6_opt_prefix_info->flagsreserved1 & UIP_ND6_RA_FLAG_AUTONOMOUS) && (nd6_opt_prefix_info->validlt != 0) && (nd6_opt_prefix_info->preflen == UIP_DEFAULT_PREFIX_LEN)) { uip_ipaddr_copy(&ipaddr, &nd6_opt_prefix_info->prefix); uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr); addr = uip_ds6_addr_lookup(&ipaddr); if((addr != NULL) && (addr->type == ADDR_AUTOCONF)) { if(nd6_opt_prefix_info->validlt != UIP_ND6_INFINITE_LIFETIME) { /* The processing below is defined in RFC4862 section 5.5.3 e */ if((uip_ntohl(nd6_opt_prefix_info->validlt) > 2 * 60 * 60) || (uip_ntohl(nd6_opt_prefix_info->validlt) > stimer_remaining(&addr->vlifetime))) { LOG_DBG("Updating timer of address "); LOG_DBG_6ADDR(&addr->ipaddr); LOG_DBG_(" new value %lu\n", (unsigned long)uip_ntohl(nd6_opt_prefix_info->validlt)); stimer_set(&addr->vlifetime, uip_ntohl(nd6_opt_prefix_info->validlt)); } else { stimer_set(&addr->vlifetime, 2 * 60 * 60); LOG_DBG("Updating timer of address "); LOG_DBG_6ADDR(&addr->ipaddr); LOG_DBG_(" new value %lu\n", (unsigned long)(2 * 60 * 60)); } addr->isinfinite = 0; } else { addr->isinfinite = 1; } } else { if(uip_ntohl(nd6_opt_prefix_info->validlt) == UIP_ND6_INFINITE_LIFETIME) { uip_ds6_addr_add(&ipaddr, 0, ADDR_AUTOCONF); } else { uip_ds6_addr_add(&ipaddr, uip_ntohl(nd6_opt_prefix_info->validlt), ADDR_AUTOCONF); } } } /* End of autonomous flag related processing */ } break; #if UIP_ND6_RA_RDNSS case UIP_ND6_OPT_RDNSS: LOG_DBG("Processing RDNSS option\n"); uint8_t naddr = (ND6_OPT_RDNSS_BUF(nd6_opt_offset)->len - 1) / 2; uip_ipaddr_t *ip = (uip_ipaddr_t *)(&ND6_OPT_RDNSS_BUF(nd6_opt_offset)->ip); LOG_DBG("got %d nameservers\n", naddr); while(naddr-- > 0) { LOG_DBG("nameserver: "); LOG_DBG_6ADDR(ip); LOG_DBG_(" lifetime: %"PRIx32"\n", uip_ntohl(ND6_OPT_RDNSS_BUF(nd6_opt_offset)->lifetime)); uip_nameserver_update(ip, uip_ntohl(ND6_OPT_RDNSS_BUF(nd6_opt_offset)->lifetime)); ip++; } break; #endif /* UIP_ND6_RA_RDNSS */ default: LOG_ERR("ND option not supported in RA\n"); break; } nd6_opt_offset += (ND6_OPT_HDR_BUF(nd6_opt_offset)->len << 3); } defrt = uip_ds6_defrt_lookup(&UIP_IP_BUF->srcipaddr); if(UIP_ND6_RA_BUF->router_lifetime != 0) { if(nbr != NULL) { nbr->isrouter = 1; } if(defrt == NULL) { uip_ds6_defrt_add(&UIP_IP_BUF->srcipaddr, (unsigned long)(uip_ntohs(UIP_ND6_RA_BUF->router_lifetime))); } else { stimer_set(&(defrt->lifetime), (unsigned long)(uip_ntohs(UIP_ND6_RA_BUF->router_lifetime))); } } else { if(defrt != NULL) { uip_ds6_defrt_rm(defrt); } } #if UIP_CONF_IPV6_QUEUE_PKT /* If the nbr just became reachable (e.g. it was in NBR_INCOMPLETE state * and we got a SLLAO), check if we had buffered a pkt for it */ /* if((nbr != NULL) && (nbr->queue_buf_len != 0)) { uip_len = nbr->queue_buf_len; memcpy(UIP_IP_BUF, nbr->queue_buf, uip_len); nbr->queue_buf_len = 0; return; }*/ if(nbr != NULL && uip_packetqueue_buflen(&nbr->packethandle) != 0) { uip_len = uip_packetqueue_buflen(&nbr->packethandle); memcpy(UIP_IP_BUF, uip_packetqueue_buf(&nbr->packethandle), uip_len); uip_packetqueue_free(&nbr->packethandle); return; } #endif /*UIP_CONF_IPV6_QUEUE_PKT */ discard: uipbuf_clear(); return; }
0
277,489
void BaseRenderingContext2D::RestoreMatrixClipStack(PaintCanvas* c) const { if (!c) return; HeapVector<Member<CanvasRenderingContext2DState>>::const_iterator curr_state; DCHECK(state_stack_.begin() < state_stack_.end()); for (curr_state = state_stack_.begin(); curr_state < state_stack_.end(); curr_state++) { c->setMatrix(SkMatrix::I()); if (curr_state->Get()) { curr_state->Get()->PlaybackClips(c); c->setMatrix(AffineTransformToSkMatrix(curr_state->Get()->Transform())); } c->save(); } c->restore(); ValidateStateStack(); }
0
478,444
static int _assign_xshm(Display *dpy, XErrorEvent *error) { cimg::unused(dpy,error); cimg::X11_attr().is_shm_enabled = false; return 0; }
0
285,360
gx_dc_pattern2_color_has_bbox(const gx_device_color * pdevc) { gs_pattern2_instance_t *pinst = (gs_pattern2_instance_t *)pdevc->ccolor.pattern; const gs_shading_t *psh = pinst->templat.Shading; return psh->params.have_BBox; }
0
344,701
int main( int argc, char *argv[] ) { ((void) argc); ((void) argv); printf("POLARSSL_TIMING_C not defined.\n"); return( 0 ); }
1
421,738
flatpak_load_override_keyfile (const char *app_id, gboolean user, GError **error) { g_autofree char *metadata_contents = NULL; gsize metadata_size; g_autoptr(GKeyFile) metakey = g_key_file_new (); g_autoptr(FlatpakDir) dir = NULL; dir = user ? flatpak_dir_get_user () : flatpak_dir_get_system_default (); metadata_contents = flatpak_dir_load_override (dir, app_id, &metadata_size, error); if (metadata_contents == NULL) return NULL; if (!g_key_file_load_from_data (metakey, metadata_contents, metadata_size, 0, error)) return NULL; return g_steal_pointer (&metakey); }
0
452,597
AuthAuthorizer* MonClient::build_authorizer(int service_id) const { std::lock_guard l(monc_lock); if (auth) { return auth->build_authorizer(service_id); } else { ldout(cct, 0) << __func__ << " for " << ceph_entity_type_name(service_id) << ", but no auth is available now" << dendl; return nullptr; } }
0
290,384
static uint8_t pfkey_proto_to_xfrm ( uint8_t proto ) { return proto == IPSEC_PROTO_ANY ? 0 : proto ; }
0
31,054
static hb_codepoint_t hb_ucdn_mirroring ( hb_unicode_funcs_t * ufuncs , hb_codepoint_t unicode , void * user_data HB_UNUSED ) { return ucdn_mirror ( unicode ) ; }
0
462,781
TEST(GtOp, MatchesDotNotationNull) { BSONObj operand = BSON("$gt" << BSONNULL); GTMatchExpression gt("a.b", operand["$gt"]); ASSERT(!gt.matchesBSON(BSONObj(), NULL)); ASSERT(!gt.matchesBSON(BSON("a" << BSONNULL), NULL)); ASSERT(!gt.matchesBSON(BSON("a" << 4), NULL)); ASSERT(!gt.matchesBSON(BSON("a" << BSONObj()), NULL)); ASSERT(!gt.matchesBSON(BSON("a" << BSON_ARRAY(BSON("b" << BSONNULL))), NULL)); ASSERT(!gt.matchesBSON(BSON("a" << BSON_ARRAY(BSON("a" << 4) << BSON("b" << 4))), NULL)); ASSERT(!gt.matchesBSON(BSON("a" << BSON_ARRAY(4)), NULL)); ASSERT(!gt.matchesBSON(BSON("a" << BSON_ARRAY(BSON("b" << 4))), NULL)); }
0
29,881
static inline void get_limits ( MpegEncContext * s , int x , int y ) { MotionEstContext * const c = & s -> me ; int range = c -> avctx -> me_range >> ( 1 + ! ! ( c -> flags & FLAG_QPEL ) ) ; if ( s -> unrestricted_mv ) { c -> xmin = - x - 16 ; c -> ymin = - y - 16 ; c -> xmax = - x + s -> mb_width * 16 ; c -> ymax = - y + s -> mb_height * 16 ; } else if ( s -> out_format == FMT_H261 ) { c -> xmin = ( x > 15 ) ? - 15 : 0 ; c -> ymin = ( y > 15 ) ? - 15 : 0 ; c -> xmax = ( x < s -> mb_width * 16 - 16 ) ? 15 : 0 ; c -> ymax = ( y < s -> mb_height * 16 - 16 ) ? 15 : 0 ; } else { c -> xmin = - x ; c -> ymin = - y ; c -> xmax = - x + s -> mb_width * 16 - 16 ; c -> ymax = - y + s -> mb_height * 16 - 16 ; } if ( range ) { c -> xmin = FFMAX ( c -> xmin , - range ) ; c -> xmax = FFMIN ( c -> xmax , range ) ; c -> ymin = FFMAX ( c -> ymin , - range ) ; c -> ymax = FFMIN ( c -> ymax , range ) ; } }
0
479,859
CImg<T> get_rows(const int y0, const int y1) const { return get_crop(0,y0,0,0,width() - 1,y1,depth() - 1,spectrum() - 1); }
0
93,141
static void TIFFIgnoreTags(TIFF *tiff) { char *q; const char *p, *tags; Image *image; register ssize_t i; size_t count; TIFFFieldInfo *ignore; if (TIFFGetReadProc(tiff) != TIFFReadBlob) return; image=(Image *)TIFFClientdata(tiff); tags=GetImageArtifact(image,"tiff:ignore-tags"); if (tags == (const char *) NULL) return; count=0; p=tags; while (*p != '\0') { while ((isspace((int) ((unsigned char) *p)) != 0)) p++; (void) strtol(p,&q,10); if (p == q) return; p=q; count++; while ((isspace((int) ((unsigned char) *p)) != 0) || (*p == ',')) p++; } if (count == 0) return; i=0; p=tags; ignore=(TIFFFieldInfo *) AcquireQuantumMemory(count,sizeof(*ignore)); if (ignore == (TIFFFieldInfo *) NULL) return; /* This also sets field_bit to 0 (FIELD_IGNORE). */ (void) memset(ignore,0,count*sizeof(*ignore)); while (*p != '\0') { while ((isspace((int) ((unsigned char) *p)) != 0)) p++; ignore[i].field_tag=(ttag_t) strtol(p,&q,10); p=q; i++; while ((isspace((int) ((unsigned char) *p)) != 0) || (*p == ',')) p++; } (void) TIFFMergeFieldInfo(tiff,ignore,(uint32) count); ignore=(TIFFFieldInfo *) RelinquishMagickMemory(ignore); }
0
512,851
void Gfx::opCurveTo2(Object args[], int numArgs) { double x1, y1, x2, y2, x3, y3; if (!state->isCurPt()) { error(getPos(), "No current point in curveto2"); return; } x1 = args[0].getNum(); y1 = args[1].getNum(); x2 = args[2].getNum(); y2 = args[3].getNum(); x3 = x2; y3 = y2; state->curveTo(x1, y1, x2, y2, x3, y3); }
0
400,198
clear_status_flags_on_sybil(routerstatus_t *rs) { rs->is_authority = rs->is_exit = rs->is_stable = rs->is_fast = rs->is_flagged_running = rs->is_named = rs->is_valid = rs->is_hs_dir = rs->is_v2_dir = rs->is_possible_guard = 0; /* FFFF we might want some mechanism to check later on if we * missed zeroing any flags: it's easy to add a new flag but * forget to add it to this clause. */ }
0
144,156
get_pfxmatch( char ** s, struct masks *m ) { while (m->name) { if (strncmp(*s, m->name, strlen(m->name)) == 0) { *s += strlen(m->name); return m->mask; } else { m++; } } return 0; }
0
173,824
ChromotingInstance::ChromotingInstance(PP_Instance pp_instance) : pp::Instance(pp_instance), initialized_(false), plugin_task_runner_( new PluginThreadTaskRunner(&plugin_thread_delegate_)), context_(plugin_task_runner_), input_tracker_(&mouse_input_filter_), #if defined(OS_MACOSX) mac_key_event_processor_(&input_tracker_), key_mapper_(&mac_key_event_processor_), #else key_mapper_(&input_tracker_), #endif input_handler_(&key_mapper_), weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { RequestInputEvents(PP_INPUTEVENT_CLASS_MOUSE | PP_INPUTEVENT_CLASS_WHEEL); RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_KEYBOARD); RegisterLoggingInstance(); scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); data->SetInteger("apiVersion", kApiVersion); data->SetString("apiFeatures", kApiFeatures); data->SetInteger("apiMinVersion", kApiMinMessagingVersion); PostChromotingMessage("hello", data.Pass()); }
0
261,531
static u16 tcm_loop_get_tag(struct se_portal_group *se_tpg) { struct tcm_loop_tpg *tl_tpg = (struct tcm_loop_tpg *)se_tpg->se_tpg_fabric_ptr; /* * This Tag is used when forming SCSI Name identifier in EVPD=1 0x83 * to represent the SCSI Target Port. */ return tl_tpg->tl_tpgt; }
0
487,186
query_string& operator=(query_string&& qs) { key_value_pairs_ = std::move(qs.key_value_pairs_); char* old_data = (char*)qs.url_.c_str(); url_ = std::move(qs.url_); for (auto& p : key_value_pairs_) { p += (char*)url_.c_str() - old_data; } return *this; }
0
508,421
int SSL_pending(const SSL *s) { /* * SSL_pending cannot work properly if read-ahead is enabled * (SSL_[CTX_]ctrl(..., SSL_CTRL_SET_READ_AHEAD, 1, NULL)), and it is * impossible to fix since SSL_pending cannot report errors that may be * observed while scanning the new data. (Note that SSL_pending() is * often used as a boolean value, so we'd better not return -1.) */ return (s->method->ssl_pending(s)); }
0
376,027
static int pxa2xx_fir_is_empty(void *opaque) { PXA2xxFIrState *s = (PXA2xxFIrState *) opaque; return (s->rx_len < 64); }
0
214,354
bool PrintRenderFrameHelper::PrintPagesNative(blink::WebLocalFrame* frame, int page_count) { const PrintMsg_PrintPages_Params& params = *print_pages_params_; const PrintMsg_Print_Params& print_params = params.params; std::vector<int> printed_pages = GetPrintedPages(params, page_count); if (printed_pages.empty()) return false; PdfMetafileSkia metafile(print_params.printed_doc_type); CHECK(metafile.Init()); PrintHostMsg_DidPrintDocument_Params page_params; PrintPageInternal(print_params, printed_pages[0], page_count, frame, &metafile, &page_params.page_size, &page_params.content_area); for (size_t i = 1; i < printed_pages.size(); ++i) { PrintPageInternal(print_params, printed_pages[i], page_count, frame, &metafile, nullptr, nullptr); } FinishFramePrinting(); metafile.FinishDocument(); if (!CopyMetafileDataToSharedMem(metafile, &page_params.metafile_data_handle)) { return false; } page_params.data_size = metafile.GetDataSize(); page_params.document_cookie = print_params.document_cookie; #if defined(OS_WIN) page_params.physical_offsets = printer_printable_area_.origin(); #endif Send(new PrintHostMsg_DidPrintDocument(routing_id(), page_params)); return true; }
0