early-access version 1617

This commit is contained in:
pineappleEA
2021-04-20 21:40:33 +02:00
parent 242b6f6b49
commit f46563104f
510 changed files with 141726 additions and 62846 deletions

View File

@@ -29,7 +29,6 @@
#include <signal.h>
#include "SDL_stdinc.h"
#include "SDL_assert.h"
#include "../../core/unix/SDL_poll.h"
#include "SDL_waylandvideo.h"
@@ -181,12 +180,20 @@ mime_data_list_find(struct wl_list* list,
static int
mime_data_list_add(struct wl_list* list,
const char* mime_type,
void* buffer, size_t length)
const void* buffer, size_t length)
{
int status = 0;
size_t mime_type_length = 0;
SDL_MimeDataList *mime_data = NULL;
void *internal_buffer = NULL;
if (buffer != NULL) {
internal_buffer = SDL_malloc(length);
if (internal_buffer == NULL) {
return SDL_OutOfMemory();
}
SDL_memcpy(internal_buffer, buffer, length);
}
mime_data = mime_data_list_find(list, mime_type);
@@ -211,8 +218,10 @@ mime_data_list_add(struct wl_list* list,
if (mime_data->data != NULL) {
SDL_free(mime_data->data);
}
mime_data->data = buffer;
mime_data->data = internal_buffer;
mime_data->length = length;
} else {
SDL_free(internal_buffer);
}
return status;
@@ -264,18 +273,7 @@ int Wayland_data_source_add_data(SDL_WaylandDataSource *source,
const void *buffer,
size_t length)
{
int status = 0;
if (length > 0) {
void *internal_buffer = SDL_malloc(length);
if (internal_buffer == NULL) {
status = SDL_OutOfMemory();
} else {
SDL_memcpy(internal_buffer, buffer, length);
status = mime_data_list_add(&source->mimes, mime_type,
internal_buffer, length);
}
}
return status;
return mime_data_list_add(&source->mimes, mime_type, buffer, length);
}
SDL_bool