mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-20 04:18:26 +01:00
make WebPSetWorkerInterface() check its arguments
Change-Id: I522c58cfe05e864a50cacb58bdfa14d5369c6d60
This commit is contained in:
parent
a9ef7ef991
commit
5584d9d2fc
@ -290,9 +290,15 @@ static WebPWorkerInterface g_worker_interface = {
|
||||
Init, Reset, Sync, Launch, Execute, End
|
||||
};
|
||||
|
||||
void WebPSetWorkerInterface(const WebPWorkerInterface* const interface) {
|
||||
assert(interface != NULL);
|
||||
int WebPSetWorkerInterface(const WebPWorkerInterface* const interface) {
|
||||
if (interface == NULL ||
|
||||
interface->Init == NULL || interface->Reset == NULL ||
|
||||
interface->Sync == NULL || interface->Launch == NULL ||
|
||||
interface->Execute == NULL || interface->End == NULL) {
|
||||
return 0;
|
||||
}
|
||||
g_worker_interface = *interface;
|
||||
return 1;
|
||||
}
|
||||
|
||||
const WebPWorkerInterface* WebPGetWorkerInterface(void) {
|
||||
@ -300,4 +306,3 @@ const WebPWorkerInterface* WebPGetWorkerInterface(void) {
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
@ -77,8 +77,8 @@ typedef struct {
|
||||
// should be done before any workers are started, i.e., before any encoding or
|
||||
// decoding takes place. The contents of the interface struct are copied, it
|
||||
// is safe to free the corresponding memory after this call. This function is
|
||||
// not thread-safe.
|
||||
WEBP_EXTERN(void) WebPSetWorkerInterface(
|
||||
// not thread-safe. Return false in case of invalid pointer or methods.
|
||||
WEBP_EXTERN(int) WebPSetWorkerInterface(
|
||||
const WebPWorkerInterface* const interface);
|
||||
|
||||
// Retrieve the currently set thread worker interface.
|
||||
|
Loading…
Reference in New Issue
Block a user