summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2013-11-14 19:45:49 +0100
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2013-11-14 19:45:49 +0100
commite92fff16d1d364f544a4f597883fbf31e80f94b9 (patch)
treecae61b7879b7feafc158815102e2e3e966f923fb /examples
parent462cd145b8544a2f529d5bc188e6782c6043afd1 (diff)
downloadlibrcc-e92fff16d1d364f544a4f597883fbf31e80f94b9.tar.gz
librcc-e92fff16d1d364f544a4f597883fbf31e80f94b9.tar.bz2
librcc-e92fff16d1d364f544a4f597883fbf31e80f94b9.tar.xz
librcc-e92fff16d1d364f544a4f597883fbf31e80f94b9.zip
Fix complaining in example
Diffstat (limited to 'examples')
-rw-r--r--examples/example2.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/examples/example2.c b/examples/example2.c
index 13c280e..f8b085c 100644
--- a/examples/example2.c
+++ b/examples/example2.c
@@ -65,14 +65,17 @@ int main(int argc, char *argv[]) {
if (strlen(buf)<2) break;
rccstring = rccFrom(NULL, 0, buf);
+ if (!rccstring) rccstring = strdup(buf);
+
if (rccstring) {
recoded = rccTo(NULL, 1, rccstring);
+ if (!recoded) recoded = strdup(rccstring);
if (recoded) {
printf("%s", recoded);
free(recoded);
- } else printf("Recoding from UTF-8 is failed\n");
+ }
free(rccstring);
- } else printf("Recoding to UTF-8 is failed\n");
+ }
}
rccFree();