id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c180100
m, err := r.readUint32() if err != nil { return nil, err } f.static = make([]byte, m+1) err = r.readFull(f.static) if err != nil { return nil, err } } f.code, err = readCommands(r) if err == io.EOF { err = nil } return f.execute, err }
c180101
d.ppm.reset() d.decode = nil } if d.decode == nil { return d.readBlockHeader() } return nil }
c180102
d.decode = d.lz.decode err = d.lz.init(d.br) } } if err == io.EOF { err = errDecoderOutOfData } return err }
c180103
} continue } var count int var value byte switch l { case 16, 18: count, err = br.readBits(3) count += 3 default: count, err = br.readBits(7) count += 11 } if err != nil { return err } if l < 18 { if i == 0 { return errInvalidLengthTable } value = codeLength[i-1] } for ; count > 0 && i < len(codeLength); i++ { codeLength[i] = value count-- } i-- } return nil }
c180104
// free old block c.a.addFreeBlock(c.statesIndex(), i1) c.setStatesIndex(n) } else { // split current block, and free units not needed n = c.statesIndex() + index2Units[i2]<<1 u := index2Units[i1] - index2Units[i2] c.a.freeUnits(n, u) } } c.setNumStates(size) return states[:size] }
c180105
n := c.a.allocUnits(i2) if n == 0 { return nil } copy(c.a.states[n:], states) c.a.addFreeBlock(c.statesIndex(), i1) c.setStatesIndex(n) states = c.a.states[n:] } } c.setNumStates(ns + 1) return states[:ns+1] }
c180106
a.states[si].freq = c default: n := (uint(oi) - 2) * 8 mask := ^(uint32(0xFF) << n) succ := uint32(a.states[si].succ) & mask succ |= uint32(c) << n a.states[si].succ = int32(succ) } a.heap1Lo++ if a.heap1Lo >= a.heap1Hi { return 0 } return -a.heap1Lo }
c180107
default: n := (uint(oi) - 2) * 8 succ := uint32(a.states[si].succ) >> n return byte(succ & 0xff) } }
c180108
} return &context{i: i, s: a.states[i : i+2 : i+2], a: a} }
c180109
hash.Sum(s[:0]) iv[i/(hashRounds/16)] = s[4*4+3] } } key = hash.Sum(s[:0]) key = key[:16] for k := key; len(k) >= 4; k = k[4:] { k[0], k[1], k[2], k[3] = k[3], k[2], k[1], k[0] } return key, iv }
c180110
& 0x0f) yr := n>>25&0x7f + 1980 return time.Date(yr, mon, day, hr, min, sec, 0, time.Local) }
c180111
case 3: n := encName.byte() b := name[len(wchars):] if l := int(n&0x7f) + 2; l < len(b) { b = b[:l] } if n&0x80 > 0 { if len(encName) < 1 { break } ec := encName.byte() for _, c := range b { wchars = append(wchars, uint16(c+ec)|highByte) } } else { for _, c := range b { wchars = append(wchars, uint16(c)) } } } flags <<= 2 flagBits -= 2 } return string(utf16.Decode(wchars)) }
c180112
len(*b) < int(n) { return // invalid, not enough data } // add extra time data in 100's of nanoseconds d := time.Duration(0) for j := 3 - n; j < n; j++ { d |= time.Duration(b.byte()) << (j * 8) } d *= 100 *t = t.Add(d) } }
c180113
return nil, errBadHeaderCrc } if h.flags&blockHasData > 0 { if len(h.data) < 4 { return nil, errCorruptHeader } h.dataSize = int64(h.data.uint32()) } if (h.htype == blockService || h.htype == blockFile) && h.flags&fileLargeData > 0 { if len(h.data) < 25 { return nil, errCorruptHeader } b := h.data[21:25] h.dataSize |= int64(b.uint32()) << 32 } return h, nil }
c180114
a.checksum.Hash32 = crc32.NewIEEE() a.buf = readBuf(make([]byte, 100)) return a }
c180115
err := br.readBits(2) if err != nil { return 0, err } bytes++ var data int for i := 0; i < bytes; i++ { n, err := br.readBits(8) if err != nil { return 0, err } data |= n << (uint(i) * 8) } return data, nil }
c180116
c w.w = (w.w + 1) & w.mask }
c180117
i := (w.w - off) & w.mask for ; len > 0; len-- { w.buf[w.w] = w.buf[i] w.w = (w.w + 1) & w.mask i = (i + 1) & w.mask } }
c180118
w.r += l n += l } if w.l > 0 && n > 0 { // if we have successfully read data, copy any // leftover data from a previous copyBytes. l := w.l w.l = 0 w.copyBytes(l, w.o) } return n }
c180119
f.length &= d.win.mask // make offset relative to previous filter in list for _, fb := range d.filters { if f.offset < fb.offset { // filter block must not start before previous filter return errInvalidFilter } f.offset -= fb.offset } d.filters = append(d.filters, f) return nil }
c180120
f = d.filters[0] if f.offset != 0 { // next filter not at current offset f.offset -= n return nil } if f.length != len(d.outbuf) { return errInvalidFilter } d.filters = d.filters[1:] if cap(d.outbuf) < cap(d.buf) { // Filter returned a smaller buffer. Copy it back to the saved buffer // so the next filter can make use of the larger buffer if needed. d.outbuf = append(d.buf[:0], d.outbuf...) } } }
c180121
fill window using decoder for _, f := range fl { err := d.queueFilter(f) if err != nil { d.err = err return } } }
c180122
len(d.filters) > 0 { f := d.filters[0] if f.offset < len(p) { // only read data up to beginning of next filter p = p[:f.offset] } n = d.win.read(p) // read directly from window f.offset -= n // adjust first filter offset by bytes just read } else { n = d.win.read(p) // read directly from window } d.tot += int64(n) return n, nil }
c180123
return io.ErrUnexpectedEOF } return err }
c180124
} if !bytes.HasPrefix(b, []byte(sigPrefix[1:])) { continue } b = b[len(sigPrefix)-1:] var ver int switch { case b[0] == 0: ver = fileFmt15 case b[0] == 1 && b[1] == 0: ver = fileFmt50 default: continue } _, _ = br.ReadSlice('\x00') return ver, nil } return 0, errNoSig }
c180125
return } ins := cmd[ip] ins.f(v, ins.bm, ins.op) // run cpu instruction if v.ipMod { // command modified ip, don't increment v.ipMod = false } else { v.ip++ // increment ip for next command } } }
c180126
len(mem); i < len(v.m); i++ { v.m[i] = 0 } } v.r[7] = vmSize return v }
c180127
return &limitedBitReader{br, n, err} }
c180128
r.readBits(8) n |= -1 << 8 return uint32(n), err } nlow, err := r.readBits(4) n = n<<4 | nlow return uint32(n), err }
c180129
lie in R2), and if one is found, remove it. suffix, _ := word.RemoveFirstSuffixIn(word.R2start, "ост", "ость") if suffix != "" { return true } return false }
c180130
if specialVersion := stemSpecialWord(word); specialVersion != "" { word = specialVersion return word } w := snowballword.New(word) // Stem the word. Note, each of these // steps will alter `w` in place. // preprocess(w) step0(w) step1a(w) step1b(w) step1c(w) step2(w) step3(w) step4(w) step5(w) postprocess(w) return w.String() }
c180131
for i := len(word.RS) - 1; i >= 0; i-- { r := word.RS[i] if isLowerVowel(r) == false { numNonVowels += 1 } else { // `r` is a vowel if (r == 233 || r == 232) && numNonVowels > 0 { // Replace with "e", or unicode code point 101 word.RS[i] = 101 return true } return false } } return false }
c180132
if suffix != "" { word.RemoveLastNRunes(1) } return false }
c180133
- len(suffixRunes) - 1 if idx >= 0 && word.RS[idx] == 117 { word.RemoveLastNRunes(len(suffixRunes)) return true } } return false }
c180134
word.HasSuffixRunes([]rune("нн")) { word.RemoveLastNRunes(1) } return true } // Remove soft sign if rsLen := len(word.RS); rsLen > 0 && word.RS[rsLen-1] == 'ь' { word.RemoveLastNRunes(1) return true } return false }
c180135
= russian.Stem case "swedish": f = swedish.Stem case "norwegian": f = norwegian.Stem default: err = fmt.Errorf("Unknown language: %s", language) return } stemmed = f(word, stemStopWords) return }
c180136
-> by, say -> say) // // Note: the unicode code points for // y, Y, & i are 121, 89, & 105 respectively. // if len(w.RS) > 2 && (w.RS[rsLen-1] == 121 || w.RS[rsLen-1] == 89) && !isLowerVowel(w.RS[rsLen-2]) { w.RS[rsLen-1] = 105 return true } return false }
c180137
things we need to do. // if suffix == "ative" { // If in R2, delete. // if len(w.RS)-w.R2start >= 5 { w.RemoveLastNRunes(len(suffixRunes)) return true } return false } // Handle a suffix that was found, which is going // to be replaced with a different suffix. // var repl string switch suffix { case "ational": repl = "ate" case "tional": repl = "tion" case "alize": repl = "al" case "icate", "iciti", "ical": repl = "ic" case "ful", "ness": repl = "" } w.ReplaceSuffixRunes(suffixRunes, []rune(repl), true) return true }
c180138
"furent", "sois", "soit", "soyons", "soyez", "soient", "fusse", "fusses", "fût", "fussions", "fussiez", "fussent", "ayant", "ayante", "ayantes", "ayants", "eu", "eue", "eues", "eus", "ai", "as", "avons", "avez", "ont", "aurai", "auras", "aura", "aurons", "aurez", "auront", "aurais", "aurait", "aurions", "auriez", "auraient", "avais", "avait", "avions", "aviez", "avaient", "eut", "eûmes", "eûtes", "eurent", "aie", "aies", "ait", "ayons", "ayez", "aient", "eusse", "eusses", "eût", "eussions", "eussiez", "eussent": return true } return false }
c180139
117: // u // Is this "u" is flanked by vowels OR preceded by a "q"? if (vowelPreviously && vowelNext(i)) || (i >= 1 && word.RS[i-1] == 113) { word.RS[i] = 85 // U vowelHere = false } case 105: // i // Is this "i" is flanked by vowels? if vowelPreviously && vowelNext(i) { word.RS[i] = 73 // I vowelHere = false } } vowelPreviously = vowelHere } }
c180140
going // to be replaced with a different suffix. // var repl string switch suffix { case "tional": repl = "tion" case "enci": repl = "ence" case "anci": repl = "ance" case "abli": repl = "able" case "entli": repl = "ent" case "izer", "ization": repl = "ize" case "ational", "ation", "ator": repl = "ate" case "alism", "aliti", "alli": repl = "al" case "fulness": repl = "ful" case "ousli", "ousness": repl = "ous" case "iveness", "iviti": repl = "ive" case "biliti", "bli": repl = "ble" case "fulli": repl = "ful" case "lessli": repl = "less" } w.ReplaceSuffixRunes(suffixRunes, []rune(repl), true) return true }
c180141
preceded by gu with the u in RV delete the u // guSuffix, _ := word.FirstSuffix("gu") if guSuffix != "" { word.RemoveLastNRunes(1) } } return true }
c180142
return false } w.RemoveLastNRunes(len(suffixRunes)) return true }
c180143
< len(word.RS[start:]); i++ { j := start + i if f(word.RS[j-1]) && !f(word.RS[j]) { return j + 1 } } return len(word.RS) }
c180144
following charaters: bcdfghjklmnoprtvy. // rsLen := len(w.RS) if rsLen >= 2 { switch w.RS[rsLen-2] { case 'b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'r', 't', 'v', 'y': w.RemoveLastNRunes(len(suffixRunes)) return true } } return false } // Remove the suffix w.RemoveLastNRunes(len(suffixRunes)) return true }
c180145
if suffix != "" { sLen := len(suffixRunes) idx := len(word.RS) - sLen - 1 if idx >= 0 && word.FitsInRV(sLen+1) && isLowerVowel(word.RS[idx]) == false { word.RemoveLastNRunes(len(suffixRunes)) return true } } return false }
c180146
if precededByARinRV(word, len(suffixRunes)) == false { suffix = "" } } if suffix != "" { word.RemoveLastNRunes(len(suffixRunes)) return true } return false }
c180147
"нн", "вш", "ющ", "щ", ) switch newSuffix { case "ем", "нн", "вш", "ющ", "щ": // These are "Group 1" participle endings. // Group 1 endings must follow а (a) or я (ia) in RV. if precededByARinRV(word, len(newSuffixRunes)) == false { newSuffix = "" } } if newSuffix != "" { word.RemoveLastNRunes(len(newSuffixRunes)) } return true } return false }
c180148
"idos", "idas", "ería", "erás", "erán", "aste", "ases", "asen", "aría", "arás", "arán", "aron", "aras", "aran", "ando", "amos", "ados", "adas", "abas", "aban", "ías", "ían", "éis", "áis", "iré", "irá", "ido", "ida", "eré", "erá", "emos", "ase", "aré", "ará", "ara", "ado", "ada", "aba", "ís", "ía", "ió", "ir", "id", "es", "er", "en", "ed", "as", "ar", "an", "ad", ) switch suffix { case "": return false case "en", "es", "éis", "emos": // Delete, and if preceded by gu delete the u (the gu need not be in RV) word.RemoveLastNRunes(len(suffixRunes)) guSuffix, _ := word.FirstSuffix("gu") if guSuffix != "" { word.RemoveLastNRunes(1) } default: // Delete word.RemoveLastNRunes(len(suffixRunes)) } return true }
c180149
idx >= 0 && word.FitsInRV(sLen+1) { if word.RS[idx] == 115 || word.RS[idx] == 116 { word.RemoveLastNRunes(sLen) return true } } return hadChange case "ier", "ière", "Ier", "Ière": // Replace with i word.ReplaceSuffixRunes(suffixRunes, []rune("i"), true) return true case "e": word.RemoveLastNRunes(1) return true case "ë": // If preceded by gu (unicode code point 103 & 117), delete idx := len(word.RS) - 1 if idx >= 2 && word.RS[idx-2] == 103 && word.RS[idx-1] == 117 { word.RemoveLastNRunes(1) return true } return hadChange } return true }
c180150
return true } return false } else if w.R2start <= lri && w.RS[lri] == 108 && lri-1 >= 0 && w.RS[lri-1] == 108 { // The word ends in double "l", and the final "l" is // in R2. (Note, the unicode code point for "l" is 108.) // Delete the second "l". w.ReplaceSuffix("l", "", true) return true } return false }
c180151
:= step1(w) if changeInStep1 == false { changeInStep2a := step2a(w) if changeInStep2a == false { step2b(w) } } step3(w) postprocess(w) return w.String() }
c180152
small words and stop words if len(w.RS) <= 2 || (stemStopwWords == false && isStopWord(word)) { return word } preprocess(w) step1(w) step2(w) step3(w) step4(w) return w.String() }
c180153
"fordi", "gjøre", "god", "ha", "start", "andre", "må", "med", "under", "meg", "oss", "innen", "på", "verdi", "ville", "kunne", "uten", "vår", "slik", "ene", "folk", "min", "riktig", "enhver", "bort", "enn", "nei", "som", "våre", "disse", "gjorde", "lage", "si", "du", "fra", "også", "hvordan", "av", "eneste", "for", "hvor", "først", "hver": return true } return false }
c180154
"mitt", "ni", "bli", "blev", "oss", "din", "dessa", "några", "deras", "blir", "mina", "samma", "vilken", "er", "sådan", "vår", "blivit", "dess", "inom", "mellan", "sådant", "varför", "varje", "vilka", "ditt", "vem", "vilket", "sitta", "sådana", "vart", "dina", "vars", "vårt", "våra", "ert", "era", "vilkas": return true } return false }
c180155
word.R2start = len(word.RS) word.RVstart = len(word.RS) return }
c180156
= w.RS[:len(w.RS)-n] w.resetR1R2() }
c180157
w.R1start = rsLen } if w.R2start > rsLen { w.R2start = rsLen } if w.RVstart > rsLen { w.RVstart = rsLen } }
c180158
{ start = max } if stop > max { stop = max } return w.RS[start:stop] }
c180159
return w.R1start <= len(w.RS)-x }
c180160
return w.R2start <= len(w.RS)-x }
c180161
return w.RVstart <= len(w.RS)-x }
c180162
rsLen-1 || (w.RS)[i] != r { found = false break } } if found { foundPrefix = prefix foundPrefixRunes = prefixRunes break } } return }
c180163
return w.HasSuffixRunesIn(0, len(w.RS), suffixRunes) }
c180164
suffixRunes = suffixRunes[:0] return "", suffixRunes } } } // Empty out suffixRunes suffixRunes = suffixRunes[:0] return "", suffixRunes }
c180165
[]rune) { suffix, suffixRunes = w.FirstSuffixIfIn(startPos, len(w.RS), suffixes...) if suffix != "" { w.RemoveLastNRunes(len(suffixRunes)) } return }
c180166
{ return w.RemoveFirstSuffixIn(0, suffixes...) }
c180167
return w.FirstSuffixIfIn(0, len(w.RS), suffixes...) }
c180168
Find the two regions, R1 & R2 r1start, r2start := r1r2(word) word.R1start = r1start word.R2start = r2start }
c180169
suffix2repl = "ando" case "ár": suffix2repl = "ar" case "ír": suffix2repl = "ir" } word.RemoveLastNRunes(len(suffix1Runes)) word.ReplaceSuffixRunes(suffix2Runes, []rune(suffix2repl), true) return true case "ando", "iendo", "ar", "er", "ir": word.RemoveLastNRunes(len(suffix1Runes)) return true case "yendo": // In the case of "yendo", the "yendo" must lie in RV, // and be preceded by a "u" somewhere in the word. for i := 0; i < len(word.RS)-(len(suffix1)+len(suffix2)); i++ { // Note, the unicode code point for "u" is 117. if word.RS[i] == 117 { word.RemoveLastNRunes(len(suffix1Runes)) return true } } } return false }
c180170
case "at", "bl", "iz": // If the word ends "at", "bl" or "iz" add "e" w.ReplaceSuffixRunes(newSuffixRunes, []rune(newSuffix+"e"), true) case "bb", "dd", "ff", "gg", "mm", "nn", "pp", "rr", "tt": // If the word ends with a double remove the last letter. // Note that, "double" does not include all possible doubles, // just those shown above. // w.RemoveLastNRunes(1) } // Because we did a double replacement, we need to fix // R1 and R2 manually. This is just becase of how we've // implemented the `ReplaceSuffix` method. // rsLen := len(w.RS) if originalR1start < rsLen { w.R1start = originalR1start } else { w.R1start = rsLen } if originalR2start < rsLen { w.R2start = originalR2start } else { w.R2start = rsLen } return true } } return false }
c180171
case "âmes", "ât", "âtes", "a", "ai", "aIent", "ais", "ait", "ant", "ante", "antes", "ants", "as", "asse", "assent", "asses", "assiez", "assions": // Delete word.RemoveLastNRunes(len(suffixRunes)) // If preceded by e (unicode code point 101), delete // idx := len(word.RS) - 1 if idx >= 0 && word.RS[idx] == 101 && word.FitsInRV(1) { word.RemoveLastNRunes(1) } return true } return false }
c180172
&& (i == 0 || isLowerVowel(word.RS[i-1])) { word.RS[i] = 89 numCapitalizations += 1 } } return }
c180173
// (Note: Y & y unicode code points = 89 & 121) if r == 89 { word.RS[i] = 121 } } return }
c180174
stemmed = "herring" case "earring": stemmed = "earring" case "earrings": stemmed = "earring" case "proceed": stemmed = "proceed" case "proceeds": stemmed = "proceed" case "proceeded": stemmed = "proceed" case "proceeding": stemmed = "proceed" case "exceed": stemmed = "exceed" case "exceeds": stemmed = "exceed" case "exceeded": stemmed = "exceed" case "exceeding": stemmed = "exceed" case "succeed": stemmed = "succeed" case "succeeds": stemmed = "succeed" case "succeeded": stemmed = "succeed" case "succeeding": stemmed = "succeed" } return }
c180175
it must end in a short syllable return endsShortSyllable(w, len(w.RS)) }
c180176
part contains a vowel // not immediately before the s (so gas and this retain // the s, gaps and kiwis lose it) // for i := 0; i < len(w.RS)-2; i++ { if isLowerVowel(w.RS[i]) { w.RemoveLastNRunes(len(suffixRunes)) return true } } } return false }
c180177
= Values{} } data[gid][key] = value dataLock.Unlock() }
c180178
return nil } value := data[gid][key] dataLock.RUnlock() return value }
c180179
dataLock.Lock() delete(data, gid) dataLock.Unlock() }
c180180
:= data[gid] dataLock.Unlock() return values }
c180181
dataLock.Lock() data[childID] = parentData dataLock.Unlock() }
c180182
dataLock.Lock() delete(data, childID) dataLock.Unlock() }
c180183
&helpersinternal.AppUriCreator{CurlConfig: config} return uriCreator.AppUri(appName, path) }
c180184
args ...string) string { appCurler := helpersinternal.NewAppCurler(Curl, cfg) return appCurler.CurlAndWait(cfg, appName, path, timeout, args...) }
c180185
{ appCurler := helpersinternal.NewAppCurler(Curl, cfg) return appCurler.CurlAndWait(cfg, appName, path, CURL_TIMEOUT, args...) }
c180186
return appCurler.CurlAndWait(cfg, appName, "/", CURL_TIMEOUT) }
c180187
// check if the character AFTER our term index is our prefix for i, t := range termIndexes { // ensure term index is not the last character in str if t >= (len(str) - 1) { break } if str[t+1] == byte(prefix) { tagText := strings.TrimLeft(str[t+2:termIndexes[i+1]], string(prefix)) if tagText == "" { continue } index := t + 1 tags = append(tags, Tag{prefix, tagText, index}) } } return }
c180188
_, tag := range tags { strs = append(strs, tag.Tag) } return uniquify(strs) }
c180189
} return unicode.IsSpace(r) || !unicode.IsPrint(r) }
c180190
if i == o { continue } } out = append(out, i) } return }
c180191
*gin.Context) { location.applyToContext(c) } }
c180192
vv, ok := v.(*url.URL) if !ok { return nil } return vv }
c180193
nil, err } pk := &priv.PublicKey return &RsaPrivateKey{sk: priv}, &RsaPublicKey{pk}, nil }
c180194
crypto.SHA256, hashed[:], sig) if err != nil { return false, err } return true, nil }
c180195
rsa.EncryptPKCS1v15(rand.Reader, pk.k, b) }
c180196
rsa.SignPKCS1v15(rand.Reader, sk.sk, crypto.SHA256, hashed[:]) }
c180197
== nil { sk.pk = &sk.sk.PublicKey } return &RsaPublicKey{sk.pk} }
c180198
rsa.DecryptPKCS1v15(rand.Reader, sk.sk, b) }
c180199
{ return nil, ErrRsaKeyTooSmall } return &RsaPrivateKey{sk: sk}, nil }