mirror of
https://git.openafs.org/openafs.git
synced 2025-01-21 00:10:15 +00:00
JAVA: Don't cast returns from malloc()
malloc() returns a (void *) on all of our current platforms. So, don't bother casting the return value before assigning it - it's unecessary noise. Change-Id: I534d424da13e03d3c0f0de3dddf1dd19088d1659 Reviewed-on: http://gerrit.openafs.org/7458 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Derrick Brashear <shadow@dementix.org>
This commit is contained in:
parent
cfcb45d4ae
commit
25bc7849ca
@ -73,7 +73,7 @@ char* getACL(char *path)
|
|||||||
char *buffer;
|
char *buffer;
|
||||||
int rval1=0;
|
int rval1=0;
|
||||||
|
|
||||||
buffer = (char*) malloc(ACL_LEN);
|
buffer = malloc(ACL_LEN);
|
||||||
params.in = NULL;
|
params.in = NULL;
|
||||||
params.out = NULL;
|
params.out = NULL;
|
||||||
params.in_size = params.out_size = 0;
|
params.in_size = params.out_size = 0;
|
||||||
|
@ -208,9 +208,8 @@ Java_org_openafs_jafs_Cell_getKasUsersNextString (JNIEnv *env, jclass cls,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( strcmp( who.instance, "" ) ) {
|
if( strcmp( who.instance, "" ) ) {
|
||||||
char *fullName = (char *) malloc( sizeof(char)*( strlen( who.principal )
|
char *fullName = malloc( sizeof(char)*( strlen( who.principal ) +
|
||||||
+ strlen( who.instance )
|
strlen( who.instance ) + 2 ) );
|
||||||
+ 2 ) );
|
|
||||||
if( !fullName ) {
|
if( !fullName ) {
|
||||||
throwAFSException( env, JAFSADMNOMEM );
|
throwAFSException( env, JAFSADMNOMEM );
|
||||||
return;
|
return;
|
||||||
@ -265,8 +264,8 @@ Java_org_openafs_jafs_Cell_getKasUsersNext (JNIEnv *env, jclass cls,
|
|||||||
|
|
||||||
// take care of the instance stuff(by concatenating with a period in between)
|
// take care of the instance stuff(by concatenating with a period in between)
|
||||||
if( strcmp( who.instance, "" ) ) {
|
if( strcmp( who.instance, "" ) ) {
|
||||||
fullName = (char *) malloc( sizeof(char)*( strlen( who.principal ) +
|
fullName = malloc( sizeof(char)*( strlen( who.principal ) +
|
||||||
strlen( who.instance ) + 2 ) );
|
strlen( who.instance ) + 2 ) );
|
||||||
if( !fullName ) {
|
if( !fullName ) {
|
||||||
throwAFSException( env, JAFSADMNOMEM );
|
throwAFSException( env, JAFSADMNOMEM );
|
||||||
return 0;
|
return 0;
|
||||||
@ -369,7 +368,7 @@ Java_org_openafs_jafs_Cell_getPtsUserCount (JNIEnv *env, jclass cls,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
userName = (char *) malloc( sizeof(char)*PTS_MAX_NAME_LEN);
|
userName = malloc( sizeof(char)*PTS_MAX_NAME_LEN);
|
||||||
|
|
||||||
if( !userName ) {
|
if( !userName ) {
|
||||||
throwAFSException( env, JAFSADMNOMEM );
|
throwAFSException( env, JAFSADMNOMEM );
|
||||||
@ -419,7 +418,7 @@ Java_org_openafs_jafs_Cell_getPtsOnlyUserCount (JNIEnv *env, jclass cls,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
userName = (char *) malloc( sizeof(char)*PTS_MAX_NAME_LEN);
|
userName = malloc( sizeof(char)*PTS_MAX_NAME_LEN);
|
||||||
|
|
||||||
if( !userName ) {
|
if( !userName ) {
|
||||||
free( who );
|
free( who );
|
||||||
@ -499,7 +498,7 @@ Java_org_openafs_jafs_Cell_getPtsUsersNextString (JNIEnv *env, jclass cls,
|
|||||||
char *userName;
|
char *userName;
|
||||||
jstring juser;
|
jstring juser;
|
||||||
|
|
||||||
userName = (char *) malloc( sizeof(char)*PTS_MAX_NAME_LEN);
|
userName = malloc( sizeof(char)*PTS_MAX_NAME_LEN);
|
||||||
|
|
||||||
if( !userName ) {
|
if( !userName ) {
|
||||||
throwAFSException( env, JAFSADMNOMEM );
|
throwAFSException( env, JAFSADMNOMEM );
|
||||||
@ -555,7 +554,7 @@ Java_org_openafs_jafs_Cell_getPtsOnlyUsersNextString (JNIEnv *env,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
userName = (char *) malloc( sizeof(char)*PTS_MAX_NAME_LEN);
|
userName = malloc( sizeof(char)*PTS_MAX_NAME_LEN);
|
||||||
|
|
||||||
if( !userName ) {
|
if( !userName ) {
|
||||||
free( who );
|
free( who );
|
||||||
@ -626,7 +625,7 @@ Java_org_openafs_jafs_Cell_getPtsUsersNext (JNIEnv *env, jclass cls,
|
|||||||
char *userName;
|
char *userName;
|
||||||
jstring juser;
|
jstring juser;
|
||||||
|
|
||||||
userName = (char *) malloc( sizeof(char)*PTS_MAX_NAME_LEN);
|
userName = malloc( sizeof(char)*PTS_MAX_NAME_LEN);
|
||||||
|
|
||||||
if( !userName ) {
|
if( !userName ) {
|
||||||
throwAFSException( env, JAFSADMNOMEM );
|
throwAFSException( env, JAFSADMNOMEM );
|
||||||
@ -696,7 +695,7 @@ Java_org_openafs_jafs_Cell_getPtsOnlyUsersNext (JNIEnv *env, jclass cls,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
userName = (char *) malloc( sizeof(char)*PTS_MAX_NAME_LEN);
|
userName = malloc( sizeof(char)*PTS_MAX_NAME_LEN);
|
||||||
|
|
||||||
if( !userName ) {
|
if( !userName ) {
|
||||||
free( who );
|
free( who );
|
||||||
@ -798,7 +797,7 @@ Java_org_openafs_jafs_Cell_getGroupCount (JNIEnv *env, jclass cls,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
groupName = (char *) malloc( sizeof(char)*PTS_MAX_NAME_LEN);
|
groupName = malloc( sizeof(char)*PTS_MAX_NAME_LEN);
|
||||||
|
|
||||||
if( !groupName ) {
|
if( !groupName ) {
|
||||||
throwAFSException( env, JAFSADMNOMEM );
|
throwAFSException( env, JAFSADMNOMEM );
|
||||||
@ -866,7 +865,7 @@ Java_org_openafs_jafs_Cell_getGroupsBeginAt (JNIEnv *env, jclass cls,
|
|||||||
char *groupName;
|
char *groupName;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
groupName = (char *) malloc( sizeof(char)*PTS_MAX_NAME_LEN);
|
groupName = malloc( sizeof(char)*PTS_MAX_NAME_LEN);
|
||||||
|
|
||||||
if( !pts_GroupListBegin( (void *) cellHandle, &iterationId, &ast ) ) {
|
if( !pts_GroupListBegin( (void *) cellHandle, &iterationId, &ast ) ) {
|
||||||
throwAFSException( env, ast );
|
throwAFSException( env, ast );
|
||||||
@ -907,7 +906,7 @@ Java_org_openafs_jafs_Cell_getGroupsNextString (JNIEnv *env, jclass cls,
|
|||||||
char *groupName;
|
char *groupName;
|
||||||
jstring jgroup;
|
jstring jgroup;
|
||||||
|
|
||||||
groupName = (char *) malloc( sizeof(char)*PTS_MAX_NAME_LEN);
|
groupName = malloc( sizeof(char)*PTS_MAX_NAME_LEN);
|
||||||
|
|
||||||
if( !groupName ) {
|
if( !groupName ) {
|
||||||
throwAFSException( env, JAFSADMNOMEM );
|
throwAFSException( env, JAFSADMNOMEM );
|
||||||
@ -952,7 +951,7 @@ Java_org_openafs_jafs_Cell_getGroupsNext (JNIEnv *env, jclass cls,
|
|||||||
char *groupName;
|
char *groupName;
|
||||||
jstring jgroup;
|
jstring jgroup;
|
||||||
|
|
||||||
groupName = (char *) malloc( sizeof(char)*PTS_MAX_NAME_LEN );
|
groupName = malloc( sizeof(char)*PTS_MAX_NAME_LEN );
|
||||||
|
|
||||||
if( !groupName ) {
|
if( !groupName ) {
|
||||||
throwAFSException( env, JAFSADMNOMEM );
|
throwAFSException( env, JAFSADMNOMEM );
|
||||||
|
@ -123,7 +123,7 @@ JNIEXPORT void JNICALL Java_org_openafs_jafs_FileOutputStream_write
|
|||||||
"descriptor\n");
|
"descriptor\n");
|
||||||
throwAFSFileException(env, 0, "Failed to get file descriptor!");
|
throwAFSFileException(env, 0, "Failed to get file descriptor!");
|
||||||
}
|
}
|
||||||
bytes = (char*) malloc(length);
|
bytes = malloc(length);
|
||||||
if(bytes == NULL) {
|
if(bytes == NULL) {
|
||||||
fprintf(stderr, "FileOutputStream::write(): malloc failed of %d bytes\n",
|
fprintf(stderr, "FileOutputStream::write(): malloc failed of %d bytes\n",
|
||||||
length);
|
length);
|
||||||
|
@ -27,7 +27,7 @@ char* GetNativeString(JNIEnv *env, jstring jstr){
|
|||||||
exc = (*env)->ExceptionOccurred(env);
|
exc = (*env)->ExceptionOccurred(env);
|
||||||
if (!exc) {
|
if (!exc) {
|
||||||
jint len = (*env)->GetArrayLength(env, bytes);
|
jint len = (*env)->GetArrayLength(env, bytes);
|
||||||
result = (char *)malloc(len + 1);
|
result = malloc(len + 1);
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
|
|
||||||
/*JNU_ThrowByName(env, "java/lang/OutOfMemoryError",
|
/*JNU_ThrowByName(env, "java/lang/OutOfMemoryError",
|
||||||
|
@ -472,7 +472,7 @@ Java_org_openafs_jafs_Group_getGroupMembersNextString
|
|||||||
(JNIEnv *env, jclass cls, jlong iterationId)
|
(JNIEnv *env, jclass cls, jlong iterationId)
|
||||||
{
|
{
|
||||||
afs_status_t ast;
|
afs_status_t ast;
|
||||||
char *userName = (char *) malloc( sizeof(char)*PTS_MAX_NAME_LEN);
|
char *userName = malloc( sizeof(char)*PTS_MAX_NAME_LEN);
|
||||||
jstring juser;
|
jstring juser;
|
||||||
|
|
||||||
if( !userName ) {
|
if( !userName ) {
|
||||||
@ -516,7 +516,7 @@ Java_org_openafs_jafs_Group_getGroupMembersNext
|
|||||||
char *userName;
|
char *userName;
|
||||||
jstring juser;
|
jstring juser;
|
||||||
|
|
||||||
userName = (char *) malloc( sizeof(char)*PTS_MAX_NAME_LEN);
|
userName = malloc( sizeof(char)*PTS_MAX_NAME_LEN);
|
||||||
|
|
||||||
if( !userName ) {
|
if( !userName ) {
|
||||||
throwAFSException( env, JAFSADMNOMEM );
|
throwAFSException( env, JAFSADMNOMEM );
|
||||||
|
@ -58,8 +58,7 @@ void fillKeyInfo( JNIEnv *env, jobject key, bos_KeyInfo_t keyEntry )
|
|||||||
// set all the fields
|
// set all the fields
|
||||||
(*env)->SetIntField( env, key, key_versionField, keyEntry.keyVersionNumber );
|
(*env)->SetIntField( env, key, key_versionField, keyEntry.keyVersionNumber );
|
||||||
|
|
||||||
convertedKey = (char *) malloc( sizeof(char *)*
|
convertedKey = malloc( sizeof(char *) * (sizeof(keyEntry.key.key)*4+1) );
|
||||||
(sizeof(keyEntry.key.key)*4+1) );
|
|
||||||
if( !convertedKey ) {
|
if( !convertedKey ) {
|
||||||
throwAFSException( env, JAFSADMNOMEM );
|
throwAFSException( env, JAFSADMNOMEM );
|
||||||
return;
|
return;
|
||||||
|
@ -180,7 +180,7 @@ Java_org_openafs_jafs_Partition_translateIDToName
|
|||||||
(JNIEnv *env, jclass cls, jint id)
|
(JNIEnv *env, jclass cls, jint id)
|
||||||
{
|
{
|
||||||
afs_status_t ast;
|
afs_status_t ast;
|
||||||
char *name = (char *) malloc( sizeof(char)*VOS_MAX_PARTITION_NAME_LEN);
|
char *name = malloc( sizeof(char)*VOS_MAX_PARTITION_NAME_LEN);
|
||||||
jstring jname;
|
jstring jname;
|
||||||
|
|
||||||
if( !name ) {
|
if( !name ) {
|
||||||
|
@ -115,7 +115,7 @@ void getProcessInfoChar( JNIEnv *env, void *serverHandle,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set state variable
|
// set state variable
|
||||||
auxStatus = (char *) malloc( sizeof(char)*BOS_MAX_NAME_LEN );
|
auxStatus = malloc( sizeof(char)*BOS_MAX_NAME_LEN );
|
||||||
if( !auxStatus ) {
|
if( !auxStatus ) {
|
||||||
throwAFSException( env, JAFSADMNOMEM );
|
throwAFSException( env, JAFSADMNOMEM );
|
||||||
return;
|
return;
|
||||||
|
@ -516,7 +516,7 @@ Java_org_openafs_jafs_Server_getBosAdminCount (JNIEnv *env, jclass cls,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
admin = (char *) malloc( sizeof(char)*BOS_MAX_NAME_LEN);
|
admin = malloc( sizeof(char)*BOS_MAX_NAME_LEN);
|
||||||
|
|
||||||
if( !admin ) {
|
if( !admin ) {
|
||||||
throwAFSException( env, JAFSADMNOMEM );
|
throwAFSException( env, JAFSADMNOMEM );
|
||||||
@ -578,7 +578,7 @@ Java_org_openafs_jafs_Server_getBosAdminsNextString (JNIEnv *env,
|
|||||||
|
|
||||||
afs_status_t ast;
|
afs_status_t ast;
|
||||||
jstring jadmin;
|
jstring jadmin;
|
||||||
char *admin = (char *) malloc( sizeof(char)*BOS_MAX_NAME_LEN );
|
char *admin = malloc( sizeof(char)*BOS_MAX_NAME_LEN );
|
||||||
|
|
||||||
if( !admin ) {
|
if( !admin ) {
|
||||||
throwAFSException( env, JAFSADMNOMEM );
|
throwAFSException( env, JAFSADMNOMEM );
|
||||||
@ -622,7 +622,7 @@ Java_org_openafs_jafs_Server_getBosAdminsNext (JNIEnv *env, jclass cls,
|
|||||||
char *admin;
|
char *admin;
|
||||||
jstring jadmin;
|
jstring jadmin;
|
||||||
|
|
||||||
admin = (char *) malloc( sizeof(char)*BOS_MAX_NAME_LEN);
|
admin = malloc( sizeof(char)*BOS_MAX_NAME_LEN);
|
||||||
|
|
||||||
if( !admin ) {
|
if( !admin ) {
|
||||||
throwAFSException( env, JAFSADMNOMEM );
|
throwAFSException( env, JAFSADMNOMEM );
|
||||||
@ -821,7 +821,7 @@ Java_org_openafs_jafs_Server_getProcessCount (JNIEnv *env, jclass cls,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
process = (char *) malloc( sizeof(char)*BOS_MAX_NAME_LEN );
|
process = malloc( sizeof(char)*BOS_MAX_NAME_LEN );
|
||||||
|
|
||||||
if( !process ) {
|
if( !process ) {
|
||||||
throwAFSException( env, JAFSADMNOMEM );
|
throwAFSException( env, JAFSADMNOMEM );
|
||||||
@ -883,7 +883,7 @@ Java_org_openafs_jafs_Server_getProcessesNextString (JNIEnv *env,
|
|||||||
|
|
||||||
afs_status_t ast;
|
afs_status_t ast;
|
||||||
jstring jprocess;
|
jstring jprocess;
|
||||||
char *process = (char *) malloc( sizeof(char)*BOS_MAX_NAME_LEN );
|
char *process = malloc( sizeof(char)*BOS_MAX_NAME_LEN );
|
||||||
|
|
||||||
if( !process ) {
|
if( !process ) {
|
||||||
throwAFSException( env, JAFSADMNOMEM );
|
throwAFSException( env, JAFSADMNOMEM );
|
||||||
@ -925,7 +925,7 @@ Java_org_openafs_jafs_Server_getProcessesNext (JNIEnv *env, jclass cls,
|
|||||||
jobject jprocessObject) {
|
jobject jprocessObject) {
|
||||||
|
|
||||||
afs_status_t ast;
|
afs_status_t ast;
|
||||||
char *process = (char *) malloc( sizeof(char)*BOS_MAX_NAME_LEN );
|
char *process = malloc( sizeof(char)*BOS_MAX_NAME_LEN );
|
||||||
jstring jprocess;
|
jstring jprocess;
|
||||||
|
|
||||||
if( !process ) {
|
if( !process ) {
|
||||||
@ -1539,7 +1539,7 @@ Java_org_openafs_jafs_Server_getLog(JNIEnv *env, jclass cls,
|
|||||||
logFile = NULL;
|
logFile = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
logData = (char *) malloc( sizeof(char)*currInLogSize );
|
logData = malloc( sizeof(char)*currInLogSize );
|
||||||
if( !logData ) {
|
if( !logData ) {
|
||||||
throwAFSException( env, JAFSADMNOMEM );
|
throwAFSException( env, JAFSADMNOMEM );
|
||||||
return;
|
return;
|
||||||
@ -1564,7 +1564,7 @@ Java_org_openafs_jafs_Server_getLog(JNIEnv *env, jclass cls,
|
|||||||
// increase log size (plus one for terminator)
|
// increase log size (plus one for terminator)
|
||||||
currInLogSize = currOutLogSize + 1;
|
currInLogSize = currOutLogSize + 1;
|
||||||
// allocate buffer
|
// allocate buffer
|
||||||
logData = (char *) malloc( sizeof(char)*currInLogSize );
|
logData = malloc( sizeof(char)*currInLogSize );
|
||||||
if( !logData ) {
|
if( !logData ) {
|
||||||
throwAFSException( env, JAFSADMNOMEM );
|
throwAFSException( env, JAFSADMNOMEM );
|
||||||
return;
|
return;
|
||||||
|
@ -559,8 +559,7 @@ void getUserInfoChar
|
|||||||
kasEntry.lastModPrincipal.principal);
|
kasEntry.lastModPrincipal.principal);
|
||||||
(*env)->SetObjectField(env, user, user_lastModNameField, jlastModName);
|
(*env)->SetObjectField(env, user, user_lastModNameField, jlastModName);
|
||||||
|
|
||||||
convertedKey = (char *) malloc( sizeof(char *)*
|
convertedKey = malloc( sizeof(char *) * (sizeof(kasEntry.key.key)*4+1) );
|
||||||
(sizeof(kasEntry.key.key)*4+1) );
|
|
||||||
if( !convertedKey ) {
|
if( !convertedKey ) {
|
||||||
throwAFSException( env, JAFSADMNOMEM );
|
throwAFSException( env, JAFSADMNOMEM );
|
||||||
return;
|
return;
|
||||||
@ -1171,7 +1170,7 @@ Java_org_openafs_jafs_User_getUserGroupsNextString
|
|||||||
(JNIEnv *env, jclass cls, jlong iterationId)
|
(JNIEnv *env, jclass cls, jlong iterationId)
|
||||||
{
|
{
|
||||||
afs_status_t ast;
|
afs_status_t ast;
|
||||||
char *groupName = (char *) malloc( sizeof(char)*PTS_MAX_NAME_LEN);
|
char *groupName = malloc( sizeof(char)*PTS_MAX_NAME_LEN);
|
||||||
jstring jgroup;
|
jstring jgroup;
|
||||||
|
|
||||||
if( !groupName ) {
|
if( !groupName ) {
|
||||||
@ -1215,7 +1214,7 @@ Java_org_openafs_jafs_User_getUserGroupsNext
|
|||||||
char *groupName;
|
char *groupName;
|
||||||
jstring jgroup;
|
jstring jgroup;
|
||||||
|
|
||||||
groupName = (char *) malloc( sizeof(char)*PTS_MAX_NAME_LEN);
|
groupName = malloc( sizeof(char)*PTS_MAX_NAME_LEN);
|
||||||
|
|
||||||
if( !groupName ) {
|
if( !groupName ) {
|
||||||
throwAFSException( env, JAFSADMNOMEM );
|
throwAFSException( env, JAFSADMNOMEM );
|
||||||
@ -1290,7 +1289,7 @@ Java_org_openafs_jafs_User_getGroupsOwnedCount
|
|||||||
cellHandle,
|
cellHandle,
|
||||||
jname );
|
jname );
|
||||||
|
|
||||||
groupName = (char *) malloc( sizeof(char)*PTS_MAX_NAME_LEN);
|
groupName = malloc( sizeof(char)*PTS_MAX_NAME_LEN);
|
||||||
|
|
||||||
if( !groupName ) {
|
if( !groupName ) {
|
||||||
throwAFSException( env, JAFSADMNOMEM );
|
throwAFSException( env, JAFSADMNOMEM );
|
||||||
@ -1370,7 +1369,7 @@ Java_org_openafs_jafs_User_getGroupsOwnedNextString
|
|||||||
(JNIEnv *env, jclass cls, jlong iterationId)
|
(JNIEnv *env, jclass cls, jlong iterationId)
|
||||||
{
|
{
|
||||||
afs_status_t ast;
|
afs_status_t ast;
|
||||||
char *groupName = (char *) malloc( sizeof(char)*PTS_MAX_NAME_LEN);
|
char *groupName = malloc( sizeof(char)*PTS_MAX_NAME_LEN);
|
||||||
jstring jgroup;
|
jstring jgroup;
|
||||||
|
|
||||||
if( !groupName ) {
|
if( !groupName ) {
|
||||||
@ -1415,7 +1414,7 @@ Java_org_openafs_jafs_User_getGroupsOwnedNext
|
|||||||
char *groupName;
|
char *groupName;
|
||||||
jstring jgroup;
|
jstring jgroup;
|
||||||
|
|
||||||
groupName = (char *) malloc( sizeof(char)*PTS_MAX_NAME_LEN);
|
groupName = malloc( sizeof(char)*PTS_MAX_NAME_LEN);
|
||||||
|
|
||||||
if( !groupName ) {
|
if( !groupName ) {
|
||||||
throwAFSException( env, JAFSADMNOMEM );
|
throwAFSException( env, JAFSADMNOMEM );
|
||||||
|
Loading…
Reference in New Issue
Block a user