mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-12 10:22:12 +02:00
Compare commits
65 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ff8b69019f | |||
| 28c367c6a4 | |||
| 48929622f8 | |||
| 1754aaef5f | |||
| da401a7c3e | |||
| 412fda612f | |||
| 2299439873 | |||
| 62fe9e1d11 | |||
| e9258cc5a8 | |||
| d8ae93f85d | |||
| ff1ecb4166 | |||
| d8ef56c3b3 | |||
| 68a0f5e3c6 | |||
| a0e913a14c | |||
| 9a940d73ba | |||
| 19ae272052 | |||
| d9286050b6 | |||
| 14ca210655 | |||
| 300ad93022 | |||
| 63ff315914 | |||
| 7663cb4399 | |||
| 944c63e8ec | |||
| 12f0088d72 | |||
| 4826986cd8 | |||
| 0869809857 | |||
| c31779e99d | |||
| 89ad35d8a1 | |||
| d651f3de43 | |||
| c34c3e5aae | |||
| c5c61584d9 | |||
| 48c3b4f980 | |||
| 93bca8d480 | |||
| c690fe5aa9 | |||
| 55e674e1cb | |||
| 0495c47909 | |||
| 2f79c39f62 | |||
| 44056f1c85 | |||
| 6358bd7844 | |||
| 11d77e0d09 | |||
| ec25659503 | |||
| 35dbcb2588 | |||
| 8b6a74f2ec | |||
| 2ea6c3767e | |||
| 827bc26b0a | |||
| e12f3631d4 | |||
| 52c9730542 | |||
| 225d9e7771 | |||
| d031d6c20f | |||
| 35af768d92 | |||
| 22c4620345 | |||
| 81738aa303 | |||
| 113f7d34d8 | |||
| 62513004c8 | |||
| 1b36c3cd5f | |||
| 78874ae583 | |||
| a447928853 | |||
| 9f446bdad7 | |||
| 4cf060eb27 | |||
| 08d419d75c | |||
| 3ae1bfdc24 | |||
| 0e257f25c2 | |||
| 195e148cc1 | |||
| 5ab192ee05 | |||
| 4897152af6 | |||
| 69418cb527 |
@@ -3,35 +3,58 @@ name: Reusable DragonFly amd64
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
env:
|
||||
CMAKE_BUILD_TYPE: ${{ vars.CMAKE_BUILD_TYPE || 'RelWithDebInfo' }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
shell: cpa.sh {0}
|
||||
|
||||
steps:
|
||||
- name: checkout repository
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: run VM
|
||||
uses: vmactions/dragonflybsd-vm@v1
|
||||
- name: Start VM
|
||||
uses: cross-platform-actions/action@master
|
||||
with:
|
||||
usesh: yes
|
||||
envs: 'CMAKE_BUILD_TYPE'
|
||||
prepare: |
|
||||
uname -a
|
||||
pkg update
|
||||
pkg install -y llvm cmake git pkgconf binutils wayland vulkan-headers vulkan-loader libxcb libXrandr libX11 libdrm glib dconf dbus sqlite3-tcl egl opencl ocl-icd v4l_compat chafa libelf lua54 libva libvdpau
|
||||
operating_system: dragonflybsd
|
||||
version: '6.4.2'
|
||||
shell: bash
|
||||
cpu_count: 4
|
||||
|
||||
run: |
|
||||
env CC=clang cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=On -DENABLE_EMBEDDED_AMDGPUIDS=On .
|
||||
cmake --build . --target package --verbose -j4
|
||||
./fastfetch --list-features
|
||||
time ./fastfetch -c presets/ci.jsonc --stat false
|
||||
time ./fastfetch -c presets/ci.jsonc --format json
|
||||
time ./flashfetch
|
||||
ldd fastfetch
|
||||
ctest --output-on-failure
|
||||
- name: Show system info
|
||||
run: |
|
||||
uname -a
|
||||
pkg --version
|
||||
|
||||
- name: Update and install dependencies
|
||||
run: |
|
||||
sudo pkg update
|
||||
sudo pkg install -y llvm cmake git pkgconf binutils wayland vulkan-headers vulkan-loader libxcb libXrandr libX11 libdrm glib dconf dbus sqlite3-tcl egl opencl ocl-icd v4l_compat chafa libelf lua54 libva libvdpau
|
||||
|
||||
- name: CMake configuration
|
||||
run: env CC=clang cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=On -DENABLE_EMBEDDED_AMDGPUIDS=On -DCMAKE_BUILD_TYPE=${{ vars.CMAKE_BUILD_TYPE || 'RelWithDebInfo' }} .
|
||||
|
||||
- name: CMake build
|
||||
run: cmake --build . --target package --verbose -j4
|
||||
|
||||
- name: List features
|
||||
run: ./fastfetch --list-features
|
||||
|
||||
- name: Run normal
|
||||
run: time ./fastfetch -c presets/ci.jsonc --stat false
|
||||
|
||||
- name: Run json
|
||||
run: time ./fastfetch -c presets/ci.jsonc --format json
|
||||
|
||||
- name: Run flashfetch
|
||||
run: time ./flashfetch
|
||||
|
||||
- name: Run ldd
|
||||
run: ldd fastfetch
|
||||
|
||||
- name: Run tests
|
||||
run: ctest --output-on-failure
|
||||
|
||||
- name: upload artifacts
|
||||
uses: actions/upload-artifact@v7
|
||||
|
||||
@@ -3,37 +3,59 @@ name: Reusable FreeBSD amd64
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
env:
|
||||
CMAKE_BUILD_TYPE: ${{ vars.CMAKE_BUILD_TYPE || 'RelWithDebInfo' }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
shell: cpa.sh {0}
|
||||
|
||||
steps:
|
||||
- name: checkout repository
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: run VM
|
||||
- name: Start VM
|
||||
uses: cross-platform-actions/action@master
|
||||
with:
|
||||
operating_system: freebsd
|
||||
architecture: x86-64
|
||||
cpu_count: 4
|
||||
version: '15.1'
|
||||
shell: bash
|
||||
version: '15.0'
|
||||
environment_variables: 'CMAKE_BUILD_TYPE'
|
||||
run: |
|
||||
uname -a
|
||||
sudo pkg update
|
||||
sudo pkg install -y cmake git pkgconf binutils wayland vulkan-headers vulkan-loader libxcb libXrandr libX11 libdrm glib dconf dbus sqlite3-tcl egl opencl ocl-icd v4l_compat chafa lua54 libva libvdpau
|
||||
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=On -DENABLE_EMBEDDED_AMDGPUIDS=On .
|
||||
cmake --build . --target package --verbose -j4
|
||||
./fastfetch --list-features
|
||||
time ./fastfetch -c presets/ci.jsonc --stat false
|
||||
time ./fastfetch -c presets/ci.jsonc --format json
|
||||
time ./flashfetch
|
||||
ldd fastfetch
|
||||
ctest --output-on-failure
|
||||
cpu_count: 4
|
||||
|
||||
- name: Show system info
|
||||
run: |
|
||||
uname -a
|
||||
freebsd-version
|
||||
pkg -v
|
||||
|
||||
- name: Update and install dependencies
|
||||
run: |
|
||||
sudo pkg update
|
||||
sudo pkg install -y cmake git pkgconf binutils wayland vulkan-headers vulkan-loader libxcb libXrandr libX11 libdrm glib dconf dbus sqlite3-tcl egl opencl ocl-icd v4l_compat chafa lua54 libva libvdpau
|
||||
|
||||
- name: CMake configuration
|
||||
run: cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=On -DENABLE_EMBEDDED_AMDGPUIDS=On -DCMAKE_BUILD_TYPE=${{ vars.CMAKE_BUILD_TYPE || 'RelWithDebInfo' }} .
|
||||
|
||||
- name: CMake build
|
||||
run: cmake --build . --target package --verbose -j4
|
||||
|
||||
- name: List features
|
||||
run: ./fastfetch --list-features
|
||||
|
||||
- name: Run normal
|
||||
run: time ./fastfetch -c presets/ci.jsonc --stat false
|
||||
|
||||
- name: Run json
|
||||
run: time ./fastfetch -c presets/ci.jsonc --format json
|
||||
|
||||
- name: Run flashfetch
|
||||
run: time ./flashfetch
|
||||
|
||||
- name: Run ldd
|
||||
run: ldd fastfetch
|
||||
|
||||
- name: Run tests
|
||||
run: ctest --output-on-failure
|
||||
|
||||
- name: upload artifacts
|
||||
uses: actions/upload-artifact@v7
|
||||
|
||||
@@ -3,35 +3,52 @@ name: Reusable Haiku amd64
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
env:
|
||||
CMAKE_BUILD_TYPE: ${{ vars.CMAKE_BUILD_TYPE || 'RelWithDebInfo' }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
shell: cpa.sh {0}
|
||||
|
||||
steps:
|
||||
- name: checkout repository
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: run VM
|
||||
- name: Start VM
|
||||
uses: cross-platform-actions/action@master
|
||||
with:
|
||||
operating_system: haiku
|
||||
version: 'r1beta5'
|
||||
architecture: x86-64
|
||||
cpu_count: 4
|
||||
shell: bash
|
||||
environment_variables: 'CMAKE_BUILD_TYPE'
|
||||
run: |
|
||||
uname -a
|
||||
pkgman install -y git dbus_devel mesa_devel libelf_devel imagemagick_devel opencl_headers ocl_icd_devel vulkan_devel zlib_devel chafa_devel cmake gcc make pkgconfig python3.10 || pkgman install -y git dbus_devel mesa_devel libelf_devel imagemagick_devel opencl_headers ocl_icd_devel vulkan_devel zlib_devel chafa_devel cmake gcc make pkgconfig python3.10 lua
|
||||
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=On -DENABLE_EMBEDDED_AMDGPUIDS=On .
|
||||
cmake --build . --target package --verbose -j4
|
||||
./fastfetch --list-features
|
||||
time ./fastfetch -c presets/ci.jsonc --stat false
|
||||
time ./fastfetch -c presets/ci.jsonc --format json
|
||||
time ./flashfetch
|
||||
ctest --output-on-failure
|
||||
cpu_count: 4
|
||||
|
||||
- name: Show system info
|
||||
run: uname -a
|
||||
|
||||
- name: Install dependencies
|
||||
shell: cpa.sh {0} --reboot
|
||||
run: pkgman install -y git dbus_devel mesa_devel libelf_devel imagemagick_devel opencl_headers ocl_icd_devel vulkan_devel zlib_devel chafa_devel cmake llvm22_clang ninja pkgconfig python3.10 lua || pkgman install -y git dbus_devel mesa_devel libelf_devel imagemagick_devel opencl_headers ocl_icd_devel vulkan_devel zlib_devel chafa_devel cmake llvm22_clang ninja pkgconfig python3.10 lua
|
||||
|
||||
- name: CMake configuration
|
||||
run: CC=clang CXX=clang++ cmake -GNinja -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=On -DENABLE_EMBEDDED_AMDGPUIDS=On -DCMAKE_BUILD_TYPE=${{ vars.CMAKE_BUILD_TYPE || 'RelWithDebInfo' }} .
|
||||
|
||||
- name: CMake build
|
||||
run: cmake --build . --target package --verbose -j4
|
||||
|
||||
- name: List features
|
||||
run: ./fastfetch --list-features
|
||||
|
||||
- name: Run normal
|
||||
run: time ./fastfetch -c presets/ci.jsonc --stat false
|
||||
|
||||
- name: Run json
|
||||
run: time ./fastfetch -c presets/ci.jsonc --format json
|
||||
|
||||
- name: Run flashfetch
|
||||
run: time ./flashfetch
|
||||
|
||||
- name: Run tests
|
||||
run: ctest --output-on-failure
|
||||
|
||||
- name: upload artifacts
|
||||
uses: actions/upload-artifact@v7
|
||||
|
||||
@@ -11,7 +11,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: checkout repository
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: run VM
|
||||
uses: uraimo/run-on-arch-action@v3
|
||||
|
||||
@@ -11,7 +11,7 @@ jobs:
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: checkout repository
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: run VM
|
||||
uses: uraimo/run-on-arch-action@v3
|
||||
|
||||
@@ -24,7 +24,7 @@ jobs:
|
||||
ffversion: ${{ steps.ffversion.outputs.ffversion }}
|
||||
steps:
|
||||
- name: checkout repository
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: uname -a
|
||||
run: uname -a
|
||||
|
||||
@@ -11,7 +11,7 @@ jobs:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: checkout repository
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: uname -a
|
||||
run: uname -a
|
||||
|
||||
@@ -15,7 +15,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: checkout repository
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: run VM
|
||||
uses: uraimo/run-on-arch-action@v3
|
||||
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
runs-on: ${{ inputs.runs-on }}
|
||||
steps:
|
||||
- name: checkout repository
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: uname -a
|
||||
run: uname -a
|
||||
|
||||
@@ -10,7 +10,7 @@ jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- name: setup alpine linux
|
||||
uses: jirutka/setup-alpine@master
|
||||
|
||||
@@ -3,36 +3,57 @@ name: Reusable NetBSD amd64
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
env:
|
||||
CMAKE_BUILD_TYPE: ${{ vars.CMAKE_BUILD_TYPE || 'RelWithDebInfo' }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
shell: cpa.sh {0}
|
||||
|
||||
steps:
|
||||
- name: checkout repository
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: run VM
|
||||
- name: Start VM
|
||||
uses: cross-platform-actions/action@master
|
||||
with:
|
||||
operating_system: netbsd
|
||||
architecture: x86-64
|
||||
cpu_count: 4
|
||||
shell: bash
|
||||
version: '10.1'
|
||||
environment_variables: 'CMAKE_BUILD_TYPE'
|
||||
run: |
|
||||
uname -a
|
||||
sudo pkgin -y install clang cmake git pkgconf wayland vulkan-headers dconf dbus sqlite3 ImageMagick libva libvdpau
|
||||
CC=clang cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=On -DENABLE_EMBEDDED_AMDGPUIDS=On .
|
||||
cmake --build . --target package --verbose -j4
|
||||
./fastfetch --list-features
|
||||
time ./fastfetch -c presets/ci.jsonc --stat false
|
||||
time ./fastfetch -c presets/ci.jsonc --format json
|
||||
time ./flashfetch
|
||||
ldd fastfetch
|
||||
ctest --output-on-failure
|
||||
shell: bash
|
||||
cpu_count: 4
|
||||
|
||||
- name: Show system info
|
||||
run: |
|
||||
uname -a
|
||||
pkgin -v
|
||||
|
||||
- name: Update and install dependencies
|
||||
run: |
|
||||
sudo pkgin -y install clang cmake git pkgconf wayland vulkan-headers dconf dbus sqlite3 ImageMagick libva libvdpau
|
||||
|
||||
- name: CMake configuration
|
||||
run: CC=clang cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=On -DENABLE_EMBEDDED_AMDGPUIDS=On -DCMAKE_BUILD_TYPE=${{ vars.CMAKE_BUILD_TYPE || 'RelWithDebInfo' }} .
|
||||
|
||||
- name: CMake build
|
||||
run: cmake --build . --target package --verbose -j4
|
||||
|
||||
- name: List features
|
||||
run: ./fastfetch --list-features
|
||||
|
||||
- name: Run normal
|
||||
run: time ./fastfetch -c presets/ci.jsonc --stat false
|
||||
|
||||
- name: Run json
|
||||
run: time ./fastfetch -c presets/ci.jsonc --format json
|
||||
|
||||
- name: Run flashfetch
|
||||
run: time ./flashfetch
|
||||
|
||||
- name: Run ldd
|
||||
run: ldd fastfetch
|
||||
|
||||
- name: Run tests
|
||||
run: ctest --output-on-failure
|
||||
|
||||
- name: upload artifacts
|
||||
uses: actions/upload-artifact@v7
|
||||
|
||||
@@ -12,7 +12,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: checkout repository
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: uname -a
|
||||
run: uname -a
|
||||
|
||||
@@ -3,37 +3,62 @@ name: Reusable OmniOS amd64
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
env:
|
||||
CMAKE_BUILD_TYPE: ${{ vars.CMAKE_BUILD_TYPE || 'RelWithDebInfo' }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
shell: cpa.sh {0}
|
||||
|
||||
steps:
|
||||
- name: checkout repository
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: run VM
|
||||
uses: vmactions/omnios-vm@v1
|
||||
- name: Start VM
|
||||
uses: cross-platform-actions/action@master
|
||||
with:
|
||||
usesh: true
|
||||
envs: 'CMAKE_BUILD_TYPE'
|
||||
prepare: |
|
||||
uname -a
|
||||
pkg update --accept || true
|
||||
pkg install gcc14 cmake git pkg-config glib2 dbus sqlite-3 imagemagick ninja
|
||||
operating_system: omnios
|
||||
version: 'r151058'
|
||||
shell: bash
|
||||
cpu_count: 4
|
||||
|
||||
run: |
|
||||
cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -GNinja .
|
||||
cmake --build . --verbose -j4
|
||||
./fastfetch --list-features
|
||||
time ./fastfetch -c presets/ci.jsonc --stat false
|
||||
time ./fastfetch -c presets/ci.jsonc --format json
|
||||
time ./flashfetch
|
||||
ldd fastfetch
|
||||
ctest --output-on-failure
|
||||
echo 'set(CPACK_PACKAGE_FILE_NAME "fastfetch-omnios-amd64")' >> CPackConfig.cmake
|
||||
cpack -V
|
||||
- name: Show system info
|
||||
run: |
|
||||
uname -a
|
||||
|
||||
- name: Update and install dependencies
|
||||
run: |
|
||||
sudo pkg update --accept || true
|
||||
sudo pkg install gcc14 cmake git pkg-config glib2 dbus sqlite-3 imagemagick ninja
|
||||
|
||||
- name: CMake configuration
|
||||
run: cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -GNinja -DENABLE_EMBEDDED_PCIIDS=On -DENABLE_EMBEDDED_AMDGPUIDS=On -DCMAKE_BUILD_TYPE=${{ vars.CMAKE_BUILD_TYPE || 'RelWithDebInfo' }} .
|
||||
|
||||
- name: CMake build
|
||||
run: cmake --build . --verbose -j4
|
||||
|
||||
- name: List features
|
||||
run: ./fastfetch --list-features
|
||||
|
||||
- name: Run normal
|
||||
run: time ./fastfetch -c presets/ci.jsonc --stat false
|
||||
|
||||
- name: Run json
|
||||
run: time ./fastfetch -c presets/ci.jsonc --format json
|
||||
|
||||
- name: Run flashfetch
|
||||
run: time ./flashfetch
|
||||
|
||||
- name: Run ldd
|
||||
run: ldd fastfetch
|
||||
|
||||
- name: Run tests
|
||||
run: ctest --output-on-failure
|
||||
|
||||
- name: Package
|
||||
run: |
|
||||
echo 'set(CPACK_PACKAGE_FILE_NAME "fastfetch-omnios-amd64")' >> CPackConfig.cmake
|
||||
cpack -V
|
||||
|
||||
- name: upload artifacts
|
||||
uses: actions/upload-artifact@v7
|
||||
|
||||
@@ -3,37 +3,57 @@ name: Reusable OpenBSD amd64
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
env:
|
||||
CMAKE_BUILD_TYPE: ${{ vars.CMAKE_BUILD_TYPE || 'RelWithDebInfo' }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
shell: cpa.sh {0}
|
||||
|
||||
steps:
|
||||
- name: checkout repository
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: run VM
|
||||
- name: Start VM
|
||||
uses: cross-platform-actions/action@master
|
||||
with:
|
||||
operating_system: openbsd
|
||||
architecture: x86-64
|
||||
cpu_count: 4
|
||||
shell: bash
|
||||
version: '7.9'
|
||||
environment_variables: 'CMAKE_BUILD_TYPE'
|
||||
run: |
|
||||
uname -a
|
||||
sudo pkg_add -u
|
||||
sudo pkg_add -r llvm-21.1.8p4 cmake git wayland vulkan-headers vulkan-loader glib2 dconf dbus sqlite3 imagemagick chafa lua-5.4.8p0 # pkg-config is preinstalled
|
||||
CC=clang-21 cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=On -DENABLE_EMBEDDED_AMDGPUIDS=On .
|
||||
cmake --build . --target package --verbose -j4
|
||||
./fastfetch --list-features
|
||||
time ./fastfetch -c presets/ci.jsonc --stat false
|
||||
time ./fastfetch -c presets/ci.jsonc --format json
|
||||
time ./flashfetch
|
||||
ldd fastfetch
|
||||
ctest --output-on-failure
|
||||
shell: bash
|
||||
cpu_count: 4
|
||||
|
||||
- name: Show system info
|
||||
run: |
|
||||
uname -a
|
||||
|
||||
- name: Update and install dependencies
|
||||
run: |
|
||||
sudo pkg_add -u
|
||||
sudo pkg_add -r llvm-21.1.8p4 cmake git wayland vulkan-headers vulkan-loader glib2 dconf dbus sqlite3 imagemagick chafa lua-5.4.8p0 # pkg-config is preinstalled
|
||||
|
||||
- name: CMake configuration
|
||||
run: CC=clang-21 cmake -DSET_TWEAK=Off -DBUILD_TESTS=On -DENABLE_EMBEDDED_PCIIDS=On -DENABLE_EMBEDDED_AMDGPUIDS=On -DCMAKE_BUILD_TYPE=${{ vars.CMAKE_BUILD_TYPE || 'RelWithDebInfo' }} .
|
||||
|
||||
- name: CMake build
|
||||
run: cmake --build . --target package --verbose -j4
|
||||
|
||||
- name: List features
|
||||
run: ./fastfetch --list-features
|
||||
|
||||
- name: Run normal
|
||||
run: time ./fastfetch -c presets/ci.jsonc --stat false
|
||||
|
||||
- name: Run json
|
||||
run: time ./fastfetch -c presets/ci.jsonc --format json
|
||||
|
||||
- name: Run flashfetch
|
||||
run: time ./flashfetch
|
||||
|
||||
- name: Run ldd
|
||||
run: ldd fastfetch
|
||||
|
||||
- name: Run tests
|
||||
run: ctest --output-on-failure
|
||||
|
||||
- name: upload artifacts
|
||||
uses: actions/upload-artifact@v7
|
||||
|
||||
@@ -11,7 +11,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: checkout repository
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: run VM
|
||||
uses: vmactions/solaris-vm@v1
|
||||
|
||||
@@ -9,7 +9,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: checkout repository
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: Install codespell
|
||||
shell: bash
|
||||
|
||||
@@ -30,7 +30,7 @@ jobs:
|
||||
shell: msys2 {0}
|
||||
steps:
|
||||
- name: checkout repository
|
||||
uses: actions/checkout@v6
|
||||
uses: actions/checkout@v7
|
||||
|
||||
- name: setup-msys2
|
||||
uses: msys2/setup-msys2@v2
|
||||
|
||||
+42
-1
@@ -1,3 +1,44 @@
|
||||
# 2.66.1
|
||||
|
||||
Bugfixes:
|
||||
* Fixed I/O rate calculation precision and prevented division by zero. (DiskIO / NetIO)
|
||||
* Fixed ash and fish version detection, including a potential out-of-bounds read. (Shell)
|
||||
* Fixed integer handling for varying sysctl data lengths. (Sysctl)
|
||||
* Fixed several memory leaks in Camera, Codec, Display, Separator and Weather.
|
||||
* Fixed Base64 encoding on big-endian hosts. (Base64)
|
||||
* Fixed VP9 codec detection and macOS 10.15 Codec compatibility. (Codec, macOS)
|
||||
* Relaxed accepted HTTP response formats and fixed invalid PublicIP URL parsing. (Networking / PublicIP)
|
||||
* Added a response size limit to prevent excessive network memory allocation. (Networking)
|
||||
* Added integer overflow checks to string buffer capacity handling. (FFstrbuf)
|
||||
* Fixed Ubuntu Studio Core detection. (OS, Linux)
|
||||
* Fixed preferred monitor mode detection for KDE Plasma. (Display, Linux)
|
||||
* Fixed bright colors being enabled incorrectly in light themes. (Display)
|
||||
* Fixed a macOS compiler warning. (Version, macOS)
|
||||
|
||||
# 2.66.0
|
||||
|
||||
Changes:
|
||||
* CPU package count is no longer reported in the default output.
|
||||
* Users can still print it in custom formats via `{packages}`
|
||||
|
||||
Bugfixes:
|
||||
* Fixed compatibility with WSL 2.9.3 (#2433, WM, Linux)
|
||||
* Fixed accurate AMD GPU names are not queried in `driverSpecific` mode (GPU, Linux)
|
||||
* Fixed GPU core counting for Apple Silicon GPU on Asahi Linux (GPU, Linux)
|
||||
* Some internal cleanups and optimizations
|
||||
|
||||
Features:
|
||||
* Added Astra Linux version detection (OS, Linux)
|
||||
* Improved performance of Windows PowerShell version detection (Shell, Windows)
|
||||
* Improved performance of Media module on macOS (Media, macOS)
|
||||
* Added proxmox backup server detection (#2443, OS, Linux)
|
||||
|
||||
Logos:
|
||||
* Added Flatcar, Azure Linux
|
||||
* Added Chimera_small, Chimera2, Parabola2_small, PostmarketOS2, Qubes_small
|
||||
* Updated linuxmint_small
|
||||
* Cleaned up distro names
|
||||
|
||||
# 2.65.2
|
||||
|
||||
Changes:
|
||||
@@ -10,7 +51,7 @@ Bugfixes:
|
||||
* Fixed a crash when detecting hardware codec support with the `amdgpu` driver on Linux. (#2419, Codec, Linux)
|
||||
|
||||
Logos:
|
||||
* Updated CachyOS_small
|
||||
* Updated CachyOS_small; fixed CachyOS logo colors to match the official logo better
|
||||
* Added Turkish
|
||||
|
||||
# 2.65.1
|
||||
|
||||
+23
-1
@@ -1,7 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url
|
||||
|
||||
project(fastfetch
|
||||
VERSION 2.65.2
|
||||
VERSION 2.66.1
|
||||
LANGUAGES C
|
||||
DESCRIPTION "Fast neofetch-like system information tool"
|
||||
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
|
||||
@@ -105,6 +105,7 @@ cmake_dependent_option(ENABLE_THREADS "Enable multithreading" ON "Threads_FOUND"
|
||||
option(ENABLE_ZLIB "Enable zlib" ON)
|
||||
option(ENABLE_SYSTEM_YYJSON "Use system provided (instead of fastfetch embedded) yyjson library" OFF)
|
||||
option(ENABLE_ASAN "Build fastfetch with ASAN (address sanitizer)" OFF)
|
||||
option(ENABLE_TRACER "Build fastfetch with function tracing" OFF)
|
||||
option(ENABLE_LTO "Enable link-time optimization in release mode if supported" ON)
|
||||
option(BUILD_FLASHFETCH "Build flashfetch" ON) # Also build the flashfetch binary
|
||||
option(BUILD_TESTS "Build tests" OFF) # Also create test executables
|
||||
@@ -1365,6 +1366,22 @@ elseif(GNU)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(ENABLE_TRACER)
|
||||
message(STATUS "Tracer is enabled")
|
||||
list(APPEND LIBFASTFETCH_SRC src/common/impl/tracer.c)
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "Clang" AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -finstrument-functions-after-inlining")
|
||||
else()
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -finstrument-functions -Dinline=\"__attribute__((no_instrument_function)) inline\"")
|
||||
endif()
|
||||
if(NOT WIN32)
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -rdynamic")
|
||||
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -gcodeview -fuse-ld=lld")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--pdb=${CMAKE_BINARY_DIR}/fastfetch.pdb")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Proprietary GPU driver APIs
|
||||
if(LINUX OR FreeBSD OR WIN32)
|
||||
list(APPEND LIBFASTFETCH_SRC src/detection/gpu/gpu_nvidia.c)
|
||||
@@ -1889,6 +1906,11 @@ elseif(WIN32)
|
||||
PRIVATE "runtimeobject"
|
||||
)
|
||||
endif()
|
||||
if(ENABLE_TRACER)
|
||||
target_link_libraries(libfastfetch
|
||||
PRIVATE "dbghelp"
|
||||
)
|
||||
endif()
|
||||
elseif(FreeBSD)
|
||||
target_link_libraries(libfastfetch
|
||||
PRIVATE "m"
|
||||
|
||||
Vendored
+6
@@ -1,3 +1,9 @@
|
||||
fastfetch (2.65.2~#UBUNTU_CODENAME#) #UBUNTU_CODENAME#; urgency=medium
|
||||
|
||||
* Update to 2.65.2
|
||||
|
||||
-- Carter Li <zhangsongcui@live.cn> Mon, 29 Jun 2026 10:05:47 +0800
|
||||
|
||||
fastfetch (2.65.1~#UBUNTU_CODENAME#) #UBUNTU_CODENAME#; urgency=medium
|
||||
|
||||
* Update to 2.65.1
|
||||
|
||||
+13
-13
@@ -42,12 +42,12 @@
|
||||
},
|
||||
{
|
||||
"type": "kernel",
|
||||
"key": "│ ├",
|
||||
"key": "│ ├{icon}",
|
||||
"keyColor": "yellow"
|
||||
},
|
||||
{
|
||||
"type": "packages",
|
||||
"key": "│ ├",
|
||||
"key": "│ ├{icon}",
|
||||
"keyColor": "yellow"
|
||||
},
|
||||
{
|
||||
@@ -62,22 +62,22 @@
|
||||
},
|
||||
{
|
||||
"type": "lm",
|
||||
"key": "│ ├",
|
||||
"key": "│ ├{icon}",
|
||||
"keyColor": "blue"
|
||||
},
|
||||
{
|
||||
"type": "wmtheme",
|
||||
"key": "│ ├",
|
||||
"key": "│ ├{icon}",
|
||||
"keyColor": "blue"
|
||||
},
|
||||
{
|
||||
"type": "icons",
|
||||
"key": "│ ├",
|
||||
"key": "│ ├{icon}",
|
||||
"keyColor": "blue"
|
||||
},
|
||||
{
|
||||
"type": "terminal",
|
||||
"key": "│ ├",
|
||||
"key": "│ ├{icon}",
|
||||
"keyColor": "blue"
|
||||
},
|
||||
{
|
||||
@@ -92,32 +92,32 @@
|
||||
},
|
||||
{
|
||||
"type": "cpu",
|
||||
"key": "│ ├",
|
||||
"key": "│ ├{icon}",
|
||||
"keyColor": "green"
|
||||
},
|
||||
{
|
||||
"type": "gpu",
|
||||
"key": "│ ├",
|
||||
"key": "│ ├{icon}",
|
||||
"keyColor": "green"
|
||||
},
|
||||
{
|
||||
"type": "disk",
|
||||
"key": "│ ├",
|
||||
"key": "│ ├{icon}",
|
||||
"keyColor": "green"
|
||||
},
|
||||
{
|
||||
"type": "memory",
|
||||
"key": "│ ├",
|
||||
"key": "│ ├{icon}",
|
||||
"keyColor": "green"
|
||||
},
|
||||
{
|
||||
"type": "swap",
|
||||
"key": "│ ├",
|
||||
"key": "│ ├{icon}",
|
||||
"keyColor": "green"
|
||||
},
|
||||
{
|
||||
"type": "uptime",
|
||||
"key": "│ ├",
|
||||
"key": "│ ├{icon}",
|
||||
"keyColor": "green"
|
||||
},
|
||||
{
|
||||
@@ -132,7 +132,7 @@
|
||||
},
|
||||
{
|
||||
"type": "player",
|
||||
"key": "│ ├",
|
||||
"key": "│ ├{icon}",
|
||||
"keyColor": "cyan"
|
||||
},
|
||||
{
|
||||
|
||||
+9
-2
@@ -15,8 +15,6 @@ typedef struct FFlist {
|
||||
uint32_t capacity;
|
||||
} FFlist;
|
||||
|
||||
void* ffListAdd(FFlist* list, uint32_t elementSize);
|
||||
|
||||
// Removes the first element, and copy its value to `*result`
|
||||
bool ffListShift(FFlist* list, uint32_t elementSize, void* __restrict result);
|
||||
// Removes the last element, and copy its value to `*result`
|
||||
@@ -105,6 +103,15 @@ static inline void ffListReserve(FFlist* list, uint32_t elementSize, uint32_t ne
|
||||
list->capacity = newCapacity;
|
||||
}
|
||||
|
||||
static inline void* ffListAdd(FFlist* list, uint32_t elementSize) {
|
||||
if (__builtin_expect(list->length == list->capacity, false)) {
|
||||
ffListReserve(list, elementSize, list->capacity == 0 ? FF_LIST_DEFAULT_ALLOC : list->capacity * 2);
|
||||
}
|
||||
|
||||
++list->length;
|
||||
return ffListGet(list, elementSize, list->length - 1);
|
||||
}
|
||||
|
||||
#define FF_LIST_FOR_EACH(itemType, itemVarName, listVar) \
|
||||
for (itemType* itemVarName = (itemType*) (listVar).data; \
|
||||
itemVarName - (itemType*) (listVar).data < (intptr_t) (listVar).length; \
|
||||
|
||||
+94
-46
@@ -37,16 +37,13 @@ static inline void ffStrbufInit(FFstrbuf* strbuf);
|
||||
void ffStrbufInitA(FFstrbuf* strbuf, uint32_t allocate);
|
||||
void ffStrbufInitVF(FFstrbuf* strbuf, const char* format, va_list arguments);
|
||||
void ffStrbufInitMoveNS(FFstrbuf* strbuf, uint32_t length, char* heapStr);
|
||||
FF_A_PRINTF(2, 3) void ffStrbufInitF(FFstrbuf* strbuf, const char* format, ...);
|
||||
FF_A_PRINTF(1, 2) FF_A_NODISCARD FFstrbuf ffStrbufCreateF(const char* format, ...);
|
||||
|
||||
void ffStrbufEnsureFree(FFstrbuf* strbuf, uint32_t free);
|
||||
void ffStrbufEnsureFixedLengthFree(FFstrbuf* strbuf, uint32_t free);
|
||||
|
||||
void ffStrbufClear(FFstrbuf* strbuf);
|
||||
void ffStrbufEnsureFreeNoCheck(FFstrbuf* strbuf, uint32_t free);
|
||||
|
||||
static inline void ffStrbufAppend(FFstrbuf* __restrict strbuf, const FFstrbuf* __restrict value);
|
||||
void ffStrbufAppendC(FFstrbuf* strbuf, char c);
|
||||
void ffStrbufAppendNC(FFstrbuf* strbuf, uint32_t num, char c);
|
||||
void ffStrbufAppendNS(FFstrbuf* strbuf, uint32_t length, const char* value);
|
||||
void ffStrbufAppendTransformS(FFstrbuf* strbuf, const char* value, int (*transformFunc)(int));
|
||||
FF_A_PRINTF(2, 3) void ffStrbufAppendF(FFstrbuf* strbuf, const char* format, ...);
|
||||
void ffStrbufAppendVF(FFstrbuf* strbuf, const char* format, va_list arguments);
|
||||
@@ -88,13 +85,6 @@ bool ffStrbufRemoveIgnCaseEndS(FFstrbuf* strbuf, const char* end);
|
||||
|
||||
bool ffStrbufEnsureEndsWithC(FFstrbuf* strbuf, char c);
|
||||
|
||||
void ffStrbufWriteTo(const FFstrbuf* strbuf, FILE* file);
|
||||
void ffStrbufPutTo(const FFstrbuf* strbuf, FILE* file);
|
||||
|
||||
FF_A_NODISCARD double ffStrbufToDouble(const FFstrbuf* strbuf, double defaultValue);
|
||||
FF_A_NODISCARD int64_t ffStrbufToSInt(const FFstrbuf* strbuf, int64_t defaultValue);
|
||||
FF_A_NODISCARD uint64_t ffStrbufToUInt(const FFstrbuf* strbuf, uint64_t defaultValue);
|
||||
|
||||
void ffStrbufUpperCase(FFstrbuf* strbuf);
|
||||
void ffStrbufLowerCase(FFstrbuf* strbuf);
|
||||
|
||||
@@ -182,31 +172,6 @@ FF_A_NODISCARD static inline FFstrbuf ffStrbufCreateMove(FFstrbuf* src) {
|
||||
return strbuf;
|
||||
}
|
||||
|
||||
FF_A_NODISCARD static inline FFstrbuf ffStrbufCreateVF(const char* format, va_list arguments) {
|
||||
FFstrbuf strbuf;
|
||||
ffStrbufInitVF(&strbuf, format, arguments);
|
||||
return strbuf;
|
||||
}
|
||||
|
||||
FF_A_PRINTF(2, 3) static inline void ffStrbufInitF(FFstrbuf* strbuf, const char* format, ...) {
|
||||
va_list arguments;
|
||||
va_start(arguments, format);
|
||||
ffStrbufInitVF(strbuf, format, arguments);
|
||||
va_end(arguments);
|
||||
}
|
||||
|
||||
FF_A_PRINTF(1, 2) FF_A_NODISCARD static inline FFstrbuf
|
||||
ffStrbufCreateF(const char* format, ...) {
|
||||
FFstrbuf strbuf;
|
||||
|
||||
va_list arguments;
|
||||
va_start(arguments, format);
|
||||
ffStrbufInitVF(&strbuf, format, arguments);
|
||||
va_end(arguments);
|
||||
|
||||
return strbuf;
|
||||
}
|
||||
|
||||
static inline void ffStrbufInitMoveS(FFstrbuf* strbuf, char* heapStr) {
|
||||
ffStrbufInitMoveNS(strbuf, (uint32_t) strlen(heapStr), heapStr);
|
||||
}
|
||||
@@ -229,6 +194,70 @@ FF_A_NODISCARD static inline uint32_t ffStrbufGetFree(const FFstrbuf* strbuf) {
|
||||
return strbuf->allocated - strbuf->length - 1; // - 1 for the null byte
|
||||
}
|
||||
|
||||
static inline void ffStrbufEnsureFree(FFstrbuf* strbuf, uint32_t free) {
|
||||
if (__builtin_expect(free == 0, false)) {
|
||||
if (__builtin_expect(!(strbuf->allocated == 0 && strbuf->length > 0), true)) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (__builtin_expect(ffStrbufGetFree(strbuf) >= free, true)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
ffStrbufEnsureFreeNoCheck(strbuf, free);
|
||||
}
|
||||
|
||||
|
||||
static inline void ffStrbufClear(FFstrbuf* strbuf) {
|
||||
assert(strbuf != NULL);
|
||||
extern char* CHAR_NULL_PTR;
|
||||
|
||||
if (strbuf->allocated == 0) {
|
||||
strbuf->chars = CHAR_NULL_PTR;
|
||||
} else {
|
||||
strbuf->chars[0] = '\0';
|
||||
}
|
||||
|
||||
strbuf->length = 0;
|
||||
}
|
||||
|
||||
static inline void ffStrbufAppendC(FFstrbuf* strbuf, char c) {
|
||||
ffStrbufEnsureFree(strbuf, 1);
|
||||
strbuf->chars[strbuf->length++] = c;
|
||||
strbuf->chars[strbuf->length] = '\0';
|
||||
}
|
||||
|
||||
static inline void ffStrbufAppendNC(FFstrbuf* strbuf, uint32_t num, char c) {
|
||||
if (__builtin_expect(num == 0, false)) {
|
||||
return;
|
||||
}
|
||||
ffStrbufEnsureFree(strbuf, num);
|
||||
|
||||
memset(&strbuf->chars[strbuf->length], c, num);
|
||||
strbuf->length += num;
|
||||
strbuf->chars[strbuf->length] = '\0';
|
||||
}
|
||||
|
||||
static inline void ffStrbufAppendNS(FFstrbuf* strbuf, uint32_t length, const char* value) {
|
||||
if (__builtin_expect(value == NULL || length == 0, false)) {
|
||||
return;
|
||||
}
|
||||
ffStrbufEnsureFree(strbuf, length);
|
||||
|
||||
memcpy(&strbuf->chars[strbuf->length], value, length);
|
||||
strbuf->length += length;
|
||||
strbuf->chars[strbuf->length] = '\0';
|
||||
}
|
||||
|
||||
static inline void ffStrbufAppend(FFstrbuf* __restrict strbuf, const FFstrbuf* __restrict value) {
|
||||
assert(value != strbuf);
|
||||
if (value == NULL) {
|
||||
return;
|
||||
}
|
||||
ffStrbufAppendNS(strbuf, value->length, value->chars);
|
||||
}
|
||||
|
||||
static inline void ffStrbufRecalculateLength(FFstrbuf* strbuf) {
|
||||
strbuf->length = (uint32_t) strlen(strbuf->chars);
|
||||
}
|
||||
@@ -338,14 +367,6 @@ FF_A_NODISCARD static inline FFstrbuf ffStrbufCreateS(const char* str) {
|
||||
return strbuf;
|
||||
}
|
||||
|
||||
static inline void ffStrbufAppend(FFstrbuf* __restrict strbuf, const FFstrbuf* __restrict value) {
|
||||
assert(value != strbuf);
|
||||
if (value == NULL) {
|
||||
return;
|
||||
}
|
||||
ffStrbufAppendNS(strbuf, value->length, value->chars);
|
||||
}
|
||||
|
||||
static inline void ffStrbufPrepend(FFstrbuf* strbuf, FFstrbuf* value) {
|
||||
if (value == NULL) {
|
||||
return;
|
||||
@@ -578,6 +599,33 @@ static inline bool ffStrbufSeparatedContainIgnCase(const FFstrbuf* strbuf, const
|
||||
return ffStrbufSeparatedContainIgnCaseNS(strbuf, comp->length, comp->chars, separator);
|
||||
}
|
||||
|
||||
static inline void ffStrbufWriteTo(const FFstrbuf* strbuf, FILE* file) {
|
||||
fwrite(strbuf->chars, sizeof(*strbuf->chars), strbuf->length, file);
|
||||
}
|
||||
|
||||
static inline void ffStrbufPutTo(const FFstrbuf* strbuf, FILE* file) {
|
||||
ffStrbufWriteTo(strbuf, file);
|
||||
fputc('\n', file);
|
||||
}
|
||||
|
||||
FF_A_NODISCARD static inline double ffStrbufToDouble(const FFstrbuf* strbuf, double defaultValue) {
|
||||
char* str_end;
|
||||
double result = strtod(strbuf->chars, &str_end);
|
||||
return str_end == strbuf->chars ? defaultValue : result;
|
||||
}
|
||||
|
||||
FF_A_NODISCARD static inline uint64_t ffStrbufToUInt(const FFstrbuf* strbuf, uint64_t defaultValue) {
|
||||
char* str_end;
|
||||
unsigned long long result = strtoull(strbuf->chars, &str_end, 10);
|
||||
return str_end == strbuf->chars ? defaultValue : (uint64_t) result;
|
||||
}
|
||||
|
||||
FF_A_NODISCARD static inline int64_t ffStrbufToSInt(const FFstrbuf* strbuf, int64_t defaultValue) {
|
||||
char* str_end;
|
||||
long long result = strtoll(strbuf->chars, &str_end, 10);
|
||||
return str_end == strbuf->chars ? defaultValue : (int64_t) result;
|
||||
}
|
||||
|
||||
// Returns true if the strbuf is modified
|
||||
bool ffStrbufDecodeHexEscapeSequences(FFstrbuf* strbuf);
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ bool ffGetAppNameAndVersion(const char* exePath, FFstrbuf* retName, FFstrbuf* re
|
||||
|
||||
lastSlash -= strlen("MacOS");
|
||||
char infoPlistPath[PATH_MAX];
|
||||
memcpy(infoPlistPath, exePath, lastSlash - exePath);
|
||||
memcpy(infoPlistPath, exePath, (size_t) (lastSlash - exePath));
|
||||
memcpy(infoPlistPath + (lastSlash - exePath), "Info.plist", sizeof("Info.plist")); // X.app/Contents/Info.plist
|
||||
NSError* error;
|
||||
NSDictionary* dict = [NSDictionary dictionaryWithContentsOfURL:[NSURL fileURLWithPath:@(infoPlistPath)]
|
||||
|
||||
@@ -236,54 +236,38 @@ static void getSystemPageSize(FFPlatformSysinfo* info) {
|
||||
}
|
||||
|
||||
static void getSystemArchitecture(FFPlatformSysinfo* info) {
|
||||
SYSTEM_PROCESSOR_INFORMATION spi;
|
||||
if (NT_SUCCESS(NtQuerySystemInformation(SystemProcessorInformation, &spi, sizeof(spi), NULL))) {
|
||||
switch (spi.ProcessorArchitecture) {
|
||||
case PROCESSOR_ARCHITECTURE_AMD64:
|
||||
ffStrbufSetStatic(&info->architecture, "x86_64");
|
||||
break;
|
||||
case PROCESSOR_ARCHITECTURE_IA64:
|
||||
ffStrbufSetStatic(&info->architecture, "ia64");
|
||||
break;
|
||||
case PROCESSOR_ARCHITECTURE_INTEL:
|
||||
switch (spi.ProcessorLevel) {
|
||||
case 4:
|
||||
ffStrbufSetStatic(&info->architecture, "i486");
|
||||
break;
|
||||
case 5:
|
||||
ffStrbufSetStatic(&info->architecture, "i586");
|
||||
break;
|
||||
case 6:
|
||||
ffStrbufSetStatic(&info->architecture, "i686");
|
||||
break;
|
||||
default:
|
||||
ffStrbufSetStatic(&info->architecture, "i386");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case PROCESSOR_ARCHITECTURE_ARM64:
|
||||
ffStrbufSetStatic(&info->architecture, "aarch64");
|
||||
break;
|
||||
case PROCESSOR_ARCHITECTURE_ARM:
|
||||
ffStrbufSetStatic(&info->architecture, "arm");
|
||||
break;
|
||||
case PROCESSOR_ARCHITECTURE_PPC:
|
||||
ffStrbufSetStatic(&info->architecture, "ppc");
|
||||
break;
|
||||
case PROCESSOR_ARCHITECTURE_MIPS:
|
||||
ffStrbufSetStatic(&info->architecture, "mips");
|
||||
break;
|
||||
case PROCESSOR_ARCHITECTURE_ALPHA:
|
||||
ffStrbufSetStatic(&info->architecture, "alpha");
|
||||
break;
|
||||
case PROCESSOR_ARCHITECTURE_ALPHA64:
|
||||
ffStrbufSetStatic(&info->architecture, "alpha64");
|
||||
break;
|
||||
case PROCESSOR_ARCHITECTURE_UNKNOWN:
|
||||
default:
|
||||
ffStrbufSetStatic(&info->architecture, "unknown");
|
||||
break;
|
||||
}
|
||||
switch (SharedUserData->NativeProcessorArchitecture) {
|
||||
case PROCESSOR_ARCHITECTURE_AMD64:
|
||||
ffStrbufSetStatic(&info->architecture, "x86_64");
|
||||
break;
|
||||
case PROCESSOR_ARCHITECTURE_IA64:
|
||||
ffStrbufSetStatic(&info->architecture, "ia64");
|
||||
break;
|
||||
case PROCESSOR_ARCHITECTURE_INTEL:
|
||||
ffStrbufSetStatic(&info->architecture, "i686");
|
||||
break;
|
||||
case PROCESSOR_ARCHITECTURE_ARM64:
|
||||
ffStrbufSetStatic(&info->architecture, "aarch64");
|
||||
break;
|
||||
case PROCESSOR_ARCHITECTURE_ARM:
|
||||
ffStrbufSetStatic(&info->architecture, "arm");
|
||||
break;
|
||||
case PROCESSOR_ARCHITECTURE_PPC:
|
||||
ffStrbufSetStatic(&info->architecture, "ppc");
|
||||
break;
|
||||
case PROCESSOR_ARCHITECTURE_MIPS:
|
||||
ffStrbufSetStatic(&info->architecture, "mips");
|
||||
break;
|
||||
case PROCESSOR_ARCHITECTURE_ALPHA:
|
||||
ffStrbufSetStatic(&info->architecture, "alpha");
|
||||
break;
|
||||
case PROCESSOR_ARCHITECTURE_ALPHA64:
|
||||
ffStrbufSetStatic(&info->architecture, "alpha64");
|
||||
break;
|
||||
case PROCESSOR_ARCHITECTURE_UNKNOWN:
|
||||
default:
|
||||
ffStrbufSetStatic(&info->architecture, "unknown");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,15 +3,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
void* ffListAdd(FFlist* list, uint32_t elementSize) {
|
||||
if (list->length == list->capacity) {
|
||||
ffListReserve(list, elementSize, list->capacity == 0 ? FF_LIST_DEFAULT_ALLOC : list->capacity * 2);
|
||||
}
|
||||
|
||||
++list->length;
|
||||
return ffListGet(list, elementSize, list->length - 1);
|
||||
}
|
||||
|
||||
bool ffListShift(FFlist* list, uint32_t elementSize, void* __restrict result) {
|
||||
if (list->length == 0) {
|
||||
return false;
|
||||
|
||||
+53
-83
@@ -1,6 +1,7 @@
|
||||
#include "common/FFstrbuf.h"
|
||||
#include "common/mallocHelper.h"
|
||||
#include "common/strutil.h"
|
||||
#include "common/debug.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <inttypes.h>
|
||||
@@ -45,18 +46,44 @@ void ffStrbufInitMoveNS(FFstrbuf* strbuf, uint32_t length, char* heapStr) {
|
||||
strbuf->chars = heapStr;
|
||||
}
|
||||
|
||||
void ffStrbufEnsureFree(FFstrbuf* strbuf, uint32_t free) {
|
||||
if (ffStrbufGetFree(strbuf) >= free && !(strbuf->allocated == 0 && strbuf->length > 0)) {
|
||||
return;
|
||||
void ffStrbufInitF(FFstrbuf* strbuf, const char* format, ...) {
|
||||
va_list arguments;
|
||||
va_start(arguments, format);
|
||||
ffStrbufInitVF(strbuf, format, arguments);
|
||||
va_end(arguments);
|
||||
}
|
||||
|
||||
FFstrbuf ffStrbufCreateF(const char* format, ...) {
|
||||
FFstrbuf strbuf;
|
||||
|
||||
va_list arguments;
|
||||
va_start(arguments, format);
|
||||
ffStrbufInitVF(&strbuf, format, arguments);
|
||||
va_end(arguments);
|
||||
|
||||
return strbuf;
|
||||
}
|
||||
|
||||
void ffStrbufEnsureFreeNoCheck(FFstrbuf* strbuf, uint32_t free) {
|
||||
uint32_t allocate;
|
||||
if (__builtin_expect(__builtin_uadd_overflow(strbuf->length, free, &allocate), false)) {
|
||||
FF_DEBUG("Error: Integer overflow when calculating allocation size. Aborting");
|
||||
abort();
|
||||
}
|
||||
|
||||
uint32_t allocate = strbuf->allocated;
|
||||
if (allocate < FASTFETCH_STRBUF_DEFAULT_ALLOC) {
|
||||
if (allocate < FASTFETCH_STRBUF_DEFAULT_ALLOC) { // `<` for null terminator
|
||||
allocate = FASTFETCH_STRBUF_DEFAULT_ALLOC;
|
||||
}
|
||||
} else {
|
||||
if (__builtin_expect(allocate > (UINT32_MAX >> 1), false)) {
|
||||
// User tried to allocate more than 2GB of memory, which exceeds the maximum size supported by FFstrbuf.
|
||||
// This is likely an error or an attempt to exploit the program. Abort to prevent potential issues.
|
||||
FF_DEBUG("Error: Attempted to allocate %" PRIu32 " bytes more than 2GB of memory in FFstrbuf. Aborting", allocate);
|
||||
abort();
|
||||
}
|
||||
|
||||
while ((strbuf->length + free + 1) > allocate) { // + 1 for the null byte
|
||||
allocate *= 2;
|
||||
// Round up to the next power of 2.
|
||||
// If the value is already a power of 2, it will be rounded up to the next power of 2.
|
||||
allocate = 1U << (32 - __builtin_clz(allocate));
|
||||
}
|
||||
|
||||
if (strbuf->allocated == 0) {
|
||||
@@ -76,16 +103,17 @@ void ffStrbufEnsureFree(FFstrbuf* strbuf, uint32_t free) {
|
||||
|
||||
// Ensure that at least `free` bytes are available in the buffer besides the current length
|
||||
// for an empty buffer, free + 1 length memory will be allocated(+1 for the NUL)
|
||||
// This function ensures a dynamic buffer is allocated even if free == 0
|
||||
void ffStrbufEnsureFixedLengthFree(FFstrbuf* strbuf, uint32_t free) {
|
||||
uint32_t oldFree = ffStrbufGetFree(strbuf);
|
||||
if (oldFree >= free && !(strbuf->allocated == 0 && strbuf->length > 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t newCap = strbuf->allocated + (free - oldFree);
|
||||
uint32_t newCap;
|
||||
|
||||
if (strbuf->allocated == 0) {
|
||||
newCap += strbuf->length + 1;
|
||||
assert(strbuf->length < UINT32_MAX - 1); // We don't use static strings with length >= UINT32_MAX - 1, so this should never happen
|
||||
if (__builtin_expect(__builtin_uadd_overflow(strbuf->length + 1, free, &newCap), false)) {
|
||||
FF_DEBUG("Error: Integer overflow when calculating new capacity. Aborting");
|
||||
abort();
|
||||
}
|
||||
|
||||
char* newbuf = malloc(sizeof(*strbuf->chars) * newCap);
|
||||
if (strbuf->length == 0) {
|
||||
*newbuf = '\0';
|
||||
@@ -94,52 +122,21 @@ void ffStrbufEnsureFixedLengthFree(FFstrbuf* strbuf, uint32_t free) {
|
||||
}
|
||||
strbuf->chars = newbuf;
|
||||
} else {
|
||||
uint32_t oldFree = ffStrbufGetFree(strbuf);
|
||||
if (oldFree >= free) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (__builtin_expect(__builtin_uadd_overflow(strbuf->allocated, free - oldFree, &newCap), false)) {
|
||||
FF_DEBUG("Error: Integer overflow when calculating new capacity. Aborting");
|
||||
abort();
|
||||
}
|
||||
strbuf->chars = realloc(strbuf->chars, sizeof(*strbuf->chars) * newCap);
|
||||
}
|
||||
|
||||
strbuf->allocated = newCap;
|
||||
}
|
||||
|
||||
void ffStrbufClear(FFstrbuf* strbuf) {
|
||||
assert(strbuf != NULL);
|
||||
|
||||
if (strbuf->allocated == 0) {
|
||||
strbuf->chars = CHAR_NULL_PTR;
|
||||
} else {
|
||||
strbuf->chars[0] = '\0';
|
||||
}
|
||||
|
||||
strbuf->length = 0;
|
||||
}
|
||||
|
||||
void ffStrbufAppendC(FFstrbuf* strbuf, char c) {
|
||||
ffStrbufEnsureFree(strbuf, 1);
|
||||
strbuf->chars[strbuf->length++] = c;
|
||||
strbuf->chars[strbuf->length] = '\0';
|
||||
}
|
||||
|
||||
void ffStrbufAppendNC(FFstrbuf* strbuf, uint32_t num, char c) {
|
||||
if (num == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
ffStrbufEnsureFree(strbuf, num);
|
||||
memset(&strbuf->chars[strbuf->length], c, num);
|
||||
strbuf->length += num;
|
||||
strbuf->chars[strbuf->length] = '\0';
|
||||
}
|
||||
|
||||
void ffStrbufAppendNS(FFstrbuf* strbuf, uint32_t length, const char* value) {
|
||||
if (value == NULL || length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
ffStrbufEnsureFree(strbuf, length);
|
||||
memcpy(&strbuf->chars[strbuf->length], value, length);
|
||||
strbuf->length += length;
|
||||
strbuf->chars[strbuf->length] = '\0';
|
||||
}
|
||||
|
||||
void ffStrbufAppendTransformS(FFstrbuf* strbuf, const char* value, int (*transformFunc)(int)) {
|
||||
if (value == NULL) {
|
||||
return;
|
||||
@@ -168,7 +165,7 @@ void ffStrbufAppendVF(FFstrbuf* strbuf, const char* format, va_list arguments) {
|
||||
int written = vsnprintf(strbuf->chars + strbuf->length, strbuf->allocated > 0 ? free + 1 : 0, format, arguments);
|
||||
|
||||
if (written > 0 && (uint32_t) written > free) {
|
||||
ffStrbufEnsureFree(strbuf, (uint32_t) written);
|
||||
ffStrbufEnsureFreeNoCheck(strbuf, (uint32_t) written);
|
||||
written = vsnprintf(strbuf->chars + strbuf->length, (uint32_t) written + 1, format, copy);
|
||||
}
|
||||
|
||||
@@ -550,33 +547,6 @@ bool ffStrbufEnsureEndsWithC(FFstrbuf* strbuf, char c) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void ffStrbufWriteTo(const FFstrbuf* strbuf, FILE* file) {
|
||||
fwrite(strbuf->chars, sizeof(*strbuf->chars), strbuf->length, file);
|
||||
}
|
||||
|
||||
void ffStrbufPutTo(const FFstrbuf* strbuf, FILE* file) {
|
||||
ffStrbufWriteTo(strbuf, file);
|
||||
fputc('\n', file);
|
||||
}
|
||||
|
||||
double ffStrbufToDouble(const FFstrbuf* strbuf, double defaultValue) {
|
||||
char* str_end;
|
||||
double result = strtod(strbuf->chars, &str_end);
|
||||
return str_end == strbuf->chars ? defaultValue : result;
|
||||
}
|
||||
|
||||
uint64_t ffStrbufToUInt(const FFstrbuf* strbuf, uint64_t defaultValue) {
|
||||
char* str_end;
|
||||
unsigned long long result = strtoull(strbuf->chars, &str_end, 10);
|
||||
return str_end == strbuf->chars ? defaultValue : (uint64_t) result;
|
||||
}
|
||||
|
||||
int64_t ffStrbufToSInt(const FFstrbuf* strbuf, int64_t defaultValue) {
|
||||
char* str_end;
|
||||
long long result = strtoll(strbuf->chars, &str_end, 10);
|
||||
return str_end == strbuf->chars ? defaultValue : (int64_t) result;
|
||||
}
|
||||
|
||||
void ffStrbufAppendSInt(FFstrbuf* strbuf, int64_t value) {
|
||||
ffStrbufEnsureFree(strbuf, 21); // Required by yyjson_write_number
|
||||
char* start = strbuf->chars + strbuf->length;
|
||||
|
||||
@@ -6,7 +6,13 @@ void ffBase64EncodeRaw(uint32_t size, const char* str, uint32_t* out_size, char*
|
||||
char* out = output;
|
||||
const char* ends = str + (size - size % 3);
|
||||
while (str != ends) {
|
||||
uint32_t n = __builtin_bswap32(*(uint32_t*) str);
|
||||
uint32_t n = *(uint32_t*) str;
|
||||
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
// The 3 input bytes must be laid out big-endian (str[0] in the most
|
||||
// significant position). On little-endian hosts swap; on big-endian
|
||||
// hosts the word is already in the right order.
|
||||
n = __builtin_bswap32(n);
|
||||
#endif
|
||||
*out++ = chars[(n >> 26) & 63];
|
||||
*out++ = chars[(n >> 20) & 63];
|
||||
*out++ = chars[(n >> 14) & 63];
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <ctype.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdalign.h>
|
||||
|
||||
bool ffParseModuleOptions(const char* key, const char* value) {
|
||||
if (!ffStrStartsWith(key, "--") || !ffCharIsEnglishAlphabet(key[2])) {
|
||||
@@ -175,7 +176,7 @@ static bool parseStructureCommand(
|
||||
for (FFModuleBaseInfo** modules = ffModuleInfos[toupper(line[0]) - 'A']; *modules; ++modules) {
|
||||
FFModuleBaseInfo* baseInfo = *modules;
|
||||
if (ffStrEqualsIgnCase(line, baseInfo->name)) {
|
||||
uint8_t optionBuf[FF_OPTION_MAX_SIZE];
|
||||
alignas(uint64_t) uint8_t optionBuf[FF_OPTION_MAX_SIZE];
|
||||
baseInfo->initOptions(optionBuf);
|
||||
if (data->resultDoc != NULL) {
|
||||
fn(data, baseInfo, optionBuf);
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "common/textModifier.h"
|
||||
#include "common/strutil.h"
|
||||
#include "detection/displayserver/displayserver.h"
|
||||
#include "detection/terminaltheme/terminaltheme.h"
|
||||
#include "logo/logo.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
@@ -27,21 +26,10 @@ static void initState(FFstate* state) {
|
||||
state->logoWidth = 0;
|
||||
state->logoHeight = 0;
|
||||
state->keysHeight = 0;
|
||||
state->terminalLightTheme = false;
|
||||
state->titleFqdn = false;
|
||||
|
||||
ffPlatformInit(&state->platform);
|
||||
state->dynamicInterval = 0;
|
||||
|
||||
#if !FF_MODULE_DISABLE_TERMINALTHEME
|
||||
{
|
||||
// don't enable bright color if the terminal is in light mode
|
||||
FFTerminalThemeResult result;
|
||||
if (ffDetectTerminalTheme(&result, true /* forceEnv for performance */) && !result.bg.dark) {
|
||||
state->terminalLightTheme = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void defaultConfig(void) {
|
||||
|
||||
@@ -177,7 +177,7 @@ bool ffWriteFileData(const char* fileName, size_t dataSize, const void* data) {
|
||||
}
|
||||
|
||||
static inline void readWithLength(HANDLE handle, FFstrbuf* buffer, uint32_t length) {
|
||||
ffStrbufEnsureFree(buffer, length);
|
||||
ffStrbufEnsureFixedLengthFree(buffer, length);
|
||||
DWORD bytesRead = 0;
|
||||
while (
|
||||
length > 0 &&
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdalign.h>
|
||||
|
||||
bool ffJsonConfigParseModuleArgs(yyjson_val* key, yyjson_val* val, FFModuleArgs* moduleArgs) {
|
||||
if (unsafe_yyjson_equals_str(key, "type") || unsafe_yyjson_equals_str(key, "condition")) {
|
||||
@@ -95,7 +96,7 @@ static bool parseModuleJsonObject(const char* type, yyjson_val* jsonVal, yyjson_
|
||||
for (FFModuleBaseInfo** modules = ffModuleInfos[toupper(type[0]) - 'A']; *modules; ++modules) {
|
||||
FFModuleBaseInfo* baseInfo = *modules;
|
||||
if (ffStrEqualsIgnCase(type, baseInfo->name)) {
|
||||
uint8_t optionBuf[FF_OPTION_MAX_SIZE];
|
||||
alignas(uint64_t) uint8_t optionBuf[FF_OPTION_MAX_SIZE];
|
||||
baseInfo->initOptions(optionBuf);
|
||||
if (jsonVal) {
|
||||
baseInfo->parseJsonObject(optionBuf, jsonVal);
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static void* libraryLoad(const char* path, int maxVersion) {
|
||||
void* ffLibraryLoadSingle(const char* path, int maxVersion) {
|
||||
void* result = dlopen(path, FF_DLOPEN_FLAGS);
|
||||
|
||||
#if _WIN32
|
||||
@@ -81,8 +81,8 @@ static void* libraryLoad(const char* path, int maxVersion) {
|
||||
return result;
|
||||
}
|
||||
|
||||
void* ffLibraryLoad(const char* path, int maxVersion, ...) {
|
||||
void* result = libraryLoad(path, maxVersion);
|
||||
void* ffLibraryLoadMulti(const char* path, int maxVersion, ...) {
|
||||
void* result = ffLibraryLoadSingle(path, maxVersion);
|
||||
|
||||
if (!result) {
|
||||
va_list defaultNames;
|
||||
@@ -95,7 +95,7 @@ void* ffLibraryLoad(const char* path, int maxVersion, ...) {
|
||||
}
|
||||
|
||||
int maxVersionRest = va_arg(defaultNames, int);
|
||||
result = libraryLoad(pathRest, maxVersionRest);
|
||||
result = ffLibraryLoadSingle(pathRest, maxVersionRest);
|
||||
} while (!result);
|
||||
|
||||
va_end(defaultNames);
|
||||
|
||||
@@ -457,6 +457,13 @@ const char* ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buf
|
||||
if (clHeader) {
|
||||
contentLength = (uint32_t) strtoul(clHeader + 15, NULL, 10);
|
||||
if (contentLength > 0) {
|
||||
if (contentLength > 1024 * 1024) { // 1MB limit to prevent excessive memory allocation and potential attacks
|
||||
FF_DEBUG("Content-Length is too large: %u bytes, aborting", contentLength);
|
||||
close(state->sockfd);
|
||||
state->sockfd = -1;
|
||||
return "Content-Length too large";
|
||||
}
|
||||
|
||||
FF_DEBUG("Detected Content-Length: %u, pre-allocating buffer", contentLength);
|
||||
// Ensure buffer is large enough, adding header size and some margin
|
||||
ffStrbufEnsureFree(buffer, contentLength + 16);
|
||||
@@ -481,7 +488,7 @@ const char* ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buf
|
||||
return "No HTTP header end found";
|
||||
}
|
||||
|
||||
if (!ffStrbufStartsWithS(buffer, "HTTP/1.0 200 OK\r\n")) {
|
||||
if (!ffStrbufStartsWithS(buffer, "HTTP/1.0 200 OK\r\n") && !ffStrbufStartsWithS(buffer, "HTTP/1.1 200 OK\r\n")) {
|
||||
FF_DEBUG("Invalid response: %.40s...", buffer->chars);
|
||||
return "Invalid response";
|
||||
}
|
||||
|
||||
@@ -322,6 +322,13 @@ const char* ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buf
|
||||
if (clHeader) {
|
||||
contentLength = (uint32_t) strtoul(clHeader + 15, NULL, 10);
|
||||
if (contentLength > 0) {
|
||||
if (contentLength > 1024 * 1024) { // 1MB limit to prevent excessive memory allocation and potential attacks
|
||||
FF_DEBUG("Content-Length is too large: %u bytes, aborting", contentLength);
|
||||
closesocket(state->sockfd);
|
||||
state->sockfd = INVALID_SOCKET;
|
||||
return "Content-Length too large";
|
||||
}
|
||||
|
||||
FF_DEBUG("Detected Content-Length: %u, pre-allocating buffer", contentLength);
|
||||
// Ensure buffer is large enough, adding header size and some margin
|
||||
ffStrbufEnsureFree(buffer, contentLength + 16);
|
||||
@@ -346,7 +353,7 @@ const char* ffNetworkingRecvHttpResponse(FFNetworkingState* state, FFstrbuf* buf
|
||||
return "No HTTP header end found";
|
||||
}
|
||||
|
||||
if (!ffStrbufStartsWithS(buffer, "HTTP/1.0 200 OK\r\n")) {
|
||||
if (!ffStrbufStartsWithS(buffer, "HTTP/1.0 200 OK\r\n") && !ffStrbufStartsWithS(buffer, "HTTP/1.1 200 OK\r\n")) {
|
||||
FF_DEBUG("Invalid response: %.40s...", buffer->chars);
|
||||
return "Invalid response";
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "common/sysctl.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdalign.h>
|
||||
|
||||
#ifdef __OpenBSD__
|
||||
const char* ffSysctlGetString(int mib1, int mib2, FFstrbuf* result) {
|
||||
@@ -22,21 +23,41 @@ const char* ffSysctlGetString(int mib1, int mib2, FFstrbuf* result) {
|
||||
}
|
||||
|
||||
int ffSysctlGetInt(int mib1, int mib2, int defaultValue) {
|
||||
int result;
|
||||
alignas(int) uint8_t result[sizeof(int)];
|
||||
size_t neededLength = sizeof(result);
|
||||
if (sysctl((int[]) { mib1, mib2 }, 2, &result, &neededLength, NULL, 0) != 0) {
|
||||
return defaultValue;
|
||||
}
|
||||
return result;
|
||||
switch (neededLength) {
|
||||
case sizeof(int32_t):
|
||||
return *(int32_t*)result;
|
||||
case sizeof(int16_t):
|
||||
return *(int16_t*)result;
|
||||
case sizeof(int8_t):
|
||||
return *(int8_t*)result;
|
||||
default:
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
int64_t ffSysctlGetInt64(int mib1, int mib2, int64_t defaultValue) {
|
||||
int64_t result;
|
||||
alignas(int64_t) uint8_t result[sizeof(int64_t)];
|
||||
size_t neededLength = sizeof(result);
|
||||
if (sysctl((int[]) { mib1, mib2 }, 2, &result, &neededLength, NULL, 0) != 0) {
|
||||
return defaultValue;
|
||||
}
|
||||
return result;
|
||||
switch (neededLength) {
|
||||
case sizeof(int64_t):
|
||||
return *(int64_t*)result;
|
||||
case sizeof(int32_t):
|
||||
return *(int32_t*)result;
|
||||
case sizeof(int16_t):
|
||||
return *(int16_t*)result;
|
||||
case sizeof(int8_t):
|
||||
return *(int8_t*)result;
|
||||
default:
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
#else
|
||||
const char* ffSysctlGetString(const char* propName, FFstrbuf* result) {
|
||||
@@ -59,21 +80,41 @@ const char* ffSysctlGetString(const char* propName, FFstrbuf* result) {
|
||||
}
|
||||
|
||||
int ffSysctlGetInt(const char* propName, int defaultValue) {
|
||||
int result;
|
||||
alignas(int) uint8_t result[sizeof(int)];
|
||||
size_t neededLength = sizeof(result);
|
||||
if (sysctlbyname(propName, &result, &neededLength, NULL, 0) != 0) {
|
||||
return defaultValue;
|
||||
}
|
||||
return result;
|
||||
switch (neededLength) {
|
||||
case sizeof(int32_t):
|
||||
return *(int32_t*)result;
|
||||
case sizeof(int16_t):
|
||||
return *(int16_t*)result;
|
||||
case sizeof(int8_t):
|
||||
return *(int8_t*)result;
|
||||
default:
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
int64_t ffSysctlGetInt64(const char* propName, int64_t defaultValue) {
|
||||
int64_t result;
|
||||
alignas(int64_t) uint8_t result[sizeof(int64_t)];
|
||||
size_t neededLength = sizeof(result);
|
||||
if (sysctlbyname(propName, &result, &neededLength, NULL, 0) != 0) {
|
||||
return defaultValue;
|
||||
}
|
||||
return result;
|
||||
switch (neededLength) {
|
||||
case sizeof(int64_t):
|
||||
return *(int64_t*)result;
|
||||
case sizeof(int32_t):
|
||||
return *(int32_t*)result;
|
||||
case sizeof(int16_t):
|
||||
return *(int16_t*)result;
|
||||
case sizeof(int8_t):
|
||||
return *(int8_t*)result;
|
||||
default:
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
#endif // OpenBSD
|
||||
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
// DON'T CALL ANY FASTFETCH FUNCTION IN THIS FILE (to avoid recursion when -finstrument-functions is enabled)
|
||||
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <stdatomic.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#if !_WIN32
|
||||
#include <dlfcn.h>
|
||||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
#else
|
||||
#include <windows.h>
|
||||
#include <dbghelp.h>
|
||||
#endif
|
||||
|
||||
#if _WIN32
|
||||
static LARGE_INTEGER freq;
|
||||
#define NtCurrentProcess() ((HANDLE) (-1))
|
||||
#endif
|
||||
|
||||
static struct trace_event {
|
||||
uint64_t ts;
|
||||
uint64_t tid;
|
||||
void* func;
|
||||
} events[4 * 1024 * 1024]; // 4M events, 96 MiB memory usage
|
||||
static _Atomic uint32_t event_count;
|
||||
|
||||
__attribute__((no_instrument_function, always_inline)) static inline uint64_t get_time_us() {
|
||||
#if !_WIN32
|
||||
struct timespec ts;
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
return (uint64_t) (ts.tv_sec * 1000000 + ts.tv_nsec / 1000);
|
||||
#else
|
||||
LARGE_INTEGER now;
|
||||
QueryPerformanceCounter(&now);
|
||||
return (uint64_t) (now.QuadPart * 1000000 / freq.QuadPart);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if _WIN32
|
||||
__attribute__((constructor, no_instrument_function)) void trace_init() {
|
||||
QueryPerformanceFrequency(&freq);
|
||||
}
|
||||
#endif
|
||||
|
||||
__attribute__((destructor, no_instrument_function)) void trace_fini() {
|
||||
#if _WIN32
|
||||
uint32_t pid = (uint32_t) GetCurrentProcessId();
|
||||
#else
|
||||
uint32_t pid = (uint32_t) getpid();
|
||||
#endif
|
||||
|
||||
char fileName[64];
|
||||
snprintf(fileName, sizeof(fileName), "trace_%d.json", pid);
|
||||
FILE* trace_file = fopen(fileName, "wb");
|
||||
if (!trace_file) {
|
||||
fprintf(stderr, "Failed to open trace file %s for writing\n", fileName);
|
||||
abort();
|
||||
}
|
||||
|
||||
fputs("[\n", trace_file);
|
||||
|
||||
#if _WIN32
|
||||
SymSetOptions(SYMOPT_DEFERRED_LOADS | SYMOPT_UNDNAME);
|
||||
SymInitialize(NtCurrentProcess(), NULL, TRUE);
|
||||
#endif
|
||||
|
||||
const char* fnName = NULL;
|
||||
|
||||
uint32_t count = atomic_load_explicit(&event_count, memory_order_acquire);
|
||||
for (uint32_t i = 0; i < count; ++i) {
|
||||
void* fn = events[i].func;
|
||||
uint64_t ts = events[i].ts;
|
||||
bool is_exit = (ts >> 63) != 0;
|
||||
ts &= ~(1ULL << 63); // clear the highest bit
|
||||
uint64_t tid = events[i].tid;
|
||||
|
||||
#if _WIN32
|
||||
char buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME * sizeof(TCHAR)];
|
||||
PSYMBOL_INFO pSymbol = (PSYMBOL_INFO) buffer;
|
||||
pSymbol->SizeOfStruct = sizeof(SYMBOL_INFO);
|
||||
pSymbol->MaxNameLen = MAX_SYM_NAME;
|
||||
|
||||
DWORD64 displacement = 0;
|
||||
if (SymFromAddr(NtCurrentProcess(), (DWORD64) fn, &displacement, pSymbol)) {
|
||||
fnName = pSymbol->Name;
|
||||
}
|
||||
#else
|
||||
char buffer[32];
|
||||
Dl_info info;
|
||||
if (dladdr(fn, &info) && info.dli_sname) {
|
||||
fnName = info.dli_sname;
|
||||
}
|
||||
#endif
|
||||
|
||||
else {
|
||||
snprintf(buffer, sizeof(buffer), "%p", fn);
|
||||
fnName = buffer;
|
||||
}
|
||||
|
||||
fprintf(trace_file, "{\"name\":\"%s\",\"ph\":\"%c\",\"pid\":%" PRIu32 ",\"tid\":%" PRIu64 ",\"ts\":%" PRIu64 "}%c\n", fnName, is_exit ? 'E' : 'B', pid, tid, ts, i < count - 1 ? ',' : ' ');
|
||||
}
|
||||
|
||||
fputc(']', trace_file);
|
||||
fclose(trace_file);
|
||||
fprintf(stderr, "Trace written to trace_%d.json with %u events. Use https://ui.perfetto.dev/ to view it.\n", pid, count);
|
||||
|
||||
#if _WIN32
|
||||
SymCleanup(NtCurrentProcess());
|
||||
#endif
|
||||
}
|
||||
|
||||
__attribute__((no_instrument_function)) static void write_event(void* this_fn, bool is_exit) {
|
||||
uint32_t idx = atomic_fetch_add_explicit(&event_count, 1, memory_order_relaxed);
|
||||
if (__builtin_expect(idx >= sizeof(events) / sizeof(events[0]), false)) {
|
||||
abort();
|
||||
}
|
||||
|
||||
events[idx].ts = get_time_us();
|
||||
#if ENABLE_THREADS
|
||||
#if _WIN32
|
||||
events[idx].tid = (uint64_t) GetCurrentThreadId();
|
||||
#else
|
||||
events[idx].tid = (uint64_t) (uintptr_t) pthread_self();
|
||||
#endif
|
||||
#else
|
||||
events[idx].tid = 0;
|
||||
#endif
|
||||
events[idx].func = this_fn;
|
||||
if (is_exit) {
|
||||
events[idx].ts |= (1ULL << 63); // set the highest bit to indicate function exit
|
||||
}
|
||||
}
|
||||
|
||||
__attribute__((no_instrument_function)) void __cyg_profile_func_enter(void* this_fn, void* call_site) {
|
||||
(void) call_site;
|
||||
write_event(this_fn, false);
|
||||
}
|
||||
|
||||
__attribute__((no_instrument_function)) void __cyg_profile_func_exit(void* this_fn, void* call_site) {
|
||||
(void) call_site;
|
||||
write_event(this_fn, true);
|
||||
}
|
||||
@@ -35,9 +35,10 @@ static inline void ffLibraryUnload(void** handle) {
|
||||
#define FF_LIBRARY_SYMBOL(symbolName) \
|
||||
__typeof__(&symbolName) ff##symbolName;
|
||||
|
||||
#define FF_LIBRARY_LOAD(libraryObjectName, returnValue, ...) \
|
||||
void* FF_A_CLEANUP(ffLibraryUnload) libraryObjectName = ffLibraryLoad(__VA_ARGS__, NULL); \
|
||||
if (libraryObjectName == NULL) \
|
||||
#define FF_LIBRARY_LOAD(libraryObjectName, returnValue, libraryFileName, maxVersion, ...) \
|
||||
void* FF_A_CLEANUP(ffLibraryUnload) libraryObjectName = ffLibraryLoadSingle(libraryFileName, maxVersion); \
|
||||
__VA_OPT__(if (__builtin_expect(libraryObjectName == NULL, false)) libraryObjectName = ffLibraryLoadMulti(__VA_ARGS__, NULL);) \
|
||||
if (__builtin_expect(libraryObjectName == NULL, false)) \
|
||||
return returnValue;
|
||||
|
||||
#define FF_LIBRARY_LOAD_MESSAGE(libraryObjectName, libraryFileName, maxVersion, ...) \
|
||||
@@ -45,7 +46,7 @@ static inline void ffLibraryUnload(void** handle) {
|
||||
|
||||
#define FF_LIBRARY_LOAD_SYMBOL_ADDRESS(library, symbolMapping, symbolName, returnValue) \
|
||||
symbolMapping = (__typeof__(&symbolName)) dlsym(library, #symbolName); \
|
||||
if (symbolMapping == NULL) \
|
||||
if (__builtin_expect(symbolMapping == NULL, false)) \
|
||||
return returnValue;
|
||||
|
||||
#define FF_LIBRARY_LOAD_SYMBOL(library, symbolName, returnValue) \
|
||||
@@ -66,7 +67,8 @@ static inline void ffLibraryUnload(void** handle) {
|
||||
#define FF_LIBRARY_LOAD_SYMBOL_PTR(library, varName, symbolName, returnValue) \
|
||||
FF_LIBRARY_LOAD_SYMBOL_ADDRESS(library, (varName)->ff##symbolName, symbolName, returnValue);
|
||||
|
||||
void* ffLibraryLoad(const char* path, int maxVersion, ...);
|
||||
void* ffLibraryLoadSingle(const char* path, int maxVersion);
|
||||
void* ffLibraryLoadMulti(const char* path, int maxVersion, ...);
|
||||
|
||||
#else
|
||||
|
||||
|
||||
+7
-1
@@ -4,7 +4,7 @@
|
||||
|
||||
#ifdef FF_HAVE_THREADS
|
||||
#if defined(_WIN32)
|
||||
#include <winternl.h>
|
||||
#include "common/windows/nt.h"
|
||||
#include <synchapi.h>
|
||||
#include <process.h>
|
||||
#include <processthreadsapi.h>
|
||||
@@ -41,6 +41,9 @@ static inline bool ffThreadJoin(FFThreadType thread, uint32_t timeout) {
|
||||
}
|
||||
NtClose(thread);
|
||||
return true;
|
||||
}
|
||||
static inline uintptr_t ffThreadGetCurrentId() {
|
||||
return (uintptr_t) ffGetTeb()->ClientId.UniqueThread;
|
||||
}
|
||||
#else
|
||||
#include <pthread.h>
|
||||
@@ -104,6 +107,9 @@ static inline bool ffThreadJoin(FFThreadType thread, FF_A_UNUSED uint32_t timeou
|
||||
#endif
|
||||
pthread_join(thread, NULL);
|
||||
return true;
|
||||
}
|
||||
static inline uintptr_t ffThreadGetCurrentId() {
|
||||
return (uintptr_t) pthread_self();
|
||||
}
|
||||
#endif
|
||||
#else // FF_HAVE_THREADS
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
#include <VideoToolbox/VideoToolbox.h>
|
||||
#include "common/apple/cf_helpers.h"
|
||||
|
||||
#ifdef MAC_OS_VERSION_11_0
|
||||
[[clang::weak_import]] VT_EXPORT void VTRegisterSupplementalVideoDecoderIfAvailable(CMVideoCodecType codecType);
|
||||
#endif
|
||||
|
||||
static const struct {
|
||||
CMVideoCodecType codec;
|
||||
FFCodecType type;
|
||||
@@ -41,7 +45,7 @@ static FFCodecType ffCodecCodecToType(CMVideoCodecType codec) {
|
||||
}
|
||||
|
||||
static FFCodecType ffCodecDetectEncoders(void) {
|
||||
CFArrayRef encoderList = NULL;
|
||||
FF_CFTYPE_AUTO_RELEASE CFArrayRef encoderList = NULL;
|
||||
if (VTCopyVideoEncoderList(NULL, &encoderList) != noErr || !encoderList) {
|
||||
return FF_CODEC_TYPE_NONE;
|
||||
}
|
||||
@@ -65,16 +69,22 @@ static FFCodecType ffCodecDetectEncoders(void) {
|
||||
static FFCodecType ffCodecDetectDecoders() {
|
||||
FFCodecType types = FF_CODEC_TYPE_NONE;
|
||||
for (uint32_t i = 0; i < ARRAY_SIZE(FF_CODEC_CODECS); ++i) {
|
||||
if (types & FF_CODEC_CODECS[i].type) {
|
||||
__auto_type codec = FF_CODEC_CODECS[i];
|
||||
if (types & codec.type) {
|
||||
continue;
|
||||
}
|
||||
|
||||
bool supported = VTIsHardwareDecodeSupported(FF_CODEC_CODECS[i].codec);
|
||||
#ifdef MAC_OS_VERSION_11_0
|
||||
if (VTRegisterSupplementalVideoDecoderIfAvailable) {
|
||||
VTRegisterSupplementalVideoDecoderIfAvailable(codec.codec);
|
||||
}
|
||||
#endif
|
||||
bool supported = VTIsHardwareDecodeSupported(codec.codec);
|
||||
if (!supported) {
|
||||
continue;
|
||||
}
|
||||
|
||||
types |= FF_CODEC_CODECS[i].type;
|
||||
types |= codec.type;
|
||||
}
|
||||
|
||||
return types;
|
||||
|
||||
@@ -65,7 +65,7 @@ static const char* detectFrequency(FFCPUResult* cpu) {
|
||||
// voltage-states5-sram stores supported <frequency / voltage> pairs of pcores from the lowest to the highest
|
||||
// voltage-states1-sram stores ecores'
|
||||
CFIndex propLength = CFDataGetLength(freqProperty);
|
||||
if (propLength == 0 || propLength % (CFIndex) sizeof(uint32_t) * 2 != 0) {
|
||||
if (propLength == 0 || propLength % (CFIndex) (sizeof(uint32_t) * 2) != 0) {
|
||||
return "Invalid \"voltage-states5-sram\" length";
|
||||
}
|
||||
|
||||
|
||||
@@ -461,7 +461,6 @@ static void detectArmName(FFstrbuf* cpuinfo, FFCPUResult* cpu, uint32_t implId)
|
||||
char* line = NULL;
|
||||
size_t len = 0;
|
||||
uint32_t lastPartId = UINT32_MAX;
|
||||
uint32_t num = 0;
|
||||
while (ffStrbufGetline(&line, &len, cpuinfo)) {
|
||||
if (!ffStrStartsWith(line, "CPU part\t: ")) {
|
||||
continue;
|
||||
@@ -529,10 +528,7 @@ static void detectArmName(FFstrbuf* cpuinfo, FFCPUResult* cpu, uint32_t implId)
|
||||
}
|
||||
if (lastPartId != partId) {
|
||||
if (lastPartId != UINT32_MAX) {
|
||||
if (num > 1) {
|
||||
ffStrbufAppendF(&cpu->name, "*%u", num);
|
||||
}
|
||||
ffStrbufAppendS(&cpu->name, " + ");
|
||||
ffStrbufAppendC(&cpu->name, '+');
|
||||
}
|
||||
if (name) {
|
||||
ffStrbufAppendS(&cpu->name, name);
|
||||
@@ -542,14 +538,8 @@ static void detectArmName(FFstrbuf* cpuinfo, FFCPUResult* cpu, uint32_t implId)
|
||||
ffStrbufAppend(&cpu->name, &cpu->vendor);
|
||||
}
|
||||
lastPartId = partId;
|
||||
num = 1;
|
||||
} else {
|
||||
++num;
|
||||
}
|
||||
}
|
||||
if (num > 1) {
|
||||
ffStrbufAppendF(&cpu->name, "*%u", num);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -72,8 +72,7 @@ const char* ffDetectDiskIO(FFlist* result, FFDiskIOOptions* options) {
|
||||
uint64_t* prevValue = (uint64_t*) ((uint8_t*) icPrev + off);
|
||||
uint64_t* currValue = (uint64_t*) ((uint8_t*) icCurr + off);
|
||||
uint64_t temp = *currValue;
|
||||
*currValue -= *prevValue;
|
||||
*currValue /= (time2 - time1) / 1000 /* seconds */;
|
||||
*currValue = (*currValue - *prevValue) * 1000 / (time2 - time1); // Calculate per second
|
||||
|
||||
// For next function call
|
||||
*prevValue = temp;
|
||||
|
||||
@@ -54,7 +54,7 @@ static void handleXdgLogicalSize(void* data, FF_A_UNUSED struct zxdg_output_v1*
|
||||
static void* outputListener[] = {
|
||||
waylandOutputGeometryListener, // geometry
|
||||
waylandOutputModeListener, // mode
|
||||
stubListener, // done
|
||||
ffWaylandStubListener, // done
|
||||
waylandOutputScaleListener, // scale
|
||||
ffWaylandOutputNameListener, // name
|
||||
ffWaylandOutputDescriptionListener, // description
|
||||
@@ -64,9 +64,9 @@ static_assert(
|
||||
"sizeof(outputListener) is too small. Please report it to fastfetch github issue");
|
||||
|
||||
static struct zxdg_output_v1_listener zxdgOutputListener = {
|
||||
.logical_position = (void*) stubListener,
|
||||
.logical_position = (void*) ffWaylandStubListener,
|
||||
.logical_size = handleXdgLogicalSize,
|
||||
.done = (void*) stubListener,
|
||||
.done = (void*) ffWaylandStubListener,
|
||||
.name = (void*) ffWaylandOutputNameListener,
|
||||
.description = (void*) ffWaylandOutputDescriptionListener,
|
||||
};
|
||||
@@ -84,17 +84,17 @@ static void handleWpTfNamed(void *data, FF_A_UNUSED struct wp_image_description_
|
||||
}
|
||||
|
||||
static const struct wp_image_description_info_v1_listener wpImageDescInfoListener = {
|
||||
.done = (void*) stubListener,
|
||||
.icc_file = (void*) stubListener,
|
||||
.primaries = (void*) stubListener,
|
||||
.primaries_named = (void*) stubListener,
|
||||
.tf_power = (void*) stubListener,
|
||||
.done = (void*) ffWaylandStubListener,
|
||||
.icc_file = (void*) ffWaylandStubListener,
|
||||
.primaries = (void*) ffWaylandStubListener,
|
||||
.primaries_named = (void*) ffWaylandStubListener,
|
||||
.tf_power = (void*) ffWaylandStubListener,
|
||||
.tf_named = (void*) handleWpTfNamed,
|
||||
.luminances = (void*) stubListener,
|
||||
.target_primaries = (void*) stubListener,
|
||||
.target_luminance = (void*) stubListener,
|
||||
.target_max_cll = (void*) stubListener,
|
||||
.target_max_fall = (void*) stubListener,
|
||||
.luminances = (void*) ffWaylandStubListener,
|
||||
.target_primaries = (void*) ffWaylandStubListener,
|
||||
.target_luminance = (void*) ffWaylandStubListener,
|
||||
.target_max_cll = (void*) ffWaylandStubListener,
|
||||
.target_max_fall = (void*) ffWaylandStubListener,
|
||||
};
|
||||
|
||||
const char* ffWaylandHandleGlobalOutput(WaylandData* wldata, struct wl_registry* registry, uint32_t name, uint32_t version) {
|
||||
|
||||
@@ -33,8 +33,8 @@ static const struct kde_output_device_mode_v2_listener modeListener = {
|
||||
.size = waylandKdeModeSizeListener,
|
||||
.refresh = waylandKdeModeRefreshListener,
|
||||
.preferred = waylandKdeModePreferredListener,
|
||||
.removed = (void*) stubListener,
|
||||
.flags = (void*) stubListener,
|
||||
.removed = (void*) ffWaylandStubListener,
|
||||
.flags = (void*) ffWaylandStubListener,
|
||||
};
|
||||
|
||||
static void waylandKdeModeListener(void* data, FF_A_UNUSED struct kde_output_device_v2* _, struct kde_output_device_mode_v2* mode) {
|
||||
@@ -57,23 +57,22 @@ static void waylandKdeCurrentModeListener(void* data, FF_A_UNUSED struct kde_out
|
||||
return;
|
||||
}
|
||||
|
||||
int set = 0;
|
||||
bool foundCurrent = false, foundPreferred = false;
|
||||
FF_LIST_FOR_EACH (WaylandKdeMode, m, *(FFlist*) wldata->internal) {
|
||||
if (m->pMode == mode) {
|
||||
if (!foundCurrent && m->pMode == mode) {
|
||||
wldata->width = m->width;
|
||||
wldata->height = m->height;
|
||||
wldata->refreshRate = m->refreshRate;
|
||||
if (++set == 2) {
|
||||
break;
|
||||
}
|
||||
foundCurrent = true;
|
||||
}
|
||||
if (m->preferred) {
|
||||
if (!foundPreferred && m->preferred) {
|
||||
wldata->preferredWidth = m->width;
|
||||
wldata->preferredHeight = m->height;
|
||||
wldata->preferredRefreshRate = m->refreshRate;
|
||||
if (++set == 2) {
|
||||
break;
|
||||
}
|
||||
foundPreferred = true;
|
||||
}
|
||||
if (foundCurrent && foundPreferred) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -151,43 +150,43 @@ static struct kde_output_device_v2_listener outputListener = {
|
||||
.geometry = waylandKdeGeometryListener,
|
||||
.current_mode = waylandKdeCurrentModeListener,
|
||||
.mode = waylandKdeModeListener,
|
||||
.done = (void*) stubListener,
|
||||
.done = (void*) ffWaylandStubListener,
|
||||
.scale = waylandKdeScaleListener,
|
||||
.edid = waylandKdeEdidListener,
|
||||
.enabled = waylandKdeEnabledListener,
|
||||
.uuid = (void*) stubListener,
|
||||
.serial_number = (void*) stubListener,
|
||||
.eisa_id = (void*) stubListener,
|
||||
.capabilities = (void*) stubListener,
|
||||
.overscan = (void*) stubListener,
|
||||
.vrr_policy = (void*) stubListener,
|
||||
.rgb_range = (void*) stubListener,
|
||||
.uuid = (void*) ffWaylandStubListener,
|
||||
.serial_number = (void*) ffWaylandStubListener,
|
||||
.eisa_id = (void*) ffWaylandStubListener,
|
||||
.capabilities = (void*) ffWaylandStubListener,
|
||||
.overscan = (void*) ffWaylandStubListener,
|
||||
.vrr_policy = (void*) ffWaylandStubListener,
|
||||
.rgb_range = (void*) ffWaylandStubListener,
|
||||
.name = waylandKdeNameListener,
|
||||
.high_dynamic_range = waylandKdeHdrListener,
|
||||
.sdr_brightness = (void*) stubListener,
|
||||
.wide_color_gamut = (void*) stubListener,
|
||||
.auto_rotate_policy = (void*) stubListener,
|
||||
.icc_profile_path = (void*) stubListener,
|
||||
.brightness_metadata = (void*) stubListener,
|
||||
.brightness_overrides = (void*) stubListener,
|
||||
.sdr_gamut_wideness = (void*) stubListener,
|
||||
.color_profile_source = (void*) stubListener,
|
||||
.brightness = (void*) stubListener,
|
||||
.color_power_tradeoff = (void*) stubListener,
|
||||
.dimming = (void*) stubListener,
|
||||
.replication_source = (void*) stubListener,
|
||||
.ddc_ci_allowed = (void*) stubListener,
|
||||
.sdr_brightness = (void*) ffWaylandStubListener,
|
||||
.wide_color_gamut = (void*) ffWaylandStubListener,
|
||||
.auto_rotate_policy = (void*) ffWaylandStubListener,
|
||||
.icc_profile_path = (void*) ffWaylandStubListener,
|
||||
.brightness_metadata = (void*) ffWaylandStubListener,
|
||||
.brightness_overrides = (void*) ffWaylandStubListener,
|
||||
.sdr_gamut_wideness = (void*) ffWaylandStubListener,
|
||||
.color_profile_source = (void*) ffWaylandStubListener,
|
||||
.brightness = (void*) ffWaylandStubListener,
|
||||
.color_power_tradeoff = (void*) ffWaylandStubListener,
|
||||
.dimming = (void*) ffWaylandStubListener,
|
||||
.replication_source = (void*) ffWaylandStubListener,
|
||||
.ddc_ci_allowed = (void*) ffWaylandStubListener,
|
||||
.max_bits_per_color = (void*) waylandKdeMaxBitsPerColorListener,
|
||||
.max_bits_per_color_range = (void*) stubListener,
|
||||
.automatic_max_bits_per_color_limit = (void*) stubListener,
|
||||
.edr_policy = (void*) stubListener,
|
||||
.sharpness = (void*) stubListener,
|
||||
.max_bits_per_color_range = (void*) ffWaylandStubListener,
|
||||
.automatic_max_bits_per_color_limit = (void*) ffWaylandStubListener,
|
||||
.edr_policy = (void*) ffWaylandStubListener,
|
||||
.sharpness = (void*) ffWaylandStubListener,
|
||||
.priority = waylandKdePriorityListener,
|
||||
.auto_brightness = (void*) stubListener,
|
||||
.removed = (void*) stubListener,
|
||||
.hdr_icc_profile_path = (void*) stubListener,
|
||||
.hdr_color_profile_source = (void*) stubListener,
|
||||
.abm_level = (void*) stubListener,
|
||||
.auto_brightness = (void*) ffWaylandStubListener,
|
||||
.removed = (void*) ffWaylandStubListener,
|
||||
.hdr_icc_profile_path = (void*) ffWaylandStubListener,
|
||||
.hdr_color_profile_source = (void*) ffWaylandStubListener,
|
||||
.abm_level = (void*) ffWaylandStubListener,
|
||||
};
|
||||
|
||||
static const char* waylandKdeHandleOutput(WaylandData* wldata, struct wl_proxy* output) {
|
||||
@@ -288,7 +287,7 @@ static void waylandKdeOutputListener(void* data, FF_A_UNUSED struct kde_output_d
|
||||
|
||||
static struct kde_output_device_registry_v2_listener registryListener = {
|
||||
.output = waylandKdeOutputListener,
|
||||
.finished = (void*) stubListener,
|
||||
.finished = (void*) ffWaylandStubListener,
|
||||
};
|
||||
|
||||
const char* ffWaylandHandleKdeOutputRegistry(WaylandData* wldata, struct wl_registry* registry, uint32_t name, uint32_t version) {
|
||||
|
||||
@@ -253,7 +253,7 @@ const char* ffdsConnectWayland(FFDisplayServerResult* result) {
|
||||
|
||||
struct wl_registry_listener registry_listener = {
|
||||
.global = waylandGlobalAddListener,
|
||||
.global_remove = (void*) stubListener
|
||||
.global_remove = (void*) ffWaylandStubListener
|
||||
};
|
||||
|
||||
data.ffwl_proxy_add_listener(registry, (void (**)(void)) ®istry_listener, &data);
|
||||
@@ -339,6 +339,10 @@ const char* ffdsConnectWayland(FFDisplayServerResult* result) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void ffWaylandStubListener(void* data, ...) {
|
||||
FF_UNUSED(data);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
const char* ffdsConnectWayland(FF_A_UNUSED FFDisplayServerResult* result) {
|
||||
|
||||
@@ -60,9 +60,7 @@ typedef struct WaylandDisplay {
|
||||
bool primary;
|
||||
} WaylandDisplay;
|
||||
|
||||
inline static void stubListener(void* data, ...) {
|
||||
(void) data;
|
||||
}
|
||||
void ffWaylandStubListener(void* data, ...);
|
||||
|
||||
inline static uint64_t ffWaylandGenerateIdFromName(const char* name) {
|
||||
uint64_t id = 0;
|
||||
|
||||
@@ -324,7 +324,7 @@ const char* ffDetectGPU(const FFGPUOptions* options, FFlist* result) {
|
||||
return "GPU detection failed";
|
||||
}
|
||||
|
||||
bool ffGPUFillVendorByDeviceName(FFGPUResult* gpu) {
|
||||
bool ffGPUDetectTypeByVendorAndName(FFGPUResult* gpu) {
|
||||
if (gpu->type != FF_GPU_TYPE_UNKNOWN) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -107,4 +107,4 @@ static inline uint64_t ffGPUGeneral2Id(uint64_t originalId) {
|
||||
return (1ULL << 63) | originalId;
|
||||
}
|
||||
|
||||
bool ffGPUFillVendorByDeviceName(FFGPUResult* gpu);
|
||||
bool ffGPUDetectTypeByVendorAndName(FFGPUResult* gpu);
|
||||
|
||||
@@ -48,8 +48,6 @@ static double detectGpuTemp(const FFstrbuf* gpuName) {
|
||||
}
|
||||
|
||||
#ifdef __aarch64__
|
||||
#include "common/apple/cf_helpers.h"
|
||||
|
||||
#include <IOKit/IOKitLib.h>
|
||||
|
||||
static const char* detectFrequency(FFGPUResult* gpu) {
|
||||
@@ -71,7 +69,7 @@ static const char* detectFrequency(FFGPUResult* gpu) {
|
||||
|
||||
// voltage-states9-sram stores supported <frequency / voltage> pairs of gpu from the lowest to the highest
|
||||
CFIndex propLength = CFDataGetLength(freqProperty);
|
||||
if (propLength == 0 || propLength % (CFIndex) sizeof(uint32_t) * 2 != 0) {
|
||||
if (propLength == 0 || propLength % (CFIndex) (sizeof(uint32_t) * 2) != 0) {
|
||||
return "Invalid \"voltage-states9-sram\" length";
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ static const char* detectByPci(const FFGPUOptions* options, FFlist* gpus) {
|
||||
}
|
||||
}
|
||||
|
||||
ffGPUFillVendorByDeviceName(gpu);
|
||||
ffGPUDetectTypeByVendorAndName(gpu);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "gpu.h"
|
||||
|
||||
#if FF_HAVE_DRM
|
||||
|
||||
#include "gpu.h"
|
||||
#include "common/strutil.h"
|
||||
#include "common/io.h"
|
||||
|
||||
@@ -72,7 +73,6 @@ static const char* drmGetPciinfo(int drmfd, const char* drmId, struct drm_pciinf
|
||||
};
|
||||
|
||||
if (ioctl(pcifd, PCIOCGETCONF, &pcio) < 0) {
|
||||
perror("ioctl");
|
||||
return "ioctl(pcifd, PCIOCGETCONF, &pc) failed";
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ const char* ffGPUDetectByDrmBSD(const FFGPUOptions* options, FFlist* gpus) {
|
||||
}
|
||||
}
|
||||
|
||||
ffGPUFillVendorByDeviceName(gpu);
|
||||
ffGPUDetectTypeByVendorAndName(gpu);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
@@ -201,4 +201,4 @@ const char* ffGPUDetectByDrmBSD(const FFGPUOptions* options, FFlist* gpus) {
|
||||
return "Fastfetch was built without libdrm support";
|
||||
}
|
||||
|
||||
#endif // __FreeBSD__ || __OpenBSD__
|
||||
#endif // FF_HAVE_DRM
|
||||
|
||||
@@ -50,7 +50,7 @@ const char* ffDrmDetectRadeon(const FFGPUOptions* options, FFGPUResult* gpu, con
|
||||
}
|
||||
|
||||
if (ioctl(fd, DRM_IOCTL_RADEON_INFO, &(struct drm_radeon_info) {
|
||||
.request = RADEON_INFO_MAX_SCLK, // MHz
|
||||
.request = RADEON_INFO_MAX_SCLK, // KHz
|
||||
.value = (uintptr_t) &value,
|
||||
}) >= 0) {
|
||||
gpu->frequency = (uint32_t) (value / 1000u);
|
||||
@@ -59,7 +59,7 @@ const char* ffDrmDetectRadeon(const FFGPUOptions* options, FFGPUResult* gpu, con
|
||||
if (options->driverSpecific) {
|
||||
struct drm_radeon_gem_info gemInfo;
|
||||
if (ioctl(fd, DRM_IOCTL_RADEON_GEM_INFO, &gemInfo) >= 0) {
|
||||
// vram_usage can be bigger than vram_usage, so we use vram_size here
|
||||
// vram_usage can be bigger than vram_size, so we use vram_size here
|
||||
gpu->dedicated.total = gemInfo.vram_size;
|
||||
gpu->shared.total = gemInfo.gart_size;
|
||||
|
||||
@@ -146,6 +146,7 @@ const char* ffDrmDetectAmdgpu(const FFGPUOptions* options, FFGPUResult* gpu, con
|
||||
ffStrbufAppendF(&gpu->memoryType, "Unknown (%u)", devInfo.vram_type);
|
||||
break;
|
||||
}
|
||||
#undef FF_VRAM_CASE
|
||||
}
|
||||
|
||||
struct drm_amdgpu_memory_info memInfo;
|
||||
@@ -228,12 +229,12 @@ static inline int popcountBytes(uint8_t* bytes, uint32_t length) {
|
||||
length -= 4;
|
||||
}
|
||||
if (length >= 2) {
|
||||
count += __builtin_popcountl(*(uint16_t*) bytes);
|
||||
count += __builtin_popcount(*(uint16_t*) bytes);
|
||||
bytes += 2;
|
||||
length -= 2;
|
||||
}
|
||||
if (length) {
|
||||
count += __builtin_popcountl(*(uint8_t*) bytes);
|
||||
count += __builtin_popcount(*(uint8_t*) bytes);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
@@ -306,7 +307,11 @@ const char* ffDrmDetectAsahi(FFGPUResult* gpu, int fd) {
|
||||
.size = sizeof(paramsGlobal),
|
||||
}) >= 0) {
|
||||
// They removed `unstable_uabi_version` from the struct. Hopefully they won't introduce new ABI changes.
|
||||
gpu->coreCount = (int32_t) (paramsGlobal.num_clusters_total * paramsGlobal.num_cores_per_cluster);
|
||||
assert(paramsGlobal.num_clusters_total <= DRM_ASAHI_MAX_CLUSTERS);
|
||||
gpu->coreCount = 0;
|
||||
for (uint32_t i = 0; i < paramsGlobal.num_clusters_total; i++) {
|
||||
gpu->coreCount += __builtin_popcountll(paramsGlobal.core_masks[i]);
|
||||
}
|
||||
gpu->frequency = paramsGlobal.max_frequency_khz / 1000;
|
||||
gpu->deviceId = ffGPUGeneral2Id(paramsGlobal.chip_id);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
|
||||
static bool pciDetectDriver(FFstrbuf* result, FFstrbuf* pciDir, FFstrbuf* buffer, FF_A_UNUSED const char* drmKey) {
|
||||
static bool detectDriverFromSysfs(FFstrbuf* result, FFstrbuf* pciDir, FFstrbuf* buffer, FF_A_UNUSED const char* drmKey) {
|
||||
uint32_t pciDirLength = pciDir->length;
|
||||
ffStrbufAppendS(pciDir, "/driver");
|
||||
char pathBuf[PATH_MAX];
|
||||
@@ -90,6 +90,7 @@ static void pciDetectAmdSpecific(const FFGPUOptions* options, FFGPUResult* gpu,
|
||||
ffStrbufAppendS(pciDir, "/hwmon/");
|
||||
FF_AUTO_CLOSE_DIR DIR* dirp = opendir(pciDir->chars);
|
||||
if (!dirp) {
|
||||
ffStrbufSubstrBefore(pciDir, pciDirLen);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -101,6 +102,7 @@ static void pciDetectAmdSpecific(const FFGPUOptions* options, FFGPUResult* gpu,
|
||||
break;
|
||||
}
|
||||
if (!entry) {
|
||||
ffStrbufSubstrBefore(pciDir, pciDirLen);
|
||||
return;
|
||||
}
|
||||
ffStrbufAppendS(pciDir, entry->d_name);
|
||||
@@ -407,7 +409,7 @@ static const char* detectPci(const FFGPUOptions* options, FFlist* gpus, FFstrbuf
|
||||
ffStrbufSetF(&gpu->platformApi, "DRM (%s)", drmKey);
|
||||
}
|
||||
|
||||
pciDetectDriver(&gpu->driver, deviceDir, buffer, drmKey);
|
||||
detectDriverFromSysfs(&gpu->driver, deviceDir, buffer, drmKey);
|
||||
ffStrbufSubstrBefore(deviceDir, drmDirPathLength);
|
||||
|
||||
if (gpu->vendor.chars == FF_GPU_VENDOR_NAME_AMD) {
|
||||
@@ -419,17 +421,17 @@ static const char* detectPci(const FFGPUOptions* options, FFlist* gpus, FFstrbuf
|
||||
if (!ok) {
|
||||
pciDetectAmdSpecific(options, gpu, deviceDir, buffer);
|
||||
ffStrbufSubstrBefore(deviceDir, drmDirPathLength);
|
||||
|
||||
ffStrbufAppendS(deviceDir, "/revision");
|
||||
if (ffReadFileBuffer(deviceDir->chars, buffer)) {
|
||||
char* pend;
|
||||
uint64_t revision = strtoul(buffer->chars, &pend, 16);
|
||||
if (pend != buffer->chars) {
|
||||
ffGPUQueryAmdGpuName((uint16_t) deviceId, (uint8_t) revision, gpu);
|
||||
}
|
||||
}
|
||||
ffStrbufSubstrBefore(deviceDir, drmDirPathLength);
|
||||
}
|
||||
|
||||
ffStrbufAppendS(deviceDir, "/revision");
|
||||
if (ffReadFileBuffer(deviceDir->chars, buffer)) {
|
||||
char* pend;
|
||||
uint64_t revision = strtoul(buffer->chars, &pend, 16);
|
||||
if (pend != buffer->chars) {
|
||||
ffGPUQueryAmdGpuName((uint16_t) deviceId, (uint8_t) revision, gpu);
|
||||
}
|
||||
}
|
||||
ffStrbufSubstrBefore(deviceDir, drmDirPathLength);
|
||||
} else if (gpu->vendor.chars == FF_GPU_VENDOR_NAME_INTEL) {
|
||||
pciDetectIntelSpecific(options, gpu, deviceDir, buffer, drmKey);
|
||||
ffStrbufSubstrBefore(deviceDir, drmDirPathLength);
|
||||
@@ -457,7 +459,7 @@ static const char* detectPci(const FFGPUOptions* options, FFlist* gpus, FFstrbuf
|
||||
ffGPUFillVendorAndName(subclassId, (uint16_t) vendorId, (uint16_t) deviceId, gpu);
|
||||
}
|
||||
|
||||
ffGPUFillVendorByDeviceName(gpu);
|
||||
ffGPUDetectTypeByVendorAndName(gpu);
|
||||
|
||||
if (options->driverSpecific && gpu->pcieSpeed == FF_GPU_PCIE_SPEED_UNSET) {
|
||||
ffStrbufAppendS(deviceDir, "/max_link_speed");
|
||||
@@ -535,12 +537,12 @@ static const char* detectOf(FFlist* gpus, FFstrbuf* buffer, FFstrbuf* drmDir, co
|
||||
gpu->temperature = FF_GPU_TEMP_UNSET;
|
||||
gpu->coreCount = FF_GPU_CORE_COUNT_UNSET;
|
||||
gpu->coreUsage = FF_GPU_CORE_USAGE_UNSET;
|
||||
gpu->type = FF_GPU_TYPE_INTEGRATED;
|
||||
gpu->type = FF_GPU_TYPE_INTEGRATED; // Open Firmware is only used on integrated GPUs
|
||||
gpu->dedicated.total = gpu->dedicated.used = gpu->shared.total = gpu->shared.used = FF_GPU_VMEM_SIZE_UNSET;
|
||||
gpu->frequency = FF_GPU_FREQUENCY_UNSET;
|
||||
gpu->pcieSpeed = FF_GPU_PCIE_SPEED_UNSET;
|
||||
|
||||
pciDetectDriver(&gpu->driver, drmDir, buffer, drmKey);
|
||||
detectDriverFromSysfs(&gpu->driver, drmDir, buffer, drmKey);
|
||||
|
||||
#ifdef __aarch64__
|
||||
if (ffStrbufEqualS(&gpu->driver, "asahi")) {
|
||||
@@ -557,7 +559,7 @@ static const char* detectOf(FFlist* gpus, FFstrbuf* buffer, FFstrbuf* drmDir, co
|
||||
ffStrbufSetStatic(&gpu->vendor, "Broadcom"); // Raspberry Pi
|
||||
} else {
|
||||
ffStrbufSetS(&gpu->vendor, compatible);
|
||||
gpu->vendor.chars[0] = (char) toupper(compatible[0]);
|
||||
gpu->vendor.chars[0] = (char) toupper((uint8_t) compatible[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -586,10 +588,11 @@ static const char* drmDetectGPUs(const FFGPUOptions* options, FFlist* gpus) {
|
||||
ffStrbufAppendS(&drmDir, entry->d_name);
|
||||
|
||||
ffStrbufAppendS(&drmDir, "/device/modalias");
|
||||
if (!ffReadFileBuffer(drmDir.chars, &buffer)) {
|
||||
ffReadFileBuffer(drmDir.chars, &buffer);
|
||||
ffStrbufSubstrBefore(&drmDir, drmDir.length - (uint32_t) strlen("/modalias"));
|
||||
if (!buffer.length) {
|
||||
continue;
|
||||
}
|
||||
ffStrbufSubstrBefore(&drmDir, drmDir.length - (uint32_t) strlen("/modalias"));
|
||||
|
||||
if (ffStrbufStartsWithS(&buffer, "pci:")) {
|
||||
detectPci(options, gpus, &buffer, &drmDir, entry->d_name);
|
||||
|
||||
@@ -225,7 +225,7 @@ static void ffStrbufSetWS(FFstrbuf* strbuf, const char16_t* str) {
|
||||
static void closeDxgfd(void) {
|
||||
if (dxgfd >= 0) {
|
||||
close(dxgfd);
|
||||
dxgfd = 0;
|
||||
dxgfd = -2;
|
||||
FF_DEBUG("Closed /dev/dxg file descriptor");
|
||||
}
|
||||
}
|
||||
@@ -294,7 +294,7 @@ ffGPUDetectWsl2
|
||||
});
|
||||
if (!NT_SUCCESS(status)) {
|
||||
FF_DEBUG("KMTQAITYPE_ADAPTERTYPE query failed for adapter #%u: %s", i, ffDebugNtStatus(status));
|
||||
continue;
|
||||
goto close_adapter;
|
||||
}
|
||||
if (adapterType.SoftwareDevice) {
|
||||
FF_DEBUG("Skipping software adapter #%u", i);
|
||||
@@ -607,7 +607,7 @@ ffGPUDetectWsl2
|
||||
}
|
||||
|
||||
if (gpu->type == FF_GPU_TYPE_UNKNOWN) {
|
||||
if (ffGPUFillVendorByDeviceName(gpu)) {
|
||||
if (ffGPUDetectTypeByVendorAndName(gpu)) {
|
||||
// OK
|
||||
}
|
||||
#if _WIN32
|
||||
|
||||
@@ -111,8 +111,7 @@ static const char* getMediaByMediaRemote(FFMediaResult* result, bool saveCover)
|
||||
}
|
||||
|
||||
#if !FF_MODULE_DISABLE_MEDIA
|
||||
__attribute__((visibility("default"), used))
|
||||
int ffPrintMediaByMediaRemote(bool saveCover) {
|
||||
__attribute__((visibility("default"), used)) int ffPrintMediaByMediaRemote(int saveCover) {
|
||||
FFMediaResult media = {
|
||||
.status = ffStrbufCreate(),
|
||||
.song = ffStrbufCreate(),
|
||||
@@ -122,7 +121,7 @@ int ffPrintMediaByMediaRemote(bool saveCover) {
|
||||
.player = ffStrbufCreate(),
|
||||
.cover = ffStrbufCreate(),
|
||||
};
|
||||
if (getMediaByMediaRemote(&media, saveCover) != NULL) {
|
||||
if (getMediaByMediaRemote(&media, !!saveCover) != NULL) {
|
||||
return 1;
|
||||
}
|
||||
ffStrbufAppendC(&media.status, '\n');
|
||||
@@ -157,13 +156,19 @@ int ffPrintMediaByMediaRemote(bool saveCover) {
|
||||
|
||||
static const char* getMediaByAuthorizedProcess(FFMediaResult* result, bool saveCover) {
|
||||
// #1737
|
||||
FF_STRBUF_AUTO_DESTROY script = ffStrbufCreateF("import ctypes;ctypes.CDLL('%s').ffPrintMediaByMediaRemote(%s)", instance.state.platform.exePath.chars, saveCover ? "True" : "False");
|
||||
FF_STRBUF_AUTO_DESTROY script = ffStrbufCreateF("require DynaLoader;\
|
||||
my $so = DynaLoader::dl_load_file('%s', 0);\
|
||||
my $sym = DynaLoader::dl_find_symbol($so, 'ffPrintMediaByMediaRemote');\
|
||||
DynaLoader::dl_install_xsub('fn', $sym, __FILE__);\
|
||||
exit(fn(%c))",
|
||||
instance.state.platform.exePath.chars,
|
||||
saveCover ? '1' : '0');
|
||||
FF_STRBUF_AUTO_DESTROY buffer = ffStrbufCreate();
|
||||
|
||||
const char* error = ffProcessAppendStdOut(
|
||||
&buffer,
|
||||
(char* const[]) { "/usr/bin/python3", // Must be signed by Apple. Homebrew python doesn't work
|
||||
"-c",
|
||||
(char* const[]) { "/usr/bin/perl", // Must be signed by Apple. Homebrew version doesn't work
|
||||
"-e",
|
||||
script.chars,
|
||||
nil });
|
||||
if (error) {
|
||||
|
||||
@@ -70,8 +70,7 @@ const char* ffDetectNetIO(FFlist* result, FFNetIOOptions* options) {
|
||||
uint64_t* prevValue = (uint64_t*) ((uint8_t*) icPrev + off);
|
||||
uint64_t* currValue = (uint64_t*) ((uint8_t*) icCurr + off);
|
||||
uint64_t temp = *currValue;
|
||||
*currValue -= *prevValue;
|
||||
*currValue /= (time2 - time1) / 1000 /* seconds */;
|
||||
*currValue = (*currValue - *prevValue) * 1000 / (time2 - time1); // Calculate per second
|
||||
*prevValue = temp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,8 @@ FF_A_UNUSED static bool getUbuntuFlavour(FFOSResult* result) {
|
||||
}
|
||||
|
||||
// xdgConfigDirs contains plasma only
|
||||
if (ffPathExists("/var/lib/dpkg/info/ubuntustudio-desktop.list", FF_PATHTYPE_FILE)) {
|
||||
// `ubuntustudio-desktop-core` is installed on both the full and core installations
|
||||
if (ffPathExists("/var/lib/dpkg/info/ubuntustudio-desktop-core.list", FF_PATHTYPE_FILE)) {
|
||||
ffStrbufSetStatic(&result->name, "Ubuntu Studio");
|
||||
ffStrbufSetStatic(&result->id, "ubuntu-studio");
|
||||
ffStrbufSetStatic(&result->idLike, "ubuntu");
|
||||
@@ -208,7 +209,7 @@ FF_A_UNUSED static bool detectDebianDerived(FFOSResult* result) {
|
||||
ffStrbufSetStatic(&result->idLike, "debian");
|
||||
return true;
|
||||
} else if (access("/usr/bin/pveversion", X_OK) == 0) {
|
||||
ffStrbufSetStatic(&result->id, "pve");
|
||||
ffStrbufSetStatic(&result->id, "proxmox");
|
||||
ffStrbufSetStatic(&result->idLike, "debian");
|
||||
ffStrbufSetStatic(&result->name, "Proxmox VE");
|
||||
ffStrbufClear(&result->versionID);
|
||||
@@ -220,8 +221,30 @@ FF_A_UNUSED static bool detectDebianDerived(FFOSResult* result) {
|
||||
NULL,
|
||||
}) == NULL) { // 8.2.2
|
||||
ffStrbufTrimRightSpace(&result->versionID);
|
||||
ffStrbufSetStatic(&result->prettyName, "Proxmox VE ");
|
||||
ffStrbufAppend(&result->prettyName, &result->versionID);
|
||||
} else {
|
||||
ffStrbufSetStatic(&result->prettyName, "Proxmox VE");
|
||||
}
|
||||
return true;
|
||||
} else if (access("/usr/sbin/proxmox-backup-manager", X_OK) == 0) {
|
||||
ffStrbufSetStatic(&result->id, "proxmox");
|
||||
ffStrbufSetStatic(&result->idLike, "debian");
|
||||
ffStrbufSetStatic(&result->name, "Proxmox Backup Server");
|
||||
ffStrbufClear(&result->versionID);
|
||||
if (ffProcessAppendStdOut(&result->versionID, (char* const[]) {
|
||||
"/usr/bin/dpkg-query",
|
||||
"--showformat=${version}",
|
||||
"--show",
|
||||
"proxmox-backup-server",
|
||||
NULL,
|
||||
}) == NULL) {
|
||||
ffStrbufTrimRightSpace(&result->versionID);
|
||||
ffStrbufSetStatic(&result->prettyName, "Proxmox Backup Server ");
|
||||
ffStrbufAppend(&result->prettyName, &result->versionID);
|
||||
} else {
|
||||
ffStrbufSetStatic(&result->prettyName, "Proxmox Backup Server");
|
||||
}
|
||||
ffStrbufSetF(&result->prettyName, "Proxmox VE %s", result->versionID.chars);
|
||||
return true;
|
||||
} else if (ffPathExists("/etc/rpi-issue", FF_PATHTYPE_FILE)) {
|
||||
// Raspberry Pi OS
|
||||
@@ -330,6 +353,17 @@ FF_A_UNUSED static void detectDeepinEnhancement(FFOSResult* result) {
|
||||
}
|
||||
}
|
||||
|
||||
FF_A_UNUSED static void detectAstraVersion(FFOSResult* result) {
|
||||
// `PRETTY_NAME` is just `Astra Linux`; the version is in `VERSION_ID`, e.g. `2.12_x86-64`
|
||||
if (result->version.length == 0) { // Should be empty. Just in case
|
||||
ffStrbufAppendSUntilC(&result->version, result->versionID.chars, '_');
|
||||
}
|
||||
if (result->version.length > 0) {
|
||||
ffStrbufAppendC(&result->prettyName, ' ');
|
||||
ffStrbufAppend(&result->prettyName, &result->version);
|
||||
}
|
||||
}
|
||||
|
||||
static void detectOS(FFOSResult* os) {
|
||||
#ifdef FF_CUSTOM_OS_RELEASE_PATH
|
||||
parseOsRelease(FF_STR(FF_CUSTOM_OS_RELEASE_PATH), os);
|
||||
@@ -389,6 +423,8 @@ void ffDetectOSImpl(FFOSResult* os) {
|
||||
}
|
||||
} else if (ffStrbufEqualS(&os->id, "deepin")) {
|
||||
detectDeepinEnhancement(os);
|
||||
} else if (ffStrbufEqualS(&os->id, "astra")) {
|
||||
detectAstraVersion(os);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -34,9 +34,8 @@ void ffPreparePublicIp(FFPublicIPOptions* options) {
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY path = ffStrbufCreate();
|
||||
if (pathStartIndex != host.length) {
|
||||
ffStrbufAppendNS(&path, pathStartIndex, host.chars + (host.length - pathStartIndex));
|
||||
host.length = pathStartIndex;
|
||||
host.chars[pathStartIndex] = '\0';
|
||||
ffStrbufAppendNS(&path, host.length - pathStartIndex, host.chars + pathStartIndex);
|
||||
ffStrbufSubstrBefore(&host, pathStartIndex);
|
||||
}
|
||||
|
||||
*status = ffNetworkingSendHttpRequest(state, host.chars, path.length == 0 ? "/" : path.chars, NULL);
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#define _PATH_LOCALBASE "/usr/pkg"
|
||||
#elif _WIN32
|
||||
|
||||
#include "common/windows/registry.h"
|
||||
#include "common/windows/version.h"
|
||||
#include <windows.h>
|
||||
|
||||
@@ -88,7 +89,14 @@ static bool getShellVersionFish(FFstrbuf* exe, FFstrbuf* version) {
|
||||
if (version->length < strlen("fish, v") || !ffStrbufStartsWithS(version, "fish")) {
|
||||
return false;
|
||||
}
|
||||
uint32_t index = ffStrbufNextIndexC(version, strlen("fish, "), ' ');
|
||||
uint32_t index = ffStrbufFirstIndexC(version, ' '); // skip "fish,"
|
||||
while (index + 1 < version->length && !ffCharIsDigit(version->chars[index + 1])) {
|
||||
index = ffStrbufNextIndexC(version, index + 1, ' '); // skip "version"
|
||||
}
|
||||
if (index + 1 >= version->length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ffStrbufSubstrAfter(version, index);
|
||||
ffStrbufSubstrBeforeFirstC(version, ' ');
|
||||
return true;
|
||||
@@ -186,6 +194,9 @@ static bool extractBusyboxVersion(const char* line, uint32_t len, void* userdata
|
||||
|
||||
static bool getShellVersionAsh(FFstrbuf* exe, FFstrbuf* version) {
|
||||
ffBinaryExtractStrings(exe->chars, extractBusyboxVersion, version, (uint32_t) strlen("BusyBox v0.0.0"));
|
||||
if (version->length > 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const char* error = ffStrbufEndsWithS(exe, "busybox")
|
||||
? ffProcessAppendStdErr(version, (char* const[]) { exe->chars, "ash", "--help", NULL })
|
||||
@@ -248,6 +259,12 @@ static bool getShellVersionWinPowerShell(FFstrbuf* exe, FFstrbuf* version) {
|
||||
return true;
|
||||
}
|
||||
|
||||
FF_AUTO_CLOSE_FD HANDLE hKey = NULL;
|
||||
if (ffRegOpenSubkeyForRead(ffRegGetRootKeyHandle(HKEY_LOCAL_MACHINE), L"SOFTWARE\\Microsoft\\PowerShell\\3\\PowerShellEngine", &hKey, NULL) && ffRegReadStrbuf(hKey, L"PowerShellVersion", version, NULL)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Extremely slow
|
||||
return ffProcessAppendStdOut(version, (char* const[]) { exe->chars, "-NoLogo", "-NoProfile", "-Command", "$PSVersionTable.PSVersion.ToString()", NULL }) == NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -7,8 +7,8 @@ static const char* status = FF_UNITIALIZED;
|
||||
|
||||
void ffPrepareWeather(FFWeatherOptions* options) {
|
||||
if (status != FF_UNITIALIZED) {
|
||||
fputs("Error: Weather module can only be used once due to internal limitations\n", stderr);
|
||||
exit(1);
|
||||
status = "Weather module can only be used once due to internal limitations";
|
||||
return;
|
||||
}
|
||||
|
||||
state.timeout = options->timeout;
|
||||
|
||||
@@ -191,14 +191,19 @@ static const char* getWslg(FFstrbuf* result) {
|
||||
return "Failed to read /mnt/wslg/versions.txt";
|
||||
}
|
||||
|
||||
if (!ffStrbufStartsWithS(result, "WSLg ")) {
|
||||
return "Failed to find WSLg version";
|
||||
if (ffStrbufStartsWithS(result, "WSLg: ")) { // WSL 2.9.3+
|
||||
ffStrbufSubstrBeforeFirstC(result, '\n');
|
||||
ffStrbufSubstrAfter(result, (uint32_t) (strlen("WSLg: ") - 1));
|
||||
} else if (ffStrbufStartsWithS(result, "WSLg ")) {
|
||||
ffStrbufSubstrBeforeFirstC(result, '\n');
|
||||
ffStrbufSubstrBeforeFirstC(result, '+');
|
||||
ffStrbufSubstrAfterFirstC(result, ':');
|
||||
ffStrbufTrimLeft(result, ' ');
|
||||
} else {
|
||||
ffStrbufClear(result);
|
||||
return "Failed to parse WSLg version from /mnt/wslg/versions.txt";
|
||||
}
|
||||
|
||||
ffStrbufSubstrBeforeFirstC(result, '\n');
|
||||
ffStrbufSubstrBeforeFirstC(result, '+');
|
||||
ffStrbufSubstrAfterFirstC(result, ':');
|
||||
ffStrbufTrimLeft(result, ' ');
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -31,7 +31,6 @@ typedef struct FFstate {
|
||||
uint32_t logoWidth;
|
||||
uint32_t logoHeight;
|
||||
uint32_t keysHeight;
|
||||
bool terminalLightTheme;
|
||||
bool titleFqdn;
|
||||
uint32_t dynamicInterval;
|
||||
FFPlatform platform;
|
||||
|
||||
+26
-1
@@ -804,7 +804,7 @@ static const FFlogo A[] = {
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_JANUSLINUX
|
||||
// Ataraxia
|
||||
{
|
||||
.names = { "Ataraxia Linux", "Ataraxia" },
|
||||
.names = { "Ataraxia" }, // New name of JanusLinux
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_JANUSLINUX,
|
||||
.colors = {
|
||||
FF_COLOR_FG_BLUE,
|
||||
@@ -876,6 +876,31 @@ static const FFlogo A[] = {
|
||||
},
|
||||
},
|
||||
#endif
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_AZURELINUX
|
||||
// AzureLinux
|
||||
{
|
||||
.names = { "AzureLinux" },
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_AZURELINUX,
|
||||
.colors = {
|
||||
FF_COLOR_FG_GREEN,
|
||||
FF_COLOR_FG_BLUE,
|
||||
FF_COLOR_FG_WHITE, // konsole...
|
||||
},
|
||||
},
|
||||
#endif
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_AZURELINUX2
|
||||
// AzureLinux2
|
||||
{
|
||||
.names = { "AzureLinux2" },
|
||||
.type = FF_LOGO_LINE_TYPE_ALTER_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_AZURELINUX2,
|
||||
.colors = {
|
||||
FF_COLOR_FG_GREEN,
|
||||
FF_COLOR_FG_BLUE,
|
||||
FF_COLOR_FG_WHITE, // konsole...
|
||||
},
|
||||
},
|
||||
#endif
|
||||
// LAST
|
||||
{},
|
||||
};
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
$1_((((((((((_
|
||||
$1_(((((((((($2/////////
|
||||
$1_((((((($2////////////
|
||||
$1_(((((($2/////////////
|
||||
$1_(((((($2/////////////
|
||||
$1_((((((($2\\\\\\\\\\\\\
|
||||
$1_((((((((($2\\\\\\\\\\\\\
|
||||
$1_((((((($3.........$2\\\\\\\\
|
||||
$1_((((($3...............$2\\\\\\
|
||||
$1_((((($3..................$2\\\\\
|
||||
$1_((((($3.....................$2\\\\
|
||||
$1_((((($3.......................$2\\\\
|
||||
$1_((((($3.........................$2\\\\
|
||||
$1_((((($3...........................$2\\\
|
||||
$1_((((($3.............................$2\\
|
||||
$1_(((($3................................$2\
|
||||
@@ -0,0 +1,16 @@
|
||||
$1############
|
||||
$1###########$2@@@@@@@@@
|
||||
$1########$2@@@@@@@@@@@@
|
||||
$1#######$2@@@@@@@@@@@@@
|
||||
$1#######$2@@@@@@@@@@@@@
|
||||
$1########$2@@@@@@@@@@@@@
|
||||
$1##########$2@@@@@@@@@@@@@
|
||||
$1########$3&&&&&&&&&$2@@@@@@@@
|
||||
$1######$3&&&&&&&&&&&&&&&$2@@@@@@
|
||||
$1######$3&&&&&&&&&&&&&&&&&&$2@@@@@
|
||||
$1######$3&&&&&&&&&&&&&&&&&&&&&$2@@@@
|
||||
$1######$3&&&&&&&&&&&&&&&&&&&&&&&$2@@@@
|
||||
$1######$3&&&&&&&&&&&&&&&&&&&&&&&&&$2@@@@
|
||||
$1######$3&&&&&&&&&&&&&&&&&&&&&&&&&&&$2@@@
|
||||
$1######$3&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$2@@
|
||||
$1#####$3&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&$2@
|
||||
+36
-5
@@ -60,7 +60,7 @@ static const FFlogo C[] = {
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_CALINIXOS
|
||||
// CalinixOS
|
||||
{
|
||||
.names = { "Calinix", "calinixos" },
|
||||
.names = { "CalinixOS" },
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_CALINIXOS,
|
||||
.colors = {
|
||||
FF_COLOR_FG_MAGENTA,
|
||||
@@ -72,7 +72,7 @@ static const FFlogo C[] = {
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_CALINIXOS_SMALL
|
||||
// CalinixOSSmall
|
||||
{
|
||||
.names = { "Calinix_small", "calinixos_small" },
|
||||
.names = { "CalinixOS_small" },
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_CALINIXOS_SMALL,
|
||||
.colors = {
|
||||
@@ -109,7 +109,7 @@ static const FFlogo C[] = {
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_CELOS
|
||||
// CelOS
|
||||
{
|
||||
.names = { "Cel", "celos", "cel-linux", "celos-linux" },
|
||||
.names = { "CelOS" },
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_CELOS,
|
||||
.colors = {
|
||||
FF_COLOR_FG_MAGENTA,
|
||||
@@ -166,7 +166,7 @@ static const FFlogo C[] = {
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_CEREUS
|
||||
// Cereus
|
||||
{
|
||||
.names = { "Cereus", "Cereus Linux" },
|
||||
.names = { "Cereus" },
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_CEREUS,
|
||||
.colors = {
|
||||
FF_COLOR_FG_256 "173",
|
||||
@@ -232,6 +232,37 @@ static const FFlogo C[] = {
|
||||
.colorTitle = FF_COLOR_FG_RED,
|
||||
},
|
||||
#endif
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_CHIMERA_LINUX2
|
||||
// Chimera2
|
||||
{
|
||||
.names = { "Chimera2" },
|
||||
.type = FF_LOGO_LINE_TYPE_ALTER_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_CHIMERA_LINUX2,
|
||||
.colors = {
|
||||
FF_COLOR_FG_BLUE,
|
||||
FF_COLOR_FG_RED,
|
||||
FF_COLOR_FG_MAGENTA,
|
||||
},
|
||||
.colorKeys = FF_COLOR_FG_MAGENTA,
|
||||
.colorTitle = FF_COLOR_FG_RED,
|
||||
},
|
||||
#endif
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_CHIMERA_LINUX_SMALL
|
||||
// Chimera_small
|
||||
{
|
||||
.names = { "Chimera_small" },
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_CHIMERA_LINUX_SMALL,
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||
.colors = {
|
||||
FF_COLOR_FG_RED,
|
||||
FF_COLOR_FG_MAGENTA,
|
||||
FF_COLOR_FG_BLUE,
|
||||
FF_COLOR_FG_RED,
|
||||
},
|
||||
.colorKeys = FF_COLOR_FG_MAGENTA,
|
||||
.colorTitle = FF_COLOR_FG_RED,
|
||||
},
|
||||
#endif
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_CHONKYSEALOS
|
||||
// ChonkySealOS
|
||||
{
|
||||
@@ -366,7 +397,7 @@ static const FFlogo C[] = {
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_FEDORA_COREOS
|
||||
// ContainerLinux
|
||||
{
|
||||
.names = { "ContainerLinux", "Container Linux", "Container Linux by CoreOS" },
|
||||
.names = { "CoreOS", "Container Linux by CoreOS" },
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_FEDORA_COREOS,
|
||||
.colors = {
|
||||
FF_COLOR_FG_BLUE,
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
888888888888 $2888
|
||||
$1888888888888 $2888
|
||||
$1888888888888 $2888
|
||||
$188888888P"' $2_,888
|
||||
$1888888P' $2,jd88888
|
||||
$188888P $2d88P'
|
||||
$18888b $2j88' xxxxxxxxxx
|
||||
$3_____ $218{ 8888888888
|
||||
$38888b. $2l88, ,88" $3______
|
||||
$3888888 $218b,_ ,d88P $3888888
|
||||
$3888888b. $2`188bwwd88P' $3,d888888
|
||||
$388888888b._ $2`"^^"'`$3.,d88888888
|
||||
$3888888888888bo od888888888888
|
||||
$388888888888888 88888888888888
|
||||
$388888888888888 88888888888888
|
||||
@@ -0,0 +1,7 @@
|
||||
$3XXXXX $1I:
|
||||
$3XXX' $1,I;
|
||||
$3XX $1,f""'.,,,,
|
||||
$2,, $1I: ;P"""
|
||||
$2XX $1`t...f' $4jj
|
||||
$2XXX. $1`"' $4.XXX
|
||||
$2OOOOOC $4lXXXXX
|
||||
+14
-1
@@ -169,10 +169,23 @@ static const FFlogo F[] = {
|
||||
.colorTitle = FF_COLOR_FG_DEFAULT,
|
||||
},
|
||||
#endif
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_FLATCAR
|
||||
// Flatcar
|
||||
{
|
||||
.names = { "Flatcar" },
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_FLATCAR,
|
||||
.colors = {
|
||||
FF_COLOR_FG_BLUE,
|
||||
FF_COLOR_FG_DEFAULT,
|
||||
},
|
||||
.colorKeys = FF_COLOR_FG_BLUE,
|
||||
.colorTitle = FF_COLOR_FG_DEFAULT,
|
||||
},
|
||||
#endif
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_FILOTIMO
|
||||
// Filotimo
|
||||
{
|
||||
.names = { "filotimo" },
|
||||
.names = { "Filotimo" },
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_FILOTIMO,
|
||||
.colors = {
|
||||
FF_COLOR_FG_BLUE,
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ
|
||||
ΞΞ ΞΞΞ ΞΞΞ ΞΞ ΞΞΞ
|
||||
ΞΞ ΞΞΞ Ξ Ξ ΞΞ ΞΞΞΞ
|
||||
ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ
|
||||
ΞΞ ΞΞ ΞΞ ΞΞ
|
||||
Ξ ΞΞ ΞΞΞΞ Ξ ΞΞ Ξ
|
||||
Ξ ΞΞ ΞΞ ΞΞ Ξ Ξ ΞΞΞ Ξ
|
||||
Ξ ΞΞ ΞΞ ΞΞ Ξ ΞΞΞ ΞΞΞ Ξ
|
||||
ΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞΞ
|
||||
@@ -19,7 +19,7 @@ static const FFlogo G[] = {
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_GARUDA
|
||||
// Garuda
|
||||
{
|
||||
.names = { "Garuda", "garuda-linux" },
|
||||
.names = { "Garuda" },
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_GARUDA,
|
||||
.colors = {
|
||||
FF_COLOR_FG_RED,
|
||||
@@ -167,7 +167,7 @@ static const FFlogo G[] = {
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_GOLDENDOGLINUX
|
||||
// GoldenDogLinux
|
||||
{
|
||||
.names = { "GoldenDog Linux", "GDL", "goldendoglinux" },
|
||||
.names = { "GoldenDogLinux" },
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_GOLDENDOGLINUX,
|
||||
.colors = {
|
||||
FF_COLOR_FG_YELLOW,
|
||||
|
||||
@@ -6,7 +6,7 @@ static const FFlogo J[] = {
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_JANUSLINUX
|
||||
// Januslinux
|
||||
{
|
||||
.names = { "januslinux", "janus" },
|
||||
.names = { "januslinux" },
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_JANUSLINUX,
|
||||
.colors = {
|
||||
FF_COLOR_FG_BLUE,
|
||||
|
||||
@@ -129,7 +129,7 @@ static const FFlogo K[] = {
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_KISS
|
||||
// KISSLinux
|
||||
{
|
||||
.names = { "KISS", "kiss-linux", "kisslinux" },
|
||||
.names = { "KISS" },
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_KISS,
|
||||
.colors = {
|
||||
FF_COLOR_FG_MAGENTA,
|
||||
|
||||
@@ -231,6 +231,20 @@ static const FFlogo L[] = {
|
||||
.colorTitle = FF_COLOR_FG_GREEN,
|
||||
},
|
||||
#endif
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_LINUXMINT2_SMALL
|
||||
// LinuxMint2Small
|
||||
{
|
||||
.names = { "linuxmint2_small" },
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT | FF_LOGO_LINE_TYPE_ALTER_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_LINUXMINT2_SMALL,
|
||||
.colors = {
|
||||
FF_COLOR_FG_GREEN,
|
||||
FF_COLOR_FG_WHITE,
|
||||
},
|
||||
.colorKeys = FF_COLOR_FG_GREEN,
|
||||
.colorTitle = FF_COLOR_FG_GREEN,
|
||||
},
|
||||
#endif
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_LINUXMINT_OLD
|
||||
// LinuxMintOld
|
||||
{
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
__________
|
||||
|_ \
|
||||
| $2| _____ $1|
|
||||
| $2| | | | $1|
|
||||
| $2| | | | $1|
|
||||
| $2\__$2___/ $1|
|
||||
\_________/
|
||||
@@ -1,7 +1,10 @@
|
||||
__________
|
||||
|_ \
|
||||
| $2| _____ $1|
|
||||
| $2| | | | $1|
|
||||
| $2| | | | $1|
|
||||
| $2\__$2___/ $1|
|
||||
\_________/
|
||||
____________________
|
||||
| \
|
||||
|_ $2| ___________ $1 |
|
||||
| $2| / __ __ \$1 |
|
||||
| $2| | | | | | |$1 |
|
||||
| $2| | | | | | |$1 |
|
||||
| $2| | | | | | |$1 |
|
||||
| $2| \_/ \_/ | |$1 |
|
||||
| $2\____________/_/$1 |
|
||||
\___________________/
|
||||
@@ -52,7 +52,7 @@ static const FFlogo O[] = {
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_OPENKYLIN
|
||||
// OpenKylin
|
||||
{
|
||||
.names = { "openkylin", "open-kylin" },
|
||||
.names = { "openKylin" },
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_OPENKYLIN,
|
||||
.colors = {
|
||||
FF_COLOR_FG_GREEN,
|
||||
@@ -277,7 +277,7 @@ static const FFlogo O[] = {
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_OPENMANDRIVA
|
||||
// OpenMandriva
|
||||
{
|
||||
.names = { "openmandriva", "open-mandriva", "open_mandriva", "openmandriva lx" },
|
||||
.names = { "OpenMandriva" },
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_OPENMANDRIVA,
|
||||
.colors = {
|
||||
FF_COLOR_FG_BLUE,
|
||||
@@ -340,7 +340,7 @@ static const FFlogo O[] = {
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_ORACLE
|
||||
// Oracle
|
||||
{
|
||||
.names = { "oracle", "oracle linux", "oracle linux server" },
|
||||
.names = { "ol", "oracle" }, // ID="ol"
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_ORACLE,
|
||||
.colors = {
|
||||
FF_COLOR_FG_RED,
|
||||
|
||||
+29
-4
@@ -29,7 +29,7 @@ static const FFlogo P[] = {
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_PARABOLA
|
||||
// Parabola
|
||||
{
|
||||
.names = { "parabola", "parabola-gnulinux" },
|
||||
.names = { "Parabola" },
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_PARABOLA,
|
||||
.colors = {
|
||||
FF_COLOR_FG_MAGENTA,
|
||||
@@ -41,7 +41,7 @@ static const FFlogo P[] = {
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_PARABOLA_SMALL
|
||||
// ParabolaSmall
|
||||
{
|
||||
.names = { "parabola_small", "parabola-gnulinux_small" },
|
||||
.names = { "Parabola_small", },
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_PARABOLA_SMALL,
|
||||
.colors = {
|
||||
@@ -51,6 +51,19 @@ static const FFlogo P[] = {
|
||||
.colorTitle = FF_COLOR_FG_MAGENTA,
|
||||
},
|
||||
#endif
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_PARABOLA2_SMALL
|
||||
// Parabola2Small
|
||||
{
|
||||
.names = { "Parabola2_small", },
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT | FF_LOGO_LINE_TYPE_ALTER_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_PARABOLA2_SMALL,
|
||||
.colors = {
|
||||
FF_COLOR_FG_BLUE,
|
||||
},
|
||||
.colorKeys = FF_COLOR_FG_BLUE,
|
||||
.colorTitle = FF_COLOR_FG_BLUE,
|
||||
},
|
||||
#endif
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_PARCH
|
||||
// Parch
|
||||
{
|
||||
@@ -171,7 +184,7 @@ static const FFlogo P[] = {
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_PEROPESIS
|
||||
// Peropesis
|
||||
{
|
||||
.names = { "Peropesis", "Peropesis Linux" },
|
||||
.names = { "Peropesis" },
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_PEROPESIS,
|
||||
.colors = {
|
||||
FF_COLOR_FG_WHITE,
|
||||
@@ -271,6 +284,18 @@ static const FFlogo P[] = {
|
||||
},
|
||||
},
|
||||
#endif
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_POSTMARKETOS2
|
||||
// PostMarketOS2
|
||||
{
|
||||
.names = { "PostMarketOS2" },
|
||||
.type = FF_LOGO_LINE_TYPE_ALTER_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_POSTMARKETOS2,
|
||||
.colors = {
|
||||
FF_COLOR_FG_GREEN,
|
||||
FF_COLOR_FG_WHITE,
|
||||
},
|
||||
},
|
||||
#endif
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_POSTMARKETOS_SMALL
|
||||
// PostMarketOSSmall
|
||||
{
|
||||
@@ -286,7 +311,7 @@ static const FFlogo P[] = {
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_PROXMOX
|
||||
// Proxmox
|
||||
{
|
||||
.names = { "Proxmox", "pve" },
|
||||
.names = { "Proxmox" },
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_PROXMOX,
|
||||
.colors = {
|
||||
FF_COLOR_FG_WHITE,
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
_. .d;' ,b,
|
||||
_.=: `" "` ,d88}
|
||||
` "888!'
|
||||
}8!'
|
||||
,P/
|
||||
,1'
|
||||
/'
|
||||
@@ -0,0 +1,17 @@
|
||||
db
|
||||
d88b
|
||||
d8888b
|
||||
d888888b
|
||||
j88888888b
|
||||
!888888888b
|
||||
j| J8^"888888b
|
||||
d8[;__, '888888b
|
||||
d88888P' '888888b
|
||||
d88888P '888888b
|
||||
d88888P '888888b
|
||||
d88888P '1^`,.__
|
||||
d88888P " ,A888b
|
||||
d888888, =ooooooooooo888888b
|
||||
d88888888, "J8888888888888888b
|
||||
d888888888" ,d88888888888888888b
|
||||
d88888888P' ,d8888888888888888888b
|
||||
@@ -50,6 +50,18 @@ static const FFlogo Q[] = {
|
||||
},
|
||||
},
|
||||
#endif
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_QUBES_SMALL
|
||||
// Qubes
|
||||
{
|
||||
.names = { "Qubes_small" },
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_QUBES_SMALL,
|
||||
.colors = {
|
||||
FF_COLOR_FG_BLUE,
|
||||
FF_COLOR_FG_MAGENTA,
|
||||
},
|
||||
},
|
||||
#endif
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_QUBYT
|
||||
// Qubyt
|
||||
{
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
.,dQb,.
|
||||
.,qdQQQQQQQbq,.
|
||||
.,qdQQQQQQQQQQQQQQQbq,.
|
||||
dIQQQQQQQQP"'"1QQQQQQQQ^b
|
||||
ttttI%QP'` `'1Q%^---|
|
||||
tttttt |----|
|
||||
tttttt |----|
|
||||
tttttt |----|
|
||||
tttttt |----|
|
||||
ttttttti, .,;-----|
|
||||
1ttttttttti, ,----------'
|
||||
'"^1ttttttt|----------;,
|
||||
'"^1ttt|---^-------->,
|
||||
'"1|^'` "^==-:"
|
||||
@@ -157,7 +157,7 @@ static const FFlogo R[] = {
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_REDSTAR
|
||||
// RedstarOS
|
||||
{
|
||||
.names = { "redstar", "redstar-os", "redstaros" },
|
||||
.names = { "Redstar" },
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_REDSTAR,
|
||||
.colors = {
|
||||
FF_COLOR_FG_RED,
|
||||
@@ -257,7 +257,7 @@ static const FFlogo R[] = {
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_ROSA
|
||||
// RosaLinux
|
||||
{
|
||||
.names = { "rosa", "rosa-linux", "rosalinux" },
|
||||
.names = { "ROSA" },
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_ROSA,
|
||||
.colors = {
|
||||
FF_COLOR_FG_RGB "250;250;250",
|
||||
|
||||
@@ -75,7 +75,7 @@ static const FFlogo S[] = {
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_SAMBABOX
|
||||
// SambaBOX
|
||||
{
|
||||
.names = { "SambaBOX", "Profelis SambaBOX" },
|
||||
.names = { "SambaBOX" },
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_SAMBABOX,
|
||||
.colors = {
|
||||
FF_COLOR_FG_YELLOW,
|
||||
|
||||
@@ -35,7 +35,7 @@ static const FFlogo U[] = {
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_UBUNTU
|
||||
// Ubuntu
|
||||
{
|
||||
.names = { "ubuntu", "ubuntu-linux" },
|
||||
.names = { "ubuntu" },
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_UBUNTU,
|
||||
.colors = {
|
||||
FF_COLOR_FG_RED,
|
||||
@@ -46,7 +46,7 @@ static const FFlogo U[] = {
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_UBUNTU_SMALL
|
||||
// UbuntuSmall
|
||||
{
|
||||
.names = { "ubuntu_small", "ubuntu-linux_small" },
|
||||
.names = { "ubuntu_small" },
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_UBUNTU_SMALL,
|
||||
.colors = {
|
||||
@@ -58,7 +58,7 @@ static const FFlogo U[] = {
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_UBUNTU_OLD
|
||||
// UbuntuOld
|
||||
{
|
||||
.names = { "ubuntu_old", "ubuntu-linux_old" },
|
||||
.names = { "ubuntu_old" },
|
||||
.type = FF_LOGO_LINE_TYPE_ALTER_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_UBUNTU_OLD,
|
||||
.colors = {
|
||||
@@ -87,7 +87,7 @@ static const FFlogo U[] = {
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_UBUNTU_OLD2_SMALL
|
||||
// UbuntuOld2Small
|
||||
{
|
||||
.names = { "ubuntu_old2_small", "ubuntu_old2_small" },
|
||||
.names = { "ubuntu_old2_small" },
|
||||
.type = FF_LOGO_LINE_TYPE_SMALL_BIT | FF_LOGO_LINE_TYPE_ALTER_BIT,
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_UBUNTU_OLD2_SMALL,
|
||||
.colors = {
|
||||
@@ -211,7 +211,7 @@ static const FFlogo U[] = {
|
||||
#ifdef FASTFETCH_DATATEXT_LOGO_ULTRAMARINE
|
||||
// Ultramarine
|
||||
{
|
||||
.names = { "Ultramarine", "Ultramarine Linux" },
|
||||
.names = { "Ultramarine" },
|
||||
.lines = FASTFETCH_DATATEXT_LOGO_ULTRAMARINE,
|
||||
.colors = {
|
||||
FF_COLOR_FG_BLUE,
|
||||
|
||||
@@ -12,7 +12,12 @@ static FF_LIBRARY_SYMBOL(ResizeImage)
|
||||
}
|
||||
|
||||
FFLogoImageResult ffLogoPrintImageIM6(FFLogoRequestData* requestData) {
|
||||
FF_LIBRARY_LOAD(imageMagick, FF_LOGO_IMAGE_RESULT_INIT_ERROR, "libMagickCore-6.Q16HDRI" FF_LIBRARY_EXTENSION, 8, "libMagickCore-6.Q16" FF_LIBRARY_EXTENSION, 8)
|
||||
// clang-format off
|
||||
FF_LIBRARY_LOAD(imageMagick, FF_LOGO_IMAGE_RESULT_INIT_ERROR,
|
||||
"libMagickCore-6.Q16HDRI" FF_LIBRARY_EXTENSION, 8,
|
||||
"libMagickCore-6.Q16" FF_LIBRARY_EXTENSION, 8
|
||||
)
|
||||
// clang-format on
|
||||
FF_LIBRARY_LOAD_SYMBOL_ADDRESS(imageMagick, ffResizeImage, ResizeImage, FF_LOGO_IMAGE_RESULT_INIT_ERROR)
|
||||
|
||||
FFLogoImageResult result = ffLogoPrintImageImpl(requestData, &(FFIMData) {
|
||||
|
||||
+11
-1
@@ -12,8 +12,18 @@ static FF_LIBRARY_SYMBOL(ResizeImage)
|
||||
}
|
||||
|
||||
FFLogoImageResult ffLogoPrintImageIM7(FFLogoRequestData* requestData) {
|
||||
FF_LIBRARY_LOAD(imageMagick, FF_LOGO_IMAGE_RESULT_INIT_ERROR, "libMagickCore-7.Q16HDRI" FF_LIBRARY_EXTENSION, 11, "libMagickCore-7.Q16" FF_LIBRARY_EXTENSION, 11, "libMagickCore-7.Q16HDRI-10" FF_LIBRARY_EXTENSION, -1 // Required for Windows
|
||||
// clang-format off
|
||||
#if _WIN32
|
||||
FF_LIBRARY_LOAD(imageMagick, FF_LOGO_IMAGE_RESULT_INIT_ERROR,
|
||||
"libMagickCore-7.Q16HDRI-10" FF_LIBRARY_EXTENSION, 0
|
||||
)
|
||||
#else
|
||||
FF_LIBRARY_LOAD(imageMagick, FF_LOGO_IMAGE_RESULT_INIT_ERROR,
|
||||
"libMagickCore-7.Q16HDRI" FF_LIBRARY_EXTENSION, 11,
|
||||
"libMagickCore-7.Q16" FF_LIBRARY_EXTENSION, 11
|
||||
)
|
||||
#endif
|
||||
// clang-format on
|
||||
FF_LIBRARY_LOAD_SYMBOL_ADDRESS(imageMagick, ffResizeImage, ResizeImage, FF_LOGO_IMAGE_RESULT_INIT_ERROR)
|
||||
|
||||
FFLogoImageResult result = ffLogoPrintImageImpl(requestData, &(FFIMData) {
|
||||
|
||||
@@ -553,8 +553,11 @@ static bool printImageKitty(FFLogoRequestData* requestData, const ImageData* ima
|
||||
#ifdef FF_HAVE_CHAFA
|
||||
#include <chafa.h>
|
||||
static bool printImageChafa(FFLogoRequestData* requestData, const ImageData* imageData) {
|
||||
FF_LIBRARY_LOAD(chafa, false, "libchafa" FF_LIBRARY_EXTENSION, 1, "libchafa-0" FF_LIBRARY_EXTENSION, -1 // Required for Windows
|
||||
)
|
||||
#if _WIN32
|
||||
FF_LIBRARY_LOAD(chafa, false, "libchafa-0" FF_LIBRARY_EXTENSION, 0)
|
||||
#else
|
||||
FF_LIBRARY_LOAD(chafa, false, "libchafa" FF_LIBRARY_EXTENSION, 1)
|
||||
#endif
|
||||
FF_LIBRARY_LOAD_SYMBOL(chafa, chafa_symbol_map_new, false)
|
||||
FF_LIBRARY_LOAD_SYMBOL(chafa, chafa_symbol_map_apply_selectors, false)
|
||||
FF_LIBRARY_LOAD_SYMBOL(chafa, chafa_canvas_config_new, false)
|
||||
|
||||
@@ -7,6 +7,14 @@
|
||||
|
||||
#define FF_BLUETOOTHRADIO_DISPLAY_NAME "Bluetooth Radio"
|
||||
|
||||
static void destroyBluetoothRadios(FFlist* radios) {
|
||||
FF_LIST_FOR_EACH (FFBluetoothRadioResult, radio, *radios) {
|
||||
ffStrbufDestroy(&radio->name);
|
||||
ffStrbufDestroy(&radio->address);
|
||||
ffStrbufDestroy(&radio->vendor);
|
||||
}
|
||||
}
|
||||
|
||||
static void printDevice(FFBluetoothRadioOptions* options, const FFBluetoothRadioResult* radio, uint8_t index) {
|
||||
FF_STRBUF_AUTO_DESTROY key = ffStrbufCreate();
|
||||
if (options->moduleArgs.key.length == 0) {
|
||||
@@ -113,14 +121,11 @@ bool ffPrintBluetoothRadio(FFBluetoothRadioOptions* options) {
|
||||
} else {
|
||||
ffPrintError(FF_BLUETOOTHRADIO_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "No devices detected");
|
||||
}
|
||||
destroyBluetoothRadios(&radios);
|
||||
return false;
|
||||
}
|
||||
|
||||
FF_LIST_FOR_EACH (FFBluetoothRadioResult, radio, radios) {
|
||||
ffStrbufDestroy(&radio->name);
|
||||
ffStrbufDestroy(&radio->address);
|
||||
ffStrbufDestroy(&radio->vendor);
|
||||
}
|
||||
destroyBluetoothRadios(&radios);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -171,11 +176,7 @@ bool ffGenerateBluetoothRadioJsonResult(FF_A_UNUSED FFBluetoothRadioOptions* opt
|
||||
yyjson_mut_obj_add_bool(doc, obj, "connectable", item->connectable);
|
||||
}
|
||||
|
||||
FF_LIST_FOR_EACH (FFBluetoothRadioResult, radio, results) {
|
||||
ffStrbufDestroy(&radio->name);
|
||||
ffStrbufDestroy(&radio->address);
|
||||
ffStrbufDestroy(&radio->vendor);
|
||||
}
|
||||
destroyBluetoothRadios(&results);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ bool ffPrintCamera(FFCameraOptions* options) {
|
||||
|
||||
FF_LIST_FOR_EACH (FFCameraResult, dev, result) {
|
||||
ffStrbufDestroy(&dev->name);
|
||||
ffStrbufDestroy(&dev->vendor);
|
||||
ffStrbufDestroy(&dev->id);
|
||||
ffStrbufDestroy(&dev->colorspace);
|
||||
}
|
||||
@@ -99,6 +100,7 @@ bool ffGenerateCameraJsonResult(FF_A_UNUSED FFCameraOptions* options, yyjson_mut
|
||||
|
||||
FF_LIST_FOR_EACH (FFCameraResult, dev, result) {
|
||||
ffStrbufDestroy(&dev->name);
|
||||
ffStrbufDestroy(&dev->vendor);
|
||||
ffStrbufDestroy(&dev->id);
|
||||
ffStrbufDestroy(&dev->colorspace);
|
||||
}
|
||||
|
||||
@@ -47,10 +47,6 @@ bool ffPrintCPU(FFCPUOptions* options) {
|
||||
|
||||
FF_STRBUF_AUTO_DESTROY str = ffStrbufCreate();
|
||||
|
||||
if (cpu.packages > 1) {
|
||||
ffStrbufAppendF(&str, "%u x ", cpu.packages);
|
||||
}
|
||||
|
||||
if (cpu.name.length > 0) {
|
||||
ffStrbufAppend(&str, &cpu.name);
|
||||
} else if (cpu.vendor.length > 0) {
|
||||
|
||||
@@ -117,6 +117,7 @@ void ffInitSeparatorOptions(FFSeparatorOptions* options) {
|
||||
|
||||
void ffDestroySeparatorOptions(FFSeparatorOptions* options) {
|
||||
ffStrbufDestroy(&options->string);
|
||||
ffStrbufDestroy(&options->outputColor);
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffSeparatorModuleInfo = {
|
||||
|
||||
@@ -87,6 +87,7 @@ void ffInitWeatherOptions(FFWeatherOptions* options) {
|
||||
void ffDestroyWeatherOptions(FFWeatherOptions* options) {
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
|
||||
ffStrbufDestroy(&options->location);
|
||||
ffStrbufDestroy(&options->outputFormat);
|
||||
}
|
||||
|
||||
|
||||
+35
-7
@@ -5,6 +5,10 @@
|
||||
#include "common/strutil.h"
|
||||
#include "options/display.h"
|
||||
|
||||
#if !FF_MODULE_DISABLE_TERMINALTHEME
|
||||
#include "detection/terminaltheme/terminaltheme.h"
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
const char* ffOptionsParseDisplayJsonConfig(FFOptionsDisplay* options, yyjson_val* root, yyjson_val** pkey) {
|
||||
@@ -825,11 +829,22 @@ bool ffOptionsParseDisplayCommandLine(FFOptionsDisplay* options, const char* key
|
||||
}
|
||||
|
||||
void ffOptionsInitDisplay(FFOptionsDisplay* options) {
|
||||
bool terminalLightTheme = false;
|
||||
#if !FF_MODULE_DISABLE_TERMINALTHEME
|
||||
{
|
||||
// don't enable bright color if the terminal is in light mode
|
||||
FFTerminalThemeResult result;
|
||||
if (ffDetectTerminalTheme(&result, true /* forceEnv for performance */) && !result.bg.dark) {
|
||||
terminalLightTheme = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
ffStrbufInit(&options->colorKeys);
|
||||
ffStrbufInit(&options->colorTitle);
|
||||
ffStrbufInit(&options->colorOutput);
|
||||
ffStrbufInit(&options->colorSeparator);
|
||||
options->brightColor = !instance.state.terminalLightTheme;
|
||||
options->brightColor = !terminalLightTheme;
|
||||
ffStrbufInitStatic(&options->keyValueSeparator, ": ");
|
||||
|
||||
options->showErrors = false;
|
||||
@@ -856,8 +871,8 @@ void ffOptionsInitDisplay(FFOptionsDisplay* options) {
|
||||
options->tempUnit = FF_TEMPERATURE_UNIT_DEFAULT;
|
||||
options->tempNdigits = 1;
|
||||
ffStrbufInitStatic(&options->tempColorGreen, FF_COLOR_FG_GREEN);
|
||||
ffStrbufInitStatic(&options->tempColorYellow, instance.state.terminalLightTheme ? FF_COLOR_FG_YELLOW : FF_COLOR_FG_LIGHT_YELLOW);
|
||||
ffStrbufInitStatic(&options->tempColorRed, instance.state.terminalLightTheme ? FF_COLOR_FG_RED : FF_COLOR_FG_LIGHT_RED);
|
||||
ffStrbufInitStatic(&options->tempColorYellow, terminalLightTheme ? FF_COLOR_FG_YELLOW : FF_COLOR_FG_LIGHT_YELLOW);
|
||||
ffStrbufInitStatic(&options->tempColorRed, terminalLightTheme ? FF_COLOR_FG_RED : FF_COLOR_FG_LIGHT_RED);
|
||||
options->tempSpaceBeforeUnit = FF_SPACE_BEFORE_UNIT_DEFAULT;
|
||||
|
||||
ffStrbufInitStatic(&options->barCharElapsed, "■");
|
||||
@@ -867,8 +882,8 @@ void ffOptionsInitDisplay(FFOptionsDisplay* options) {
|
||||
ffStrbufInit(&options->barBorderLeftElapsed);
|
||||
ffStrbufInit(&options->barBorderRightElapsed);
|
||||
ffStrbufInitStatic(&options->barColorElapsed, "auto");
|
||||
ffStrbufInitStatic(&options->barColorTotal, instance.state.terminalLightTheme ? FF_COLOR_FG_WHITE : FF_COLOR_FG_LIGHT_WHITE);
|
||||
ffStrbufInitStatic(&options->barColorBorder, instance.state.terminalLightTheme ? FF_COLOR_FG_WHITE : FF_COLOR_FG_LIGHT_WHITE);
|
||||
ffStrbufInitStatic(&options->barColorTotal, terminalLightTheme ? FF_COLOR_FG_WHITE : FF_COLOR_FG_LIGHT_WHITE);
|
||||
ffStrbufInitStatic(&options->barColorBorder, terminalLightTheme ? FF_COLOR_FG_WHITE : FF_COLOR_FG_LIGHT_WHITE);
|
||||
options->barWidth = 10;
|
||||
|
||||
options->durationAbbreviation = false;
|
||||
@@ -876,8 +891,8 @@ void ffOptionsInitDisplay(FFOptionsDisplay* options) {
|
||||
options->percentType = FF_PERCENTAGE_TYPE_NUM_BIT | FF_PERCENTAGE_TYPE_NUM_COLOR_BIT;
|
||||
options->percentNdigits = 0;
|
||||
ffStrbufInitStatic(&options->percentColorGreen, FF_COLOR_FG_GREEN);
|
||||
ffStrbufInitStatic(&options->percentColorYellow, instance.state.terminalLightTheme ? FF_COLOR_FG_YELLOW : FF_COLOR_FG_LIGHT_YELLOW);
|
||||
ffStrbufInitStatic(&options->percentColorRed, instance.state.terminalLightTheme ? FF_COLOR_FG_RED : FF_COLOR_FG_LIGHT_RED);
|
||||
ffStrbufInitStatic(&options->percentColorYellow, terminalLightTheme ? FF_COLOR_FG_YELLOW : FF_COLOR_FG_LIGHT_YELLOW);
|
||||
ffStrbufInitStatic(&options->percentColorRed, terminalLightTheme ? FF_COLOR_FG_RED : FF_COLOR_FG_LIGHT_RED);
|
||||
options->percentSpaceBeforeUnit = FF_SPACE_BEFORE_UNIT_DEFAULT;
|
||||
options->percentWidth = 0;
|
||||
|
||||
@@ -897,6 +912,19 @@ void ffOptionsDestroyDisplay(FFOptionsDisplay* options) {
|
||||
ffStrbufDestroy(&options->keyValueSeparator);
|
||||
ffStrbufDestroy(&options->barCharElapsed);
|
||||
ffStrbufDestroy(&options->barCharTotal);
|
||||
ffStrbufDestroy(&options->barBorderLeft);
|
||||
ffStrbufDestroy(&options->barBorderRight);
|
||||
ffStrbufDestroy(&options->barBorderLeftElapsed);
|
||||
ffStrbufDestroy(&options->barBorderRightElapsed);
|
||||
ffStrbufDestroy(&options->barColorElapsed);
|
||||
ffStrbufDestroy(&options->barColorTotal);
|
||||
ffStrbufDestroy(&options->barColorBorder);
|
||||
ffStrbufDestroy(&options->tempColorGreen);
|
||||
ffStrbufDestroy(&options->tempColorYellow);
|
||||
ffStrbufDestroy(&options->tempColorRed);
|
||||
ffStrbufDestroy(&options->percentColorGreen);
|
||||
ffStrbufDestroy(&options->percentColorYellow);
|
||||
ffStrbufDestroy(&options->percentColorRed);
|
||||
FF_LIST_FOR_EACH (FFstrbuf, item, options->constants) {
|
||||
ffStrbufDestroy(item);
|
||||
}
|
||||
|
||||
+27
-1
@@ -414,7 +414,7 @@ int main(void) {
|
||||
ffStrbufInit(&strbuf);
|
||||
ffStrbufEnsureFixedLengthFree(&strbuf, 0);
|
||||
VERIFY(strbuf.length == 0);
|
||||
VERIFY(strbuf.allocated == 0);
|
||||
VERIFY(strbuf.allocated == 1);
|
||||
ffStrbufDestroy(&strbuf);
|
||||
|
||||
// ffStrbufEnsureFixedLengthFree / empty buffer but oldFree >= newFree
|
||||
@@ -1139,6 +1139,32 @@ int main(void) {
|
||||
VERIFY(strbuf.allocated == 0);
|
||||
ffStrbufDestroy(&strbuf);
|
||||
|
||||
#if FASTFETCH_STRBUF_DEFAULT_ALLOC == 32
|
||||
ffStrbufEnsureFreeNoCheck(&strbuf, 1);
|
||||
VERIFY(strbuf.allocated == 32);
|
||||
ffStrbufDestroy(&strbuf);
|
||||
|
||||
ffStrbufEnsureFreeNoCheck(&strbuf, 31);
|
||||
VERIFY(strbuf.allocated == 32);
|
||||
ffStrbufDestroy(&strbuf);
|
||||
|
||||
ffStrbufEnsureFreeNoCheck(&strbuf, 32);
|
||||
VERIFY(strbuf.allocated == 64);
|
||||
ffStrbufDestroy(&strbuf);
|
||||
|
||||
ffStrbufEnsureFreeNoCheck(&strbuf, 33);
|
||||
VERIFY(strbuf.allocated == 64);
|
||||
ffStrbufDestroy(&strbuf);
|
||||
|
||||
ffStrbufEnsureFreeNoCheck(&strbuf, 63);
|
||||
VERIFY(strbuf.allocated == 64);
|
||||
ffStrbufDestroy(&strbuf);
|
||||
|
||||
ffStrbufEnsureFreeNoCheck(&strbuf, 64);
|
||||
VERIFY(strbuf.allocated == 128);
|
||||
ffStrbufDestroy(&strbuf);
|
||||
#endif
|
||||
|
||||
// Success
|
||||
puts("\e[32mAll tests passed!" FASTFETCH_TEXT_MODIFIER_RESET);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user