8281523: Accessibility: Conversion from string literal loses const qualifier

Reviewed-by: prr, aivanov, kizune
This commit is contained in:
Daniel Jeliński 2022-02-21 17:40:27 +00:00 committed by Alexey Ivanov
parent cc7cf81256
commit e1c98bd1f2
9 changed files with 20 additions and 20 deletions

View File

@ -40,7 +40,7 @@ extern "C" {
static FILE* logFP = nullptr;
void initializeFileLogger(char * fileName) {
void initializeFileLogger(const char * fileName) {
auto var = "JAVA_ACCESSBRIDGE_LOGDIR";
const auto envfilePath = getenv(var);
if (envfilePath != nullptr && fileName != nullptr) {
@ -83,7 +83,7 @@ unsigned long long getTimeStamp() {
/**
* print a GetLastError message
*/
char *printError(char *msg) {
char *printError(const char *msg) {
LPVOID lpMsgBuf = nullptr;
static char retbuf[256] = {0};
@ -119,7 +119,7 @@ char *printError(char *msg) {
/**
* Send debugging info to the appropriate place
*/
void PrintDebugString(char *msg, ...) {
void PrintDebugString(const char *msg, ...) {
#ifdef DEBUGGING_ON
char buf[1024] = {0};
va_list argprt;
@ -147,7 +147,7 @@ char *printError(char *msg) {
/**
* Send Java debugging info to the appropriate place
*/
void PrintJavaDebugString2(char *msg, ...) {
void PrintJavaDebugString2(const char *msg, ...) {
#ifdef JAVA_DEBUGGING_ON
char buf[1024] = {0};
va_list argprt;
@ -174,7 +174,7 @@ char *printError(char *msg) {
/**
* Wide version of the method to send debugging info to the appropriate place
*/
void wPrintDebugString(wchar_t *msg, ...) {
void wPrintDebugString(const wchar_t *msg, ...) {
#ifdef DEBUGGING_ON
char buf[1024] = {0};
char charmsg[256];
@ -204,7 +204,7 @@ char *printError(char *msg) {
/**
* Wide version of the method to send Java debugging info to the appropriate place
*/
void wPrintJavaDebugString(wchar_t *msg, ...) {
void wPrintJavaDebugString(const wchar_t *msg, ...) {
#ifdef JAVA_DEBUGGING_ON
char buf[1024] = {0};
char charmsg[256] = {0};

View File

@ -49,12 +49,12 @@
extern "C" {
#endif
char *printError(char *msg);
void PrintDebugString(char *msg, ...);
void PrintJavaDebugString(char *msg, ...);
void wPrintJavaDebugString(wchar_t *msg, ...);
void wPrintDebugString(wchar_t *msg, ...);
void initializeFileLogger(char * fileName);
char *printError(const char *msg);
void PrintDebugString(const char *msg, ...);
void PrintJavaDebugString(const char *msg, ...);
void wPrintJavaDebugString(const wchar_t *msg, ...);
void wPrintDebugString(const wchar_t *msg, ...);
void initializeFileLogger(const char * fileName);
void finalizeFileLogger();
#ifdef __cplusplus

View File

@ -205,7 +205,7 @@ void displayJavaEvent(long vmID, AccessibleContext ac, char *announcement) {
* Display Accessible propertyChange event info
*/
void displayAccessiblePropertyChange(long vmID, AccessibleContext ac,
char *announcement) {
const char *announcement) {
char buffer[HUGE_BUFSIZE];
char *bufOffset;

View File

@ -34,7 +34,7 @@
DEBUG_CODE(extern HWND theDialogWindow);
extern "C" {
DEBUG_CODE(void AppendToCallInfo(char *s));
DEBUG_CODE(void AppendToCallInfo(const char *s));
}

View File

@ -47,7 +47,7 @@ extern bool isVMInstanceChainInUse;
DEBUG_CODE(extern HWND theDialogWindow);
extern "C" {
DEBUG_CODE(void AppendToCallInfo(char *s));
DEBUG_CODE(void AppendToCallInfo(const char *s));
}

View File

@ -36,7 +36,7 @@
DEBUG_CODE(extern HWND theDialogWindow);
extern "C" {
DEBUG_CODE(void AppendToCallInfo(char *s));
DEBUG_CODE(void AppendToCallInfo(const char *s));
}
// -------------------

View File

@ -152,7 +152,7 @@ extern "C" {
* replaced with code to send output to debug file
*
*/
void AppendToCallInfo(char *s) {
void AppendToCallInfo(const char *s) {
/*
_CrtDbgReport(_CRT_WARN, (const char *) NULL, NULL, (const char *) NULL,

View File

@ -85,7 +85,7 @@ void displayAndLog(HWND hDlg, int nIDDlgItem, FILE *logfile, char *msg, ...) {
/*
* writes a text string to a logfile
*/
void logString(FILE *logfile, char *msg, ...) {
void logString(FILE *logfile, const char *msg, ...) {
if (logfile == NULL || msg == NULL) {
return;
@ -105,7 +105,7 @@ void logString(FILE *logfile, char *msg, ...) {
/*
* safely appends a message to a buffer
*/
BOOL appendToBuffer(char *buf, size_t buflen, char *msg, ...) {
BOOL appendToBuffer(char *buf, size_t buflen, const char *msg, ...) {
static char warning[] =
"\nNot enough buffer space; remaining information truncated.\n";

View File

@ -43,7 +43,7 @@ void displayAndLog(HWND hDlg, int nIDDlgItem, FILE *logfile, char *msg, ...);
/*
* writes a text string to a logfile
*/
void logString(FILE *logfile, char *msg, ...);
void logString(FILE *logfile, const char *msg, ...);
/**
* returns accessibility information for an AccessibleContext