projects
/
fms.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
version 0.3.2
[fms.git]
/
src
/
freenet
/
captcha
/
simplecaptcha.cpp
diff --git
a/src/freenet/captcha/simplecaptcha.cpp
b/src/freenet/captcha/simplecaptcha.cpp
index
41d7166
..
512774e
100644
(file)
--- a/
src/freenet/captcha/simplecaptcha.cpp
+++ b/
src/freenet/captcha/simplecaptcha.cpp
@@
-3,6
+3,10
@@
#include "../../../include/freenet/captcha/easybmp/EasyBMP_Font.h"
\r
#include "../../../include/freenet/captcha/easybmp/EasyBMP_Geometry.h"
\r
\r
#include "../../../include/freenet/captcha/easybmp/EasyBMP_Font.h"
\r
#include "../../../include/freenet/captcha/easybmp/EasyBMP_Geometry.h"
\r
\r
+#include <Poco/TemporaryFile.h>
\r
+
\r
+#include <cstdlib>
\r
+
\r
#ifdef XMEM
\r
#include <xmem.h>
\r
#endif
\r
#ifdef XMEM
\r
#include <xmem.h>
\r
#endif
\r
@@
-14,8
+18,9
@@
void SimpleCaptcha::Generate()
int bmpheight=50;
\r
RGBApixel lettercols[5];
\r
std::string puzzlestring;
\r
int bmpheight=50;
\r
RGBApixel lettercols[5];
\r
std::string puzzlestring;
\r
- std::string tempfilename=GenerateRandomString(10);
\r
- tempfilename+=".bmp";
\r
+ std::string tempfilename="";
\r
+
\r
+ tempfilename=Poco::TemporaryFile::tempName();
\r
\r
puzzlestring=GenerateRandomString(5);
\r
m_solution.clear();
\r
\r
puzzlestring=GenerateRandomString(5);
\r
m_solution.clear();
\r
@@
-51,16
+56,17
@@
void SimpleCaptcha::Generate()
double endangle=(double)(rand()%360)*(3.14159/180);
\r
pixel.Red=100+(rand()%150);
\r
pixel.Green=100+(rand()%150);
\r
double endangle=(double)(rand()%360)*(3.14159/180);
\r
pixel.Red=100+(rand()%150);
\r
pixel.Green=100+(rand()%150);
\r
+ pixel.Blue=100+(rand()%150);
\r
DrawArc(bmp,x1,y1,radius,startangle,endangle,pixel);
\r
}
\r
\r
for(int i=0; i<5; i++)
\r
{
\r
// keep the colors dark
\r
DrawArc(bmp,x1,y1,radius,startangle,endangle,pixel);
\r
}
\r
\r
for(int i=0; i<5; i++)
\r
{
\r
// keep the colors dark
\r
- lettercols[i].Red=(rand()%
20
0);
\r
- lettercols[i].Green=(rand()%
20
0);
\r
- lettercols[i].Blue=(rand()%
20
0);
\r
- // draw a line with the letter col
\r
+ lettercols[i].Red=(rand()%
15
0);
\r
+ lettercols[i].Green=(rand()%
15
0);
\r
+ lettercols[i].Blue=(rand()%
15
0);
\r
+ // draw a line with the letter col
or
\r
DrawAALine(bmp,rand()%bmpwidth,rand()%bmpheight,rand()%bmpwidth,rand()%bmpheight,lettercols[i]);
\r
}
\r
\r
DrawAALine(bmp,rand()%bmpwidth,rand()%bmpheight,rand()%bmpwidth,rand()%bmpheight,lettercols[i]);
\r
}
\r
\r