Browse Source

SDL_GetWindowICCProfile() follows the SDL_GetStringRule

Sam Lantinga 1 year ago
parent
commit
892df4bf4b
3 changed files with 5 additions and 5 deletions
  1. 2 2
      include/SDL3/SDL_video.h
  2. 1 1
      src/dynapi/SDL_dynapi_procs.h
  3. 2 2
      src/video/SDL_video.c

+ 2 - 2
include/SDL3/SDL_video.h

@@ -767,7 +767,7 @@ extern SDL_DECLSPEC const SDL_DisplayMode * SDLCALL SDL_GetWindowFullscreenMode(
 /**
 /**
  * Get the raw ICC profile data for the screen the window is currently on.
  * Get the raw ICC profile data for the screen the window is currently on.
  *
  *
- * Data returned should be freed with SDL_free.
+ * The returned data follows the SDL_GetStringRule, and will be automatically freed later.
  *
  *
  * \param window the window to query.
  * \param window the window to query.
  * \param size the size of the ICC profile.
  * \param size the size of the ICC profile.
@@ -776,7 +776,7 @@ extern SDL_DECLSPEC const SDL_DisplayMode * SDLCALL SDL_GetWindowFullscreenMode(
  *
  *
  * \since This function is available since SDL 3.0.0.
  * \since This function is available since SDL 3.0.0.
  */
  */
-extern SDL_DECLSPEC void * SDLCALL SDL_GetWindowICCProfile(SDL_Window *window, size_t *size);
+extern SDL_DECLSPEC const void * SDLCALL SDL_GetWindowICCProfile(SDL_Window *window, size_t *size);
 
 
 /**
 /**
  * Get the pixel format associated with the window.
  * Get the pixel format associated with the window.

+ 1 - 1
src/dynapi/SDL_dynapi_procs.h

@@ -515,7 +515,7 @@ SDL_DYNAPI_PROC(float,SDL_GetWindowDisplayScale,(SDL_Window *a),(a),return)
 SDL_DYNAPI_PROC(SDL_WindowFlags,SDL_GetWindowFlags,(SDL_Window *a),(a),return)
 SDL_DYNAPI_PROC(SDL_WindowFlags,SDL_GetWindowFlags,(SDL_Window *a),(a),return)
 SDL_DYNAPI_PROC(SDL_Window*,SDL_GetWindowFromID,(SDL_WindowID a),(a),return)
 SDL_DYNAPI_PROC(SDL_Window*,SDL_GetWindowFromID,(SDL_WindowID a),(a),return)
 SDL_DYNAPI_PROC(const SDL_DisplayMode*,SDL_GetWindowFullscreenMode,(SDL_Window *a),(a),return)
 SDL_DYNAPI_PROC(const SDL_DisplayMode*,SDL_GetWindowFullscreenMode,(SDL_Window *a),(a),return)
-SDL_DYNAPI_PROC(void*,SDL_GetWindowICCProfile,(SDL_Window *a, size_t *b),(a,b),return)
+SDL_DYNAPI_PROC(const void*,SDL_GetWindowICCProfile,(SDL_Window *a, size_t *b),(a,b),return)
 SDL_DYNAPI_PROC(SDL_WindowID,SDL_GetWindowID,(SDL_Window *a),(a),return)
 SDL_DYNAPI_PROC(SDL_WindowID,SDL_GetWindowID,(SDL_Window *a),(a),return)
 SDL_DYNAPI_PROC(SDL_bool,SDL_GetWindowKeyboardGrab,(SDL_Window *a),(a),return)
 SDL_DYNAPI_PROC(SDL_bool,SDL_GetWindowKeyboardGrab,(SDL_Window *a),(a),return)
 SDL_DYNAPI_PROC(int,SDL_GetWindowMaximumSize,(SDL_Window *a, int *b, int *c),(a,b,c),return)
 SDL_DYNAPI_PROC(int,SDL_GetWindowMaximumSize,(SDL_Window *a, int *b, int *c),(a,b,c),return)

+ 2 - 2
src/video/SDL_video.c

@@ -2000,13 +2000,13 @@ const SDL_DisplayMode *SDL_GetWindowFullscreenMode(SDL_Window *window)
     }
     }
 }
 }
 
 
-void *SDL_GetWindowICCProfile(SDL_Window *window, size_t *size)
+const void *SDL_GetWindowICCProfile(SDL_Window *window, size_t *size)
 {
 {
     if (!_this->GetWindowICCProfile) {
     if (!_this->GetWindowICCProfile) {
         SDL_Unsupported();
         SDL_Unsupported();
         return NULL;
         return NULL;
     }
     }
-    return _this->GetWindowICCProfile(_this, window, size);
+    return SDL_FreeLater(_this->GetWindowICCProfile(_this, window, size));
 }
 }
 
 
 SDL_PixelFormat SDL_GetWindowPixelFormat(SDL_Window *window)
 SDL_PixelFormat SDL_GetWindowPixelFormat(SDL_Window *window)