comparison libpurple/protocols/myspace/myspace.c @ 24922:cead8692e35f

Terminate the loop on the first null-character. (Currently it would not terminate for the first null in, e.g. "1 2 \0 3")
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Tue, 06 Jan 2009 19:50:18 +0000
parents c6cadb7bdcf7
children b15168f2b7ee
comparison
equal deleted inserted replaced
24921:253e5d3988ca 24922:cead8692e35f
2874 /* Have username. */ 2874 /* Have username. */
2875 strncpy(normalized, str, BUF_LEN); 2875 strncpy(normalized, str, BUF_LEN);
2876 } 2876 }
2877 2877
2878 /* Strip spaces. */ 2878 /* Strip spaces. */
2879 for (i=0, j=0; normalized[j]; i++, j++) { 2879 for (i=0, j=0; normalized[j]; j++) {
2880 while (normalized[j] == ' ') 2880 if (normalized[j] != ' ')
2881 j++; 2881 normalized[i++] = normalized[j];
2882 normalized[i] = normalized[j];
2883 } 2882 }
2884 normalized[i] = '\0'; 2883 normalized[i] = '\0';
2885 2884
2886 /* Lowercase and perform UTF-8 normalization. */ 2885 /* Lowercase and perform UTF-8 normalization. */
2887 tmp1 = g_utf8_strdown(normalized, -1); 2886 tmp1 = g_utf8_strdown(normalized, -1);