// See: http://duktape.org/api.html#duk_peval_file_noresult
327992
func (d *Context) PevalFileNoresult(path string) int {
	__path__ := C.CString(path)
	result := int(C._duk_peval_file_noresult(d.duk_context, __path__))
	C.free(unsafe.Pointer(__path__))
	return result
}
775050
func (d *Context) PevalLstring(src string, lenght int) error {
	__src__ := C.CString(src)
	result := int(C._duk_peval_lstring(d.duk_context, __src__, C.duk_size_t(lenght)))
	C.free(unsafe.Pointer(__src__))
	return d.castStringToError(result)

}
204001
func (d *Context) EvalStringNoresult(src string) {
	__src__ := C.CString(src)
	C._duk_eval_string_noresult(d.duk_context, __src__)
	C.free(unsafe.Pointer(__src__))
}
1298358
func (f *SnappyFile) Dump() {
	fmt.Printf("EncBuf has length %d and contents:\n%s\n", len(f.EncBuf.Bytes()), string(f.EncBuf.Bytes()))
	fmt.Printf("DecBuf has length %d and contents:\n%s\n", len(f.DecBuf.Bytes()), string(f.DecBuf.Bytes()))
}
1055272
func DupStderr() (*os.File, error) {
	dupStderrFd, err := syscall.Dup(2)
	if err != nil {
		return nil, err
	}
	stderrFile := os.NewFile(uintptr(dupStderrFd), "stderr")
	return stderrFile, nil
}
666483
func (fis FileInfoSums) GetDuplicatePaths() (dups FileInfoSums) {
	seen := make(map[string]int, len(fis)) // allocate earl. no need to grow this map.
	for i := range fis {
		f := fis[i]
		if _, ok := seen[f.Name()]; ok {
			dups = append(dups, f)
		} else {
			seen[f.Name()] = 0
		}
	}
	return dups
}
309422
func (f *File) CalcNormSignalMax() (ret float64, err error) {
	e := C.sf_command(f.s, C.SFC_CALC_NORM_SIGNAL_MAX, unsafe.Pointer(&ret), 8)
	if e != 0 {
		err = sErrorType(e)
	}
	return
}
959423
func (result *Result) AppendResult(src *Result) {
	if src.RowsAffected == 0 && len(src.Fields) == 0 {
		return
	}
	if result.Fields == nil {
		result.Fields = src.Fields
	}
	result.RowsAffected += src.RowsAffected
	if src.InsertID != 0 {
		result.InsertID = src.InsertID
	}
	if len(result.Rows) == 0 {
		// we haven't gotten any result yet, just save the new extras.
		result.Extras = src.Extras
	} else {
		// Merge the EventTokens / Fresher flags within Extras.
		if src.Extras == nil {
			// We didn't get any from innerq. Have to clear any
			// we'd have gotten already.
			if result.Extras != nil {
				result.Extras.EventToken = nil
				result.Extras.Fresher = false
			}
		} else {
			// We may have gotten an EventToken from
			// innerqr.  If we also got one earlier, merge
			// it. If we didn't get one earlier, we
			// discard the new one.
			if result.Extras != nil {
				// Note if any of the two is nil, we get nil.
				result.Extras.EventToken = EventTokenMinimum(result.Extras.EventToken, src.Extras.EventToken)

				result.Extras.Fresher = result.Extras.Fresher && src.Extras.Fresher
			}
		}
	}
	result.Rows = append(result.Rows, src.Rows...)
}
610839
func (d *Context) EvalLstringNoresult(src string, lenght int) {
	__src__ := C.CString(src)
	C._duk_eval_lstring_noresult(d.duk_context, __src__, C.duk_size_t(lenght))
	C.free(unsafe.Pointer(__src__))
}
907579
func (a FileLayerAnalyzer) Diff(image1, image2 pkgutil.Image) (util.Result, error) {
	var dirDiffs []util.DirDiff

	// Go through each layer of the first image...
	for index, layer := range image1.Layers {
		if index >= len(image2.Layers) {
			continue
		}
		// ...else, diff as usual
		layer2 := image2.Layers[index]
		diff, err := diffImageFiles(layer.FSPath, layer2.FSPath)
		if err != nil {
			return &util.MultipleDirDiffResult{}, err
		}
		dirDiffs = append(dirDiffs, diff)
	}

	// check if there are any additional layers in either image
	if len(image1.Layers) != len(image2.Layers) {
		if len(image1.Layers) > len(image2.Layers) {
			logrus.Infof("%s has additional layers, please use container-diff analyze to view the files in these layers", image1.Source)
		} else {
			logrus.Infof("%s has additional layers, please use container-diff analyze to view the files in these layers", image2.Source)
		}
	}
	return &util.MultipleDirDiffResult{
		Image1:   image1.Source,
		Image2:   image2.Source,
		DiffType: "FileLayer",
		Diff: util.MultipleDirDiff{
			DirDiffs: dirDiffs,
		},
	}, nil
}
416577
func parseFile(source string) (*model.Package, error) {
	srcDir, err := filepath.Abs(filepath.Dir(source))
	if err != nil {
		return nil, fmt.Errorf("failed getting source directory: %v", err)
	}

	cfg := &packages.Config{Mode: packages.LoadSyntax, Tests: true}
	pkgs, err := packages.Load(cfg, "file="+source)
	if err != nil {
		return nil, err
	}
	if packages.PrintErrors(pkgs) > 0 || len(pkgs) == 0 {
		return nil, errors.New("loading package failed")
	}

	packageImport := pkgs[0].PkgPath

	// It is illegal to import a _test package.
	packageImport = strings.TrimSuffix(packageImport, "_test")

	fs := token.NewFileSet()
	file, err := parser.ParseFile(fs, source, nil, 0)
	if err != nil {
		return nil, fmt.Errorf("failed parsing source file %v: %v", source, err)
	}

	p := &fileParser{
		fileSet:            fs,
		imports:            make(map[string]string),
		importedInterfaces: make(map[string]map[string]*ast.InterfaceType),
		auxInterfaces:      make(map[string]map[string]*ast.InterfaceType),
		srcDir:             srcDir,
	}

	// Handle -imports.
	dotImports := make(map[string]bool)
	if *imports != "" {
		for _, kv := range strings.Split(*imports, ",") {
			eq := strings.Index(kv, "=")
			k, v := kv[:eq], kv[eq+1:]
			if k == "." {
				// TODO: Catch dupes?
				dotImports[v] = true
			} else {
				// TODO: Catch dupes?
				p.imports[k] = v
			}
		}
	}

	// Handle -aux_files.
	if err := p.parseAuxFiles(*auxFiles); err != nil {
		return nil, err
	}
	p.addAuxInterfacesFromFile(packageImport, file) // this file

	pkg, err := p.parseFile(packageImport, file)
	if err != nil {
		return nil, err
	}
	for path := range dotImports {
		pkg.DotImports = append(pkg.DotImports, path)
	}
	return pkg, nil
}
733146
func OpenFileSequential(name string, flag int, _ os.FileMode) (*os.File, error) {
	if name == "" {
		return nil, &os.PathError{Op: "open", Path: name, Err: syscall.ENOENT}
	}
	r, errf := syscallOpenFileSequential(name, flag, 0)
	if errf == nil {
		return r, nil
	}
	return nil, &os.PathError{Op: "open", Path: name, Err: errf}
}
587155
func (c context) updaterPromptResultFromFile(path string) (*updaterPromptInputResult, error) {
	resultRaw, err := util.ReadFile(path)
	if err != nil {
		return nil, err
	}

	var result updaterPromptInputResult
	if err := json.Unmarshal(resultRaw, &result); err != nil {
		return nil, err
	}
	return &result, nil
}
1307080
func (u *FileErrorResult) UnmarshalJSON(body []byte) error {
	type wrap struct {
		dropbox.Tagged
	}
	var w wrap
	var err error
	if err = json.Unmarshal(body, &w); err != nil {
		return err
	}
	u.Tag = w.Tag
	switch u.Tag {
	case "file_not_found_error":
		err = json.Unmarshal(body, &u.FileNotFoundError)

		if err != nil {
			return err
		}
	case "invalid_file_action_error":
		err = json.Unmarshal(body, &u.InvalidFileActionError)

		if err != nil {
			return err
		}
	case "permission_denied_error":
		err = json.Unmarshal(body, &u.PermissionDeniedError)

		if err != nil {
			return err
		}
	}
	return nil
}
1292989
func NewListFileRequestsResult(FileRequests []*FileRequest) *ListFileRequestsResult {
	s := new(ListFileRequestsResult)
	s.FileRequests = FileRequests
	return s
}
975430
func ParseFile(path string) (config Config, err error) {
	var file *os.File
	file, err = os.Open(path) //nolint:gosec
	if err != nil {
		return
	}
	defer file.Close() // nolint: errcheck
	return Parse(file)
}
1106297
func FileResult(l *State, err error, filename string) int {
	if err == nil {
		l.PushBoolean(true)
		return 1
	}
	l.PushNil()
	if filename != "" {
		l.PushString(filename + ": " + err.Error())
	} else {
		l.PushString(err.Error())
	}
	l.PushInteger(0) // TODO map err to errno
	return 3
}