(no subject)
Sep. 2nd, 2004 04:15 ama Winamp plugin I’ve been using for a while now decided to randomly break. as in, it started crashing 5 seconds after hitting Play, every time. so, naturally, I decided to poke around in the (happily available) source.
the verdict? how the hell did it work in the first place? O_o I mean, it’s C++—the Microsoft Visual variety—and even I can see serious problems with it. but oddly enough, the part that it’s actually barfing on is a simple call to
I suspect it may be related to the almost complete lack of URL encoding involved. (seriously: it replaces spaces with “%20” and that’s it.) was kinda hard to look at with no internet, though.
the verdict? how the hell did it work in the first place? O_o I mean, it’s C++—the Microsoft Visual variety—and even I can see serious problems with it. but oddly enough, the part that it’s actually barfing on is a simple call to
CHttpFile::SendRequest(). I tried throwing a try block around it to get more info, but the exception type it’s supposed to throw is apparently not present. or at least not completely present. -_-I suspect it may be related to the almost complete lack of URL encoding involved. (seriously: it replaces spaces with “%20” and that’s it.) was kinda hard to look at with no internet, though.
no subject
Date: 2004-09-02 04:57 pm (UTC)I've actually had programming problems like that. Not so often now, but certainly when I first started perfectly working code would seem to all of a sudden break. Most of them, I later found out, had to do with the lousy memory scheme of MacOS 7 and that of C++. (Using a reference to an object that was programmically delted elsewhere, but not yet erased out of main memory.)
I mention this because it may be that skin was coded by someone with similar inexperience, and that the error is actually somewhere else and only causing this crash as a side effect.
I think it’s bigger than the original entry O_o
Date: 2004-09-02 05:40 pm (UTC)LPSTR, instead ofLPCSTR)), important strings scattered all over the place...Hell, they didn’t even use the STL (
char) string‑handling functions: they were manually comparing and constructing strings!This plugin is my current exercise in masochism. I seriously think I should just rewrite it, using the original as a model, rather than repairing it. Thankfully, it’s small enough that this is actually feasible. ^^;;;
Re: I think it’s bigger than the original entry O_o
Date: 2004-09-02 06:26 pm (UTC)This is actually just a straight struct, but it has special variables init, config, and quit that are pointers to C functions.
In this way, the struct becomes a bit like a class. static functions have no need for a reference to the struct, others do. This is usually being taken as the function's first argument.
C++ still offically supports this construct so as to be backwards compatable with C. But, it wouldn't surprise me is MS dropped it in visual C++ do to the problems with being able to treat any pointer as a function.
Re: I think it’s bigger than the original entry O_o
Date: 2004-09-03 02:28 am (UTC)structis—hell, I even understand it—but I don't know enough about C# to know what the strict equivalent is—or if there even is one.