|
|
| version 1.224, 2007/04/23 10:30:31 | version 1.226, 2007/11/27 09:57:08 |
|---|---|
| Line 298 void create_dir_for_file(const String& f | Line 298 void create_dir_for_file(const String& f |
| bool file_write_action_under_lock( | bool file_write_action_under_lock( |
| const String& file_spec, | const String& file_spec, |
| const char* action_name, File_write_action action, void *context, | const char* action_name, |
| File_write_action action, | |
| void *context, | |
| bool as_text, | bool as_text, |
| bool do_append, | bool do_append, |
| bool do_block, | bool do_block, |
| Line 369 void file_write( | Line 371 void file_write( |
| bool as_text, | bool as_text, |
| bool do_append) { | bool do_append) { |
| File_write_action_info info={data, size}; | File_write_action_info info={data, size}; |
| file_write_action_under_lock( | file_write_action_under_lock( |
| file_spec, | file_spec, |
| "write", file_write_action, &info, | "write", |
| file_write_action, | |
| &info, | |
| as_text, | as_text, |
| do_append); | do_append); |
| } | } |
| Line 660 int getMonthDays(int year, int month) { | Line 665 int getMonthDays(int year, int month) { |
| return (month == 2 && isLeap(year)) ? 29 : monthDays[month]; | return (month == 2 && isLeap(year)) ? 29 : monthDays[month]; |
| } | } |
| void remove_crlf(char* start, char* end) { | int remove_crlf(char* start, char* end) { |
| for(char* p=start; p<end; p++) | char* from=start; |
| switch(*p) { | char* to=start; |
| case '\n': *p='|'; break; | bool skip=false; |
| case '\r': *p=' '; break; | while(from < end){ |
| switch(*from){ | |
| case '\n': | |
| case '\r': | |
| case '\t': | |
| case ' ': | |
| if(!skip){ | |
| *to=' '; | |
| to++; | |
| skip=true; | |
| } | |
| break; | |
| default: | |
| if(from != to) | |
| *to=*from; | |
| to++; | |
| skip=false; | |
| } | } |
| from++; | |
| } | |
| return to-start; | |
| } | } |