*** empty log message ***
authorgc <gc>
Mon, 3 Mar 2008 23:08:21 +0000 (23:08 +0000)
committergc <gc>
Mon, 3 Mar 2008 23:08:21 +0000 (23:08 +0000)
bin/booh-backend
ext/rbbooh.c

index 230d23d..cb7b619 100755 (executable)
@@ -21,6 +21,7 @@
 
 require 'getoptlong'
 require 'gettext'
+require 'gettext/locale'
 include GetText
 require 'booh/rexml/document'
 include REXML
@@ -30,6 +31,8 @@ require 'booh/html-merges'
 
 #- bind text domain as soon as possible because some _() functions are called early to build data structures
 bindtextdomain("booh")
+#- save locale for restoring for multi languages
+$default_locale = Locale.get
 
 #- options
 $options = [
@@ -659,7 +662,7 @@ def find_translation_for_file(file, msg)
         if file =~ /\.(\w\w)\.html$/
             bindtextdomain("booh", { :locale => "#{$1}.UTF-8" })
             retval = _(msg)
-            bindtextdomain("booh")
+            bindtextdomain("booh", { :locale => $default_locale })
             return retval
         else
             die "Internal error: cannot find multi language suffix of file '#{file}'"
@@ -697,7 +700,7 @@ def save_html(html, base_filename)
             ios = File.open("#{base_filename}.#{language}.html", "w")
             ios.write(html.gsub(/@@(.*?)@@/) { _($1) })
             ios.close
-            bindtextdomain("booh")
+            bindtextdomain("booh", { :locale => $default_locale })
         end
     else
         ios = File.open("#{base_filename}.html", "w")
index 2e59e92..ae7ce9b 100644 (file)
@@ -50,8 +50,8 @@ static VALUE whitebalance(VALUE self, VALUE level) {
         for (y = 0; y < gdk_pixbuf_get_height(_SELF(self)); y++) {
                 guchar* pixline = &(pixels[rowstride*y]);
                 for (x = 0; x < gdk_pixbuf_get_width(_SELF(self)); x++) {
-                        pixline[x*3]   = red_filter[pixline[x*3]];
-                        pixline[x*3+2] = blue_filter[pixline[x*3+2]];
+                        pixline[x*3]   = (guchar) red_filter[pixline[x*3]];
+                        pixline[x*3+2] = (guchar) blue_filter[pixline[x*3+2]];
                 }
         }
 
@@ -76,9 +76,9 @@ static VALUE gammacorrect(VALUE self, VALUE level) {
         for (y = 0; y < gdk_pixbuf_get_height(_SELF(self)); y++) {
                 guchar* pixline = &(pixels[rowstride*y]);
                 for (x = 0; x < gdk_pixbuf_get_width(_SELF(self)); x++) {
-                        pixline[x*3]   = filter[pixline[x*3]];
-                        pixline[x*3+1] = filter[pixline[x*3+1]];
-                        pixline[x*3+2] = filter[pixline[x*3+2]];
+                        pixline[x*3]   = (guchar) filter[pixline[x*3]];
+                        pixline[x*3+1] = (guchar) filter[pixline[x*3+1]];
+                        pixline[x*3+2] = (guchar) filter[pixline[x*3+2]];
                 }
         }