![]() |
|
|||||||
| Register | FAQ | The Twelve Commandments | Members List | Calendar | Arcade | Find the Best VPN | Today's Posts | Search |
| Mutella (Linux/Unix) Mutella has been discontinued. We highly recommend you use an actively developed client instead. |
![]() |
|
|
Thread Tools | Display Modes |
|
#11
|
|||
|
|||
|
Good luck with your new home, if you're becoming my neighbour call me for a beer. :)
Thx for the answers, I still need lots of time. Since my network class grows with my server (no Gnutella thingie) and the server takes all my time. I'll plan to use STL std::string with some tiny addition yet like sstring::format() and sstring::operator const char*(). Btw when using std::string here's a port of format() member: Code:
void vformat(const char *fmt, va_list ap)
{
if(strstr(fmt, "%n")) { //check against %n, which can be exploited by accident
assert(0 && "sstring::format: Parachute for unsafe type %n");
assign(fmt); //note: really nobody needs unsafe %n
return;
}
std::vector<char> buffer; //buffer for creating string
size_t size = strlen(fmt)+16; //some extra characters, string will grow
while (1)
{
buffer.reserve(size); //ensure we have that much space in the buffer
//try to print into allocated space
int n = vsnprintf(&buffer[0], buffer.capacity(), fmt, ap);
if (n>-1 && n<buffer.capacity())
{ //allocated space was fine
assign(&buffer[0]); //store the formated string (unfortunately a copy)
return;
}
//else try again with more space
if (n>-1) //glibc 2.1
size = n+1; //precisely what is needed
else //glibc 2.0 or MS-crt
size = buffer.capacity()*2; //twice the old size
}
}
|
|
#12
|
|||
|
|||
|
hm, I wonder where the random generator is initialized? grep srand finds nothing. Propably I'm using an old version?
|
|
#13
|
|||
|
|||
|
Quote:
--Max |
![]() |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| any updates to mutella? | Gateway | Mutella (Linux/Unix) | 3 | December 2nd, 2005 06:13 PM |
| Mutella 0.4 is out! | maksik | Mutella (Linux/Unix) | 5 | November 20th, 2003 11:34 AM |
| mutella newbie question | hotcarl | Mutella (Linux/Unix) | 2 | September 8th, 2002 05:02 AM |
| Welcome to the Mutella forum | maksik | Mutella (Linux/Unix) | 3 | March 7th, 2002 08:36 AM |
| Why not a Mutella forum | fefu | Mutella (Linux/Unix) | 7 | March 7th, 2002 08:19 AM |