@@ -442,22 +442,22 @@ char *fossil_io_soap_normalize_slang(const char *text) {
442442 const char * bad = FOSSIL_SOAP_SUGGESTIONS [i ].bad ;
443443 const char * sugg = FOSSIL_SOAP_SUGGESTIONS [i ].suggested ;
444444
445- char * found = NULL ;
445+ const char * found = NULL ;
446446 while ((found = custom_strcasestr (result , bad )) != NULL ) {
447- size_t offset = found - result ;
447+ size_t offset = ( size_t )( found - result ) ;
448448 size_t newlen = strlen (result ) - strlen (bad ) + strlen (sugg ) + 1 ;
449-
449+
450450 char * temp = malloc (newlen );
451451 if (!temp ) {
452452 free (result );
453453 return NULL ;
454454 }
455-
455+
456456 strncpy (temp , result , offset );
457457 temp [offset ] = '\0' ;
458458 strcat (temp , sugg );
459- strcat (temp , found + strlen (bad ));
460-
459+ strcat (temp , result + offset + strlen (bad ));
460+
461461 free (result );
462462 result = temp ;
463463 }
@@ -531,22 +531,22 @@ char *fossil_io_soap_filter_offensive(const char *text) {
531531 const char * bad = OFFENSIVE_WORDS [i ].offensive ;
532532 const char * good = OFFENSIVE_WORDS [i ].replacement ;
533533
534- char * found = NULL ;
534+ const char * found = NULL ;
535535 while ((found = custom_strcasestr (result , bad )) != NULL ) {
536- size_t offset = found - result ;
536+ size_t offset = ( size_t )( found - result ) ;
537537 size_t newlen = strlen (result ) - strlen (bad ) + strlen (good ) + 1 ;
538-
538+
539539 char * temp = malloc (newlen );
540540 if (!temp ) {
541541 free (result );
542542 return NULL ;
543543 }
544-
544+
545545 strncpy (temp , result , offset );
546546 temp [offset ] = '\0' ;
547547 strcat (temp , good );
548- strcat (temp , found + strlen (bad ));
549-
548+ strcat (temp , result + offset + strlen (bad ));
549+
550550 free (result );
551551 result = temp ;
552552 }
0 commit comments