blob: Use intptr_t instead of ssize_t
ssize_t is a GNU extension and is not available on Windows or MacOS.
Instead, we use intptr_t which should be effectively equivalent and is
part of the C standard. This should fix the Windows and Mac OS builds.
Fixes: 3af1c82989
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103253
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Tested-by: Vinson Lee <vlee@freedesktop.org>
This commit is contained in:
@@ -158,10 +158,10 @@ blob_write_bytes(struct blob *blob, const void *bytes, size_t to_write)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize_t
|
intptr_t
|
||||||
blob_reserve_bytes(struct blob *blob, size_t to_write)
|
blob_reserve_bytes(struct blob *blob, size_t to_write)
|
||||||
{
|
{
|
||||||
ssize_t ret;
|
intptr_t ret;
|
||||||
|
|
||||||
if (! grow_to_fit (blob, to_write))
|
if (! grow_to_fit (blob, to_write))
|
||||||
return -1;
|
return -1;
|
||||||
@@ -172,14 +172,14 @@ blob_reserve_bytes(struct blob *blob, size_t to_write)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize_t
|
intptr_t
|
||||||
blob_reserve_uint32(struct blob *blob)
|
blob_reserve_uint32(struct blob *blob)
|
||||||
{
|
{
|
||||||
align_blob(blob, sizeof(uint32_t));
|
align_blob(blob, sizeof(uint32_t));
|
||||||
return blob_reserve_bytes(blob, sizeof(uint32_t));
|
return blob_reserve_bytes(blob, sizeof(uint32_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize_t
|
intptr_t
|
||||||
blob_reserve_intptr(struct blob *blob)
|
blob_reserve_intptr(struct blob *blob)
|
||||||
{
|
{
|
||||||
align_blob(blob, sizeof(intptr_t));
|
align_blob(blob, sizeof(intptr_t));
|
||||||
|
@@ -135,7 +135,7 @@ blob_write_bytes(struct blob *blob, const void *bytes, size_t to_write);
|
|||||||
* \return An offset to space allocated within \blob to which \to_write bytes
|
* \return An offset to space allocated within \blob to which \to_write bytes
|
||||||
* can be written, (or -1 in case of any allocation error).
|
* can be written, (or -1 in case of any allocation error).
|
||||||
*/
|
*/
|
||||||
ssize_t
|
intptr_t
|
||||||
blob_reserve_bytes(struct blob *blob, size_t to_write);
|
blob_reserve_bytes(struct blob *blob, size_t to_write);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -143,7 +143,7 @@ blob_reserve_bytes(struct blob *blob, size_t to_write);
|
|||||||
* space. Note that this must be used if later reading with \sa
|
* space. Note that this must be used if later reading with \sa
|
||||||
* blob_read_uint32, since it aligns the offset correctly.
|
* blob_read_uint32, since it aligns the offset correctly.
|
||||||
*/
|
*/
|
||||||
ssize_t
|
intptr_t
|
||||||
blob_reserve_uint32(struct blob *blob);
|
blob_reserve_uint32(struct blob *blob);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -151,7 +151,7 @@ blob_reserve_uint32(struct blob *blob);
|
|||||||
* space. Note that this must be used if later reading with \sa
|
* space. Note that this must be used if later reading with \sa
|
||||||
* blob_read_intptr, since it aligns the offset correctly.
|
* blob_read_intptr, since it aligns the offset correctly.
|
||||||
*/
|
*/
|
||||||
ssize_t
|
intptr_t
|
||||||
blob_reserve_intptr(struct blob *blob);
|
blob_reserve_intptr(struct blob *blob);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -449,7 +449,7 @@ VkResult anv_GetPipelineCacheData(
|
|||||||
blob_write_bytes(&blob, &header, sizeof(header));
|
blob_write_bytes(&blob, &header, sizeof(header));
|
||||||
|
|
||||||
uint32_t count = 0;
|
uint32_t count = 0;
|
||||||
ssize_t count_offset = blob_reserve_uint32(&blob);
|
intptr_t count_offset = blob_reserve_uint32(&blob);
|
||||||
if (count_offset < 0) {
|
if (count_offset < 0) {
|
||||||
*pDataSize = 0;
|
*pDataSize = 0;
|
||||||
blob_finish(&blob);
|
blob_finish(&blob);
|
||||||
|
Reference in New Issue
Block a user