Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
openSUSE:12.2:ARM
novel-pinyin
bnc528583.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File bnc528583.patch of Package novel-pinyin
diff --git a/utils/storage/gen_pinyin_table.cpp b/utils/storage/gen_pinyin_table.cpp index 110fa18..38e6a27 100644 --- a/utils/storage/gen_pinyin_table.cpp +++ b/utils/storage/gen_pinyin_table.cpp @@ -92,6 +92,10 @@ void feed_file ( const char * filename){ char phrase[1024], pinyin[1024]; guint32 n_freq; FILE * infile = fopen(filename, "r"); + if ( NULL == infile ){ + fprintf(stderr, "Can't open file %s.\n", filename); + exit(1); + } while ( !feof(infile)){ fscanf(infile, "%s", phrase); fscanf(infile, "%s", pinyin); @@ -100,6 +104,7 @@ void feed_file ( const char * filename){ break; feed_line(phrase, pinyin, n_freq); } + fclose(infile); } void feed_line (const char * phrase, const char * pinyin, const guint32 freq){ @@ -200,6 +205,10 @@ void sort_item_array(){ void gen_phrase_file(const char * outfilename, int phrase_index){ FILE * outfile = fopen(outfilename, "w"); + if (NULL == outfile ) { + fprintf(stderr, "Can't write file %s.\n", outfilename); + exit(1); + } phrase_token_t token = 1; char pinyin_buffer[4096]; //phrase length @@ -235,4 +244,5 @@ void gen_phrase_file(const char * outfilename, int phrase_index){ token++; } } + fclose(outfile); }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor