From 04ef12c19a06600708a52cccca7c7bee17bdbb8a Mon Sep 17 00:00:00 2001 From: Seednode Date: Mon, 11 Sep 2023 20:02:52 -0500 Subject: [PATCH] Replaced uint32 with uint64 --- README.md | 8 ++++---- cmd/files.go | 22 +++++++++++----------- cmd/root.go | 14 +++++++------- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 51c4856..48fd7ec 100644 --- a/README.md +++ b/README.md @@ -117,9 +117,9 @@ Flags: -f, --filter enable filtering -h, --help help for roulette --images enable support for image files (default true) - --maximum-files uint32 skip directories with file counts over this value (default 4294967295) - --minimum-files uint32 skip directories with file counts under this value - --page-length uint16 pagination length for statistics and debug pages + --maximum-files uint skip directories with file counts above this value (default 18446744073709551615) + --minimum-files uint skip directories with file counts below this value (default 1) + --page-length uint pagination length for statistics and debug pages -p, --port uint16 port to listen on (default 8080) --profile register net/http/pprof handlers -r, --recursive recurse into subdirectories @@ -128,7 +128,7 @@ Flags: -s, --sort enable sorting --stats expose stats endpoint --stats-file string path to optional persistent stats file - --text enable support for text files (default true) + --text enable support for text files -v, --verbose log accessed files to stdout -V, --version display version and exit --video enable support for video files diff --git a/cmd/files.go b/cmd/files.go index 3278497..e8ec849 100644 --- a/cmd/files.go +++ b/cmd/files.go @@ -47,10 +47,10 @@ func (f *Files) Append(directory, path string) { } type ScanStats struct { - filesMatched atomic.Uint32 - filesSkipped atomic.Uint32 - directoriesMatched atomic.Uint32 - directoriesSkipped atomic.Uint32 + filesMatched atomic.Uint64 + filesSkipped atomic.Uint64 + directoriesMatched atomic.Uint64 + directoriesSkipped atomic.Uint64 } type Path struct { @@ -355,9 +355,9 @@ func pathHasSupportedFiles(path string, registeredFormats *formats.SupportedForm } } -func pathCount(path string) (uint32, uint32, error) { - var directories uint32 = 0 - var files uint32 = 0 +func pathCount(path string) (uint64, uint64, error) { + var directories uint64 = 0 + var files uint64 = 0 nodes, err := os.ReadDir(path) if err != nil { @@ -449,10 +449,10 @@ func fileList(paths []string, filters *Filters, sort string, index *Index, types } stats := &ScanStats{ - filesMatched: atomic.Uint32{}, - filesSkipped: atomic.Uint32{}, - directoriesMatched: atomic.Uint32{}, - directoriesSkipped: atomic.Uint32{}, + filesMatched: atomic.Uint64{}, + filesSkipped: atomic.Uint64{}, + directoriesMatched: atomic.Uint64{}, + directoriesSkipped: atomic.Uint64{}, } concurrency := &Concurrency{ diff --git a/cmd/root.go b/cmd/root.go index 7aed9e5..f80c217 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -12,7 +12,7 @@ import ( ) const ( - Version string = "0.69.1" + Version string = "0.69.2" ) var ( @@ -24,9 +24,9 @@ var ( debug bool filtering bool images bool - maximumFileCount uint32 - minimumFileCount uint32 - pageLength uint16 + maximumFileCount uint64 + minimumFileCount uint64 + pageLength uint64 port uint16 profile bool recursive bool @@ -83,9 +83,9 @@ func init() { rootCmd.Flags().BoolVarP(&debug, "debug", "d", false, "expose debug endpoint") rootCmd.Flags().BoolVarP(&filtering, "filter", "f", false, "enable filtering") rootCmd.Flags().BoolVar(&images, "images", true, "enable support for image files") - rootCmd.Flags().Uint32Var(&maximumFileCount, "maximum-files", 1<<32-1, "skip directories with file counts over this value") - rootCmd.Flags().Uint32Var(&minimumFileCount, "minimum-files", 0, "skip directories with file counts under this value") - rootCmd.Flags().Uint16Var(&pageLength, "page-length", 0, "pagination length for statistics and debug pages") + rootCmd.Flags().Uint64Var(&maximumFileCount, "maximum-files", 1<<64-1, "skip directories with file counts above this value") + rootCmd.Flags().Uint64Var(&minimumFileCount, "minimum-files", 1, "skip directories with file counts below this value") + rootCmd.Flags().Uint64Var(&pageLength, "page-length", 0, "pagination length for statistics and debug pages") rootCmd.Flags().Uint16VarP(&port, "port", "p", 8080, "port to listen on") rootCmd.Flags().BoolVar(&profile, "profile", false, "register net/http/pprof handlers") rootCmd.Flags().BoolVarP(&recursive, "recursive", "r", false, "recurse into subdirectories")