/[winpt]/trunk/Src/wptNLS.cpp
ViewVC logotype

Diff of /trunk/Src/wptNLS.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 371 by twoaday, Tue Dec 6 13:40:04 2011 UTC revision 372 by twoaday, Fri Dec 9 10:59:16 2011 UTC
# Line 64  struct string_desc { Line 64  struct string_desc {
64  };  };
65    
66  struct loaded_domain_s {  struct loaded_domain_s {
67        /* Full file name to the MO file */
68      char *file_name;      char *file_name;
69        /* Last modification date of the MO file */
70      time_t modify_time;      time_t modify_time;
71        
72      char *data;      char *data;
73      int must_swap;      int must_swap;
74      DWORD nstrings;      DWORD nstrings;
# Line 172  load_domain (const char *filename) Line 175  load_domain (const char *filename)
175      } while (to_read > 0);      } while (to_read > 0);
176      fclose (fp);      fclose (fp);
177    
178      /* Using the magic number we can test whether it really is a message      /* Using the magic number we can test whether it really is a message catalog file.  */
      * catalog file.  */  
179      if (data->magic != MAGIC && data->magic != MAGIC_SWAPPED) {      if (data->magic != MAGIC && data->magic != MAGIC_SWAPPED) {
180          /* The magic number is wrong: not a message catalog file.  */          /* The magic number is wrong: not a message catalog file.  */
181          free (data);          free (data);
# Line 229  get_module_dir (char *buf, DWORD buflen) Line 231  get_module_dir (char *buf, DWORD buflen)
231      size_t pos = strlen (buf);      size_t pos = strlen (buf);
232      while (pos > 0 && buf[--pos] != '\\')      while (pos > 0 && buf[--pos] != '\\')
233          ;          ;
234      buf[pos+1] = '\0';      buf[pos + 1] = '\0';
235      return buf;      return buf;
236  }  }
237    
# Line 241  char* Line 243  char*
243  get_locale_name (const char *file)  get_locale_name (const char *file)
244  {  {
245      const char *lang = gettext_get_langid ();      const char *lang = gettext_get_langid ();
246      char *name, *ext;      char buf[MAX_PATH+1];
     char *p, buf[MAX_PATH+1];  
247            
248      p = strrchr (file, '.');      char *p = strrchr (file, '.');
249      if (p == NULL) {      if (p == NULL) {
250          p = new char[strlen(file)+strlen(lang)+2+1];          p = new char[strlen(file)+strlen(lang)+2+1];
251          sprintf (p, "%s.%s", file, lang);          sprintf (p, "%s.%s", file, lang);
252          return p;          return p;
253      }      }
254      name = substr (file, 0, p - file);      char *name = substr (file, 0, p - file);
255      ext = substr (file, p - file + 1, strlen(file));      char *ext = substr (file, p - file + 1, strlen(file));
256      p = get_module_dir (buf, MAX_PATH);      p = get_module_dir (buf, MAX_PATH);
257      if (!p)      if (!p)
258          BUG (NULL);          BUG (NULL);
# Line 318  load_modir_domain (void) Line 319  load_modir_domain (void)
319    
320  /* Try to load the user domain, either from  /* Try to load the user domain, either from
321     the WinPT.exe directory or from the registry */     the WinPT.exe directory or from the registry */
322  int  void
323  gettext_set_user_domain (void)  gettext_set_user_domain (void)
324  {  {
325      if (!gettext_is_required ())      if (!gettext_is_required ())
326          return 0;          return;
327            
328      gettext_domain_t domain = NULL;      gettext_domain_t domain = NULL;
329      char *file = get_locale_name ("winpt.mo");      char *file = get_locale_name ("winpt.mo");
# Line 332  gettext_set_user_domain (void) Line 333  gettext_set_user_domain (void)
333          domain = load_modir_domain ();          domain = load_modir_domain ();
334      free_if_alloc (file);      free_if_alloc (file);
335      gettext_update_domain (domain);      gettext_update_domain (domain);
     return 0;  
336  }  }
337    
338    

Legend:
Removed from v.371  
changed lines
  Added in v.372

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26