libs/lmo: fix logic errors in po2lmo
authorJo-Philipp Wich <jow@openwrt.org>
Sun, 1 Nov 2009 17:27:56 +0000 (17:27 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Sun, 1 Nov 2009 17:27:56 +0000 (17:27 +0000)
libs/lmo/src/lmo_po2lmo.c

index 9b7b09792f2b3d6c783b3cec05381853030df51a..afe894e8e068c3ea1b3bfed8c46363d5989fc789 100644 (file)
@@ -99,7 +99,7 @@ int main(int argc, char *argv[])
        memset(key, 0, sizeof(val));
        memset(val, 0, sizeof(val));
 
-       while( (NULL != fgets(line, sizeof(line), in)) || (state >= 3 && feof(in)) )
+       while( (NULL != fgets(line, sizeof(line), in)) || (state >= 2 && feof(in)) )
        {
                if( state == 0 && strstr(line, "msgid \"") == line )
                {
@@ -123,9 +123,6 @@ int main(int argc, char *argv[])
                                        case -1:
                                                state = 4;
                                                break;
-                                       case 0:
-                                               state = 2;
-                                               break;
                                        default:
                                                state = 3;
                                }
@@ -135,7 +132,7 @@ int main(int argc, char *argv[])
                                switch(extract_string(line, tmp, sizeof(tmp)))
                                {
                                        case -1:
-                                               state = 4;
+                                               state = 2;
                                                break;
                                        default:
                                                strcat(key, tmp);
@@ -153,7 +150,8 @@ int main(int argc, char *argv[])
                                        strcat(val, tmp);
                        }
                }
-               else if( state == 4 )
+
+               if( state == 4 )
                {
                        if( strlen(key) > 0 && strlen(val) > 0 )
                        {