I just downloaded bstrlib and started using it. It's great, but I have encountered one problem - I wanted to use the bstring type (intended for C) in C++, but when I compile the program, it gives me an error that it cannot convert from void* to bstring*. I received this error in Visual Studio 2005, but I tried it on my Linux box and got the same thing. I believe this is a difference between C and C++; that you always have to cast void* pointers in C++. I modified three lines in bstrlib.c (lines 2463, 2467, and 2488) to add (bstring*) before the calls to bstr__realloc, and it compiled and appears to work. I don't know much about the inner workings of bstrlib, and I'm not terribly experienced with C++ (even more so with C), so I guess my question is if I actually fixed a bug or if by casting like that I might create other problems. Thanks!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Indeed, you have found an oversight in the last update to Bstrlib. This has been corrected in the CVS tree just as you suggested. You can get this corrected version of bstrlib.c here:
I just downloaded bstrlib and started using it. It's great, but I have encountered one problem - I wanted to use the bstring type (intended for C) in C++, but when I compile the program, it gives me an error that it cannot convert from void* to bstring*. I received this error in Visual Studio 2005, but I tried it on my Linux box and got the same thing. I believe this is a difference between C and C++; that you always have to cast void* pointers in C++. I modified three lines in bstrlib.c (lines 2463, 2467, and 2488) to add (bstring*) before the calls to bstr__realloc, and it compiled and appears to work. I don't know much about the inner workings of bstrlib, and I'm not terribly experienced with C++ (even more so with C), so I guess my question is if I actually fixed a bug or if by casting like that I might create other problems. Thanks!
Indeed, you have found an oversight in the last update to Bstrlib. This has been corrected in the CVS tree just as you suggested. You can get this corrected version of bstrlib.c here:
http://bstring.cvs.sourceforge.net/\*checkout*/bstring/tree/bstrlib.c?revision=1.181
Thanks for pointing this out, I will try to update the distribution soon.
--
Paul
That works great - thanks!