File tree Expand file tree Collapse file tree 1 file changed +27
-16
lines changed
Expand file tree Collapse file tree 1 file changed +27
-16
lines changed Original file line number Diff line number Diff line change @@ -162,17 +162,23 @@ int url_count_inline(const wchar_t *line) {
162162 int count = 0 ;
163163 const wchar_t * i = line ;
164164
165- for (; * i ; i ++ ) {
165+ while ( * i ) {
166166 if (* i == '\\' ) {
167- i ++ ;
168- } else if ( * i == '[' && * (i + 1 ) && * (i + 1 ) != ']' ) {
169- while (* i && * i != ']' ) i ++ ;
170- i ++ ;
171- if (* i == '(' && wcschr (i , ')' )) {
172- count ++ ;
173- i = wcschr (i , ')' );
167+ if (* (i + 1 )) i ++ ;
168+ } else if (* i == '[' ) {
169+ if (* (i + 1 ) && * (i + 1 ) != ']' ) {
170+ i ++ ;
171+ while (* i && * i != ']' ) i ++ ;
172+ if (* i == ']' ) {
173+ i ++ ;
174+ if (* i == '(' && wcschr (i , ')' )) {
175+ count ++ ;
176+ i = wcschr (i , ')' );
177+ }
178+ }
174179 }
175180 }
181+ if (* i ) i ++ ;
176182 }
177183
178184 return count ;
@@ -182,19 +188,24 @@ int url_len_inline(const wchar_t *value) {
182188 int count = 0 ;
183189 const wchar_t * i = value ;
184190
185- for (; * i ; i ++ ) {
191+ while ( * i ) {
186192 if (* i == '\\' ) {
187- i ++ ;
188- } else if ( * i == '[' && * (i + 1 ) && * (i + 1 ) != ']' ) {
189- while (* i && * i != ']' ) i ++ ;
190- i ++ ;
191- if (* i == '(' && wcschr (i , ')' )) {
192- while (* i && * i != ')' ) {
193- count ++ ;
193+ if (* (i + 1 )) i ++ ;
194+ } else if (* i == '[' ) {
195+ if (* (i + 1 ) && * (i + 1 ) != ']' ) {
196+ while (* i && * i != ']' ) i ++ ;
197+ if (* i == ']' ) {
194198 i ++ ;
199+ if (* i == '(' && wcschr (i , ')' )) {
200+ while (* i && * i != ')' ) {
201+ count ++ ;
202+ i ++ ;
203+ }
204+ }
195205 }
196206 }
197207 }
208+ if (* i ) i ++ ;
198209 }
199210
200211 return count ;
You can’t perform that action at this time.
0 commit comments