Fossil SCM

In the markdown engine, use fossil_strnicmp() to allow easy compilation with MSVC.

mistachkin 2012-12-08 01:01 trunk
Commit 3ad20f4b257b0898030d419c3958999df5f3c0a9
1 file changed +5 -5
+5 -5
--- src/markdown.c
+++ src/markdown.c
@@ -273,11 +273,11 @@
273273
/* cmp_html_tag -- comparison function for bsearch() (stolen from discount) */
274274
static int cmp_html_tag(const void *a, const void *b){
275275
const struct html_tag *hta = a;
276276
const struct html_tag *htb = b;
277277
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);
279279
}
280280
281281
282282
/* find_block_tag -- returns the current block tag */
283283
static struct html_tag *find_block_tag(char *data, size_t size){
@@ -367,20 +367,20 @@
367367
}
368368
369369
/* scheme test */
370370
*autolink = MKDA_NOT_AUTOLINK;
371371
if( size>6
372
- && strncasecmp(data+1, "http", 4)==0
372
+ && fossil_strnicmp(data+1, "http", 4)==0
373373
&& (data[5]==':'
374374
|| ((data[5]=='s' || data[5]=='S') && data[6]==':'))
375375
){
376376
i = (data[5]==':') ? 6 : 7;
377377
*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 ){
379379
i = 5;
380380
*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 ){
382382
i = 8;
383383
/* not changing *autolink to go to the address test */
384384
}
385385
386386
/* completing autolink test: no whitespace or ' or " */
@@ -1640,11 +1640,11 @@
16401640
16411641
/* assuming data[0]=='<' && data[1]=='/' already tested */
16421642
16431643
/* checking tag is a match */
16441644
if( (tag->size+3)>=size
1645
- || strncasecmp(data+2, tag->text, tag->size)
1645
+ || fossil_strnicmp(data+2, tag->text, tag->size)
16461646
|| data[tag->size+2]!='>'
16471647
){
16481648
return 0;
16491649
}
16501650
16511651
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button