From c4409487fdb2822309b9d8cf79bcd7d3895b8390 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Wed, 22 Apr 2020 02:36:36 +0200 Subject: Const correct (most) strings At least those cases that are reported by gcc and/or clang. --- src/opengl.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/opengl.c') diff --git a/src/opengl.c b/src/opengl.c index dd89509..87539eb 100644 --- a/src/opengl.c +++ b/src/opengl.c @@ -2322,7 +2322,7 @@ void D3D_RenderHUDNumber_Centred(unsigned int number,int x,int y,int colour) } while (--noOfDigits); } -void D3D_RenderHUDString(char *stringPtr,int x,int y,int colour) +void D3D_RenderHUDString(const char *stringPtr,int x,int y,int colour) { struct VertexTag quadVertices[4]; @@ -2371,7 +2371,7 @@ void D3D_RenderHUDString(char *stringPtr,int x,int y,int colour) } } -void D3D_RenderHUDString_Clipped(char *stringPtr,int x,int y,int colour) +void D3D_RenderHUDString_Clipped(const char *stringPtr,int x,int y,int colour) { struct VertexTag quadVertices[4]; @@ -2422,10 +2422,10 @@ void D3D_RenderHUDString_Clipped(char *stringPtr,int x,int y,int colour) } } -void D3D_RenderHUDString_Centred(char *stringPtr, int centreX, int y, int colour) +void D3D_RenderHUDString_Centred(const char *stringPtr, int centreX, int y, int colour) { int x, length = 0; - char *ptr = stringPtr; + const char *ptr = stringPtr; struct VertexTag quadVertices[4]; if (stringPtr == NULL) @@ -2481,15 +2481,15 @@ void D3D_RenderHUDString_Centred(char *stringPtr, int centreX, int y, int colour } } -void RenderString(char *stringPtr, int x, int y, int colour) +void RenderString(const char *stringPtr, int x, int y, int colour) { D3D_RenderHUDString(stringPtr,x,y,colour); } -void RenderStringCentred(char *stringPtr, int centreX, int y, int colour) +void RenderStringCentred(const char *stringPtr, int centreX, int y, int colour) { int length = 0; - char *ptr = stringPtr; + const char *ptr = stringPtr; while(*ptr) { @@ -2498,7 +2498,7 @@ void RenderStringCentred(char *stringPtr, int centreX, int y, int colour) D3D_RenderHUDString(stringPtr,centreX-length/2,y,colour); } -void RenderStringVertically(char *stringPtr, int centreX, int bottomY, int colour) +void RenderStringVertically(const char *stringPtr, int centreX, int bottomY, int colour) { struct VertexTag quadVertices[4]; int y = bottomY; @@ -2511,7 +2511,7 @@ void RenderStringVertically(char *stringPtr, int centreX, int bottomY, int colou CheckFilteringModeIsCorrect(FILTERING_BILINEAR_OFF); while( *stringPtr ) { - char c = *stringPtr++; + const char c = *stringPtr++; { int topLeftU = 1+((c-32)&15)*16; @@ -2542,7 +2542,7 @@ void RenderStringVertically(char *stringPtr, int centreX, int bottomY, int colou } } -int Hardware_RenderSmallMenuText(char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format) +int Hardware_RenderSmallMenuText(const char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format) { switch(format) { @@ -2558,7 +2558,7 @@ int Hardware_RenderSmallMenuText(char *textPtr, int x, int y, int alpha, enum AV case AVPMENUFORMAT_RIGHTJUSTIFIED: { int length = 0; - char *ptr = textPtr; + const char *ptr = textPtr; while(*ptr) { @@ -2571,7 +2571,7 @@ int Hardware_RenderSmallMenuText(char *textPtr, int x, int y, int alpha, enum AV case AVPMENUFORMAT_CENTREJUSTIFIED: { int length = 0; - char *ptr = textPtr; + const char *ptr = textPtr; while(*ptr) { @@ -2594,7 +2594,7 @@ int Hardware_RenderSmallMenuText(char *textPtr, int x, int y, int alpha, enum AV return x; } -int Hardware_RenderSmallMenuText_Coloured(char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format, int red, int green, int blue) +int Hardware_RenderSmallMenuText_Coloured(const char *textPtr, int x, int y, int alpha, enum AVPMENUFORMAT_ID format, int red, int green, int blue) { switch(format) { @@ -2610,7 +2610,7 @@ int Hardware_RenderSmallMenuText_Coloured(char *textPtr, int x, int y, int alpha case AVPMENUFORMAT_RIGHTJUSTIFIED: { int length = 0; - char *ptr = textPtr; + const char *ptr = textPtr; while(*ptr) { @@ -2623,7 +2623,7 @@ int Hardware_RenderSmallMenuText_Coloured(char *textPtr, int x, int y, int alpha case AVPMENUFORMAT_CENTREJUSTIFIED: { int length = 0; - char *ptr = textPtr; + const char *ptr = textPtr; while(*ptr) { -- cgit v1.3