Fossil SCM
Adjust the captcha to use light-gray blocks instead of spaces for the background, to work around issues with systems where a space is smaller than a unicode block character. [forum:/forumpost/839b3b6fef|Forum post 839b3b6fef].
Commit
20c579e435ef8c4f0825220a7e8fad0391a0569a4acce38a01866b2d883788a6
Parent
e454028a292625d…
1 file changed
+7
-3
+7
-3
| --- src/captcha.c | ||
| +++ src/captcha.c | ||
| @@ -129,11 +129,11 @@ | ||
| 129 | 129 | ** Render an 8-character hexadecimal string as ascii art. |
| 130 | 130 | ** Space to hold the result is obtained from malloc() and should be freed |
| 131 | 131 | ** by the caller. |
| 132 | 132 | */ |
| 133 | 133 | char *captcha_render(const char *zPw){ |
| 134 | - char *z = fossil_malloc( 160*strlen(zPw) + 9 ); | |
| 134 | + char *z = fossil_malloc( 224*strlen(zPw) + 9 ); | |
| 135 | 135 | int i, j, k, m; |
| 136 | 136 | |
| 137 | 137 | k = 0; |
| 138 | 138 | for(i=0; i<7; i++){ |
| 139 | 139 | for(j=0; zPw[j]; j++){ |
| @@ -146,12 +146,16 @@ | ||
| 146 | 146 | z[k++] = 0x88; |
| 147 | 147 | z[k++] = 0xe2; |
| 148 | 148 | z[k++] = 0x96; |
| 149 | 149 | z[k++] = 0x88; |
| 150 | 150 | }else{ |
| 151 | - z[k++] = ' '; | |
| 152 | - z[k++] = ' '; | |
| 151 | + z[k++] = 0xe2; | |
| 152 | + z[k++] = 0x96; | |
| 153 | + z[k++] = 0x91; | |
| 154 | + z[k++] = 0xe2; | |
| 155 | + z[k++] = 0x96; | |
| 156 | + z[k++] = 0x91; | |
| 153 | 157 | } |
| 154 | 158 | } |
| 155 | 159 | z[k++] = ' '; |
| 156 | 160 | z[k++] = ' '; |
| 157 | 161 | } |
| 158 | 162 |
| --- src/captcha.c | |
| +++ src/captcha.c | |
| @@ -129,11 +129,11 @@ | |
| 129 | ** Render an 8-character hexadecimal string as ascii art. |
| 130 | ** Space to hold the result is obtained from malloc() and should be freed |
| 131 | ** by the caller. |
| 132 | */ |
| 133 | char *captcha_render(const char *zPw){ |
| 134 | char *z = fossil_malloc( 160*strlen(zPw) + 9 ); |
| 135 | int i, j, k, m; |
| 136 | |
| 137 | k = 0; |
| 138 | for(i=0; i<7; i++){ |
| 139 | for(j=0; zPw[j]; j++){ |
| @@ -146,12 +146,16 @@ | |
| 146 | z[k++] = 0x88; |
| 147 | z[k++] = 0xe2; |
| 148 | z[k++] = 0x96; |
| 149 | z[k++] = 0x88; |
| 150 | }else{ |
| 151 | z[k++] = ' '; |
| 152 | z[k++] = ' '; |
| 153 | } |
| 154 | } |
| 155 | z[k++] = ' '; |
| 156 | z[k++] = ' '; |
| 157 | } |
| 158 |
| --- src/captcha.c | |
| +++ src/captcha.c | |
| @@ -129,11 +129,11 @@ | |
| 129 | ** Render an 8-character hexadecimal string as ascii art. |
| 130 | ** Space to hold the result is obtained from malloc() and should be freed |
| 131 | ** by the caller. |
| 132 | */ |
| 133 | char *captcha_render(const char *zPw){ |
| 134 | char *z = fossil_malloc( 224*strlen(zPw) + 9 ); |
| 135 | int i, j, k, m; |
| 136 | |
| 137 | k = 0; |
| 138 | for(i=0; i<7; i++){ |
| 139 | for(j=0; zPw[j]; j++){ |
| @@ -146,12 +146,16 @@ | |
| 146 | z[k++] = 0x88; |
| 147 | z[k++] = 0xe2; |
| 148 | z[k++] = 0x96; |
| 149 | z[k++] = 0x88; |
| 150 | }else{ |
| 151 | z[k++] = 0xe2; |
| 152 | z[k++] = 0x96; |
| 153 | z[k++] = 0x91; |
| 154 | z[k++] = 0xe2; |
| 155 | z[k++] = 0x96; |
| 156 | z[k++] = 0x91; |
| 157 | } |
| 158 | } |
| 159 | z[k++] = ' '; |
| 160 | z[k++] = ' '; |
| 161 | } |
| 162 |