1 /* GLIB - Library of useful routines for C programming
2 * Copyright (C) 1995-1998 Peter Mattis, Spencer Kimball and Josh MacDonald
3 * Copyright (C) 1998-1999 Tor Lillqvist
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
22 * Modified by the GLib Team and others 1997-2000. See the AUTHORS
23 * file for a list of people on the GLib Team. See the ChangeLog
24 * files for a list of changes. These files are distributed with
25 * GLib at ftp://ftp.gtk.org/pub/gtk/.
29 * MT safe for the unix part, FIXME: make the win32 part MT safe as well.
36 #include "glibconfig.h"
43 #define STRICT /* Strict typing, please */
55 g_win32_ftruncate (gint fd
,
61 g_return_val_if_fail (fd
>= 0, -1);
63 hfile
= (HANDLE
) _get_osfhandle (fd
);
64 curpos
= SetFilePointer (hfile
, 0, NULL
, FILE_CURRENT
);
65 if (curpos
== 0xFFFFFFFF
66 || SetFilePointer (hfile
, size
, NULL
, FILE_BEGIN
) == 0xFFFFFFFF
67 || !SetEndOfFile (hfile
))
69 gint error
= GetLastError ();
73 case ERROR_INVALID_HANDLE
:
88 g_win32_opendir (const char *dirname
)
94 g_return_val_if_fail (dirname
!= NULL
, NULL
);
96 result
= g_new0 (DIR, 1);
97 result
->find_file_data
= g_new0 (WIN32_FIND_DATA
, 1);
98 result
->dir_name
= g_strdup (dirname
);
100 k
= strlen (result
->dir_name
);
101 if (k
&& result
->dir_name
[k
- 1] == '\\')
103 result
->dir_name
[k
- 1] = '\0';
105 mask
= g_strdup_printf ("%s\\*", result
->dir_name
);
107 result
->find_file_handle
= (guint
) FindFirstFile (mask
,
108 (LPWIN32_FIND_DATA
) result
->find_file_data
);
111 if (result
->find_file_handle
== (guint
) INVALID_HANDLE_VALUE
)
113 int error
= GetLastError ();
115 g_free (result
->dir_name
);
116 g_free (result
->find_file_data
);
125 result
->just_opened
= TRUE
;
131 g_win32_readdir (DIR *dir
)
135 g_return_val_if_fail (dir
!= NULL
, NULL
);
137 if (dir
->just_opened
)
138 dir
->just_opened
= FALSE
;
141 if (!FindNextFile ((HANDLE
) dir
->find_file_handle
,
142 (LPWIN32_FIND_DATA
) dir
->find_file_data
))
144 int error
= GetLastError ();
148 case ERROR_NO_MORE_FILES
:
157 basename
= g_path_get_basename (((LPWIN32_FIND_DATA
) dir
->find_file_data
)->cFileName
);
159 strcpy (dir
->readdir_result
.d_name
, basename
);
163 return &dir
->readdir_result
;
167 g_win32_rewinddir (DIR *dir
)
171 g_return_if_fail (dir
!= NULL
);
173 if (!FindClose ((HANDLE
) dir
->find_file_handle
))
174 g_warning ("gwin_rewinddir(): FindClose() failed\n");
176 mask
= g_strdup_printf ("%s\\*", dir
->dir_name
);
177 dir
->find_file_handle
= (guint
) FindFirstFile (mask
,
178 (LPWIN32_FIND_DATA
) dir
->find_file_data
);
181 if (dir
->find_file_handle
== (guint
) INVALID_HANDLE_VALUE
)
183 int error
= GetLastError ();
192 dir
->just_opened
= TRUE
;
196 g_win32_closedir (DIR *dir
)
198 g_return_val_if_fail (dir
!= NULL
, -1);
200 if (!FindClose ((HANDLE
) dir
->find_file_handle
))
202 int error
= GetLastError ();
207 errno
= EIO
; return -1;
211 g_free (dir
->dir_name
);
212 g_free (dir
->find_file_data
);
218 /* Mingw32 headers don't have latest language and sublanguage codes */
219 #ifndef LANG_AFRIKAANS
220 #define LANG_AFRIKAANS 0x36
222 #ifndef LANG_ALBANIAN
223 #define LANG_ALBANIAN 0x1c
226 #define LANG_ARABIC 0x01
228 #ifndef LANG_ARMENIAN
229 #define LANG_ARMENIAN 0x2b
231 #ifndef LANG_ASSAMESE
232 #define LANG_ASSAMESE 0x4d
235 #define LANG_AZERI 0x2c
238 #define LANG_BASQUE 0x2d
240 #ifndef LANG_BELARUSIAN
241 #define LANG_BELARUSIAN 0x23
244 #define LANG_BENGALI 0x45
247 #define LANG_CATALAN 0x03
249 #ifndef LANG_ESTONIAN
250 #define LANG_ESTONIAN 0x25
252 #ifndef LANG_FAEROESE
253 #define LANG_FAEROESE 0x38
256 #define LANG_FARSI 0x29
258 #ifndef LANG_GEORGIAN
259 #define LANG_GEORGIAN 0x37
261 #ifndef LANG_GUJARATI
262 #define LANG_GUJARATI 0x47
265 #define LANG_HEBREW 0x0d
268 #define LANG_HINDI 0x39
270 #ifndef LANG_INDONESIAN
271 #define LANG_INDONESIAN 0x21
274 #define LANG_KANNADA 0x4b
276 #ifndef LANG_KASHMIRI
277 #define LANG_KASHMIRI 0x60
280 #define LANG_KAZAK 0x3f
283 #define LANG_KONKANI 0x57
286 #define LANG_LATVIAN 0x26
288 #ifndef LANG_LITHUANIAN
289 #define LANG_LITHUANIAN 0x27
291 #ifndef LANG_MACEDONIAN
292 #define LANG_MACEDONIAN 0x2f
295 #define LANG_MALAY 0x3e
297 #ifndef LANG_MALAYALAM
298 #define LANG_MALAYALAM 0x4c
300 #ifndef LANG_MANIPURI
301 #define LANG_MANIPURI 0x58
304 #define LANG_MARATHI 0x4e
307 #define LANG_NEPALI 0x61
310 #define LANG_ORIYA 0x48
313 #define LANG_PUNJABI 0x46
315 #ifndef LANG_SANSKRIT
316 #define LANG_SANSKRIT 0x4f
319 #define LANG_SERBIAN 0x1a
322 #define LANG_SINDHI 0x59
325 #define LANG_SLOVAK 0x1b
328 #define LANG_SWAHILI 0x41
331 #define LANG_TAMIL 0x49
334 #define LANG_TATAR 0x44
337 #define LANG_TELUGU 0x4a
340 #define LANG_THAI 0x1e
342 #ifndef LANG_UKRAINIAN
343 #define LANG_UKRAINIAN 0x22
346 #define LANG_URDU 0x20
349 #define LANG_UZBEK 0x43
351 #ifndef LANG_VIETNAMESE
352 #define LANG_VIETNAMESE 0x2a
354 #ifndef SUBLANG_ARABIC_SAUDI_ARABIA
355 #define SUBLANG_ARABIC_SAUDI_ARABIA 0x01
357 #ifndef SUBLANG_ARABIC_IRAQ
358 #define SUBLANG_ARABIC_IRAQ 0x02
360 #ifndef SUBLANG_ARABIC_EGYPT
361 #define SUBLANG_ARABIC_EGYPT 0x03
363 #ifndef SUBLANG_ARABIC_LIBYA
364 #define SUBLANG_ARABIC_LIBYA 0x04
366 #ifndef SUBLANG_ARABIC_ALGERIA
367 #define SUBLANG_ARABIC_ALGERIA 0x05
369 #ifndef SUBLANG_ARABIC_MOROCCO
370 #define SUBLANG_ARABIC_MOROCCO 0x06
372 #ifndef SUBLANG_ARABIC_TUNISIA
373 #define SUBLANG_ARABIC_TUNISIA 0x07
375 #ifndef SUBLANG_ARABIC_OMAN
376 #define SUBLANG_ARABIC_OMAN 0x08
378 #ifndef SUBLANG_ARABIC_YEMEN
379 #define SUBLANG_ARABIC_YEMEN 0x09
381 #ifndef SUBLANG_ARABIC_SYRIA
382 #define SUBLANG_ARABIC_SYRIA 0x0a
384 #ifndef SUBLANG_ARABIC_JORDAN
385 #define SUBLANG_ARABIC_JORDAN 0x0b
387 #ifndef SUBLANG_ARABIC_LEBANON
388 #define SUBLANG_ARABIC_LEBANON 0x0c
390 #ifndef SUBLANG_ARABIC_KUWAIT
391 #define SUBLANG_ARABIC_KUWAIT 0x0d
393 #ifndef SUBLANG_ARABIC_UAE
394 #define SUBLANG_ARABIC_UAE 0x0e
396 #ifndef SUBLANG_ARABIC_BAHRAIN
397 #define SUBLANG_ARABIC_BAHRAIN 0x0f
399 #ifndef SUBLANG_ARABIC_QATAR
400 #define SUBLANG_ARABIC_QATAR 0x10
402 #ifndef SUBLANG_AZERI_LATIN
403 #define SUBLANG_AZERI_LATIN 0x01
405 #ifndef SUBLANG_AZERI_CYRILLIC
406 #define SUBLANG_AZERI_CYRILLIC 0x02
408 #ifndef SUBLANG_CHINESE_MACAU
409 #define SUBLANG_CHINESE_MACAU 0x05
411 #ifndef SUBLANG_ENGLISH_SOUTH_AFRICA
412 #define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07
414 #ifndef SUBLANG_ENGLISH_JAMAICA
415 #define SUBLANG_ENGLISH_JAMAICA 0x08
417 #ifndef SUBLANG_ENGLISH_CARIBBEAN
418 #define SUBLANG_ENGLISH_CARIBBEAN 0x09
420 #ifndef SUBLANG_ENGLISH_BELIZE
421 #define SUBLANG_ENGLISH_BELIZE 0x0a
423 #ifndef SUBLANG_ENGLISH_TRINIDAD
424 #define SUBLANG_ENGLISH_TRINIDAD 0x0b
426 #ifndef SUBLANG_ENGLISH_ZIMBABWE
427 #define SUBLANG_ENGLISH_ZIMBABWE 0x0c
429 #ifndef SUBLANG_ENGLISH_PHILIPPINES
430 #define SUBLANG_ENGLISH_PHILIPPINES 0x0d
432 #ifndef SUBLANG_FRENCH_LUXEMBOURG
433 #define SUBLANG_FRENCH_LUXEMBOURG 0x05
435 #ifndef SUBLANG_FRENCH_MONACO
436 #define SUBLANG_FRENCH_MONACO 0x06
438 #ifndef SUBLANG_GERMAN_LUXEMBOURG
439 #define SUBLANG_GERMAN_LUXEMBOURG 0x04
441 #ifndef SUBLANG_GERMAN_LIECHTENSTEIN
442 #define SUBLANG_GERMAN_LIECHTENSTEIN 0x05
444 #ifndef SUBLANG_KASHMIRI_INDIA
445 #define SUBLANG_KASHMIRI_INDIA 0x02
447 #ifndef SUBLANG_MALAY_MALAYSIA
448 #define SUBLANG_MALAY_MALAYSIA 0x01
450 #ifndef SUBLANG_MALAY_BRUNEI_DARUSSALAM
451 #define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02
453 #ifndef SUBLANG_NEPALI_INDIA
454 #define SUBLANG_NEPALI_INDIA 0x02
456 #ifndef SUBLANG_SERBIAN_LATIN
457 #define SUBLANG_SERBIAN_LATIN 0x02
459 #ifndef SUBLANG_SERBIAN_CYRILLIC
460 #define SUBLANG_SERBIAN_CYRILLIC 0x03
462 #ifndef SUBLANG_SPANISH_GUATEMALA
463 #define SUBLANG_SPANISH_GUATEMALA 0x04
465 #ifndef SUBLANG_SPANISH_COSTA_RICA
466 #define SUBLANG_SPANISH_COSTA_RICA 0x05
468 #ifndef SUBLANG_SPANISH_PANAMA
469 #define SUBLANG_SPANISH_PANAMA 0x06
471 #ifndef SUBLANG_SPANISH_DOMINICAN_REPUBLIC
472 #define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07
474 #ifndef SUBLANG_SPANISH_VENEZUELA
475 #define SUBLANG_SPANISH_VENEZUELA 0x08
477 #ifndef SUBLANG_SPANISH_COLOMBIA
478 #define SUBLANG_SPANISH_COLOMBIA 0x09
480 #ifndef SUBLANG_SPANISH_PERU
481 #define SUBLANG_SPANISH_PERU 0x0a
483 #ifndef SUBLANG_SPANISH_ARGENTINA
484 #define SUBLANG_SPANISH_ARGENTINA 0x0b
486 #ifndef SUBLANG_SPANISH_ECUADOR
487 #define SUBLANG_SPANISH_ECUADOR 0x0c
489 #ifndef SUBLANG_SPANISH_CHILE
490 #define SUBLANG_SPANISH_CHILE 0x0d
492 #ifndef SUBLANG_SPANISH_URUGUAY
493 #define SUBLANG_SPANISH_URUGUAY 0x0e
495 #ifndef SUBLANG_SPANISH_PARAGUAY
496 #define SUBLANG_SPANISH_PARAGUAY 0x0f
498 #ifndef SUBLANG_SPANISH_BOLIVIA
499 #define SUBLANG_SPANISH_BOLIVIA 0x10
501 #ifndef SUBLANG_SPANISH_EL_SALVADOR
502 #define SUBLANG_SPANISH_EL_SALVADOR 0x11
504 #ifndef SUBLANG_SPANISH_HONDURAS
505 #define SUBLANG_SPANISH_HONDURAS 0x12
507 #ifndef SUBLANG_SPANISH_NICARAGUA
508 #define SUBLANG_SPANISH_NICARAGUA 0x13
510 #ifndef SUBLANG_SPANISH_PUERTO_RICO
511 #define SUBLANG_SPANISH_PUERTO_RICO 0x14
513 #ifndef SUBLANG_SWEDISH_FINLAND
514 #define SUBLANG_SWEDISH_FINLAND 0x02
516 #ifndef SUBLANG_URDU_PAKISTAN
517 #define SUBLANG_URDU_PAKISTAN 0x01
519 #ifndef SUBLANG_URDU_INDIA
520 #define SUBLANG_URDU_INDIA 0x02
522 #ifndef SUBLANG_UZBEK_LATIN
523 #define SUBLANG_UZBEK_LATIN 0x01
525 #ifndef SUBLANG_UZBEK_CYRILLIC
526 #define SUBLANG_UZBEK_CYRILLIC 0x02
530 g_win32_getlocale (void)
535 gchar
*l
= NULL
, *sl
= NULL
;
538 if ((ev
= getenv ("LC_ALL")) != NULL
539 || (ev
= getenv ("LC_CTYPE")) != NULL
540 || (ev
= getenv ("LANG")) != NULL
)
541 return g_strdup (ev
);
543 lcid
= GetThreadLocale ();
544 primary
= PRIMARYLANGID (LANGIDFROMLCID (lcid
));
545 sub
= SUBLANGID (LANGIDFROMLCID (lcid
));
548 case LANG_AFRIKAANS
: l
= "af"; break;
549 case LANG_ALBANIAN
: l
= "sq"; break;
554 case SUBLANG_ARABIC_SAUDI_ARABIA
: sl
= "SA"; break;
555 case SUBLANG_ARABIC_IRAQ
: sl
= "IQ"; break;
556 case SUBLANG_ARABIC_EGYPT
: sl
= "EG"; break;
557 case SUBLANG_ARABIC_LIBYA
: sl
= "LY"; break;
558 case SUBLANG_ARABIC_ALGERIA
: sl
= "DZ"; break;
559 case SUBLANG_ARABIC_MOROCCO
: sl
= "MA"; break;
560 case SUBLANG_ARABIC_TUNISIA
: sl
= "TN"; break;
561 case SUBLANG_ARABIC_OMAN
: sl
= "OM"; break;
562 case SUBLANG_ARABIC_YEMEN
: sl
= "YE"; break;
563 case SUBLANG_ARABIC_SYRIA
: sl
= "SY"; break;
564 case SUBLANG_ARABIC_JORDAN
: sl
= "JO"; break;
565 case SUBLANG_ARABIC_LEBANON
: sl
= "LB"; break;
566 case SUBLANG_ARABIC_KUWAIT
: sl
= "KW"; break;
567 case SUBLANG_ARABIC_UAE
: sl
= "AE"; break;
568 case SUBLANG_ARABIC_BAHRAIN
: sl
= "BH"; break;
569 case SUBLANG_ARABIC_QATAR
: sl
= "QA"; break;
572 case LANG_ARMENIAN
: l
= "hy"; break;
573 case LANG_ASSAMESE
: l
= "as"; break;
574 case LANG_AZERI
: l
= "az"; break;
575 case LANG_BASQUE
: l
= "eu"; break;
576 case LANG_BELARUSIAN
: l
= "be"; break;
577 case LANG_BENGALI
: l
= "bn"; break;
578 case LANG_BULGARIAN
: l
= "bg"; break;
579 case LANG_CATALAN
: l
= "ca"; break;
584 case SUBLANG_CHINESE_TRADITIONAL
: sl
= "TW"; break;
585 case SUBLANG_CHINESE_SIMPLIFIED
: sl
= "CH"; break;
586 case SUBLANG_CHINESE_HONGKONG
: sl
= "HK"; break;
587 case SUBLANG_CHINESE_SINGAPORE
: sl
= "SG"; break;
588 case SUBLANG_CHINESE_MACAU
: sl
= "MO"; break;
591 case LANG_CROATIAN
: /* LANG_CROATIAN == LANG_SERBIAN
592 * What used to be called Serbo-Croatian
593 * should really now be two separate
594 * languages because of political reasons.
595 * (Says tml, who knows nothing about Serbian
597 * (I can feel those flames coming already.)
601 case SUBLANG_SERBIAN_LATIN
: l
= "sp"; break;
602 case SUBLANG_SERBIAN_CYRILLIC
: l
= "sr"; break;
603 default: l
= "hr"; /* ??? */
606 case LANG_CZECH
: l
= "cs"; break;
607 case LANG_DANISH
: l
= "da"; break;
612 case SUBLANG_DUTCH_BELGIAN
: sl
= "BE"; break;
619 /* SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. Heh. I thought
620 * English was the language spoken in England.
623 case SUBLANG_ENGLISH_UK
: sl
= "GB"; break;
624 case SUBLANG_ENGLISH_AUS
: sl
= "AU"; break;
625 case SUBLANG_ENGLISH_CAN
: sl
= "CA"; break;
626 case SUBLANG_ENGLISH_NZ
: sl
= "NZ"; break;
627 case SUBLANG_ENGLISH_EIRE
: sl
= "IE"; break;
628 case SUBLANG_ENGLISH_SOUTH_AFRICA
: sl
= "SA"; break;
629 case SUBLANG_ENGLISH_JAMAICA
: sl
= "JM"; break;
630 case SUBLANG_ENGLISH_CARIBBEAN
: sl
= "@caribbean"; break; /* ??? */
631 case SUBLANG_ENGLISH_BELIZE
: sl
= "BZ"; break;
632 case SUBLANG_ENGLISH_TRINIDAD
: sl
= "TT"; break;
633 case SUBLANG_ENGLISH_ZIMBABWE
: sl
= "ZW"; break;
634 case SUBLANG_ENGLISH_PHILIPPINES
: sl
= "PH"; break;
637 case LANG_ESTONIAN
: l
= "et"; break;
638 case LANG_FAEROESE
: l
= "fo"; break;
639 case LANG_FARSI
: l
= "fa"; break;
640 case LANG_FINNISH
: l
= "fi"; break;
645 case SUBLANG_FRENCH_BELGIAN
: sl
= "BE"; break;
646 case SUBLANG_FRENCH_CANADIAN
: sl
= "CA"; break;
647 case SUBLANG_FRENCH_SWISS
: sl
= "CH"; break;
648 case SUBLANG_FRENCH_LUXEMBOURG
: sl
= "LU"; break;
649 case SUBLANG_FRENCH_MONACO
: sl
= "MC"; break;
652 case LANG_GEORGIAN
: l
= "ka"; break;
657 case SUBLANG_GERMAN_SWISS
: sl
= "CH"; break;
658 case SUBLANG_GERMAN_AUSTRIAN
: sl
= "AT"; break;
659 case SUBLANG_GERMAN_LUXEMBOURG
: sl
= "LU"; break;
660 case SUBLANG_GERMAN_LIECHTENSTEIN
: sl
= "LI"; break;
663 case LANG_GREEK
: l
= "el"; break;
664 case LANG_GUJARATI
: l
= "gu"; break;
665 case LANG_HEBREW
: l
= "he"; break;
666 case LANG_HINDI
: l
= "hi"; break;
667 case LANG_HUNGARIAN
: l
= "hu"; break;
668 case LANG_ICELANDIC
: l
= "is"; break;
669 case LANG_INDONESIAN
: l
= "id"; break;
674 case SUBLANG_ITALIAN_SWISS
: sl
= "CH"; break;
677 case LANG_JAPANESE
: l
= "ja"; break;
678 case LANG_KANNADA
: l
= "kn"; break;
683 case SUBLANG_KASHMIRI_INDIA
: sl
= "IN"; break;
686 case LANG_KAZAK
: l
= "kk"; break;
687 case LANG_KONKANI
: l
= "kok"; break; /* ??? */
688 case LANG_KOREAN
: l
= "ko"; break;
689 case LANG_LATVIAN
: l
= "lv"; break;
690 case LANG_LITHUANIAN
: l
= "lt"; break;
691 case LANG_MACEDONIAN
: l
= "mk"; break;
696 case SUBLANG_MALAY_BRUNEI_DARUSSALAM
: sl
= "BN"; break;
699 case LANG_MALAYALAM
: l
= "ml"; break;
700 case LANG_MANIPURI
: l
= "mni"; break;
701 case LANG_MARATHI
: l
= "mr"; break;
706 case SUBLANG_NEPALI_INDIA
: sl
= "IN"; break;
713 /* SUBLANG_NORWEGIAN_BOKMAL == SUBLANG_DEFAULT */
714 case SUBLANG_NORWEGIAN_NYNORSK
: sl
= "@nynorsk"; break;
717 case LANG_ORIYA
: l
= "or"; break;
718 case LANG_POLISH
: l
= "pl"; break;
719 case LANG_PORTUGUESE
:
723 /* Hmm. SUBLANG_PORTUGUESE_BRAZILIAN == SUBLANG_DEFAULT */
724 case SUBLANG_PORTUGUESE_BRAZILIAN
: sl
= "BR"; break;
727 case LANG_PUNJABI
: l
= "pa"; break;
728 case LANG_ROMANIAN
: l
= "ro"; break;
729 case LANG_RUSSIAN
: l
= "ru"; break;
730 case LANG_SANSKRIT
: l
= "sa"; break;
731 case LANG_SINDHI
: l
= "sd"; break;
732 case LANG_SLOVAK
: l
= "sk"; break;
733 case LANG_SLOVENIAN
: l
= "sl"; break;
738 case SUBLANG_SPANISH_MEXICAN
: sl
= "MX"; break;
739 case SUBLANG_SPANISH_MODERN
: sl
= "@modern"; break; /* ??? */
740 case SUBLANG_SPANISH_GUATEMALA
: sl
= "GT"; break;
741 case SUBLANG_SPANISH_COSTA_RICA
: sl
= "CR"; break;
742 case SUBLANG_SPANISH_PANAMA
: sl
= "PA"; break;
743 case SUBLANG_SPANISH_DOMINICAN_REPUBLIC
: sl
= "DO"; break;
744 case SUBLANG_SPANISH_VENEZUELA
: sl
= "VE"; break;
745 case SUBLANG_SPANISH_COLOMBIA
: sl
= "CO"; break;
746 case SUBLANG_SPANISH_PERU
: sl
= "PE"; break;
747 case SUBLANG_SPANISH_ARGENTINA
: sl
= "AR"; break;
748 case SUBLANG_SPANISH_ECUADOR
: sl
= "EC"; break;
749 case SUBLANG_SPANISH_CHILE
: sl
= "CL"; break;
750 case SUBLANG_SPANISH_URUGUAY
: sl
= "UY"; break;
751 case SUBLANG_SPANISH_PARAGUAY
: sl
= "PY"; break;
752 case SUBLANG_SPANISH_BOLIVIA
: sl
= "BO"; break;
753 case SUBLANG_SPANISH_EL_SALVADOR
: sl
= "SV"; break;
754 case SUBLANG_SPANISH_HONDURAS
: sl
= "HN"; break;
755 case SUBLANG_SPANISH_NICARAGUA
: sl
= "NI"; break;
756 case SUBLANG_SPANISH_PUERTO_RICO
: sl
= "PR"; break;
759 case LANG_SWAHILI
: l
= "sw"; break;
764 case SUBLANG_SWEDISH_FINLAND
: sl
= "FI"; break;
767 case LANG_TAMIL
: l
= "ta"; break;
768 case LANG_TATAR
: l
= "tt"; break;
769 case LANG_TELUGU
: l
= "te"; break;
770 case LANG_THAI
: l
= "th"; break;
771 case LANG_TURKISH
: l
= "tr"; break;
772 case LANG_UKRAINIAN
: l
= "uk"; break;
777 case SUBLANG_URDU_PAKISTAN
: sl
= "PK"; break;
778 case SUBLANG_URDU_INDIA
: sl
= "IN"; break;
785 case SUBLANG_UZBEK_CYRILLIC
: sl
= "@cyrillic"; break;
788 case LANG_VIETNAMESE
: l
= "vi"; break;
789 default: l
= "xx"; break;
798 return g_strdup (bfr
);
802 g_win32_error_message (gint error
)
808 FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER
809 |FORMAT_MESSAGE_IGNORE_INSERTS
810 |FORMAT_MESSAGE_FROM_SYSTEM
,
812 (LPTSTR
) &msg
, 0, NULL
);
813 nbytes
= strlen (msg
);
815 if (nbytes
> 2 && msg
[nbytes
-1] == '\n' && msg
[nbytes
-2] == '\r')
816 msg
[nbytes
-2] = '\0';
818 retval
= g_strdup (msg
);