Skip to content

Commit 471239e

Browse files
committed
8281523: Accessibility: Conversion from string literal loses const qualifier
Backport-of: e1c98bd1f2f57ddf47e4660038059117af87f938
1 parent 2952721 commit 471239e

File tree

9 files changed

+20
-20
lines changed

9 files changed

+20
-20
lines changed

src/jdk.accessibility/windows/native/common/AccessBridgeDebug.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ extern "C" {
4040

4141
static FILE* logFP = nullptr;
4242

43-
void initializeFileLogger(char * fileName) {
43+
void initializeFileLogger(const char * fileName) {
4444
auto var = "JAVA_ACCESSBRIDGE_LOGDIR";
4545
const auto envfilePath = getenv(var);
4646
if (envfilePath != nullptr && fileName != nullptr) {
@@ -83,7 +83,7 @@ unsigned long long getTimeStamp() {
8383
/**
8484
* print a GetLastError message
8585
*/
86-
char *printError(char *msg) {
86+
char *printError(const char *msg) {
8787
LPVOID lpMsgBuf = nullptr;
8888
static char retbuf[256] = {0};
8989

@@ -119,7 +119,7 @@ char *printError(char *msg) {
119119
/**
120120
* Send debugging info to the appropriate place
121121
*/
122-
void PrintDebugString(char *msg, ...) {
122+
void PrintDebugString(const char *msg, ...) {
123123
#ifdef DEBUGGING_ON
124124
char buf[1024] = {0};
125125
va_list argprt;
@@ -147,7 +147,7 @@ char *printError(char *msg) {
147147
/**
148148
* Send Java debugging info to the appropriate place
149149
*/
150-
void PrintJavaDebugString2(char *msg, ...) {
150+
void PrintJavaDebugString2(const char *msg, ...) {
151151
#ifdef JAVA_DEBUGGING_ON
152152
char buf[1024] = {0};
153153
va_list argprt;
@@ -174,7 +174,7 @@ char *printError(char *msg) {
174174
/**
175175
* Wide version of the method to send debugging info to the appropriate place
176176
*/
177-
void wPrintDebugString(wchar_t *msg, ...) {
177+
void wPrintDebugString(const wchar_t *msg, ...) {
178178
#ifdef DEBUGGING_ON
179179
char buf[1024] = {0};
180180
char charmsg[256];
@@ -204,7 +204,7 @@ char *printError(char *msg) {
204204
/**
205205
* Wide version of the method to send Java debugging info to the appropriate place
206206
*/
207-
void wPrintJavaDebugString(wchar_t *msg, ...) {
207+
void wPrintJavaDebugString(const wchar_t *msg, ...) {
208208
#ifdef JAVA_DEBUGGING_ON
209209
char buf[1024] = {0};
210210
char charmsg[256] = {0};

src/jdk.accessibility/windows/native/common/AccessBridgeDebug.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@
4949
extern "C" {
5050
#endif
5151

52-
char *printError(char *msg);
53-
void PrintDebugString(char *msg, ...);
54-
void PrintJavaDebugString(char *msg, ...);
55-
void wPrintJavaDebugString(wchar_t *msg, ...);
56-
void wPrintDebugString(wchar_t *msg, ...);
57-
void initializeFileLogger(char * fileName);
52+
char *printError(const char *msg);
53+
void PrintDebugString(const char *msg, ...);
54+
void PrintJavaDebugString(const char *msg, ...);
55+
void wPrintJavaDebugString(const wchar_t *msg, ...);
56+
void wPrintDebugString(const wchar_t *msg, ...);
57+
void initializeFileLogger(const char * fileName);
5858
void finalizeFileLogger();
5959

6060
#ifdef __cplusplus

src/jdk.accessibility/windows/native/jaccessinspector/jaccessinspector.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ void displayJavaEvent(long vmID, AccessibleContext ac, char *announcement) {
205205
* Display Accessible propertyChange event info
206206
*/
207207
void displayAccessiblePropertyChange(long vmID, AccessibleContext ac,
208-
char *announcement) {
208+
const char *announcement) {
209209
char buffer[HUGE_BUFSIZE];
210210
char *bufOffset;
211211

src/jdk.accessibility/windows/native/libwindowsaccessbridge/AccessBridgeEventHandler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
DEBUG_CODE(extern HWND theDialogWindow);
3636
extern "C" {
37-
DEBUG_CODE(void AppendToCallInfo(char *s));
37+
DEBUG_CODE(void AppendToCallInfo(const char *s));
3838
}
3939

4040

src/jdk.accessibility/windows/native/libwindowsaccessbridge/AccessBridgeJavaVMInstance.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ extern bool isVMInstanceChainInUse;
4747

4848
DEBUG_CODE(extern HWND theDialogWindow);
4949
extern "C" {
50-
DEBUG_CODE(void AppendToCallInfo(char *s));
50+
DEBUG_CODE(void AppendToCallInfo(const char *s));
5151
}
5252

5353

src/jdk.accessibility/windows/native/libwindowsaccessbridge/AccessBridgeMessageQueue.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
DEBUG_CODE(extern HWND theDialogWindow);
3838
extern "C" {
39-
DEBUG_CODE(void AppendToCallInfo(char *s));
39+
DEBUG_CODE(void AppendToCallInfo(const char *s));
4040
}
4141

4242
// -------------------

src/jdk.accessibility/windows/native/libwindowsaccessbridge/WinAccessBridge.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ extern "C" {
152152
* replaced with code to send output to debug file
153153
*
154154
*/
155-
void AppendToCallInfo(char *s) {
155+
void AppendToCallInfo(const char *s) {
156156

157157
/*
158158
_CrtDbgReport(_CRT_WARN, (const char *) NULL, NULL, (const char *) NULL,

src/jdk.accessibility/windows/native/toolscommon/AccessInfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ void displayAndLog(HWND hDlg, int nIDDlgItem, FILE *logfile, char *msg, ...) {
8585
/*
8686
* writes a text string to a logfile
8787
*/
88-
void logString(FILE *logfile, char *msg, ...) {
88+
void logString(FILE *logfile, const char *msg, ...) {
8989

9090
if (logfile == NULL || msg == NULL) {
9191
return;
@@ -105,7 +105,7 @@ void logString(FILE *logfile, char *msg, ...) {
105105
/*
106106
* safely appends a message to a buffer
107107
*/
108-
BOOL appendToBuffer(char *buf, size_t buflen, char *msg, ...) {
108+
BOOL appendToBuffer(char *buf, size_t buflen, const char *msg, ...) {
109109

110110
static char warning[] =
111111
"\nNot enough buffer space; remaining information truncated.\n";

src/jdk.accessibility/windows/native/toolscommon/AccessInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void displayAndLog(HWND hDlg, int nIDDlgItem, FILE *logfile, char *msg, ...);
4343
/*
4444
* writes a text string to a logfile
4545
*/
46-
void logString(FILE *logfile, char *msg, ...);
46+
void logString(FILE *logfile, const char *msg, ...);
4747

4848
/**
4949
* returns accessibility information for an AccessibleContext

0 commit comments

Comments
 (0)