Fixed + enabled all compiler warnings

This commit is contained in:
Jordon Brooks 2024-06-06 18:15:51 +01:00
parent 6b90c9f76a
commit c68c039c70
Signed by: jordon
GPG key ID: DBD9758CD53E786A
16 changed files with 72 additions and 22 deletions

View file

@ -17,7 +17,7 @@
#include "Version.h"
bool HarmonyLink_Init(void)
bool HL_Init(void)
{
HL_version_print();
return 1;

View file

@ -23,7 +23,8 @@ FBattery* HL_FBattery_Init(bool has_battery, bool is_connected_to_ac, unsigned c
if (battery == NULL) {
fprintf(stderr, "Memory allocation failed for FCPUInfo.\n");
exit(EXIT_FAILURE);
return NULL;
//exit(EXIT_FAILURE);
}
battery->has_battery = has_battery;

View file

@ -13,28 +13,43 @@
// limitations under the License.
#include <malloc.h>
#include <string.h>
#include <wchar.h>
#include "Structs/OSInfo.h"
#ifdef _WIN32
#define strdup _strdup
#endif
FOSVerInfo* FOSVerInfo_Init(char* name, char* version, unsigned int id, char* version_id, char* version_codename, char* pretty_name,
char* variant_id) {
FOSVerInfo* OSVerInfo = (FOSVerInfo*)malloc(sizeof(FOSVerInfo));
if (OSVerInfo == NULL) {
fprintf(stderr, "Memory allocation failed for FOSVerInfo.\n");
exit(EXIT_FAILURE);
return NULL;
//exit(EXIT_FAILURE);
}
OSVerInfo->name = name;
OSVerInfo->version = version;
OSVerInfo->name = strdup(name);
OSVerInfo->version = strdup(version);
OSVerInfo->id = id;
OSVerInfo->variant_id = version_id;
OSVerInfo->version_codename = version_codename;
OSVerInfo->pretty_name = pretty_name;
OSVerInfo->version_id = variant_id;
OSVerInfo->version_id = strdup(version_id);
OSVerInfo->version_codename = strdup(version_codename);
OSVerInfo->pretty_name = strdup(pretty_name);
OSVerInfo->variant_id = strdup(variant_id);
return OSVerInfo;
}
void HL_FOSVerInfo_Free(FOSVerInfo *OSVerInfo) {
void HL_FOSVerInfo_Free(FOSVerInfo* osVerInfo) {
if (!osVerInfo) return;
free(osVerInfo->name);
free(osVerInfo->version);
free(osVerInfo->version_id);
free(osVerInfo->version_codename);
free(osVerInfo->pretty_name);
free(osVerInfo->variant_id);
free(osVerInfo);
}

View file

@ -41,4 +41,4 @@ wchar_t* convertToWideChar(const char* str) {
#endif
return wstr;
}
}

View file

@ -16,6 +16,8 @@
#include <Version.generated.h>
#include <stdio.h>
#include <string.h>
#include <wchar.h>
char* HL_version_get_string(void)
{