修改使用gcc14编译时的问题

This commit is contained in:
tianshaoshuai 2024-09-06 10:43:44 +08:00 committed by openkylin-cibot
parent 4ece889314
commit 005dac38eb
2 changed files with 128 additions and 0 deletions

127
debian/patches/0039-gcc14.patch vendored Normal file
View File

@ -0,0 +1,127 @@
From: tianshaoshuai <tianshaoshuai@kylinos.cn>
Date: Fri, 6 Sep 2024 10:43:44 +0800
Subject: =?utf-8?b?5L+u5pS55L2/55SoZ2NjMTTnvJbor5Hml7bnmoTpl67popg=?=
---
src/hardware/test/kybluetooth-test.c | 7 +++----
src/storage/libkystorage.c | 9 ++++++---
src/systeminfo/libkysysinfo.c | 5 ++---
3 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/src/hardware/test/kybluetooth-test.c b/src/hardware/test/kybluetooth-test.c
index 66f6099..4f53ee7 100644
--- a/src/hardware/test/kybluetooth-test.c
+++ b/src/hardware/test/kybluetooth-test.c
@@ -24,7 +24,6 @@
#include <stdio.h>
#include <stdlib.h>
-
int main()
{
int i = 0;
@@ -42,7 +41,7 @@ int main()
int *id = (int *)kdk_bluetooth_get_device_id();
if(NULL == id)
return 0;
- do
+ for(; id[i]; i++)
{
printf("id = %d\n",id[i]);
@@ -136,8 +135,8 @@ int main()
kdk_bluetooth_free_major_class(major);
}
- free((int*)id[i]);
- }while(id[i]);
+ // free((int*)id[i]);
+ }
free((int**)id);
return 0;
}
diff --git a/src/storage/libkystorage.c b/src/storage/libkystorage.c
index 9000758..b8251ab 100644
--- a/src/storage/libkystorage.c
+++ b/src/storage/libkystorage.c
@@ -228,6 +228,7 @@ char *kdk_storage_get_default_desktop_path()
sprintf(path, "%s/%s", getenv("HOME"), "desktop");
if (0 == access(path, F_OK))
return strdup(path);
+ return NULL;
}
char *kdk_storage_get_default_documents_path()
@@ -239,6 +240,7 @@ char *kdk_storage_get_default_documents_path()
sprintf(path, "%s/%s", getenv("HOME"), "documents");
if (0 == access(path, F_OK))
return strdup(path);
+ return NULL;
}
char *kdk_storage_get_default_internetCache_path(char *name)
@@ -272,6 +274,7 @@ char *kdk_storage_get_default_download_path()
sprintf(path, "%s/%s", getenv("HOME"), "download");
if (0 == access(path, F_OK))
return strdup(path);
+ return NULL;
}
char *kdk_storage_get_file_ContentType(char *file_name)
@@ -315,7 +318,7 @@ char *kdk_storage_get_file_dateChange(char *file_name)
return NULL;
}
- char *time[32];
+ char time[32];
strftime(time, sizeof(time), "%Y-%m-%d %H:%M:%S", localtime(&file_stat.st_ctime));
return strdup(time);
@@ -331,7 +334,7 @@ char *kdk_storage_get_file_dateModify(char *file_name)
return NULL;
}
- char *time[32];
+ char time[32];
strftime(time, sizeof(time), "%Y-%m-%d %H:%M:%S", localtime(&file_stat.st_mtime));
return strdup(time);
@@ -347,7 +350,7 @@ char *kdk_storage_get_file_dateAccess(char *file_name)
return NULL;
}
- char *time[32];
+ char time[32];
strftime(time, sizeof(time), "%Y-%m-%d %H:%M:%S", localtime(&file_stat.st_atime));
return strdup(time);
diff --git a/src/systeminfo/libkysysinfo.c b/src/systeminfo/libkysysinfo.c
index fe47434..2a63597 100644
--- a/src/systeminfo/libkysysinfo.c
+++ b/src/systeminfo/libkysysinfo.c
@@ -2731,7 +2731,7 @@ static DBusHandlerResult signal_handler(DBusConnection *connection, DBusMessage
dbus_message_iter_next(&value_iter);
dbus_message_iter_get_basic(&value_iter, &session_path);
- //切换tty会出发信号切换到tty1 tty2等终端但这些没有用户登录时不相应
+ // 切换tty会出发信号切换到tty1 tty2等终端但这些没有用户登录时不相应
if (0 == strcmp("/", session_path))
{
// free(curr_user);
@@ -2777,7 +2777,6 @@ static DBusHandlerResult signal_handler(DBusConnection *connection, DBusMessage
free(curr_user);
curr_user = strdup(response);
}
-
}
return DBUS_HANDLER_RESULT_HANDLED;
@@ -2809,7 +2808,7 @@ void *dbus_listener_thread(void *data)
dbus_bus_add_match(connection,
"type='signal',path='/org/freedesktop/login1/seat/seat0',interface='org.freedesktop.DBus.Properties',member='PropertiesChanged'",
&error);
- dbus_connection_add_filter(connection, (DBusHandleMessageFunction)signal_handler, NULL, NULL);
+ dbus_connection_add_filter(connection, signal_handler, NULL, NULL);
// 循环监听DBus消息
while (true)

View File

@ -36,3 +36,4 @@
0036-111.patch
0037-1111.patch
0038-1111.patch
0039-gcc14.patch