Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
fix segmentation faults in c api (#4158)
Browse files Browse the repository at this point in the history
  • Loading branch information
jemaw authored and piiswrong committed Dec 9, 2016
1 parent 29143dd commit 7907e45
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions include/mxnet/c_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -1328,7 +1328,7 @@ MXNET_DLL int MXRecordIOWriterFree(RecordIOHandle handle);
* \param size size of buffer
* \return 0 when success, -1 when failure happens
*/
MXNET_DLL int MXRecordIOWriterWriteRecord(RecordIOHandle *handle,
MXNET_DLL int MXRecordIOWriterWriteRecord(RecordIOHandle handle,
const char *buf, size_t size);

/**
Expand All @@ -1337,7 +1337,7 @@ MXNET_DLL int MXRecordIOWriterWriteRecord(RecordIOHandle *handle,
* \param pos handle to output position
* \return 0 when success, -1 when failure happens
*/
MXNET_DLL int MXRecordIOWriterTell(RecordIOHandle *handle, size_t *pos);
MXNET_DLL int MXRecordIOWriterTell(RecordIOHandle handle, size_t *pos);

/**
* \brief Create a RecordIO reader object
Expand All @@ -1352,7 +1352,7 @@ MXNET_DLL int MXRecordIOReaderCreate(const char *uri, RecordIOHandle *out);
* \param handle handle to RecordIO object
* \return 0 when success, -1 when failure happens
*/
MXNET_DLL int MXRecordIOReaderFree(RecordIOHandle *handle);
MXNET_DLL int MXRecordIOReaderFree(RecordIOHandle handle);

/**
* \brief Write a record to a RecordIO object
Expand All @@ -1361,7 +1361,7 @@ MXNET_DLL int MXRecordIOReaderFree(RecordIOHandle *handle);
* \param size point to size of buffer
* \return 0 when success, -1 when failure happens
*/
MXNET_DLL int MXRecordIOReaderReadRecord(RecordIOHandle *handle,
MXNET_DLL int MXRecordIOReaderReadRecord(RecordIOHandle handle,
char const **buf, size_t *size);

/**
Expand All @@ -1370,7 +1370,7 @@ MXNET_DLL int MXRecordIOReaderReadRecord(RecordIOHandle *handle,
* \param pos target position
* \return 0 when success, -1 when failure happens
*/
MXNET_DLL int MXRecordIOReaderSeek(RecordIOHandle *handle, size_t pos);
MXNET_DLL int MXRecordIOReaderSeek(RecordIOHandle handle, size_t pos);

/**
* \brief Create a MXRtc object
Expand Down
10 changes: 5 additions & 5 deletions src/c_api/c_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1396,7 +1396,7 @@ int MXRecordIOWriterFree(RecordIOHandle handle) {
API_END();
}

int MXRecordIOWriterWriteRecord(RecordIOHandle *handle,
int MXRecordIOWriterWriteRecord(RecordIOHandle handle,
const char *buf, size_t size) {
API_BEGIN();
MXRecordIOContext *context =
Expand All @@ -1405,7 +1405,7 @@ int MXRecordIOWriterWriteRecord(RecordIOHandle *handle,
API_END();
}

int MXRecordIOWriterTell(RecordIOHandle *handle, size_t *pos) {
int MXRecordIOWriterTell(RecordIOHandle handle, size_t *pos) {
API_BEGIN();
MXRecordIOContext *context =
reinterpret_cast<MXRecordIOContext*>(handle);
Expand All @@ -1426,7 +1426,7 @@ int MXRecordIOReaderCreate(const char *uri,
API_END();
}

int MXRecordIOReaderFree(RecordIOHandle *handle) {
int MXRecordIOReaderFree(RecordIOHandle handle) {
API_BEGIN();
MXRecordIOContext *context =
reinterpret_cast<MXRecordIOContext*>(handle);
Expand All @@ -1436,7 +1436,7 @@ int MXRecordIOReaderFree(RecordIOHandle *handle) {
API_END();
}

int MXRecordIOReaderReadRecord(RecordIOHandle *handle,
int MXRecordIOReaderReadRecord(RecordIOHandle handle,
char const **buf, size_t *size) {
API_BEGIN();
MXRecordIOContext *context =
Expand All @@ -1451,7 +1451,7 @@ int MXRecordIOReaderReadRecord(RecordIOHandle *handle,
API_END();
}

int MXRecordIOReaderSeek(RecordIOHandle *handle, size_t pos) {
int MXRecordIOReaderSeek(RecordIOHandle handle, size_t pos) {
API_BEGIN();
MXRecordIOContext *context =
reinterpret_cast<MXRecordIOContext*>(handle);
Expand Down

0 comments on commit 7907e45

Please sign in to comment.