Author: matt
Date: 2009-10-29 13:00:12 -0700 (Thu, 29 Oct 2009)
New Revision: 6922
Log:
Fixed character set conversion functions (STR #2268)

Modified:
   branches/branch-1.1/CHANGES
   branches/branch-1.1/src/fl_encoding_latin1.cxx
   branches/branch-1.1/src/fl_encoding_mac_roman.cxx

Modified: branches/branch-1.1/CHANGES
===================================================================
--- branches/branch-1.1/CHANGES 2009-10-22 11:44:48 UTC (rev 6921)
+++ branches/branch-1.1/CHANGES 2009-10-29 20:00:12 UTC (rev 6922)
@@ -1,5 +1,6 @@
 CHANGES IN FLTK 1.1.10
 
+       - Fixed character set conversion functions (STR #2268)
        - Fixed image lib configure and fltk-config issues by backporting
          the image lib and zlib configure code from FLTK 1.3 (STR #2203)
        - Updated the bundled libpng to v1.2.40 (released Sep. 10, 2009)

Modified: branches/branch-1.1/src/fl_encoding_latin1.cxx
===================================================================
--- branches/branch-1.1/src/fl_encoding_latin1.cxx      2009-10-22 11:44:48 UTC 
(rev 6921)
+++ branches/branch-1.1/src/fl_encoding_latin1.cxx      2009-10-29 20:00:12 UTC 
(rev 6922)
@@ -78,8 +78,8 @@
 
 const char *fl_latin1_to_local(const char *t, int n)  
 {
-  if (n==-1) n = strlen(t);
-  if (n<=n_buf) {
+  if (n==-1) n = strlen(t)+1;
+  if (n>=n_buf) {
     n_buf = (n + 257) & 0x7fffff00;
     if (buf) free(buf);
     buf = (char*)malloc(n_buf);
@@ -89,9 +89,9 @@
   for ( ; n>0; n--) {
     uchar c = *src++;
     if (c>127) 
-      *dst = latin2roman[c-128];
+      *dst++ = latin2roman[c-128];
     else
-      *dst = c;
+      *dst++ = c;
   }
   //*dst = 0; // this would be wrong!
   return buf;
@@ -99,8 +99,8 @@
 
 const char *fl_local_to_latin1(const char *t, int n)
 {
-  if (n==-1) n = strlen(t);
-  if (n<=n_buf) {
+  if (n==-1) n = strlen(t)+1;
+  if (n>=n_buf) {
     n_buf = (n + 257) & 0x7fffff00;
     if (buf) free(buf);
     buf = (char*)malloc(n_buf);

Modified: branches/branch-1.1/src/fl_encoding_mac_roman.cxx
===================================================================
--- branches/branch-1.1/src/fl_encoding_mac_roman.cxx   2009-10-22 11:44:48 UTC 
(rev 6921)
+++ branches/branch-1.1/src/fl_encoding_mac_roman.cxx   2009-10-29 20:00:12 UTC 
(rev 6922)
@@ -87,8 +87,8 @@
 
 const char *fl_local_to_mac_roman(const char *t, int n)  
 {
-  if (n==-1) n = strlen(t);
-  if (n<=n_buf) {
+  if (n==-1) n = strlen(t)+1;
+  if (n>=n_buf) {
     n_buf = (n + 257) & 0x7fffff00;
     if (buf) free(buf);
     buf = (char*)malloc(n_buf);
@@ -98,9 +98,9 @@
   for ( ; n>0; n--) {
     uchar c = *src;
     if (c>127) 
-      *dst = latin2roman[c-128];
+      *dst++ = latin2roman[c-128];
     else
-      *dst = c;
+      *dst++ = c;
   }
   //*dst = 0; // this would be wrong!
   return buf;
@@ -108,8 +108,8 @@
 
 const char *fl_mac_roman_to_local(const char *t, int n)
 {
-  if (n==-1) n = strlen(t);
-  if (n<=n_buf) {
+  if (n==-1) n = strlen(t)+1;
+  if (n>=n_buf) {
     n_buf = (n + 257) & 0x7fffff00;
     if (buf) free(buf);
     buf = (char*)malloc(n_buf);

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to