From: ornse01 Date: Sun, 8 May 2011 10:35:26 +0000 (+0000) Subject: add function for write UW value string to allocated buffer. X-Git-Tag: 0.4.0~32 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=b9470ae857407689cb80ac99374e041531d52f20;p=bbk%2Fbchan.git add function for write UW value string to allocated buffer. git-svn-id: http://svn.sourceforge.jp/svnroot/bchan/bchan/trunk@272 20a0b8eb-f62a-4a12-8fe1-b598822500fb --- diff --git a/src/sjisstring.c b/src/sjisstring.c index 3049c6e..2f2a652 100644 --- a/src/sjisstring.c +++ b/src/sjisstring.c @@ -1,7 +1,7 @@ /* * sjisstring.c * - * Copyright (c) 2009-2010 project bchan + * Copyright (c) 2009-2011 project bchan * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -53,10 +53,9 @@ EXPORT W sjstring_appendasciistring(UB **dest, W *dest_len, UB *str, W len) LOCAL UB dec[] = "0123456789"; -EXPORT W sjstring_appendUWstring(UB **dest, W *dlen, UW n) +EXPORT W sjstring_writeUWstring(UB *str, UW n) { W i = 0,digit,draw = 0; - UB str[10]; digit = n / 1000000000 % 10; if ((digit != 0)||(draw != 0)) { @@ -106,6 +105,16 @@ EXPORT W sjstring_appendUWstring(UB **dest, W *dlen, UW n) digit = n % 10; str[i++] = dec[digit]; + return i; +} + +EXPORT W sjstring_appendUWstring(UB **dest, W *dlen, UW n) +{ + W i; + UB str[10]; + + i = sjstring_writeUWstring(str, n); + return sjstring_appendasciistring(dest, dlen, str, i); } diff --git a/src/sjisstring.h b/src/sjisstring.h index 0ac7150..af34df2 100644 --- a/src/sjisstring.h +++ b/src/sjisstring.h @@ -1,7 +1,7 @@ /* * sjisstring.h * - * Copyright (c) 2009-2010 project bchan + * Copyright (c) 2009-2011 project bchan * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -30,6 +30,7 @@ #define __SJISSTRING_H__ IMPORT W sjstring_appendasciistring(UB **dest, W *dest_len, UB *str, W len); +IMPORT W sjstring_writeUWstring(UB *str, UW n); IMPORT W sjstring_appendUWstring(UB **dest, W *dlen, UW n); IMPORT W sjstring_appendurlencodestring(UB **dest, W *dest_len, UB *str, W len); IMPORT W sjstring_appendconvartingTCstring(UB **dest, W *dest_len, TC *str, W len);