Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8286562: GCC 12 reports some compiler warnings #8646

Closed
wants to merge 14 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/java.base/share/native/libjli/java.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -1626,7 +1626,7 @@ TranslateApplicationArgs(int jargc, const char **jargv, int *pargc, char ***parg
for (i = 0; i < jargc; i++) {
const char *arg = jargv[i];
if (arg[0] == '-' && arg[1] == 'J') {
*nargv++ = (arg[2] == '\0') ? NULL : JLI_StringDup(arg + 2);
*nargv++ = ((arg + 2) == NULL) ? NULL : JLI_StringDup(arg + 2);
}
}

4 changes: 2 additions & 2 deletions src/java.base/share/native/libjli/parse_manifest.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -288,8 +288,8 @@ find_positions(int fd, Byte *eb, jlong* base_offset, jlong* censtart)
for (cp = &buffer[bytes - ENDHDR]; cp >= &buffer[0]; cp--)
if (ENDSIG_AT(cp) && (cp + ENDHDR + ENDCOM(cp) == endpos)) {
(void) memcpy(eb, cp, ENDHDR);
pos = flen - (endpos - cp);
free(buffer);
pos = flen - (endpos - cp);
return find_positions64(fd, eb, pos, base_offset, censtart);
}
free(buffer);
7 changes: 2 additions & 5 deletions src/jdk.jpackage/linux/native/applauncher/LinuxPackage.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,6 @@

#include <stdio.h>
#include <string.h>
#include <stddef.h>
#include <stdlib.h>
#include <errno.h>
#include <linux/limits.h>
@@ -124,7 +123,6 @@ static int popenCommand(const char* cmdlineFormat, const char* arg,
int callbackMode = POPEN_CALLBACK_USE;
int exitCode = -1;
int c;
ptrdiff_t char_offset;

cmdline = malloc(cmdlineLenth + 1 /* \0 */);
if (!cmdline) {
@@ -173,14 +171,13 @@ static int popenCommand(const char* cmdlineFormat, const char* arg,
if (strBufNextChar == strBufEnd) {
/* Double buffer size */
strBufCapacity = strBufCapacity * 2 + 1;
char_offset = strBufNextChar - strBufBegin;
strNewBufBegin = realloc(strBufBegin, strBufCapacity);
if (!strNewBufBegin) {
JP_LOG_ERRNO;
goto cleanup;
}

strBufNextChar = strNewBufBegin + char_offset;
strBufNextChar = strNewBufBegin + (strBufNextChar - strBufBegin);
strBufEnd = strNewBufBegin + strBufCapacity;
strBufBegin = strNewBufBegin;
}