fix include of files without last newline, as reported by Wes Hodges
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9032 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
3d4a44ac03
commit
c2b8a083a0
2 changed files with 13 additions and 2 deletions
|
|
@ -1,3 +1,5 @@
|
||||||
|
#ifndef a_h
|
||||||
|
#define a_h
|
||||||
enum GlobalEnum { globalenum1=1, globalenum2 };
|
enum GlobalEnum { globalenum1=1, globalenum2 };
|
||||||
|
|
||||||
/* This function should be static as it will be emitted into the code for
|
/* This function should be static as it will be emitted into the code for
|
||||||
|
|
@ -15,5 +17,5 @@ class A {
|
||||||
enum MemberEnum { memberenum1=10, memberenum2 };
|
enum MemberEnum { memberenum1=10, memberenum2 };
|
||||||
virtual MemberEnum member_virtual_test(MemberEnum e) { return e; }
|
virtual MemberEnum member_virtual_test(MemberEnum e) { return e; }
|
||||||
virtual GlobalEnum global_virtual_test(GlobalEnum e) { return global_test(e); }
|
virtual GlobalEnum global_virtual_test(GlobalEnum e) { return global_test(e); }
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
@ -266,6 +266,7 @@ Swig_open(const String_or_char *name) {
|
||||||
|
|
||||||
String *
|
String *
|
||||||
Swig_read_file(FILE *f) {
|
Swig_read_file(FILE *f) {
|
||||||
|
int len;
|
||||||
char buffer[4096];
|
char buffer[4096];
|
||||||
String *str = NewStringEmpty();
|
String *str = NewStringEmpty();
|
||||||
|
|
||||||
|
|
@ -273,6 +274,14 @@ Swig_read_file(FILE *f) {
|
||||||
while (fgets(buffer,4095,f)) {
|
while (fgets(buffer,4095,f)) {
|
||||||
StringAppend(str,buffer);
|
StringAppend(str,buffer);
|
||||||
}
|
}
|
||||||
|
len = StringLen(str);
|
||||||
|
if (len) {
|
||||||
|
char *cstr = Char(str);
|
||||||
|
if (cstr[len - 1] != '\n') {
|
||||||
|
StringAppend(str, "\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue