id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c172200
r.err != nil { return 0 } return int32(binary.LittleEndian.Uint32(r.b[:4])) }
c172201
if r.err != nil { return 0 } return binary.LittleEndian.Uint32(r.b[:4]) }
c172202
r.err != nil { return 0 } return int64(binary.LittleEndian.Uint64(r.b[:8])) }
c172203
if r.err != nil { return 0 } return binary.LittleEndian.Uint64(r.b[:8]) }
c172204
bits := binary.LittleEndian.Uint32(r.b[:4]) return math.Float32frombits(bits) }
c172205
bits := binary.LittleEndian.Uint64(r.b[:8]) return math.Float64frombits(bits) }
c172206
r.tr.Reset() if n, _, r.err = r.tr.Transform(p, p, true); r.err != nil { // inplace transformation return nil } return p[:n] }
c172207
make([]byte, writerBufferSize), tr: unicode.Utf8ToCesu8Transformer, } }
c172208
bufio.NewWriterSize(w, size), b: make([]byte, writerBufferSize), tr: unicode.Utf8ToCesu8Transformer, } }
c172209
w.err != nil { return w.err } return w.wr.Flush() }
c172210
if j > len(w.b) { j = len(w.b) } n, _ := w.wr.Write(w.b[:j]) if n != j { return } i += n } }
c172211
return } w.wr.Write(p) }
c172212
from WriteByte (vet issues) if w.err != nil { return } w.wr.WriteByte(b) }
c172213
{ w.wr.WriteByte(1) } else { w.wr.WriteByte(0) } }
c172214
} w.wr.WriteByte(byte(i)) }
c172215
} binary.LittleEndian.PutUint16(w.b[:2], uint16(i)) w.wr.Write(w.b[:2]) }
c172216
{ return } binary.LittleEndian.PutUint32(w.b[:4], i) w.wr.Write(w.b[:4]) }
c172217
} binary.LittleEndian.PutUint64(w.b[:8], uint64(i)) w.wr.Write(w.b[:8]) }
c172218
} bits := math.Float32bits(f) binary.LittleEndian.PutUint32(w.b[:4], bits) w.wr.Write(w.b[:4]) }
c172219
} bits := math.Float64bits(f) binary.LittleEndian.PutUint64(w.b[:8], bits) w.wr.Write(w.b[:8]) }
c172220
return } w.wr.WriteString(s) }
c172221
if err != nil && err != transform.ErrShortDst { w.err = err return cnt } if m == 0 { w.err = transform.ErrShortDst return cnt } o, _ := w.wr.Write(w.b[:m]) cnt += o i += n } return cnt }
c172222
return w.WriteCesu8([]byte(s)) }
c172223
return DtTime case tcDecimal: return DtDecimal case tcChar, tcVarchar, tcString, tcNchar, tcNvarchar, tcNstring: return DtString case tcBinary, tcVarbinary: return DtBytes case tcBlob, tcClob, tcNclob: return DtLob } }
c172224
return f.fieldNames.name(f.offsets[columnDisplayName]) }
c172225
c.username = username c.password = password return c }
c172226
c.mu.RUnlock() return c.locale }
c172227
c.mu.RLock() defer c.mu.RUnlock() return c.fetchSize }
c172228
c.mu.RLock() defer c.mu.RUnlock() return c.timeout }
c172229
defer c.mu.RUnlock() return c.tlsConfig }
c172230
defer c.mu.Unlock() c.tlsConfig = tlsConfig return nil }
c172231
defer c.mu.RUnlock() return c.sessionVariables }
c172232
error { c.mu.Lock() defer c.mu.Unlock() c.sessionVariables = sessionVariables return nil }
c172233
(&url.URL{ Scheme: DriverName, User: url.UserPassword(c.username, c.password), Host: c.host, RawQuery: values.Encode(), }).String() }
c172234
{ copy(dest, f.values[idx*f.cols:(idx+1)*f.cols]) }
c172235
{ size := rd.ReadB() b := rd.ReadCesu8(int(size)) return b, int(size) }
c172236
*Lob { return &Lob{rd: rd, wr: wr} }
c172237
return fmt.Sprintf("%q", string(tok)) }
c172238
strings.NewReader(str)} } else { s.rd.Reset(str) } s.ch = -2 s.err = nil return s }
c172239
case isDoubleQuote(ch): tok = QuotedIdentifier ch = s.scanQuotedIdentifier(ch) case isQuestionMark(ch): tok = Variable ch = s.next() case isColon(ch): ch = s.peek() if isDigit(ch) { tok = PosVariable ch = s.scanNumeric() } else { tok = NamedVariable ch = s.scanAlpha() } case isNumber(ch): tok = Number ch = s.scanNumber() } s.ch = ch s.rd.UnreadRune() if ch == Error { return ch } return tok }
c172240
rand should never fail } return Identifier(fmt.Sprintf("%s%x", prefix, b)) }
c172241
return s } return strconv.Quote(s) }
c172242
for i, part := range parts { if result[i], e = base64url.Decode(part); e != nil { return nil, e } } return result, nil }
c172243
result[i] = base64url.Encode(part) } return strings.Join(result, ".") }
c172244
>= required) { return data } return append(bytes.Repeat([]byte{0}, required-actual), data...) }
c172245
i++ { result[i] = left[i] ^ right[i] } return result }
c172246
count end := i*count + count result[i] = arr[start:end] } return result }
c172247
!= nil { return nil, err } return data, nil }
c172248
result = append(result, arr...) } return result }
c172249
result = append(result, arr...) } return result }
c172250
make([]byte, 8) binary.BigEndian.PutUint64(result, value) return result }
c172251
make([]byte, 4) binary.BigEndian.PutUint32(result, value) return result }
c172252
if idx != len(arr)-1 { buf.WriteString(", ") } } buf.WriteString("], Hex: [") for idx, b := range arr { buf.WriteString(fmt.Sprintf("%X", b)) if idx != len(arr)-1 { buf.WriteString(" ") } } buf.WriteString("], Base64Url:") buf.WriteString(base64url.Encode(arr)) return buf.String() }
c172253
case 2: data+="==" // 2 pad chars case 3: data+="=" // 1 pad char } return base64.StdEncoding.DecodeString(data) }
c172254
62nd char of encoding result = strings.Replace(result, "/", "_", -1) // 63rd char of encoding result = strings.Replace(result, "=", "", -1) // Remove any trailing '='s return result }
c172255
!= nil { return "", nil, err } return string(payload), headers, nil }
c172256
if len(parts) == 3 { return verify(parts, key) } if len(parts) == 5 { return decrypt(parts, key) } return nil, nil, errors.New(fmt.Sprintf("jwt.DecodeBytes() expects token of 3 or 5 parts, but was given: %v parts", len(parts))) }
c172257
was requested %v bits.", keyBitLength)) } dk := make([]byte, 0, dkLen) for i := 0; i < l; i++ { t := f(salt, iterationCount, i+1, prf) // T_l = F (P, S, c, l) if i == (l - 1) { t = t[:r] } // truncate last block to r bits dk = append(dk, t...) // DK = T_1 || T_2 || ... || T_l<0..r-1> } return dk }
c172258
return nil,err } } var ok bool if key,ok=parsedKey.(*ecdsa.PrivateKey);!ok { return nil, errors.New("Ecc.ReadPrivate(): Key is not valid *ecdsa.PrivateKey") } return key,nil }
c172259
var cert *x509.Certificate if parsedKey, err = x509.ParsePKIXPublicKey(encoded.Bytes); err != nil { if cert,err = x509.ParseCertificate(encoded.Bytes);err!=nil { return nil, err } parsedKey=cert.PublicKey } var ok bool if key, ok = parsedKey.(*rsa.PublicKey); !ok { return nil, errors.New("Rsa.NewPublic(): Key is not a valid RSA public key") } return key, nil }
c172260
% blockSize);paddingCount == 0 { paddingCount=blockSize } return append(data, bytes.Repeat([]byte{byte(paddingCount)}, paddingCount)...) }
c172261
padded correctly), return as is } padding := padded[dataLen-paddingCount : dataLen-1] for _, b := range padding { if int(b) != paddingCount { return padded //data is not padded (or not padded correcly), return as is } } return padded[:len(padded)-paddingCount] //return data - padding }
c172262
for _, env := range envelopes { messages = append(messages, env.GetContainerMetric()) } noaa.SortContainerMetrics(messages) return messages, nil }
c172263
sort.Stable(logMessageSlice(messages)) return messages }
c172264
[]*events.ContainerMetric { sort.Sort(containerMetricSlice(messages)) return messages }
c172265
}, Timeout: internal.Timeout, }, minRetryDelay: int64(DefaultMinRetryDelay), maxRetryDelay: int64(DefaultMaxRetryDelay), maxRetryCount: int64(DefaultMaxRetryCount), dialer: websocket.Dialer{ HandshakeTimeout: internal.Timeout, Proxy: proxy, TLSClientConfig: tlsConfig, }, recentPathBuilder: defaultRecentPathBuilder, streamPathBuilder: defaultStreamPathBuilder, } }
c172266
return c.tailingLogs(appGuid, authToken, true) }
c172267
error) { return c.tailingLogs(appGuid, authToken, false) }
c172268
error) { return c.runStream(appGuid, authToken, true) }
c172269
error) { return c.runStream(appGuid, authToken, false) }
c172270
(<-chan *events.Envelope, <-chan error) { return c.firehose(newFirehose( subscriptionId, authToken, )) }
c172271
(<-chan *events.Envelope, <-chan error) { return c.firehose(newFirehose( subscriptionId, authToken, WithRetry(false), )) }
c172272
) (<-chan *events.Envelope, <-chan error) { return c.firehose(newFirehose( subscriptionId, authToken, WithEnvelopeFilter(filter), )) }
c172273
defer c.callbackLock.Unlock() c.callback = cb }
c172274
{ errStrings = append(errStrings, err.Error()) } c.conns = c.conns[1:] } if len(errStrings) > 0 { return fmt.Errorf(strings.Join(errStrings, ", ")) } return nil }
c172275
command{Command: "zpool"} return c.Run(arg...) }
c172276
out[1:] z := &Zpool{Name: name} for _, line := range out { if err := z.parseLine(line); err != nil { return nil, err } } return z, nil }
c172277
zpool("destroy", z.Name) return err }
c172278
z, err := GetZpool(line[0]) if err != nil { return nil, err } pools = append(pools, z) } return pools, nil }
c172279
fmt.Sprintf("%s: %q => %s", e.Err, e.Debug, e.Stderr) }
c172280
command{Command: "zfs"} return c.Run(arg...) }
c172281
_, line := range out { if err := ds.parseLine(line); err != nil { return nil, err } } return ds, nil }
c172282
args = append(args, propsSlice(properties)...) } args = append(args, []string{d.Name, dest}...) _, err := zfs(args...) if err != nil { return nil, err } return GetDataset(dest) }
c172283
= append(args, "-f") } args = append(args, d.Name) _, err := zfs(args...) if err != nil { return nil, err } return GetDataset(d.Name) }
c172284
= "mount" if overlay { args = append(args, "-O") } if options != nil { args = append(args, "-o") args = append(args, strings.Join(options, ",")) } args = append(args, d.Name) _, err := zfs(args...) if err != nil { return nil, err } return GetDataset(d.Name) }
c172285
if err != nil { return nil, err } return GetDataset(name) }
c172286
:= command{Command: "zfs", Stdout: output} _, err := c.Run("send", d.Name) return err }
c172287
args = append(args, "-d") } if flags&DestroyForceUmount != 0 { args = append(args, "-f") } args = append(args, d.Name) _, err := zfs(args...) return err }
c172288
} if recursiveRenameSnapshots { args = append(args, "-r") } _, err := zfs(args...) if err != nil { return d, err } return GetDataset(name) }
c172289
append(args, snapName) _, err := zfs(args...) if err != nil { return nil, err } return GetDataset(snapName) }
c172290
args = append(args, "-r") } args = append(args, d.Name) _, err := zfs(args...) return err }
c172291
ds *Dataset for _, line := range out { if name != line[0] { name = line[0] ds = &Dataset{Name: name} datasets = append(datasets, ds) } if err := ds.parseLine(line); err != nil { return nil, err } } return datasets[1:], nil }
c172292
inodeChanges, err := parseInodeChanges(out) if err != nil { return nil, err } return inodeChanges, nil }
c172293
2 if temp != 0 { pos -= 2 x = temp } temp = x >> 1 if temp != 0 { return pos - 2 } return int(uint32(pos) - x) }
c172294
8 } if v >= 1<<4 { r += 4 v >>= 4 } if v >= 1<<2 { r += 2 v >>= 2 } r += v >> 1 return int(r) }
c172295
+= 4 } else if canPack(remaining, 9, 3) { dst[j] = pack3(src[i : i+3]) i += 3 } else if canPack(remaining, 14, 2) { dst[j] = pack2(src[i : i+2]) i += 2 } else if canPack(remaining, 28, 1) { dst[j] = pack1(src[i : i+1]) i += 1 } else { return nil, fmt.Errorf("value out of bounds") } j += 1 } return dst[:j], nil }
c172296
selector[sel].unpack(v, dst[j:]) j += selector[sel].n } return nil }
c172297
- 1) for i := 0; i < end; i++ { if src[i] > max { return false } } return true }
c172298
in[11]<<11 | in[12]<<12 | in[13]<<13 | in[14]<<14 | in[15]<<15 | in[16]<<16 | in[17]<<17 | in[18]<<18 | in[19]<<19 | in[20]<<20 | in[21]<<21 | in[22]<<22 | in[23]<<23 | in[24]<<24 | in[25]<<25 | in[26]<<26 | in[27]<<27 }
c172299
in[8]<<16 | in[9]<<18 | in[10]<<20 | in[11]<<22 | in[12]<<24 | in[13]<<26 }