- if (pos == -1) return; // incorrectly filled Content-Type header
- pos += 34 ; /*strlen("Content-Type: text/plain; charset=")*/
- while (header[pos] != '\n') charset << header[pos++];
-
- if ((enc = wxTheFontMapper -> CharsetToEncoding(charset, FALSE)) == wxFONTENCODING_SYSTEM) return;
+ if (pos == wxNOT_FOUND)
+ return; // incorrectly filled Content-Type header
+ size_t n = pos + 34; /*strlen("Content-Type: text/plain; charset=")*/
+ while (header[n] != '\n')
+ charset << header[n++];
+
+ enc = wxTheFontMapper->CharsetToEncoding(charset, FALSE);
+ if ( enc == wxFONTENCODING_SYSTEM )
+ return; // unknown encoding