|
@@ -286,8 +286,7 @@ extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_IOFromFile(const char *file, cons
|
|
|
* certain size, for both read and write access.
|
|
|
*
|
|
|
* This memory buffer is not copied by the SDL_IOStream; the pointer you
|
|
|
- * provide must remain valid until you close the stream. Closing the stream
|
|
|
- * will not free the original buffer.
|
|
|
+ * provide must remain valid until you close the stream.
|
|
|
*
|
|
|
* If you need to make sure the SDL_IOStream never writes to the memory
|
|
|
* buffer, you should use SDL_IOFromConstMem() with a read-only buffer of
|
|
@@ -300,6 +299,13 @@ extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_IOFromFile(const char *file, cons
|
|
|
* - `SDL_PROP_IOSTREAM_MEMORY_SIZE_NUMBER`: this will be the `size` parameter
|
|
|
* that was passed to this function.
|
|
|
*
|
|
|
+ * Additionally, the following properties are recognized:
|
|
|
+ *
|
|
|
+ * - `SDL_PROP_IOSTREAM_MEMORY_FREE_FUNC`: if this property is set to a non-NULL
|
|
|
+ * value it will be interpreted as a function of SDL_free_func type and called
|
|
|
+ * with the passed `mem` pointer when closing the stream. By default it is
|
|
|
+ * unset, i.e., the memory will not be freed.
|
|
|
+ *
|
|
|
* \param mem a pointer to a buffer to feed an SDL_IOStream stream.
|
|
|
* \param size the buffer size, in bytes.
|
|
|
* \returns a pointer to a new SDL_IOStream structure or NULL on failure; call
|
|
@@ -321,6 +327,7 @@ extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_IOFromMem(void *mem, size_t size)
|
|
|
|
|
|
#define SDL_PROP_IOSTREAM_MEMORY_POINTER "SDL.iostream.memory.base"
|
|
|
#define SDL_PROP_IOSTREAM_MEMORY_SIZE_NUMBER "SDL.iostream.memory.size"
|
|
|
+#define SDL_PROP_IOSTREAM_MEMORY_FREE_FUNC "SDL.iostream.memory.free"
|
|
|
|
|
|
/**
|
|
|
* Use this function to prepare a read-only memory buffer for use with
|
|
@@ -333,8 +340,7 @@ extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_IOFromMem(void *mem, size_t size)
|
|
|
* without writing to the memory buffer.
|
|
|
*
|
|
|
* This memory buffer is not copied by the SDL_IOStream; the pointer you
|
|
|
- * provide must remain valid until you close the stream. Closing the stream
|
|
|
- * will not free the original buffer.
|
|
|
+ * provide must remain valid until you close the stream.
|
|
|
*
|
|
|
* If you need to write to a memory buffer, you should use SDL_IOFromMem()
|
|
|
* with a writable buffer of memory instead.
|
|
@@ -346,6 +352,13 @@ extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_IOFromMem(void *mem, size_t size)
|
|
|
* - `SDL_PROP_IOSTREAM_MEMORY_SIZE_NUMBER`: this will be the `size` parameter
|
|
|
* that was passed to this function.
|
|
|
*
|
|
|
+ * Additionally, the following properties are recognized:
|
|
|
+ *
|
|
|
+ * - `SDL_PROP_IOSTREAM_MEMORY_FREE_FUNC`: if this property is set to a non-NULL
|
|
|
+ * value it will be interpreted as a function of SDL_free_func type and called
|
|
|
+ * with the passed `mem` pointer when closing the stream. By default it is
|
|
|
+ * unset, i.e., the memory will not be freed.
|
|
|
+ *
|
|
|
* \param mem a pointer to a read-only buffer to feed an SDL_IOStream stream.
|
|
|
* \param size the buffer size, in bytes.
|
|
|
* \returns a pointer to a new SDL_IOStream structure or NULL on failure; call
|