Skip to content

Commit

Permalink
fix some casts of literal 0
Browse files Browse the repository at this point in the history
  • Loading branch information
kimbarrett committed Dec 12, 2024
1 parent 18e0b34 commit 966dc6f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/hotspot/os/aix/attachListener_aix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include <unistd.h>

#ifndef UNIX_PATH_MAX
#define UNIX_PATH_MAX sizeof(((struct sockaddr_un *)0)->sun_path)
#define UNIX_PATH_MAX sizeof(sockaddr_un{}.sun_path)
#endif

// The attach mechanism on AIX uses a UNIX domain socket. An attach listener
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/os/posix/attachListener_posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#ifndef AIX

#ifndef UNIX_PATH_MAX
#define UNIX_PATH_MAX sizeof(((struct sockaddr_un *)0)->sun_path)
#define UNIX_PATH_MAX sizeof(sockaddr_un{}.sun_path)
#endif

// The attach mechanism on Linux and BSD uses a UNIX domain socket. An attach
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/os/posix/perfMemory_posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,7 @@ static char* mmap_create_shared(size_t size) {
return nullptr;
}

mapAddress = (char*)::mmap((char*)0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
mapAddress = (char*)::mmap(nullptr, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);

result = ::close(fd);
assert(result != OS_ERR, "could not close file");
Expand Down Expand Up @@ -1208,7 +1208,7 @@ static void mmap_attach_shared(int vmid, char** addr, size_t* sizep, TRAPS) {

assert(size > 0, "unexpected size <= 0");

char* mapAddress = (char*)::mmap((char*)0, size, mmap_prot, MAP_SHARED, fd, 0);
char* mapAddress = (char*)::mmap(nullptr, size, mmap_prot, MAP_SHARED, fd, 0);

int result = ::close(fd);
assert(result != OS_ERR, "could not close file");
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/oops/compressedKlass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ void CompressedKlassPointers::initialize(address addr, size_t len) {
if (!set_klass_decode_mode()) {

// Give fatal error if this is a specified address
if ((address)CompressedClassSpaceBaseAddress == _base) {
if (CompressedClassSpaceBaseAddress == (size_t)_base) {
vm_exit_during_initialization(
err_msg("CompressedClassSpaceBaseAddress=" PTR_FORMAT " given with shift %d, cannot be used to encode class pointers",
CompressedClassSpaceBaseAddress, _shift));
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/utilities/vmError.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ static const char* env_list[] = {
// defined on Windows
"OS", "PROCESSOR_IDENTIFIER", "_ALT_JAVA_HOME_DIR", "TMP", "TEMP",

(const char *)0
nullptr // End marker.
};

// A simple parser for -XX:OnError, usage:
Expand Down

0 comments on commit 966dc6f

Please sign in to comment.