OSDN Git Service

add function for write UW value string to allocated buffer.
authorornse01 <ornse01@users.sourceforge.jp>
Sun, 8 May 2011 10:35:26 +0000 (10:35 +0000)
committerornse01 <ornse01@users.sourceforge.jp>
Sun, 8 May 2011 10:35:26 +0000 (10:35 +0000)
git-svn-id: http://svn.sourceforge.jp/svnroot/bchan/bchan/trunk@272 20a0b8eb-f62a-4a12-8fe1-b598822500fb

src/sjisstring.c
src/sjisstring.h

index 3049c6e..2f2a652 100644 (file)
@@ -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);
 }
 
index 0ac7150..af34df2 100644 (file)
@@ -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);