Browse code

hwp3.x: simplify 'match' variable declarations

Kevin Lin authored on 2016/01/13 01:21:13
Showing 1 changed files
... ...
@@ -560,6 +560,9 @@ static inline int parsehwp3_paragraph(cli_ctx *ctx, fmap_t *map, int p, int leve
560 560
     uint16_t nchars, nlines, content;
561 561
     uint8_t ppfs, csb;
562 562
     int i, c, l, sp = 0, term = 0, ret = CL_SUCCESS;
563
+#if HWP3_VERIFY
564
+    uint16_t match;
565
+#endif
563 566
 #if HWP3_DEBUG
564 567
     /* other paragraph info */
565 568
     uint8_t ifsc, flags, istyle;
... ...
@@ -735,9 +738,6 @@ static inline int parsehwp3_paragraph(cli_ctx *ctx, fmap_t *map, int p, int leve
735 735
             case 27:
736 736
                 {
737 737
                     uint32_t length;
738
-#if HWP3_VERIFY
739
-                    uint16_t match;
740
-#endif
741 738
 
742 739
                     hwp3_debug("HWP3.x: Paragraph[%d, %d]: detected special character as [reserved]\n", level, p);
743 740
 
... ...
@@ -776,7 +776,6 @@ static inline int parsehwp3_paragraph(cli_ctx *ctx, fmap_t *map, int p, int leve
776 776
                 {
777 777
 #if HWP3_VERIFY
778 778
                     uint32_t length;
779
-                    uint16_t match;
780 779
 #endif
781 780
 
782 781
                     hwp3_debug("HWP3.x: Paragraph[%d, %d]: detected bookmark marker @ offset %llu\n", level, p, (long long unsigned)offset);
... ...
@@ -815,10 +814,6 @@ static inline int parsehwp3_paragraph(cli_ctx *ctx, fmap_t *map, int p, int leve
815 815
                 }
816 816
             case 7: /* date format */
817 817
                 {
818
-#if HWP3_VERIFY
819
-                    uint16_t match;
820
-#endif
821
-
822 818
                     hwp3_debug("HWP3.x: Paragraph[%d, %d]: detected date format marker @ offset %llu\n", level, p, (long long unsigned)offset);
823 819
 
824 820
                     /*
... ...
@@ -844,10 +839,6 @@ static inline int parsehwp3_paragraph(cli_ctx *ctx, fmap_t *map, int p, int leve
844 844
                 }
845 845
             case 8: /* date code */
846 846
                 {
847
-#if HWP3_VERIFY
848
-                    uint16_t match;
849
-#endif
850
-
851 847
                     hwp3_debug("HWP3.x: Paragraph[%d, %d]: detected date code marker @ offset %llu\n", level, p, (long long unsigned)offset);
852 848
 
853 849
                     /*
... ...
@@ -875,10 +866,6 @@ static inline int parsehwp3_paragraph(cli_ctx *ctx, fmap_t *map, int p, int leve
875 875
                 }
876 876
             case 9: /* tab */
877 877
                 {
878
-#if HWP3_VERIFY
879
-                    uint16_t match;
880
-#endif
881
-
882 878
                     hwp3_debug("HWP3.x: Paragraph[%d, %d]: detected tab marker @ offset %llu\n", level, p, (long long unsigned)offset);
883 879
 
884 880
                     /*
... ...
@@ -1020,28 +1007,26 @@ static inline int parsehwp3_paragraph(cli_ctx *ctx, fmap_t *map, int p, int leve
1020 1020
                 offset += sizeof(content);
1021 1021
                 break;
1022 1022
             case 14: /* line information */
1023
-                hwp3_debug("HWP3.x: Detected line information marker @ offset %llu\n", (long long unsigned)offset);
1023
+                {
1024
+                    hwp3_debug("HWP3.x: Detected line information marker @ offset %llu\n", (long long unsigned)offset);
1024 1025
 
1025 1026
 #if HWP3_VERIFY
1026
-                /* verification */
1027
-                ret = parsehwp3_paragraph_special_verify(map, offset, content);
1028
-                if (ret != CL_SUCCESS) {
1029
-                    if (ret == CL_EFORMAT) {
1030
-                        cli_errmsg("HWP3.x: Line Information ID block fails verification\n");
1031
-                        return CL_EFORMAT;
1027
+                    /* verification */
1028
+                    ret = parsehwp3_paragraph_special_verify(map, offset, content);
1029
+                    if (ret != CL_SUCCESS) {
1030
+                        if (ret == CL_EFORMAT) {
1031
+                            cli_errmsg("HWP3.x: Line Information ID block fails verification\n");
1032
+                            return CL_EFORMAT;
1033
+                        }
1034
+                        return ret;
1032 1035
                     }
1033
-                    return ret;
1034
-                }
1035 1036
 #endif
1036
-                /* ID block is 8 bytes + line information is always 84 bytes */
1037
-                offset += 92;
1038
-                break;
1037
+                    /* ID block is 8 bytes + line information is always 84 bytes */
1038
+                    offset += 92;
1039
+                    break;
1040
+                }
1039 1041
             case 15: /* hidden description */
1040 1042
                 {
1041
-#if HWP3_VERIFY
1042
-                    uint16_t match;
1043
-#endif
1044
-
1045 1043
                     hwp3_debug("HWP3.x: Detected hidden description marker @ offset %llu\n", (long long unsigned)offset);
1046 1044
 
1047 1045
                     /*
... ...
@@ -1073,9 +1058,6 @@ static inline int parsehwp3_paragraph(cli_ctx *ctx, fmap_t *map, int p, int leve
1073 1073
             }
1074 1074
             case 16: /* header/footer */
1075 1075
                 {
1076
-#if HWP3_VERIFY
1077
-                    uint16_t match;
1078
-#endif
1079 1076
 #if HWP3_DEBUG
1080 1077
                     uint8_t type;
1081 1078
 #endif
... ...
@@ -1126,10 +1108,6 @@ static inline int parsehwp3_paragraph(cli_ctx *ctx, fmap_t *map, int p, int leve
1126 1126
                 }
1127 1127
             case 17: /* footnote/North America??? */
1128 1128
                 {
1129
-#if HWP3_VERIFY
1130
-                    uint16_t match;
1131
-#endif
1132
-
1133 1129
                     hwp3_debug("HWP3.x: Detected hidden description marker @ offset %llu\n", (long long unsigned)offset);
1134 1130
 
1135 1131
                     /*
... ...
@@ -1160,9 +1138,6 @@ static inline int parsehwp3_paragraph(cli_ctx *ctx, fmap_t *map, int p, int leve
1160 1160
                 }
1161 1161
             case 18: /* paste code number */
1162 1162
                 {
1163
-#if HWP3_VERIFY
1164
-                    uint16_t match;
1165
-#endif
1166 1163
 #if HWP3_DEBUG
1167 1164
                     uint8_t type;
1168 1165
 #endif
... ...
@@ -1212,10 +1187,6 @@ static inline int parsehwp3_paragraph(cli_ctx *ctx, fmap_t *map, int p, int leve
1212 1212
                 }
1213 1213
             case 19: /* code number change */
1214 1214
                 {
1215
-#if HWP3_VERIFY
1216
-                    uint16_t match;
1217
-#endif
1218
-
1219 1215
                     hwp3_debug("HWP3.x: Paragraph[%d, %d]: detected code number change marker @ offset %llu\n", level, p, (long long unsigned)offset);
1220 1216
 
1221 1217
                     /*
... ...
@@ -1242,10 +1213,6 @@ static inline int parsehwp3_paragraph(cli_ctx *ctx, fmap_t *map, int p, int leve
1242 1242
                 }
1243 1243
             case 20:
1244 1244
                 {
1245
-#if HWP3_VERIFY
1246
-                    uint16_t match;
1247
-#endif
1248
-
1249 1245
                     hwp3_debug("HWP3.x: Paragraph[%d, %d]: detected thread page number marker @ offset %llu\n", level, p, (long long unsigned)offset);
1250 1246
 
1251 1247
                     /*
... ...
@@ -1272,10 +1239,6 @@ static inline int parsehwp3_paragraph(cli_ctx *ctx, fmap_t *map, int p, int leve
1272 1272
                 }
1273 1273
             case 21: /* hide special */
1274 1274
                 {
1275
-#if HWP3_VERIFY
1276
-                    uint16_t match;
1277
-#endif
1278
-
1279 1275
                     hwp3_debug("HWP3.x: Paragraph[%d, %d]: detected hide special marker @ offset %llu\n", level, p, (long long unsigned)offset);
1280 1276
 
1281 1277
                     /*