HDFS-3673. libhdfs: fix some compiler warnings. Contributed by Colin Patrick McCabe

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1363458 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Eli Collins 2012-07-19 18:23:15 +00:00
parent 5568bf8260
commit 0d0e551efd
7 changed files with 20 additions and 18 deletions

View File

@ -161,6 +161,8 @@ Release 2.0.1-alpha - UNRELEASED
HDFS-3666. Plumb more exception messages to terminate. (eli)
HDFS-3673. libhdfs: fix some compiler warnings. (Colin Patrick McCabe via eli)
OPTIMIZATIONS
HDFS-2982. Startup performance suffers when there are many edit log

View File

@ -275,7 +275,7 @@ done:
*/
static int jStrToCstr(JNIEnv *env, jstring jstr, char **cstr)
{
char *tmp;
const char *tmp;
tmp = (*env)->GetStringUTFChars(env, jstr, NULL);
*cstr = strdup(tmp);
@ -632,7 +632,7 @@ done:
if (ret)
errno = ret;
return gFsRef;
return (hdfsFS)gFsRef;
}
int hdfsDisconnect(hdfsFS fs)
@ -667,7 +667,7 @@ int hdfsDisconnect(hdfsFS fs)
}
//Release unnecessary references
(*env)->DeleteGlobalRef(env, fs);
(*env)->DeleteGlobalRef(env, jFS);
return 0;
}

View File

@ -81,15 +81,6 @@ extern "C" {
*/
int hdfsFileIsOpenForWrite(hdfsFile file);
/**
* Disable the direct read optimization for a file.
*
* This is mainly provided for unit testing purposes.
*
* @param file The HDFS file
*/
void hdfsFileDisableDirectRead(hdfsFile file);
/**
* hdfsConnectAsUser - Connect to a hdfs file system as a specific user
* Connect to the hdfs.
@ -101,7 +92,6 @@ extern "C" {
*/
hdfsFS hdfsConnectAsUser(const char* nn, tPort port, const char *user);
/**
* hdfsConnect - Connect to a hdfs file system.
* Connect to the hdfs.

View File

@ -19,7 +19,7 @@
#ifndef LIBHDFS_HDFS_TEST_H
#define LIBHDFS_HDFS_TEST_H
struct hdfs_internal;
struct hdfsFile_internal;
/**
* Some functions that are visible only for testing.
@ -38,7 +38,16 @@ extern "C" {
* @return 1 if the file is using the direct read optimization,
* 0 otherwise.
*/
int hdfsFileUsesDirectRead(struct hdfs_internal *file);
int hdfsFileUsesDirectRead(struct hdfsFile_internal *file);
/**
* Disable the direct read optimization for a file.
*
* This is mainly provided for unit testing purposes.
*
* @param file The HDFS file
*/
void hdfsFileDisableDirectRead(struct hdfsFile_internal *file);
#ifdef __cplusplus
}
#endif

View File

@ -550,7 +550,8 @@ JNIEnv* getJNIEnv(void)
ret = pthread_key_create(&gTlsKey, hdfsThreadDestructor);
if (ret) {
pthread_mutex_unlock(&jvmMutex);
fprintf("pthread_key_create failed with error %d\n", ret);
fprintf(stderr, "getJNIEnv: pthread_key_create failed with "
"error %d\n", ret);
return NULL;
}
gTlsKeyInitialized = 1;
@ -569,7 +570,7 @@ JNIEnv* getJNIEnv(void)
}
tls = calloc(1, sizeof(struct hdfsTls));
if (!tls) {
fprintf(stderr, "getJNIEnv: OOM allocating %d bytes\n",
fprintf(stderr, "getJNIEnv: OOM allocating %zd bytes\n",
sizeof(struct hdfsTls));
return NULL;
}

View File

@ -35,7 +35,6 @@ int main(int argc, char **argv) {
}
const char* rfile = argv[1];
tSize fileTotalSize = strtoul(argv[2], NULL, 10);
tSize bufferSize = strtoul(argv[3], NULL, 10);
hdfsFile readFile = hdfsOpenFile(fs, rfile, O_RDONLY, bufferSize, 0, 0);

View File

@ -25,6 +25,7 @@
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define TLH_MAX_THREADS 100