Fossil SCM
Merge updates from trunk.
Commit
4b675fb0e635f8c433ce58bee32fca26c6bbeca7
Parent
3221e519b6baee3…
2 files changed
+17
-3
+17
-3
+17
-3
| --- src/comformat.c | ||
| +++ src/comformat.c | ||
| @@ -116,23 +116,36 @@ | ||
| 116 | 116 | } |
| 117 | 117 | return lineCnt; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | /* |
| 121 | -** Test the comment printing | |
| 122 | 121 | ** |
| 123 | 122 | ** COMMAND: test-comment-format |
| 123 | +** | |
| 124 | +** Usage: %fossil test-comment-format ?OPTIONS? PREFIX TEXT ?WIDTH? | |
| 125 | +** | |
| 126 | +** Test comment formatting and printing. Use for testing only. | |
| 127 | +** | |
| 128 | +** Options: | |
| 129 | +** --decode Decode the text using the same method used when | |
| 130 | +** handling the value of a C-card from a manifest. | |
| 124 | 131 | */ |
| 125 | 132 | void test_comment_format(void){ |
| 126 | 133 | const char *zPrefix; |
| 127 | - const char *zText; | |
| 134 | + char *zText; | |
| 128 | 135 | int indent, width; |
| 136 | + int decode = find_option("decode", 0, 0)!=0; | |
| 129 | 137 | if( g.argc!=4 && g.argc!=5 ){ |
| 130 | 138 | usage("PREFIX TEXT ?WIDTH?"); |
| 131 | 139 | } |
| 132 | 140 | zPrefix = g.argv[2]; |
| 133 | - zText = g.argv[3]; | |
| 141 | + if( decode ){ | |
| 142 | + zText = mprintf("%s", g.argv[3]); | |
| 143 | + defossilize(zText); | |
| 144 | + }else{ | |
| 145 | + zText = g.argv[3]; | |
| 146 | + } | |
| 134 | 147 | indent = strlen(zPrefix); |
| 135 | 148 | if( g.argc==5 ){ |
| 136 | 149 | width = atoi(g.argv[4]); |
| 137 | 150 | }else{ |
| 138 | 151 | width = -1; /* automatic */ |
| @@ -139,6 +152,7 @@ | ||
| 139 | 152 | } |
| 140 | 153 | if( indent>0 ){ |
| 141 | 154 | fossil_print("%s", zPrefix); |
| 142 | 155 | } |
| 143 | 156 | fossil_print("(%d lines output)\n", comment_print(zText, indent, width)); |
| 157 | + if( zText!=g.argv[3] ) fossil_free(zText); | |
| 144 | 158 | } |
| 145 | 159 |
| --- src/comformat.c | |
| +++ src/comformat.c | |
| @@ -116,23 +116,36 @@ | |
| 116 | } |
| 117 | return lineCnt; |
| 118 | } |
| 119 | |
| 120 | /* |
| 121 | ** Test the comment printing |
| 122 | ** |
| 123 | ** COMMAND: test-comment-format |
| 124 | */ |
| 125 | void test_comment_format(void){ |
| 126 | const char *zPrefix; |
| 127 | const char *zText; |
| 128 | int indent, width; |
| 129 | if( g.argc!=4 && g.argc!=5 ){ |
| 130 | usage("PREFIX TEXT ?WIDTH?"); |
| 131 | } |
| 132 | zPrefix = g.argv[2]; |
| 133 | zText = g.argv[3]; |
| 134 | indent = strlen(zPrefix); |
| 135 | if( g.argc==5 ){ |
| 136 | width = atoi(g.argv[4]); |
| 137 | }else{ |
| 138 | width = -1; /* automatic */ |
| @@ -139,6 +152,7 @@ | |
| 139 | } |
| 140 | if( indent>0 ){ |
| 141 | fossil_print("%s", zPrefix); |
| 142 | } |
| 143 | fossil_print("(%d lines output)\n", comment_print(zText, indent, width)); |
| 144 | } |
| 145 |
| --- src/comformat.c | |
| +++ src/comformat.c | |
| @@ -116,23 +116,36 @@ | |
| 116 | } |
| 117 | return lineCnt; |
| 118 | } |
| 119 | |
| 120 | /* |
| 121 | ** |
| 122 | ** COMMAND: test-comment-format |
| 123 | ** |
| 124 | ** Usage: %fossil test-comment-format ?OPTIONS? PREFIX TEXT ?WIDTH? |
| 125 | ** |
| 126 | ** Test comment formatting and printing. Use for testing only. |
| 127 | ** |
| 128 | ** Options: |
| 129 | ** --decode Decode the text using the same method used when |
| 130 | ** handling the value of a C-card from a manifest. |
| 131 | */ |
| 132 | void test_comment_format(void){ |
| 133 | const char *zPrefix; |
| 134 | char *zText; |
| 135 | int indent, width; |
| 136 | int decode = find_option("decode", 0, 0)!=0; |
| 137 | if( g.argc!=4 && g.argc!=5 ){ |
| 138 | usage("PREFIX TEXT ?WIDTH?"); |
| 139 | } |
| 140 | zPrefix = g.argv[2]; |
| 141 | if( decode ){ |
| 142 | zText = mprintf("%s", g.argv[3]); |
| 143 | defossilize(zText); |
| 144 | }else{ |
| 145 | zText = g.argv[3]; |
| 146 | } |
| 147 | indent = strlen(zPrefix); |
| 148 | if( g.argc==5 ){ |
| 149 | width = atoi(g.argv[4]); |
| 150 | }else{ |
| 151 | width = -1; /* automatic */ |
| @@ -139,6 +152,7 @@ | |
| 152 | } |
| 153 | if( indent>0 ){ |
| 154 | fossil_print("%s", zPrefix); |
| 155 | } |
| 156 | fossil_print("(%d lines output)\n", comment_print(zText, indent, width)); |
| 157 | if( zText!=g.argv[3] ) fossil_free(zText); |
| 158 | } |
| 159 |
+17
-3
| --- src/comformat.c | ||
| +++ src/comformat.c | ||
| @@ -116,23 +116,36 @@ | ||
| 116 | 116 | } |
| 117 | 117 | return lineCnt; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | /* |
| 121 | -** Test the comment printing | |
| 122 | 121 | ** |
| 123 | 122 | ** COMMAND: test-comment-format |
| 123 | +** | |
| 124 | +** Usage: %fossil test-comment-format ?OPTIONS? PREFIX TEXT ?WIDTH? | |
| 125 | +** | |
| 126 | +** Test comment formatting and printing. Use for testing only. | |
| 127 | +** | |
| 128 | +** Options: | |
| 129 | +** --decode Decode the text using the same method used when | |
| 130 | +** handling the value of a C-card from a manifest. | |
| 124 | 131 | */ |
| 125 | 132 | void test_comment_format(void){ |
| 126 | 133 | const char *zPrefix; |
| 127 | - const char *zText; | |
| 134 | + char *zText; | |
| 128 | 135 | int indent, width; |
| 136 | + int decode = find_option("decode", 0, 0)!=0; | |
| 129 | 137 | if( g.argc!=4 && g.argc!=5 ){ |
| 130 | 138 | usage("PREFIX TEXT ?WIDTH?"); |
| 131 | 139 | } |
| 132 | 140 | zPrefix = g.argv[2]; |
| 133 | - zText = g.argv[3]; | |
| 141 | + if( decode ){ | |
| 142 | + zText = mprintf("%s", g.argv[3]); | |
| 143 | + defossilize(zText); | |
| 144 | + }else{ | |
| 145 | + zText = g.argv[3]; | |
| 146 | + } | |
| 134 | 147 | indent = strlen(zPrefix); |
| 135 | 148 | if( g.argc==5 ){ |
| 136 | 149 | width = atoi(g.argv[4]); |
| 137 | 150 | }else{ |
| 138 | 151 | width = -1; /* automatic */ |
| @@ -139,6 +152,7 @@ | ||
| 139 | 152 | } |
| 140 | 153 | if( indent>0 ){ |
| 141 | 154 | fossil_print("%s", zPrefix); |
| 142 | 155 | } |
| 143 | 156 | fossil_print("(%d lines output)\n", comment_print(zText, indent, width)); |
| 157 | + if( zText!=g.argv[3] ) fossil_free(zText); | |
| 144 | 158 | } |
| 145 | 159 |
| --- src/comformat.c | |
| +++ src/comformat.c | |
| @@ -116,23 +116,36 @@ | |
| 116 | } |
| 117 | return lineCnt; |
| 118 | } |
| 119 | |
| 120 | /* |
| 121 | ** Test the comment printing |
| 122 | ** |
| 123 | ** COMMAND: test-comment-format |
| 124 | */ |
| 125 | void test_comment_format(void){ |
| 126 | const char *zPrefix; |
| 127 | const char *zText; |
| 128 | int indent, width; |
| 129 | if( g.argc!=4 && g.argc!=5 ){ |
| 130 | usage("PREFIX TEXT ?WIDTH?"); |
| 131 | } |
| 132 | zPrefix = g.argv[2]; |
| 133 | zText = g.argv[3]; |
| 134 | indent = strlen(zPrefix); |
| 135 | if( g.argc==5 ){ |
| 136 | width = atoi(g.argv[4]); |
| 137 | }else{ |
| 138 | width = -1; /* automatic */ |
| @@ -139,6 +152,7 @@ | |
| 139 | } |
| 140 | if( indent>0 ){ |
| 141 | fossil_print("%s", zPrefix); |
| 142 | } |
| 143 | fossil_print("(%d lines output)\n", comment_print(zText, indent, width)); |
| 144 | } |
| 145 |
| --- src/comformat.c | |
| +++ src/comformat.c | |
| @@ -116,23 +116,36 @@ | |
| 116 | } |
| 117 | return lineCnt; |
| 118 | } |
| 119 | |
| 120 | /* |
| 121 | ** |
| 122 | ** COMMAND: test-comment-format |
| 123 | ** |
| 124 | ** Usage: %fossil test-comment-format ?OPTIONS? PREFIX TEXT ?WIDTH? |
| 125 | ** |
| 126 | ** Test comment formatting and printing. Use for testing only. |
| 127 | ** |
| 128 | ** Options: |
| 129 | ** --decode Decode the text using the same method used when |
| 130 | ** handling the value of a C-card from a manifest. |
| 131 | */ |
| 132 | void test_comment_format(void){ |
| 133 | const char *zPrefix; |
| 134 | char *zText; |
| 135 | int indent, width; |
| 136 | int decode = find_option("decode", 0, 0)!=0; |
| 137 | if( g.argc!=4 && g.argc!=5 ){ |
| 138 | usage("PREFIX TEXT ?WIDTH?"); |
| 139 | } |
| 140 | zPrefix = g.argv[2]; |
| 141 | if( decode ){ |
| 142 | zText = mprintf("%s", g.argv[3]); |
| 143 | defossilize(zText); |
| 144 | }else{ |
| 145 | zText = g.argv[3]; |
| 146 | } |
| 147 | indent = strlen(zPrefix); |
| 148 | if( g.argc==5 ){ |
| 149 | width = atoi(g.argv[4]); |
| 150 | }else{ |
| 151 | width = -1; /* automatic */ |
| @@ -139,6 +152,7 @@ | |
| 152 | } |
| 153 | if( indent>0 ){ |
| 154 | fossil_print("%s", zPrefix); |
| 155 | } |
| 156 | fossil_print("(%d lines output)\n", comment_print(zText, indent, width)); |
| 157 | if( zText!=g.argv[3] ) fossil_free(zText); |
| 158 | } |
| 159 |