Fossil SCM
In the markdown engine, use fossil_strnicmp() to allow easy compilation with MSVC.
Commit
3ad20f4b257b0898030d419c3958999df5f3c0a9
Parent
61079c3bef3257f…
1 file changed
+5
-5
+5
-5
| --- src/markdown.c | ||
| +++ src/markdown.c | ||
| @@ -273,11 +273,11 @@ | ||
| 273 | 273 | /* cmp_html_tag -- comparison function for bsearch() (stolen from discount) */ |
| 274 | 274 | static int cmp_html_tag(const void *a, const void *b){ |
| 275 | 275 | const struct html_tag *hta = a; |
| 276 | 276 | const struct html_tag *htb = b; |
| 277 | 277 | if( hta->size!=htb->size ) return hta->size-htb->size; |
| 278 | - return strncasecmp(hta->text, htb->text, hta->size); | |
| 278 | + return fossil_strnicmp(hta->text, htb->text, hta->size); | |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | |
| 282 | 282 | /* find_block_tag -- returns the current block tag */ |
| 283 | 283 | static struct html_tag *find_block_tag(char *data, size_t size){ |
| @@ -367,20 +367,20 @@ | ||
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | /* scheme test */ |
| 370 | 370 | *autolink = MKDA_NOT_AUTOLINK; |
| 371 | 371 | if( size>6 |
| 372 | - && strncasecmp(data+1, "http", 4)==0 | |
| 372 | + && fossil_strnicmp(data+1, "http", 4)==0 | |
| 373 | 373 | && (data[5]==':' |
| 374 | 374 | || ((data[5]=='s' || data[5]=='S') && data[6]==':')) |
| 375 | 375 | ){ |
| 376 | 376 | i = (data[5]==':') ? 6 : 7; |
| 377 | 377 | *autolink = MKDA_NORMAL; |
| 378 | - }else if( size>5 && strncasecmp(data+1, "ftp:", 4)==0 ){ | |
| 378 | + }else if( size>5 && fossil_strnicmp(data+1, "ftp:", 4)==0 ){ | |
| 379 | 379 | i = 5; |
| 380 | 380 | *autolink = MKDA_NORMAL; |
| 381 | - }else if( size>7 && strncasecmp(data+1, "mailto:", 7)==0 ){ | |
| 381 | + }else if( size>7 && fossil_strnicmp(data+1, "mailto:", 7)==0 ){ | |
| 382 | 382 | i = 8; |
| 383 | 383 | /* not changing *autolink to go to the address test */ |
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | /* completing autolink test: no whitespace or ' or " */ |
| @@ -1640,11 +1640,11 @@ | ||
| 1640 | 1640 | |
| 1641 | 1641 | /* assuming data[0]=='<' && data[1]=='/' already tested */ |
| 1642 | 1642 | |
| 1643 | 1643 | /* checking tag is a match */ |
| 1644 | 1644 | if( (tag->size+3)>=size |
| 1645 | - || strncasecmp(data+2, tag->text, tag->size) | |
| 1645 | + || fossil_strnicmp(data+2, tag->text, tag->size) | |
| 1646 | 1646 | || data[tag->size+2]!='>' |
| 1647 | 1647 | ){ |
| 1648 | 1648 | return 0; |
| 1649 | 1649 | } |
| 1650 | 1650 | |
| 1651 | 1651 |
| --- src/markdown.c | |
| +++ src/markdown.c | |
| @@ -273,11 +273,11 @@ | |
| 273 | /* cmp_html_tag -- comparison function for bsearch() (stolen from discount) */ |
| 274 | static int cmp_html_tag(const void *a, const void *b){ |
| 275 | const struct html_tag *hta = a; |
| 276 | const struct html_tag *htb = b; |
| 277 | if( hta->size!=htb->size ) return hta->size-htb->size; |
| 278 | return strncasecmp(hta->text, htb->text, hta->size); |
| 279 | } |
| 280 | |
| 281 | |
| 282 | /* find_block_tag -- returns the current block tag */ |
| 283 | static struct html_tag *find_block_tag(char *data, size_t size){ |
| @@ -367,20 +367,20 @@ | |
| 367 | } |
| 368 | |
| 369 | /* scheme test */ |
| 370 | *autolink = MKDA_NOT_AUTOLINK; |
| 371 | if( size>6 |
| 372 | && strncasecmp(data+1, "http", 4)==0 |
| 373 | && (data[5]==':' |
| 374 | || ((data[5]=='s' || data[5]=='S') && data[6]==':')) |
| 375 | ){ |
| 376 | i = (data[5]==':') ? 6 : 7; |
| 377 | *autolink = MKDA_NORMAL; |
| 378 | }else if( size>5 && strncasecmp(data+1, "ftp:", 4)==0 ){ |
| 379 | i = 5; |
| 380 | *autolink = MKDA_NORMAL; |
| 381 | }else if( size>7 && strncasecmp(data+1, "mailto:", 7)==0 ){ |
| 382 | i = 8; |
| 383 | /* not changing *autolink to go to the address test */ |
| 384 | } |
| 385 | |
| 386 | /* completing autolink test: no whitespace or ' or " */ |
| @@ -1640,11 +1640,11 @@ | |
| 1640 | |
| 1641 | /* assuming data[0]=='<' && data[1]=='/' already tested */ |
| 1642 | |
| 1643 | /* checking tag is a match */ |
| 1644 | if( (tag->size+3)>=size |
| 1645 | || strncasecmp(data+2, tag->text, tag->size) |
| 1646 | || data[tag->size+2]!='>' |
| 1647 | ){ |
| 1648 | return 0; |
| 1649 | } |
| 1650 | |
| 1651 |
| --- src/markdown.c | |
| +++ src/markdown.c | |
| @@ -273,11 +273,11 @@ | |
| 273 | /* cmp_html_tag -- comparison function for bsearch() (stolen from discount) */ |
| 274 | static int cmp_html_tag(const void *a, const void *b){ |
| 275 | const struct html_tag *hta = a; |
| 276 | const struct html_tag *htb = b; |
| 277 | if( hta->size!=htb->size ) return hta->size-htb->size; |
| 278 | return fossil_strnicmp(hta->text, htb->text, hta->size); |
| 279 | } |
| 280 | |
| 281 | |
| 282 | /* find_block_tag -- returns the current block tag */ |
| 283 | static struct html_tag *find_block_tag(char *data, size_t size){ |
| @@ -367,20 +367,20 @@ | |
| 367 | } |
| 368 | |
| 369 | /* scheme test */ |
| 370 | *autolink = MKDA_NOT_AUTOLINK; |
| 371 | if( size>6 |
| 372 | && fossil_strnicmp(data+1, "http", 4)==0 |
| 373 | && (data[5]==':' |
| 374 | || ((data[5]=='s' || data[5]=='S') && data[6]==':')) |
| 375 | ){ |
| 376 | i = (data[5]==':') ? 6 : 7; |
| 377 | *autolink = MKDA_NORMAL; |
| 378 | }else if( size>5 && fossil_strnicmp(data+1, "ftp:", 4)==0 ){ |
| 379 | i = 5; |
| 380 | *autolink = MKDA_NORMAL; |
| 381 | }else if( size>7 && fossil_strnicmp(data+1, "mailto:", 7)==0 ){ |
| 382 | i = 8; |
| 383 | /* not changing *autolink to go to the address test */ |
| 384 | } |
| 385 | |
| 386 | /* completing autolink test: no whitespace or ' or " */ |
| @@ -1640,11 +1640,11 @@ | |
| 1640 | |
| 1641 | /* assuming data[0]=='<' && data[1]=='/' already tested */ |
| 1642 | |
| 1643 | /* checking tag is a match */ |
| 1644 | if( (tag->size+3)>=size |
| 1645 | || fossil_strnicmp(data+2, tag->text, tag->size) |
| 1646 | || data[tag->size+2]!='>' |
| 1647 | ){ |
| 1648 | return 0; |
| 1649 | } |
| 1650 | |
| 1651 |