diff options
author | jlovell <jlovell@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2006-01-26 21:39:43 +0000 |
---|---|---|
committer | jlovell <jlovell@a1ca3aef-8c08-0410-bb20-df032aa958be> | 2006-01-26 21:39:43 +0000 |
commit | fa73b22906f71080fa5056485d8204612717adac (patch) | |
tree | f2f23b68c20d1fc9a85301527690aca5efa382df /cups/langprintf.c | |
parent | 4a09f02d10d679af0b04d36c25f0dcb518e432a4 (diff) |
Load cups into easysw/current.
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@13 a1ca3aef-8c08-0410-bb20-df032aa958be
Diffstat (limited to 'cups/langprintf.c')
-rw-r--r-- | cups/langprintf.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/cups/langprintf.c b/cups/langprintf.c index 5f0b40b84..4430c6792 100644 --- a/cups/langprintf.c +++ b/cups/langprintf.c @@ -1,10 +1,10 @@ /* - * "$Id: langprintf.c 4898 2006-01-08 23:13:20Z mike $" + * "$Id: langprintf.c 4924 2006-01-13 01:55:20Z mike $" * * Localized printf/puts functions for the Common UNIX Printing * System (CUPS). * - * Copyright 2002 by Easy Software Products. + * Copyright 2002-2006 by Easy Software Products. * * These coded instructions, statements, and computer programs are the * property of Easy Software Products and are protected by Federal @@ -35,9 +35,7 @@ */ #include <stdio.h> -#include "string.h" -#include "i18n.h" -#include "transcode.h" +#include "globals.h" /* @@ -46,7 +44,6 @@ int /* O - Number of bytes written */ _cupsLangPrintf(FILE *fp, /* I - File to write to */ - cups_lang_t *language, /* I - Language to use */ const char *message, /* I - Message string to use */ ...) /* I - Additional arguments as needed */ { @@ -54,6 +51,7 @@ _cupsLangPrintf(FILE *fp, /* I - File to write to */ char buffer[2048], /* Message buffer */ output[8192]; /* Output buffer */ va_list ap; /* Pointer to additional arguments */ + _cups_globals_t *cg; /* Global data */ /* @@ -63,8 +61,10 @@ _cupsLangPrintf(FILE *fp, /* I - File to write to */ if (!fp || !message) return (-1); - if (!language) - language = cupsLangDefault(); + cg = _cupsGlobals(); + + if (!cg->lang_default) + cg->lang_default = cupsLangDefault(); /* * Format the string... @@ -72,7 +72,7 @@ _cupsLangPrintf(FILE *fp, /* I - File to write to */ va_start(ap, message); bytes = vsnprintf(buffer, sizeof(buffer), - _cupsLangString(language, message), ap); + _cupsLangString(cg->lang_default, message), ap); va_end(ap); /* @@ -80,7 +80,7 @@ _cupsLangPrintf(FILE *fp, /* I - File to write to */ */ bytes = cupsUTF8ToCharset(output, (cups_utf8_t *)buffer, sizeof(output), - language->encoding); + cg->lang_default->encoding); /* * Write the string and return the number of bytes written... @@ -99,11 +99,11 @@ _cupsLangPrintf(FILE *fp, /* I - File to write to */ int /* O - Number of bytes written */ _cupsLangPuts(FILE *fp, /* I - File to write to */ - cups_lang_t *language, /* I - Language to use */ const char *message) /* I - Message string to use */ { int bytes; /* Number of bytes formatted */ char output[2048]; /* Message buffer */ + _cups_globals_t *cg; /* Global data */ /* @@ -113,16 +113,19 @@ _cupsLangPuts(FILE *fp, /* I - File to write to */ if (!fp || !message) return (-1); - if (!language) - language = cupsLangDefault(); + cg = _cupsGlobals(); + + if (!cg->lang_default) + cg->lang_default = cupsLangDefault(); /* * Transcode to the destination charset... */ bytes = cupsUTF8ToCharset(output, - (cups_utf8_t *)_cupsLangString(language, message), - sizeof(output), language->encoding); + (cups_utf8_t *)_cupsLangString(cg->lang_default, + message), + sizeof(output), cg->lang_default->encoding); /* * Write the string and return the number of bytes written... @@ -136,5 +139,5 @@ _cupsLangPuts(FILE *fp, /* I - File to write to */ /* - * End of "$Id: langprintf.c 4898 2006-01-08 23:13:20Z mike $". + * End of "$Id: langprintf.c 4924 2006-01-13 01:55:20Z mike $". */ |