Cleanup: use const arguments & variables

This commit is contained in:
Campbell Barton 2023-09-19 11:01:28 +10:00
parent 05c053cd25
commit 085b094f18
34 changed files with 96 additions and 96 deletions

View File

@ -68,7 +68,7 @@ void GHOST_ShowMessageBox(GHOST_SystemHandle systemhandle,
const char *link,
GHOST_DialogOptions dialog_options)
{
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
const GHOST_ISystem *system = (const GHOST_ISystem *)systemhandle;
system->showMessageBox(title, message, help_label, continue_label, link, dialog_options);
}
@ -86,7 +86,7 @@ GHOST_TSuccess GHOST_DisposeEventConsumer(GHOST_EventConsumerHandle consumerhand
uint64_t GHOST_GetMilliSeconds(GHOST_SystemHandle systemhandle)
{
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
const GHOST_ISystem *system = (const GHOST_ISystem *)systemhandle;
return system->getMilliSeconds();
}
@ -113,7 +113,7 @@ GHOST_TSuccess GHOST_RemoveTimer(GHOST_SystemHandle systemhandle,
uint8_t GHOST_GetNumDisplays(GHOST_SystemHandle systemhandle)
{
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
const GHOST_ISystem *system = (const GHOST_ISystem *)systemhandle;
return system->getNumDisplays();
}
@ -122,7 +122,7 @@ void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle,
uint32_t *width,
uint32_t *height)
{
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
const GHOST_ISystem *system = (const GHOST_ISystem *)systemhandle;
system->getMainDisplayDimensions(*width, *height);
}
@ -131,7 +131,7 @@ void GHOST_GetAllDisplayDimensions(GHOST_SystemHandle systemhandle,
uint32_t *width,
uint32_t *height)
{
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
const GHOST_ISystem *system = (const GHOST_ISystem *)systemhandle;
system->getAllDisplayDimensions(*width, *height);
}
@ -180,7 +180,7 @@ GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle,
GHOST_TUserDataPtr GHOST_GetWindowUserData(GHOST_WindowHandle windowhandle)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
const GHOST_IWindow *window = (const GHOST_IWindow *)windowhandle;
return window->getUserData();
}
@ -193,7 +193,7 @@ void GHOST_SetWindowUserData(GHOST_WindowHandle windowhandle, GHOST_TUserDataPtr
bool GHOST_IsDialogWindow(GHOST_WindowHandle windowhandle)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
const GHOST_IWindow *window = (const GHOST_IWindow *)windowhandle;
return window->isDialog();
}
@ -305,7 +305,7 @@ GHOST_TSuccess GHOST_EndProgressBar(GHOST_WindowHandle windowhandle)
GHOST_TStandardCursor GHOST_GetCursorShape(GHOST_WindowHandle windowhandle)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
const GHOST_IWindow *window = (const GHOST_IWindow *)windowhandle;
return window->getCursorShape();
}
@ -350,7 +350,7 @@ GHOST_TSuccess GHOST_GetCursorBitmap(GHOST_WindowHandle windowhandle,
bool GHOST_GetCursorVisibility(GHOST_WindowHandle windowhandle)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
const GHOST_IWindow *window = (const GHOST_IWindow *)windowhandle;
return window->getCursorVisibility();
}
@ -449,7 +449,7 @@ GHOST_TSuccess GHOST_GetModifierKeyState(GHOST_SystemHandle systemhandle,
GHOST_TModifierKey mask,
bool *r_is_down)
{
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
const GHOST_ISystem *system = (const GHOST_ISystem *)systemhandle;
GHOST_TSuccess result;
bool is_down = false;
@ -463,7 +463,7 @@ GHOST_TSuccess GHOST_GetButtonState(GHOST_SystemHandle systemhandle,
GHOST_TButton mask,
bool *r_is_down)
{
GHOST_ISystem *system = (GHOST_ISystem *)systemhandle;
const GHOST_ISystem *system = (const GHOST_ISystem *)systemhandle;
GHOST_TSuccess result;
bool is_down = false;
@ -518,7 +518,7 @@ GHOST_TEventDataPtr GHOST_GetEventData(GHOST_EventHandle eventhandle)
GHOST_TimerProcPtr GHOST_GetTimerProc(GHOST_TimerTaskHandle timertaskhandle)
{
GHOST_ITimerTask *timertask = (GHOST_ITimerTask *)timertaskhandle;
const GHOST_ITimerTask *timertask = (const GHOST_ITimerTask *)timertaskhandle;
return timertask->getTimerProc();
}
@ -532,7 +532,7 @@ void GHOST_SetTimerProc(GHOST_TimerTaskHandle timertaskhandle, GHOST_TimerProcPt
GHOST_TUserDataPtr GHOST_GetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle)
{
GHOST_ITimerTask *timertask = (GHOST_ITimerTask *)timertaskhandle;
const GHOST_ITimerTask *timertask = (const GHOST_ITimerTask *)timertaskhandle;
return timertask->getUserData();
}
@ -546,7 +546,7 @@ void GHOST_SetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle, GHOST_TUs
bool GHOST_GetValid(GHOST_WindowHandle windowhandle)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
const GHOST_IWindow *window = (const GHOST_IWindow *)windowhandle;
return window->getValid();
}
@ -581,7 +581,7 @@ void GHOST_SetTitle(GHOST_WindowHandle windowhandle, const char *title)
char *GHOST_GetTitle(GHOST_WindowHandle windowhandle)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
const GHOST_IWindow *window = (const GHOST_IWindow *)windowhandle;
std::string title = window->getTitle();
const size_t ctitle_size = title.size() + 1;
@ -598,7 +598,7 @@ char *GHOST_GetTitle(GHOST_WindowHandle windowhandle)
GHOST_RectangleHandle GHOST_GetWindowBounds(GHOST_WindowHandle windowhandle)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
const GHOST_IWindow *window = (const GHOST_IWindow *)windowhandle;
GHOST_Rect *rectangle = nullptr;
rectangle = new GHOST_Rect();
@ -609,7 +609,7 @@ GHOST_RectangleHandle GHOST_GetWindowBounds(GHOST_WindowHandle windowhandle)
GHOST_RectangleHandle GHOST_GetClientBounds(GHOST_WindowHandle windowhandle)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
const GHOST_IWindow *window = (const GHOST_IWindow *)windowhandle;
GHOST_Rect *rectangle = nullptr;
rectangle = new GHOST_Rect();
@ -649,7 +649,7 @@ GHOST_TSuccess GHOST_SetClientSize(GHOST_WindowHandle windowhandle,
void GHOST_ScreenToClient(
GHOST_WindowHandle windowhandle, int32_t inX, int32_t inY, int32_t *outX, int32_t *outY)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
const GHOST_IWindow *window = (const GHOST_IWindow *)windowhandle;
window->screenToClient(inX, inY, *outX, *outY);
}
@ -657,14 +657,14 @@ void GHOST_ScreenToClient(
void GHOST_ClientToScreen(
GHOST_WindowHandle windowhandle, int32_t inX, int32_t inY, int32_t *outX, int32_t *outY)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
const GHOST_IWindow *window = (const GHOST_IWindow *)windowhandle;
window->clientToScreen(inX, inY, *outX, *outY);
}
GHOST_TWindowState GHOST_GetWindowState(GHOST_WindowHandle windowhandle)
{
GHOST_IWindow *window = (GHOST_IWindow *)windowhandle;
const GHOST_IWindow *window = (const GHOST_IWindow *)windowhandle;
return window->getState();
}
@ -770,7 +770,7 @@ void GHOST_SetTabletAPI(GHOST_SystemHandle systemhandle, GHOST_TTabletAPI api)
GHOST_TSuccess GHOST_GetPixelAtCursor(float r_color[3])
{
GHOST_ISystem *system = GHOST_ISystem::getSystem();
const GHOST_ISystem *system = GHOST_ISystem::getSystem();
return system->getPixelAtCursor(r_color);
}
@ -881,31 +881,31 @@ GHOST_TSuccess GHOST_ClipRectangle(GHOST_RectangleHandle rectanglehandle,
char *GHOST_getClipboard(bool selection)
{
GHOST_ISystem *system = GHOST_ISystem::getSystem();
const GHOST_ISystem *system = GHOST_ISystem::getSystem();
return system->getClipboard(selection);
}
void GHOST_putClipboard(const char *buffer, bool selection)
{
GHOST_ISystem *system = GHOST_ISystem::getSystem();
const GHOST_ISystem *system = GHOST_ISystem::getSystem();
system->putClipboard(buffer, selection);
}
GHOST_TSuccess GHOST_hasClipboardImage()
{
GHOST_ISystem *system = GHOST_ISystem::getSystem();
const GHOST_ISystem *system = GHOST_ISystem::getSystem();
return system->hasClipboardImage();
}
uint *GHOST_getClipboardImage(int *r_width, int *r_height)
{
GHOST_ISystem *system = GHOST_ISystem::getSystem();
const GHOST_ISystem *system = GHOST_ISystem::getSystem();
return system->getClipboardImage(r_width, r_height);
}
GHOST_TSuccess GHOST_putClipboardImage(uint *rgba, int width, int height)
{
GHOST_ISystem *system = GHOST_ISystem::getSystem();
const GHOST_ISystem *system = GHOST_ISystem::getSystem();
return system->putClipboardImage(rgba, width, height);
}
@ -923,7 +923,7 @@ bool GHOST_UseNativePixels()
GHOST_TCapabilityFlag GHOST_GetCapabilities()
{
GHOST_ISystem *system = GHOST_ISystem::getSystem();
const GHOST_ISystem *system = GHOST_ISystem::getSystem();
return system->getCapabilities();
}
@ -1036,7 +1036,7 @@ void GHOST_XrDrawViewFunc(GHOST_XrContextHandle xr_contexthandle, GHOST_XrDrawVi
int GHOST_XrSessionNeedsUpsideDownDrawing(const GHOST_XrContextHandle xr_contexthandle)
{
GHOST_IXrContext *xr_context = (GHOST_IXrContext *)xr_contexthandle;
const GHOST_IXrContext *xr_context = (const GHOST_IXrContext *)xr_contexthandle;
GHOST_XR_CAPI_CALL_RET(xr_context->needsUpsideDownDrawing(), xr_context);
return 0; /* Only reached if exception is thrown. */

View File

@ -99,7 +99,7 @@ GHOST_DropTargetX11::~GHOST_DropTargetX11()
}
}
char *GHOST_DropTargetX11::FileUrlDecode(char *fileUrl)
char *GHOST_DropTargetX11::FileUrlDecode(const char *fileUrl)
{
if (strncmp(fileUrl, "file://", 7) == 0) {
return GHOST_URL_decode_alloc(fileUrl + 7);
@ -108,7 +108,7 @@ char *GHOST_DropTargetX11::FileUrlDecode(char *fileUrl)
return nullptr;
}
void *GHOST_DropTargetX11::getURIListGhostData(uchar *dropBuffer, int dropBufferSize)
void *GHOST_DropTargetX11::getURIListGhostData(const uchar *dropBuffer, int dropBufferSize)
{
GHOST_TStringArray *strArray = nullptr;
int totPaths = 0, curLength = 0;
@ -158,7 +158,7 @@ void *GHOST_DropTargetX11::getURIListGhostData(uchar *dropBuffer, int dropBuffer
return strArray;
}
void *GHOST_DropTargetX11::getGhostData(Atom dropType, uchar *dropBuffer, int dropBufferSize)
void *GHOST_DropTargetX11::getGhostData(Atom dropType, const uchar *dropBuffer, int dropBufferSize)
{
void *data = nullptr;
uchar *tmpBuffer = (uchar *)malloc(dropBufferSize + 1);
@ -174,7 +174,7 @@ void *GHOST_DropTargetX11::getGhostData(Atom dropType, uchar *dropBuffer, int dr
}
else if (dropType == dndTypeURL) {
/* need to be tested */
char *decodedPath = FileUrlDecode((char *)tmpBuffer);
char *decodedPath = FileUrlDecode((const char *)tmpBuffer);
if (decodedPath) {
m_draggedObjectType = GHOST_kDragnDropTypeString;

View File

@ -42,7 +42,7 @@ class GHOST_DropTargetX11 {
* \param dropBufferSize: Size of returned buffer.
* \return Pointer to data.
*/
void *getGhostData(Atom dropType, unsigned char *dropBuffer, int dropBufferSize);
void *getGhostData(Atom dropType, const unsigned char *dropBuffer, int dropBufferSize);
private:
/* Internal helper functions */
@ -63,14 +63,14 @@ class GHOST_DropTargetX11 {
* \param dropBufferSize: Size of dropped buffer.
* \return pointer to newly created GHOST data.
*/
void *getURIListGhostData(unsigned char *dropBuffer, int dropBufferSize);
void *getURIListGhostData(const unsigned char *dropBuffer, int dropBufferSize);
/**
* Fully decode file URL (i.e. converts `file:///a%20b/test` to `/a b/test`)
* \param fileUrl: - file path URL to be fully decoded.
* \return decoded file path (result should be free-d).
*/
char *FileUrlDecode(char *fileUrl);
char *FileUrlDecode(const char *fileUrl);
/* The associated GHOST_WindowWin32. */
GHOST_WindowX11 *m_window;

View File

@ -125,7 +125,7 @@ GHOST_TSuccess GHOST_EventManager::removeConsumer(GHOST_IEventConsumer *consumer
return success;
}
void GHOST_EventManager::removeWindowEvents(GHOST_IWindow *window)
void GHOST_EventManager::removeWindowEvents(const GHOST_IWindow *window)
{
TEventStack::iterator iter;
iter = m_events.begin();
@ -147,7 +147,7 @@ void GHOST_EventManager::removeWindowEvents(GHOST_IWindow *window)
}
}
void GHOST_EventManager::removeTypeEvents(GHOST_TEventType type, GHOST_IWindow *window)
void GHOST_EventManager::removeTypeEvents(GHOST_TEventType type, const GHOST_IWindow *window)
{
TEventStack::iterator iter;
iter = m_events.begin();

View File

@ -90,7 +90,7 @@ class GHOST_EventManager {
* Removes all events for a window from the stack.
* \param window: The window to remove events for.
*/
void removeWindowEvents(GHOST_IWindow *window);
void removeWindowEvents(const GHOST_IWindow *window);
/**
* Removes all events of a certain type from the stack.
@ -99,7 +99,7 @@ class GHOST_EventManager {
* \param type: The type of events to be removed.
* \param window: The window to remove the events for.
*/
void removeTypeEvents(GHOST_TEventType type, GHOST_IWindow *window = nullptr);
void removeTypeEvents(GHOST_TEventType type, const GHOST_IWindow *window = nullptr);
protected:
/**

View File

@ -25,34 +25,34 @@ GHOST_TSuccess GHOST_DisposeSystemPaths()
const char *GHOST_getSystemDir(int version, const char *versionstr)
{
GHOST_ISystemPaths *systemPaths = GHOST_ISystemPaths::get();
const GHOST_ISystemPaths *systemPaths = GHOST_ISystemPaths::get();
return systemPaths ? systemPaths->getSystemDir(version, versionstr) : nullptr;
}
const char *GHOST_getUserDir(int version, const char *versionstr)
{
GHOST_ISystemPaths *systemPaths = GHOST_ISystemPaths::get();
const GHOST_ISystemPaths *systemPaths = GHOST_ISystemPaths::get();
/* Shouldn't be `nullptr`. */
return systemPaths ? systemPaths->getUserDir(version, versionstr) : nullptr;
}
const char *GHOST_getUserSpecialDir(GHOST_TUserSpecialDirTypes type)
{
GHOST_ISystemPaths *systemPaths = GHOST_ISystemPaths::get();
const GHOST_ISystemPaths *systemPaths = GHOST_ISystemPaths::get();
/* Shouldn't be `nullptr`. */
return systemPaths ? systemPaths->getUserSpecialDir(type) : nullptr;
}
const char *GHOST_getBinaryDir()
{
GHOST_ISystemPaths *systemPaths = GHOST_ISystemPaths::get();
const GHOST_ISystemPaths *systemPaths = GHOST_ISystemPaths::get();
/* Shouldn't be `nullptr`. */
return systemPaths ? systemPaths->getBinaryDir() : nullptr;
}
void GHOST_addToSystemRecentFiles(const char *filepath)
{
GHOST_ISystemPaths *systemPaths = GHOST_ISystemPaths::get();
const GHOST_ISystemPaths *systemPaths = GHOST_ISystemPaths::get();
if (systemPaths) {
systemPaths->addToSystemRecentFiles(filepath);
}

View File

@ -818,7 +818,7 @@ GHOST_IWindow *GHOST_SystemCocoa::getWindowUnderCursor(int32_t x, int32_t y)
return nil;
}
return m_windowManager->getWindowAssociatedWithOSWindow((void *)nswindow);
return m_windowManager->getWindowAssociatedWithOSWindow((const void *)nswindow);
}
/**
@ -1468,7 +1468,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleTabletEvent(void *eventPtr, short eventT
NSEvent *event = (NSEvent *)eventPtr;
GHOST_IWindow *window;
window = m_windowManager->getWindowAssociatedWithOSWindow((void *)[event window]);
window = m_windowManager->getWindowAssociatedWithOSWindow((const void *)[event window]);
if (!window) {
// printf("\nW failure for event 0x%x",[event type]);
return GHOST_kFailure;
@ -1545,7 +1545,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleMouseEvent(void *eventPtr)
* however, if mouse exits window(s), the windows become inactive, until you click.
* We then fall back to the active window from ghost. */
window = (GHOST_WindowCocoa *)m_windowManager->getWindowAssociatedWithOSWindow(
(void *)[event window]);
(const void *)[event window]);
if (!window) {
window = (GHOST_WindowCocoa *)m_windowManager->getActiveWindow();
if (!window) {
@ -1853,7 +1853,7 @@ GHOST_TSuccess GHOST_SystemCocoa::handleKeyEvent(void *eventPtr)
GHOST_TKey keyCode;
NSString *charsIgnoringModifiers;
window = m_windowManager->getWindowAssociatedWithOSWindow((void *)[event window]);
window = m_windowManager->getWindowAssociatedWithOSWindow((const void *)[event window]);
if (!window) {
// printf("\nW failure for event 0x%x",[event type]);
return GHOST_kFailure;

View File

@ -1947,7 +1947,7 @@ static void keyboard_depressed_state_push_events_from_change(
GWL_Seat *seat, const GWL_KeyboardDepressedState &key_depressed_prev)
{
GHOST_IWindow *win = ghost_wl_surface_user_data(seat->keyboard.wl.surface_window);
GHOST_SystemWayland *system = seat->system;
const GHOST_SystemWayland *system = seat->system;
/* Separate key up and down into separate passes so key down events always come after key up.
* Do this so users of GHOST can use the last pressed or released modifier to check
@ -6262,7 +6262,7 @@ GHOST_TSuccess GHOST_SystemWayland::getCursorPosition(int32_t &x, int32_t &y) co
}
if (wl_surface *wl_surface_focus = seat_state_pointer->wl.surface_window) {
GHOST_WindowWayland *win = ghost_wl_surface_user_data(wl_surface_focus);
const GHOST_WindowWayland *win = ghost_wl_surface_user_data(wl_surface_focus);
return getCursorPositionClientRelative_impl(seat_state_pointer, win, x, y);
}
return GHOST_kFailure;
@ -6713,8 +6713,8 @@ GHOST_TSuccess GHOST_SystemWayland::cursor_shape_check(const GHOST_TStandardCurs
return GHOST_kSuccess;
}
GHOST_TSuccess GHOST_SystemWayland::cursor_shape_custom_set(uint8_t *bitmap,
uint8_t *mask,
GHOST_TSuccess GHOST_SystemWayland::cursor_shape_custom_set(const uint8_t *bitmap,
const uint8_t *mask,
const int sizex,
const int sizey,
const int hotX,
@ -7155,7 +7155,7 @@ bool GHOST_SystemWayland::output_unref(wl_output *wl_output)
/* NOTE: keep in sync with `output_scale_update`. */
GWL_Output *output = ghost_wl_output_user_data(wl_output);
GHOST_WindowManager *window_manager = getWindowManager();
const GHOST_WindowManager *window_manager = getWindowManager();
if (window_manager) {
for (GHOST_IWindow *iwin : window_manager->getWindows()) {
GHOST_WindowWayland *win = static_cast<GHOST_WindowWayland *>(iwin);

View File

@ -191,8 +191,8 @@ class GHOST_SystemWayland : public GHOST_System {
GHOST_TSuccess cursor_shape_check(GHOST_TStandardCursor cursorShape);
GHOST_TSuccess cursor_shape_custom_set(uint8_t *bitmap,
uint8_t *mask,
GHOST_TSuccess cursor_shape_custom_set(const uint8_t *bitmap,
const uint8_t *mask,
int sizex,
int sizey,
int hotX,

View File

@ -487,7 +487,7 @@ GHOST_IWindow *GHOST_SystemWin32::getWindowUnderCursor(int32_t /*x*/, int32_t /*
return nullptr;
}
return m_windowManager->getWindowAssociatedWithOSWindow((void *)win);
return m_windowManager->getWindowAssociatedWithOSWindow((const void *)win);
}
GHOST_TSuccess GHOST_SystemWin32::getModifierKeys(GHOST_ModifierKeys &keys) const

View File

@ -791,7 +791,7 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
(void)class_presence;
if (xe->type == xi_presence) {
XDevicePresenceNotifyEvent *notify_event = (XDevicePresenceNotifyEvent *)xe;
const XDevicePresenceNotifyEvent *notify_event = (const XDevicePresenceNotifyEvent *)xe;
if (ELEM(notify_event->devchange, DeviceEnabled, DeviceDisabled, DeviceAdded, DeviceRemoved))
{
refreshXInputDevices();
@ -825,7 +825,7 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
if (window->GetTabletData().Active != GHOST_kTabletModeNone) {
bool any_proximity = false;
for (GHOST_TabletX11 &xtablet : m_xtablets) {
for (const GHOST_TabletX11 &xtablet : m_xtablets) {
if (checkTabletProximity(xe->xany.display, xtablet.Device)) {
any_proximity = true;
}
@ -1456,7 +1456,7 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
#ifdef WITH_X11_XINPUT
for (GHOST_TabletX11 &xtablet : m_xtablets) {
if (ELEM(xe->type, xtablet.MotionEvent, xtablet.PressEvent)) {
XDeviceMotionEvent *data = (XDeviceMotionEvent *)xe;
const XDeviceMotionEvent *data = (const XDeviceMotionEvent *)xe;
if (data->deviceid != xtablet.ID) {
continue;
}
@ -1504,7 +1504,7 @@ void GHOST_SystemX11::processEvent(XEvent *xe)
# undef AXIS_VALUE_GET
}
else if (xe->type == xtablet.ProxInEvent) {
XProximityNotifyEvent *data = (XProximityNotifyEvent *)xe;
const XProximityNotifyEvent *data = (const XProximityNotifyEvent *)xe;
if (data->deviceid != xtablet.ID) {
continue;
}
@ -2369,7 +2369,7 @@ class DialogData {
}
/* Is the mouse inside the given button */
bool isInsideButton(const XEvent &e, uint button_num)
bool isInsideButton(const XEvent &e, uint button_num) const
{
return (
(e.xmotion.y > int(height - padding_y - button_height)) &&

View File

@ -152,7 +152,7 @@ const std::vector<GHOST_IWindow *> &GHOST_WindowManager::getWindows() const
return m_windows;
}
GHOST_IWindow *GHOST_WindowManager::getWindowAssociatedWithOSWindow(void *osWindow)
GHOST_IWindow *GHOST_WindowManager::getWindowAssociatedWithOSWindow(const void *osWindow)
{
std::vector<GHOST_IWindow *>::iterator iter;

View File

@ -108,7 +108,7 @@ class GHOST_WindowManager {
* \param osWindow: The OS window object/handle.
* \return The associated window, null if none corresponds.
*/
GHOST_IWindow *getWindowAssociatedWithOSWindow(void *osWindow);
GHOST_IWindow *getWindowAssociatedWithOSWindow(const void *osWindow);
protected:
/** The list of windows managed */

View File

@ -1122,7 +1122,7 @@ static void libdecor_frame_handle_configure(libdecor_frame *frame,
{
GWL_Window *win = static_cast<GWL_Window *>(data);
# ifdef USE_EVENT_BACKGROUND_THREAD
GHOST_SystemWayland *system = win->ghost_system;
const GHOST_SystemWayland *system = win->ghost_system;
const bool is_main_thread = system->main_thread_id == std::this_thread::get_id();
if (!is_main_thread) {
gwl_window_pending_actions_tag(win, PENDING_WINDOW_FRAME_CONFIGURE);
@ -1220,7 +1220,7 @@ static void xdg_surface_handle_configure(void *data,
win->xdg_decor->pending.ack_configure_serial = serial;
#ifdef USE_EVENT_BACKGROUND_THREAD
GHOST_SystemWayland *system = win->ghost_system;
const GHOST_SystemWayland *system = win->ghost_system;
const bool is_main_thread = system->main_thread_id == std::this_thread::get_id();
if (!is_main_thread) {
/* NOTE(@ideasman42): this only gets one redraw,

View File

@ -894,7 +894,7 @@ void *GHOST_XrSession::getActionCustomdata(const char *action_set_name, const ch
uint32_t GHOST_XrSession::getActionCount(const char *action_set_name)
{
GHOST_XrActionSet *action_set = find_action_set(m_oxr.get(), action_set_name);
const GHOST_XrActionSet *action_set = find_action_set(m_oxr.get(), action_set_name);
if (action_set == nullptr) {
return 0;
}

View File

@ -56,7 +56,7 @@ void BKE_text_write(struct Text *text, const char *str, int str_len) ATTR_NONNUL
* - 2 if filepath on disk has been deleted.
* - -1 is returned if an error occurs.
*/
int BKE_text_file_modified_check(struct Text *text);
int BKE_text_file_modified_check(const struct Text *text);
void BKE_text_file_modified_ignore(struct Text *text);
char *txt_to_buf(struct Text *text, size_t *r_buf_strlen)

View File

@ -525,7 +525,7 @@ void BKE_text_write(Text *text, const char *str, int str_len) /* called directly
txt_make_dirty(text);
}
int BKE_text_file_modified_check(Text *text)
int BKE_text_file_modified_check(const Text *text)
{
BLI_stat_t st;
int result;

View File

@ -245,7 +245,7 @@ static void polyedge_beauty_cost_update(const float (*coords)[2],
}
}
static void polyedge_rotate(struct HalfEdge *edges, struct HalfEdge *e)
static void polyedge_rotate(struct HalfEdge *edges, const struct HalfEdge *e)
{
/** CCW winding, rotate internal edge to new vertical state.
*

View File

@ -319,10 +319,10 @@ ImBuf *make_sep_waveform_view_from_ibuf(ImBuf *ibuf)
return make_sep_waveform_view_from_ibuf_byte(ibuf);
}
static void draw_zebra_byte(ImBuf *src, ImBuf *ibuf, float perc)
static void draw_zebra_byte(const ImBuf *src, ImBuf *ibuf, float perc)
{
uint limit = 255.0f * perc / 100.0f;
uchar *p = src->byte_buffer.data;
const uchar *p = src->byte_buffer.data;
uchar *o = ibuf->byte_buffer.data;
int x;
int y;

View File

@ -51,7 +51,7 @@ static IKPlugin ikplugin_tab[] = {
{nullptr}};
static IKPlugin *get_plugin(bPose *pose)
static IKPlugin *get_plugin(const bPose *pose)
{
if (!pose || pose->iksolver < 0 || pose->iksolver >= (ARRAY_SIZE(ikplugin_tab) - 1)) {
return nullptr;

View File

@ -45,7 +45,7 @@ int logimage_fseek(LogImageFile *logFile, intptr_t offset, int origin)
return 0;
}
int logimage_fwrite(void *buffer, size_t size, uint count, LogImageFile *logFile)
int logimage_fwrite(const void *buffer, size_t size, uint count, LogImageFile *logFile)
{
if (logFile->file) {
return fwrite(buffer, size, count, logFile->file);

View File

@ -15,7 +15,7 @@
#include <stdlib.h>
int logimage_fseek(LogImageFile *logFile, intptr_t offset, int origin);
int logimage_fwrite(void *buffer, size_t size, unsigned int count, LogImageFile *logFile);
int logimage_fwrite(const void *buffer, size_t size, unsigned int count, LogImageFile *logFile);
int logimage_fread(void *buffer, size_t size, unsigned int count, LogImageFile *logFile);
int logimage_read_uchar(unsigned char *x, LogImageFile *logFile);
int logimage_read_ushort(unsigned short *x, LogImageFile *logFile);

View File

@ -1252,7 +1252,7 @@ struct FallbackIndexBuilderContext {
};
static AviMovie *alloc_proxy_output_avi(
anim *anim, char *filepath, int width, int height, int quality)
anim *anim, const char *filepath, int width, int height, int quality)
{
int x, y;
AviFormat format;

View File

@ -105,7 +105,7 @@ bool ABC_import(struct bContext *C,
const struct AlembicImportParams *params,
bool as_background_job);
struct CacheArchiveHandle *ABC_create_handle(struct Main *bmain,
struct CacheArchiveHandle *ABC_create_handle(const struct Main *bmain,
const char *filepath,
const struct CacheFileLayer *layers,
struct ListBase *object_paths);

View File

@ -63,7 +63,7 @@ static IArchive open_archive(const std::string &filename,
return IArchive();
}
ArchiveReader *ArchiveReader::get(Main *bmain, const std::vector<const char *> &filenames)
ArchiveReader *ArchiveReader::get(const Main *bmain, const std::vector<const char *> &filenames)
{
std::vector<ArchiveReader *> readers;
@ -103,7 +103,7 @@ ArchiveReader::ArchiveReader(const std::vector<ArchiveReader *> &readers) : m_re
m_archive = IArchive(arPtr, kWrapExisting, ErrorHandler::kThrowPolicy);
}
ArchiveReader::ArchiveReader(Main *bmain, const char *filename)
ArchiveReader::ArchiveReader(const Main *bmain, const char *filename)
{
char abs_filepath[FILE_MAX];
STRNCPY(abs_filepath, filename);

View File

@ -30,10 +30,10 @@ class ArchiveReader {
ArchiveReader(const std::vector<ArchiveReader *> &readers);
ArchiveReader(struct Main *bmain, const char *filename);
ArchiveReader(const struct Main *bmain, const char *filename);
public:
static ArchiveReader *get(struct Main *bmain, const std::vector<const char *> &filenames);
static ArchiveReader *get(const struct Main *bmain, const std::vector<const char *> &filenames);
~ArchiveReader();

View File

@ -154,7 +154,7 @@ static bool gather_objects_paths(const IObject &object, ListBase *object_paths)
return parent_is_part_of_this_object;
}
CacheArchiveHandle *ABC_create_handle(Main *bmain,
CacheArchiveHandle *ABC_create_handle(const Main *bmain,
const char *filepath,
const CacheFileLayer *layers,
ListBase *object_paths)

View File

@ -227,7 +227,7 @@ bool AVI_is_avi(const char *filepath);
/**
* Open a compressed file, decompress it into memory.
*/
AviError AVI_open_compress(char *filepath, AviMovie *movie, int streams, ...);
AviError AVI_open_compress(const char *filepath, AviMovie *movie, int streams, ...);
/**
* Finalize a compressed output stream.

View File

@ -701,7 +701,7 @@ AviError AVI_close(AviMovie *movie)
return AVI_ERROR_NONE;
}
AviError AVI_open_compress(char *filepath, AviMovie *movie, int streams, ...)
AviError AVI_open_compress(const char *filepath, AviMovie *movie, int streams, ...)
{
va_list ap;
AviList list;

View File

@ -131,7 +131,7 @@ static void Iindexe(AviIndexEntry *indexe)
}
#endif /* __BIG_ENDIAN__ */
void awrite(AviMovie *movie, void *datain, int block, int size, FILE *fp, int type)
void awrite(AviMovie *movie, const void *datain, int block, int size, FILE *fp, int type)
{
#ifdef __BIG_ENDIAN__
void *data;

View File

@ -23,7 +23,7 @@ extern "C" {
#define AVI_INDEXE 6
#define AVI_MJPEGU 7
void awrite(AviMovie *movie, void *datain, int block, int size, FILE *fp, int type);
void awrite(AviMovie *movie, const void *datain, int block, int size, FILE *fp, int type);
#ifdef __cplusplus
}

View File

@ -29,7 +29,7 @@
static void rna_Text_filepath_get(PointerRNA *ptr, char *value)
{
Text *text = (Text *)ptr->data;
const Text *text = (const Text *)ptr->data;
if (text->filepath) {
strcpy(value, text->filepath);
@ -41,7 +41,7 @@ static void rna_Text_filepath_get(PointerRNA *ptr, char *value)
static int rna_Text_filepath_length(PointerRNA *ptr)
{
Text *text = (Text *)ptr->data;
const Text *text = (const Text *)ptr->data;
return (text->filepath) ? strlen(text->filepath) : 0;
}
@ -63,13 +63,13 @@ static void rna_Text_filepath_set(PointerRNA *ptr, const char *value)
static bool rna_Text_modified_get(PointerRNA *ptr)
{
Text *text = (Text *)ptr->data;
const Text *text = (const Text *)ptr->data;
return BKE_text_file_modified_check(text) != 0;
}
static int rna_Text_current_line_index_get(PointerRNA *ptr)
{
Text *text = (Text *)ptr->data;
const Text *text = (const Text *)ptr->data;
return BLI_findindex(&text->lines, text->curl);
}
@ -86,7 +86,7 @@ static void rna_Text_current_line_index_set(PointerRNA *ptr, int value)
static int rna_Text_select_end_line_index_get(PointerRNA *ptr)
{
Text *text = static_cast<Text *>(ptr->data);
const Text *text = static_cast<Text *>(ptr->data);
return BLI_findindex(&text->lines, text->sell);
}
@ -103,7 +103,7 @@ static void rna_Text_select_end_line_index_set(PointerRNA *ptr, int value)
static int rna_Text_current_character_get(PointerRNA *ptr)
{
Text *text = static_cast<Text *>(ptr->data);
const Text *text = static_cast<const Text *>(ptr->data);
const TextLine *line = text->curl;
return BLI_str_utf8_offset_to_index(line->line, line->len, text->curc);
}
@ -135,7 +135,7 @@ static void rna_Text_select_end_character_set(PointerRNA *ptr, int index)
static void rna_TextLine_body_get(PointerRNA *ptr, char *value)
{
TextLine *line = (TextLine *)ptr->data;
const TextLine *line = (const TextLine *)ptr->data;
if (line->line) {
strcpy(value, line->line);
@ -147,7 +147,7 @@ static void rna_TextLine_body_get(PointerRNA *ptr, char *value)
static int rna_TextLine_body_length(PointerRNA *ptr)
{
TextLine *line = (TextLine *)ptr->data;
const TextLine *line = (const TextLine *)ptr->data;
return line->len;
}

View File

@ -252,7 +252,7 @@ bool seq_disk_cache_enforce_limits(SeqDiskCache *disk_cache)
}
static DiskCacheFile *seq_disk_cache_get_file_entry_by_path(SeqDiskCache *disk_cache,
char *filepath)
const char *filepath)
{
DiskCacheFile *cache_file = static_cast<DiskCacheFile *>(disk_cache->files.first);
@ -266,7 +266,7 @@ static DiskCacheFile *seq_disk_cache_get_file_entry_by_path(SeqDiskCache *disk_c
}
/* Update file size and timestamp. */
static void seq_disk_cache_update_file(SeqDiskCache *disk_cache, char *filepath)
static void seq_disk_cache_update_file(SeqDiskCache *disk_cache, const char *filepath)
{
DiskCacheFile *cache_file;
int64_t size_before;

View File

@ -46,7 +46,7 @@ static bool wm_platform_support_check_approval(const char *platform_support_key,
BLI_path_join(filepath, sizeof(filepath), cfgdir, BLENDER_PLATFORM_SUPPORT_FILE);
LinkNode *lines = BLI_file_read_as_lines(filepath);
for (LinkNode *line_node = lines; line_node; line_node = line_node->next) {
char *line = static_cast<char *>(line_node->link);
const char *line = static_cast<char *>(line_node->link);
if (STREQ(line, platform_support_key)) {
result = true;
break;