Skip to content

Commit

Permalink
Merge pull request #43 from alessiop86/gh-pages
Browse files Browse the repository at this point in the history
A couple of fix avoiding segmentation fault and other errors when using the library in the Android version
  • Loading branch information
petewarden committed Mar 30, 2015
2 parents 92a3f76 + 7b7f7ae commit 274366f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
Binary file modified AndroidLibrary/jars/libjpcnn.so
Binary file not shown.
Binary file modified examples/AndroidExample/libs/armeabi/libjpcnn.so
Binary file not shown.
18 changes: 16 additions & 2 deletions source/src/lib/svm/svm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2681,7 +2681,14 @@ int svm_save_model(const char *model_file_name, const svm_model *model)

int svm_save_model_to_file_handle(FILE* fp, const svm_model* model) {

char *old_locale = strdup(setlocale(LC_ALL, NULL));
char *old_locale_nillable = setlocale(LC_ALL, NULL);

char *old_locale;
if (old_locale_nillable == NULL)
old_locale = NULL;
else
old_locale = strdup(old_locale_nillable);

setlocale(LC_ALL, "C");

const svm_parameter& param = model->param;
Expand Down Expand Up @@ -2797,7 +2804,14 @@ svm_model *svm_load_model(const char *model_file_name)
FILE *fp = fopen(model_file_name,"rb");
if(fp==NULL) return NULL;

char *old_locale = strdup(setlocale(LC_ALL, NULL));
char *old_locale_nillable = setlocale(LC_ALL, NULL);

char *old_locale;
if (old_locale_nillable == NULL)
old_locale = NULL;
else
old_locale = strdup(old_locale_nillable);

setlocale(LC_ALL, "C");

// read parameters
Expand Down

0 comments on commit 274366f

Please sign in to comment.