Compilation fixes.

This commit is contained in:
Martín Lucas Golini
2026-09-03 20:29:57 -03:00
parent e45ff6af00
commit 090e7c1288
11 changed files with 29 additions and 25 deletions
@@ -12,7 +12,8 @@
#include <thread>
#include <type_traits>
#if EE_PLATFORM != EE_PLATFORM_WIN && EE_PLATFORM != EE_PLATFORM_EMSCRIPTEN
#if EE_PLATFORM != EE_PLATFORM_WIN && EE_PLATFORM != EE_PLATFORM_EMSCRIPTEN && \
EE_PLATFORM != EE_PLATFORM_ANDROID
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/stat.h>
@@ -89,7 +90,8 @@ bool decodeBase64( std::string_view input, bool finalChunk, std::vector<Uint8>&
}
bool readSharedMemory( const KittyGraphicsCommandData& data, std::vector<Uint8>& output ) {
#if EE_PLATFORM == EE_PLATFORM_WIN || EE_PLATFORM == EE_PLATFORM_EMSCRIPTEN
#if EE_PLATFORM == EE_PLATFORM_WIN || EE_PLATFORM == EE_PLATFORM_EMSCRIPTEN || \
EE_PLATFORM == EE_PLATFORM_ANDROID
(void)data;
(void)output;
return false;
@@ -597,7 +599,7 @@ KittyGraphicsHandleResult KittyGraphicsProtocol::finishTransfer( PendingTransfer
std::vector<Uint8>* destinationPixels = nullptr;
bool createdFrame = false;
if ( frameNumber == 1 ) {
if ( !image->second.rgba.unique() )
if ( image->second.rgba.use_count() != 1 )
image->second.rgba = std::make_shared<std::vector<Uint8>>( *image->second.rgba );
destinationPixels = image->second.rgba.get();
} else {
@@ -749,7 +751,7 @@ KittyGraphicsHandleResult KittyGraphicsProtocol::finishTransfer( PendingTransfer
mPrimaryPlacements.end() );
}
std::shared_ptr<std::vector<Uint8>> pixelStorage;
if ( existing != mImages.end() && existing->second.rgba.unique() ) {
if ( existing != mImages.end() && existing->second.rgba.use_count() == 1 ) {
pixelStorage = existing->second.rgba;
pixelStorage->assign( pixels.begin(), pixels.end() );
if ( format == 24 )
@@ -1282,7 +1284,7 @@ KittyGraphicsProtocol::composeFrames( const KittyGraphicsCommandData& data ) {
source->data() + static_cast<size_t>( sourceY + row ) * imageStride +
static_cast<size_t>( sourceX ) * 4,
rowBytes );
if ( destinationFrame == 1 && !image->second.rgba.unique() ) {
if ( destinationFrame == 1 && image->second.rgba.use_count() != 1 ) {
image->second.rgba = std::make_shared<std::vector<Uint8>>( *image->second.rgba );
destination = image->second.rgba.get();
}
+4 -2
View File
@@ -14,7 +14,8 @@
#include <limits>
#include <thread>
#if EE_PLATFORM != EE_PLATFORM_WIN && EE_PLATFORM != EE_PLATFORM_EMSCRIPTEN
#if EE_PLATFORM != EE_PLATFORM_WIN && EE_PLATFORM != EE_PLATFORM_EMSCRIPTEN && \
EE_PLATFORM != EE_PLATFORM_ANDROID
#include <fcntl.h>
#include <sys/mman.h>
#include <unistd.h>
@@ -1035,7 +1036,8 @@ UTEST( eterm, kitty_graphics_reuses_unreferenced_replacement_pixel_storage ) {
EXPECT_TRUE( expected == *protocol.imagePixels( 91 ) );
}
#if EE_PLATFORM != EE_PLATFORM_WIN && EE_PLATFORM != EE_PLATFORM_EMSCRIPTEN
#if EE_PLATFORM != EE_PLATFORM_WIN && EE_PLATFORM != EE_PLATFORM_EMSCRIPTEN && \
EE_PLATFORM != EE_PLATFORM_ANDROID
UTEST( eterm, kitty_graphics_reads_and_unlinks_posix_shared_memory ) {
// mpv uses the Linux-compatible form without the optional leading slash.
const std::string name = "eterm-kitty-unit-" + std::to_string( getpid() );
@@ -40,9 +40,9 @@ class AIAssistantPlugin : public PluginBase {
std::string getDescription() override { return Definition().description; }
bool hasSettingsPage() const override { return true; }
bool hasSettingsPage() const { return true; }
void registerSettings( SettingsPage& page ) override;
void registerSettings( SettingsPage& page );
const LLMProviders& getProviders() { return mProviders; }
@@ -95,9 +95,9 @@ class AutoCompletePlugin : public Plugin {
bool isReady() const override { return true; }
bool hasSettingsPage() const override { return true; }
bool hasSettingsPage() const { return true; }
void registerSettings( SettingsPage& page ) override;
void registerSettings( SettingsPage& page );
void onRegister( UICodeEditor* ) override;
@@ -68,9 +68,9 @@ class DebuggerPlugin : public PluginBase {
std::string getDescription() override { return Definition().description; }
bool hasSettingsPage() const override { return true; }
bool hasSettingsPage() const { return true; }
void registerSettings( SettingsPage& page ) override;
void registerSettings( SettingsPage& page );
void onSaveState( IniFile* state ) override;
@@ -43,9 +43,9 @@ class DiscordRPCplugin : public PluginBase {
std::string getDescription() override { return Definition().description; }
bool hasSettingsPage() const override { return true; }
bool hasSettingsPage() const { return true; }
void registerSettings( SettingsPage& page ) override;
void registerSettings( SettingsPage& page );
protected:
DiscordIPC mIPC;
@@ -50,9 +50,9 @@ class FormatterPlugin : public Plugin {
std::string getDescription() { return Definition().description; }
bool hasSettingsPage() const override { return true; }
bool hasSettingsPage() const { return true; }
void registerSettings( SettingsPage& page ) override;
void registerSettings( SettingsPage& page );
virtual String::HashType getConfigFileHash() { return mConfigHash; }
+2 -2
View File
@@ -83,9 +83,9 @@ class GitPlugin : public PluginBase {
std::string getDescription() override { return Definition().description; }
bool hasSettingsPage() const override { return true; }
bool hasSettingsPage() const { return true; }
void registerSettings( SettingsPage& page ) override;
void registerSettings( SettingsPage& page );
void onSaveState( IniFile* state ) override;
@@ -76,9 +76,9 @@ class LinterPlugin : public Plugin {
std::string getDescription() { return Definition().description; }
bool hasSettingsPage() const override { return true; }
bool hasSettingsPage() const { return true; }
void registerSettings( SettingsPage& page ) override;
void registerSettings( SettingsPage& page );
virtual String::HashType getConfigFileHash() { return mConfigHash; }
@@ -39,9 +39,9 @@ class SpellCheckerPlugin : public PluginBase {
std::string getDescription() override { return Definition().description; }
bool hasSettingsPage() const override { return true; }
bool hasSettingsPage() const { return true; }
void registerSettings( SettingsPage& page ) override;
void registerSettings( SettingsPage& page );
void drawAfterLineText( UICodeEditor* editor, const Int64& index, Vector2f position,
const Float& fontSize, const Float& lineHeight ) override;
@@ -36,9 +36,9 @@ class XMLToolsPlugin : public PluginBase {
std::string getDescription() override { return Definition().description; }
bool hasSettingsPage() const override { return true; }
bool hasSettingsPage() const { return true; }
void registerSettings( SettingsPage& page ) override;
void registerSettings( SettingsPage& page );
bool getHighlightMatch() const;